Subject: install/18954: MANZ make(1) variable and release build
To: None <gnats-bugs@gnats.netbsd.org>
From: None <mishka@terabyte.com.ua>
List: netbsd-bugs
Date: 11/06/2002 15:12:05
>Number:         18954
>Category:       install
>Synopsis:       Invalid (missing) MANZ handling when building release
>Confidential:   no
>Severity:       non-critical
>Priority:       medium
>Responsible:    install-manager
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Wed Nov 06 05:18:00 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Mishka
>Release:        NetBSD 1.6I
>Organization:
Terabyte ACS
>Environment:
System: NetBSD batraq.anything3d.com 1.6I NetBSD 1.6I (GENERIC) #1: Wed Oct 23 17:23:58 EEST 2002 mishka@batraq.anything3d.com:/usr/home/mishka/prj/netbsd/src-current/sys/arch/i386/compile/GENERIC i386
Architecture: i386
Machine: i386
>Description:

	Greetings!

	At this night having upgraded source tree to NetBSD-1.6K
	(05 Jan 2002) i tried to build whole release with following
	command:

	    ./build.sh -m i386 -d -D DESTDIR -R RELEASEDIR -U -o

	But at morning i found build was stopped with following errors:

	    ...
	    < ./usr/share/man/man9/wsmouse_input.9
	    < ./usr/share/man/man9/wsmousedevprint.9
	    ---
	    ...
	    > ./usr/share/man/man9/wsmouse_input.9.gz
	    > ./usr/share/man/man9/wsmousedevprint.9.gz
	    checkflist: flist inconsistencies found
	    checkflist: key to output:
	      <  file is in flist but missing from DESTDIR
		 (file wasn't installed ?)
	      >  file is in DESTDIR but missing from flist
		 (file is obsolete or flist is out of date ?)
	    *** Error code 1

	    Stop.
	    nbmake: stopped in /usr/..LONG_PATH../src-current/distrib/sets
	    *** Error code 1

	    ...

	This fault occurs after adding of "MANZ=yes" line into my
	/etc/mk.conf file.

	Taking a look through sources I haven't found any feature
	which allows me leave my man-pages compressed inside `man.tgz'
	package. Thus, the divergentions between src/distrib/sets/lists/*
	lists and installed (compressed) files prevents success build.

>How-To-Repeat:

	Just add "MANZ=yes" into /etc/mk.conf and then try build release.

>Fix:

	The patch following below tries to solve that problem. The decision
	is change "cat list" command to "sed 'change man' list".

	The sed(1) sequence was tested with following commands:

	    find src/distrib/sets/lists -type f \
	    | grep -v 'CVS/' \
	    | xargs sed -n 's:\([man|cat][0-9]/..*\.[0-9]\):\1.gz:p' \
	    | awk '{print $1}'

	This shows converted filenames of man|cat pages.
	Adding to pipe above following command we should get nothing:

	    | grep -v '\.gz$'

	This means that `.gz' suffix was appended to END only of each
	filename.


==== BEGIN OF PATCH ====
Index: Makefile
===================================================================
RCS file: /cvsroot/basesrc/distrib/sets/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- Makefile	2002/09/19 22:04:34	1.17
+++ Makefile	2002/11/06 11:42:34
@@ -27,6 +27,9 @@
 print_toolchain_missing: .PHONY
 	@echo "${TOOLCHAIN_MISSING}"
 
+print_manz: .PHONY
+	@echo "${MANZ}"
+
 print_x11_version: .PHONY
 .if defined(USE_XF86_4) && (${USE_XF86_4} != no)
 	@echo 4
Index: listpkgs
===================================================================
RCS file: /cvsroot/basesrc/distrib/sets/listpkgs,v
retrieving revision 1.4
diff -u -r1.4 listpkgs
--- listpkgs	2002/07/23 09:02:45	1.4
+++ listpkgs	2002/11/06 11:42:35
@@ -9,9 +9,13 @@
 MAKE="${MAKE:-make} -j 1"
 machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | ${MAKE} -s -f-`}
 arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | ${MAKE} -s -f-`}
+manz=`${MAKE} print_manz`
 setd=`dirname $0`
 prefix=/
 
