Bug 100594

Summary: [patch bsd.port.mk] to update makewhatis database after manpages have been installed
Product: Ports & Packages Reporter: Dominic Fandrey <LoN_Kamikaze>
Component: Individual Port(s)Assignee: Port Management Team <portmgr>
Status: Closed FIXED    
Severity: Affects Only Me    
Priority: Normal    
Version: Latest   
Hardware: Any   
OS: Any   
Attachments:
Description Flags
file.diff none

Description Dominic Fandrey 2006-07-20 07:20:14 UTC
The patch adds MKWHATIS to bsd.port.mk and updates the according whatis
database after man pages have been installed.
It also uncovered broken links installed by cups-base on my system, that
shows that it's double useful.

The patch is trivial, I hope it will be accepted.
Comment 1 Edwin Groothuis freebsd_committer 2006-07-20 07:20:22 UTC
Responsible Changed
From-To: freebsd-ports-bugs->portmgr

bsd.port.mk is port manager territory
Comment 2 Mark Linimon 2006-07-20 16:07:35 UTC
On Thu, Jul 20, 2006 at 07:40:15AM +0000, [LoN]Kamikaze wrote:
>   MKDIR?=		/bin/mkdir -p
>   MKTEMP?=	/usr/bin/mktemp
>   MV?=		/bin/mv
>  +MKWHATIS?=	/usr/bin/makewhatis

ITYM MKDIR, then MKTEMP, then MKWHATIS, then MV.

btw, have you figured out how much extra time it will take per port to
add this feature?
Comment 3 Dominic Fandrey 2006-07-20 16:47:01 UTC
Mark Linimon wrote:
> On Thu, Jul 20, 2006 at 07:40:15AM +0000, [LoN]Kamikaze wrote:
>>   MKDIR?=		/bin/mkdir -p
>>   MKTEMP?=	/usr/bin/mktemp
>>   MV?=		/bin/mv
>>  +MKWHATIS?=	/usr/bin/makewhatis
> 
> ITYM MKDIR, then MKTEMP, then MKWHATIS, then MV.

Kill me. :(

 
> btw, have you figured out how much extra time it will take per port to
> add this feature?
Comment 4 Sergey Matveychuk freebsd_committer 2006-07-21 07:30:01 UTC
Anyway some message should be shown.

2Mark: Will an extra PREFIX/man/whatis file a problem for pointyhat builds?
-- 
Dixi.
Sem.
Comment 5 Dominic Fandrey 2006-07-21 13:04:44 UTC
Sergey Matveychuk wrote:
> Anyway some message should be shown.

What kind of message?

> 2Mark: Will an extra PREFIX/man/whatis file a problem for pointyhat builds?

I'm sorry, I don't understand this question.

I tried my test on a new machine which I'm compiling from scratch and so far
everything looks nice with the patch. Normally the man page folder stays in
the cache, so that it only takes ~1 second to update the whatis database. If
this is not the case (i.e. because the machine doesn't have enough memory), 
it takes 10 to 15 seconds. For me that doesn't look bad. Better than waiting
one week for whatis and apropos starting to work.
Comment 6 Mark Linimon freebsd_committer freebsd_triage 2006-07-25 01:14:59 UTC
State Changed
From-To: open->feedback

IMHO a 10-15 second delay per port (if you are doing something like upgrading 
GNOME, KDE, or modular xorg) is going to be _very_ significant. 

I agree that waiting for a periodic process a week later is not acceptable, 
but I don't think this idea is, either.  Port installation is already too 
slow as it is. 

Unfortunately I don't have a better suggestion at the moment.  Anyone?
Comment 7 Dominic Fandrey 2006-07-31 20:18:46 UTC
Considering that makewhatis is almost entirely disk I/O,
it might suffice to put it into the background.

That might cause messy output when it complains about broken links
(like they used to be installed by cups-base), but I do not see any
other problems and it happens very rarely (actually it only happened
once to me).

--- Mk/bsd.port.mk.orig	Thu Jul 20 07:27:27 2006
+++ Mk/bsd.port.mk	Thu Jul 20 08:06:20 2006
@@ -1047,6 +1047,7 @@
 LDCONFIG?=	/sbin/ldconfig
 LN?=		/bin/ln
 LS?=		/bin/ls
 MKDIR?=		/bin/mkdir -p
 MKTEMP?=	/usr/bin/mktemp
+MKWHATIS?=	/usr/bin/makewhatis
 MV?=		/bin/mv
@@ -5300,6 +5301,8 @@
 		shift; shift; \
 	done
 .endif
+	@${ECHO_MSG} "===>   Updating whatis database"
+	@${MKWHATIS} ${MANPREFIX}/man &
 .else
 	@${DO_NADA}
 .endif
Comment 8 Dominic Fandrey 2006-08-01 16:17:40 UTC
Mark Linimon wrote:
> I agree that waiting for a periodic process a week later is not acceptable,
> but I don't think this idea is, either.  Port installation is already too
> slow as it is.
> 
> Unfortunately I don't have a better suggestion at the moment.  Anyone?

How about letting users choose. The following version smells of compromise:

--- Mk/bsd.port.mk.orig	Tue Aug  1 16:58:11 2006
+++ Mk/bsd.port.mk	Tue Aug  1 17:11:28 2006
@@ -842,6 +842,10 @@
 # SUB_LIST		- List of "variable=value" pair for substitution in ${SUB_FILES}
 #				  Some pairs are added by default: eg. PREFIX=${PREFIX}
 #
+# WITH_WHATIS_UPDATE
+#				- If defined the whatis database will be updated if man pages
+#				  have been installed.
+#
 # INSTALLS_SHLIB
 #				- If set, bsd.port.mk will automatically run ldconfig commands
 #				  from post-install and also add appropriate @exec/@unexec
@@ -1049,6 +1053,7 @@
 LS?=		/bin/ls
 MKDIR?=		/bin/mkdir -p
 MKTEMP?=	/usr/bin/mktemp
+MKWHATIS?=	/usr/bin/makewhatis
 MV?=		/bin/mv
 OBJCOPY?=	/usr/bin/objcopy
 OBJDUMP?=	/usr/bin/objdump
@@ -5299,6 +5309,10 @@
 					for (; i<z; i++) printf a[i] "/"; printf a[z]; }'` $$2; \
 		shift; shift; \
 	done
+.endif
+.if defined(WITH_WHATIS_UPDATE)
+	@${ECHO_MSG} "===>   Updating whatis database"
+	@${MKWHATIS} ${MANPREFIX}/man
 .endif
 .else
 	@${DO_NADA}
Comment 9 Pav Lucistnik freebsd_committer 2007-02-08 00:30:51 UTC
On my mediocre 2 GHz desktop with 500 packages installed, it takes
7 seconds, or 0.5 seconds if the mandir is buffered in memory.

-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

Canada is a country whose main exports are hockey players and cold fronts.
Our main imports are baseball players and acid rain.
  -- Pierre Elliott Trudeau
Comment 10 Mark Linimon freebsd_committer freebsd_triage 2007-05-25 04:28:40 UTC
State Changed
From-To: feedback->closed

At the portmgr meeting at BSDCan 2007, we decided that this should be 
up to individual administrators to do, e.g., by a cron job, rather than 
as a step which will slow down the standard upgrade path (which is slow 
enough already).  So, we're not going to pursue this one, but thanks for 
the submission.