+DO_MANZ=""
+[ -n "$manz" ] && DO_MANZ="s:\([man|cat][0-9]/..*\.[0-9]\):\1.gz:"
+
 usage() {
 exec 1>&2
 
@@ -68,19 +72,19 @@
 fi
 
 (
-	cat $setd/lists/$setname/mi
+	sed "${DO_MANZ}" $setd/lists/$setname/mi
 	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
-		cat $setd/lists/$setname/ad.${arch}
+		sed "${DO_MANZ}" $setd/lists/$setname/ad.${arch}
 	fi
 	if [ -f $setd/lists/$setname/md.${machine} ]; then
-		cat $setd/lists/$setname/md.${machine}
+		sed "${DO_MANZ}" $setd/lists/$setname/md.${machine}
 	fi
 	if [ "$shlib" != "" ]; then
 		if [ -f $setd/lists/$setname/shl.mi ]; then
-			cat $setd/lists/$setname/shl.mi
+			sed "${DO_MANZ}" $setd/lists/$setname/shl.mi
 		fi
 		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
-			cat $setd/lists/$setname/shl.${shlib}
+			sed "${DO_MANZ}" $setd/lists/$setname/shl.${shlib}
 		fi
 	fi
 )| awk -- '/^[^#]/ {print $2}' | sort -u
Index: makeflist
===================================================================
RCS file: /cvsroot/basesrc/distrib/sets/makeflist,v
retrieving revision 1.54
diff -u -r1.54 makeflist
--- makeflist	2002/10/10 20:46:39	1.54
+++ makeflist	2002/11/06 11:42:36
@@ -13,12 +13,16 @@
 machine_cpu=`${MAKE} print_machine_cpu`
 object_fmt=`${MAKE} print_object_fmt`
 toolchain_missing=`${MAKE} print_toolchain_missing`
+manz=`${MAKE} print_manz`
 x11_version=`${MAKE} print_x11_version`
 setd=`pwd`
 nlists="base comp etc games man misc text"
 xlists="xbase xcomp xcontrib xfont xserver xmisc"
 lists=$nlists
 
+DO_MANZ=""
+[ -n "$manz" ] && DO_MANZ="s:\([man|cat][0-9]/..*\.[0-9]\):\1.gz:"
+
 # handle args
 while : ; do
 	case $1 in
@@ -98,50 +102,50 @@
 unset _lists
 
 for setname in $lists; do
-	cat $setd/lists/$setname/mi
+	sed "${DO_MANZ}" $setd/lists/$setname/mi
 	if [ "$machine" != "$machine_arch" ]; then
 		# Prefer an ad.${machine_arch} over an ad.${machine_cpu},
 		# since the arch-specific one will be more specific than
 		# the cpu-specific one.
 		if [ -f $setd/lists/$setname/ad.${machine_arch} ]; then
-			cat $setd/lists/$setname/ad.${machine_arch}
+			sed "${DO_MANZ}" $setd/lists/$setname/ad.${machine_arch}
 		elif [ -f $setd/lists/$setname/ad.${machine_cpu} ]; then
-			cat $setd/lists/$setname/ad.${machine_cpu}
+			sed "${DO_MANZ}" $setd/lists/$setname/ad.${machine_cpu}
 		fi
 		if [ "$shlib" != "no" -a \
 		     -f $setd/lists/$setname/ad.${machine_cpu}.shl ]; then
-			cat $setd/lists/$setname/ad.${machine_cpu}.shl
+			sed "${DO_MANZ}" $setd/lists/$setname/ad.${machine_cpu}.shl
 		fi
 	fi
 	if [ -f $setd/lists/$setname/md.${machine} ]; then
-		cat $setd/lists/$setname/md.${machine}
+		sed "${DO_MANZ}" $setd/lists/$setname/md.${machine}
 	fi
 	if [ -f $setd/lists/$setname/stl.mi ]; then
-		cat $setd/lists/$setname/stl.mi
+		sed "${DO_MANZ}" $setd/lists/$setname/stl.mi
 	fi
 	if [ -f $setd/lists/$setname/stl.${stlib} ]; then
-		cat $setd/lists/$setname/stl.${stlib}
+		sed "${DO_MANZ}" $setd/lists/$setname/stl.${stlib}
 	fi
 	if [ "$shlib" != "no" ]; then
 		if [ -f $setd/lists/$setname/shl.mi ]; then
-			cat $setd/lists/$setname/shl.mi
+			sed "${DO_MANZ}" $setd/lists/$setname/shl.mi
 		fi
 		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
-			cat $setd/lists/$setname/shl.${shlib}
+			sed "${DO_MANZ}" $setd/lists/$setname/shl.${shlib}
 		fi
 	fi
 	if [ "$lintlibs" != no ]; then
 		if [ -f $setd/lists/$setname/lint.mi ]; then
-			cat $setd/lists/$setname/lint.mi
+			sed "${DO_MANZ}" $setd/lists/$setname/lint.mi
 		fi
 	fi
 	if [ "$toolchain_missing" != "yes" ]; then
 		if [ -f $setd/lists/$setname/tc.mi ]; then
-			cat $setd/lists/$setname/tc.mi
+			sed "${DO_MANZ}" $setd/lists/$setname/tc.mi
 		fi
 		if [ "$shlib" != "no" ]; then
 			if [ -f $setd/lists/$setname/tc.shl ]; then
-				cat $setd/lists/$setname/tc.shl
+				sed "${DO_MANZ}" $setd/lists/$setname/tc.shl
 			fi
 		fi
 	fi
@@ -152,10 +156,10 @@
 	fi
 
 	if [ -f $setd/lists/$setname/rescue.mi ]; then
-		cat $setd/lists/$setname/rescue.mi
+		sed "${DO_MANZ}" $setd/lists/$setname/rescue.mi
 	fi
 	if [ -f $setd/lists/$setname/rescue.${machine} ]; then
-		cat $setd/lists/$setname/rescue.${machine}
+		sed "${DO_MANZ}" $setd/lists/$setname/rescue.${machine}
 	fi
 	if [ "$machine" != "$machine_arch" ]; then
 		# Prefer a rescue.ad.${machine_arch} over a
@@ -163,13 +167,13 @@
 		# specific one will be more specific than the
 		# cpu-specific one.
 		if [ -f $setd/lists/$setname/rescue.ad.${machine_arch} ]; then
-			cat $setd/lists/$setname/rescue.ad.${machine_arch}
+			sed "${DO_MANZ}" $setd/lists/$setname/rescue.ad.${machine_arch}
 		elif [ -f $setd/lists/$setname/rescue.ad.${machine_cpu} ]; then
-			cat $setd/lists/$setname/rescue.ad.${machine_cpu}
+			sed "${DO_MANZ}" $setd/lists/$setname/rescue.ad.${machine_cpu}
 		fi
 		if [ "$shlib" != "no" -a -f \
 		     $setd/lists/$setname/rescue.ad.${machine_cpu}.shl ]; then
-			cat $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
+			sed "${DO_MANZ}" $setd/lists/$setname/rescue.ad.${machine_cpu}.shl
 		fi
 	fi
 done | awk -- '/^[^#]/ {print $1}' | sort -u
Index: makeplist
===================================================================
RCS file: /cvsroot/basesrc/distrib/sets/makeplist,v
retrieving revision 1.3
diff -u -r1.3 makeplist
--- makeplist	2002/07/23 09:02:45	1.3
+++ makeplist	2002/11/06 11:42:37
@@ -8,9 +8,13 @@
 MAKE="${MAKE:-make} -j 1"
 machine=${MACHINE:-`printf 'xxx:\n\techo ${MACHINE}' | ${MAKE} -s -f-`}
 arch=${MACHINE_ARCH:-`printf 'xxx:\n\techo ${MACHINE_ARCH}' | ${MAKE} -s -f-`}
+manz=`${MAKE} print_manz`
 setd=`dirname $0`
 prefix=/
 
+DO_MANZ=""
+[ -n "$manz" ] && DO_MANZ="s:\([man|cat][0-9]/..*\.[0-9]\):\1.gz:"
+
 usage() {
 exec 1>&2
 
@@ -78,19 +82,19 @@
 
 echo "@cwd $prefix"
 (
-	cat $setd/lists/$setname/mi
+	sed "${DO_MANZ}" $setd/lists/$setname/mi
 	if [ "$machine" != "$cpu" -a -f $setd/lists/$setname/ad.${arch} ]; then
-		cat $setd/lists/$setname/ad.${arch}
+		sed "${DO_MANZ}" $setd/lists/$setname/ad.${arch}
 	fi
 	if [ -f $setd/lists/$setname/md.${machine} ]; then
-		cat $setd/lists/$setname/md.${machine}
+		sed "${DO_MANZ}" $setd/lists/$setname/md.${machine}
 	fi
 	if [ "$shlib" != "" ]; then
 		if [ -f $setd/lists/$setname/shl.mi ]; then
-			cat $setd/lists/$setname/shl.mi
+			sed "${DO_MANZ}" $setd/lists/$setname/shl.mi
 		fi
 		if [ -f $setd/lists/$setname/shl.${shlib} ]; then
-			cat $setd/lists/$setname/shl.${shlib}
+			sed "${DO_MANZ}" $setd/lists/$setname/shl.${shlib}
 		fi
 	fi
 )| egrep -v '^#' | egrep $pkgname\$ | awk -- '{print $1}' | sort -u
==== END OF PATCH ====


	Thank you very much!

	--
	Best regards,
	Mishka.
>Release-Note:
>Audit-Trail:
>Unformatted: