Subject: pkg/18710: redo cleanup for pkgtools/pkg_tarup
To: None <gnats-bugs@gnats.netbsd.org>
From: Greg A. Woods <woods@weird.com>
List: netbsd-bugs
Date: 10/19/2002 14:08:19
>Number:         18710
>Category:       pkg
>Synopsis:       redo cleanup for pkgtools/pkg_tarup
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    pkg-manager
>State:          open
>Class:          change-request
>Submitter-Id:   net
>Arrival-Date:   Sat Oct 19 11:09:01 PDT 2002
>Closed-Date:
>Last-Modified:
>Originator:     Greg A. Woods
>Release:        pkgsrc-current 2002/10/18
>Organization:
Planix, Inc.; Toronto, Ontario; Canada
>Environment:
System: NetBSD
>Description:

	re-do cleanups for pkgtools/pkg_tarup

>How-To-Repeat:

>Fix:

cvs diff: Diffing pkgtools/pkg_tarup
Index: pkgtools/pkg_tarup/Makefile
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/pkgtools/pkg_tarup/Makefile,v
retrieving revision 1.7
diff -c -r1.7 Makefile
*** pkgtools/pkg_tarup/Makefile	14 Oct 2002 15:28:43 -0000	1.7
--- pkgtools/pkg_tarup/Makefile	16 Oct 2002 23:54:39 -0000
***************
*** 15,33 ****
  NO_BUILD=	yes
  NO_MTREE=	yes
  
! # Set SCRIPT_SUBST to substitute "${variable}" to "value" in MESSAGE
! SCRIPT_SUBST+=	AWK=${AWK}				\
! 		ECHO=${ECHO}				\
! 		ID=${ID}				\
! 		PKG_DBDIR=${PKG_DBDIR}			\
! 		PKG_SUFX=${PKG_SUFX}			\
! 		PREFIX=${PREFIX}			\
! 		PKG_TOOLS_BIN=${PKG_TOOLS_BIN}		\
! 		SH=${SH}				\
! 		SU=${SU}
  
! # XXX this should probably use the @VAR@ form instead of ${VAR}...
! SCRIPT_SUBST_SED=	${SCRIPT_SUBST:S/=/}!/:S/$/!g/:S/^/ -e s!\\\${/}
  
  do-configure:
  	${SED} ${SCRIPT_SUBST_SED}			\
--- 15,32 ----
  NO_BUILD=	yes
  NO_MTREE=	yes
  
! # Set SCRIPT_SUBST to substitute "@VARIABLE@" with "value"
! SCRIPT_SUBST+=	AWK=${AWK:Q}				\
! 		ECHO=${ECHO:Q}				\
! 		ID=${ID:Q}				\
! 		PKG_DBDIR=${PKG_DBDIR:Q}		\
! 		PKG_SUFX=${PKG_SUFX:Q}			\
! 		PREFIX=${PREFIX:Q}			\
! 		PKG_TOOLS_BIN=${PKG_TOOLS_BIN:Q}	\
! 		SH=${SH:Q}				\
! 		SU=${SU:Q}
  
! SCRIPT_SUBST_SED=	${SCRIPT_SUBST:S/=/@!/:S/$/!g/:S/^/ -e s!@/}
  
  do-configure:
  	${SED} ${SCRIPT_SUBST_SED}			\
cvs diff: Diffing pkgtools/pkg_tarup/files
Index: pkgtools/pkg_tarup/files/pkg_tarup
===================================================================
RCS file: /cvs/master/m-NetBSD/main/pkgsrc/pkgtools/pkg_tarup/files/pkg_tarup,v
retrieving revision 1.7
diff -c -r1.7 pkg_tarup
*** pkgtools/pkg_tarup/files/pkg_tarup	14 Oct 2002 15:28:43 -0000	1.7
--- pkgtools/pkg_tarup/files/pkg_tarup	16 Oct 2002 23:57:26 -0000
***************
*** 1,4 ****
! #! ${SH}
  #
  # $Id: pkg_tarup,v 1.7 2002/10/14 15:28:43 hubertf Exp $
  #
--- 1,4 ----
! #! @SH@
  #
  # $Id: pkg_tarup,v 1.7 2002/10/14 15:28:43 hubertf Exp $
  #
***************
*** 7,29 ****
  # (c) Copyright 2000-2002 Hubert Feyrer <hubert@feyrer.de>
  #
  
! PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin:${PKG_TOOLS_BIN}
  
! if [ `${ID} -u` != 0 ]; then
! 	${ECHO} "Becoming root@`/bin/hostname` to create a binary package"
! 	${ECHO} -n "`${ECHO} ${SU} | ${AWK} '{ print $$1 }'` ";\
! 	exec ${SU} root -c "$0 $@"
  fi
  
! pkgdbdir=${PKG_DBDIR:-${PKG_DBDIR}}
! pkgsufx=${PKG_SUFX:-${PKG_SUFX}}
  
  PKGREPOSITORY=${PKGREPOSITORY:-/tmp}
  
  PKG="$1"
  rPKG="`pkg_info -e \"$PKG\"`"
  
! if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${pkgdbdir}/${rPKG}" ]
  then
       ${ECHO} Usage: $0 installed_pkg
       exit 1
--- 7,39 ----
  # (c) Copyright 2000-2002 Hubert Feyrer <hubert@feyrer.de>
  #
  
! PREFIX=${PREFIX:-@PREFIX@}
  
! PATH=/sbin:/usr/sbin:/bin:/usr/bin:${PREFIX}/sbin:${PREFIX}/bin:@PKG_TOOLS_BIN@
! export PATH
! 
! OS=`uname -s`
! 
! awkprog=${AWK:-@AWK@}
! echoprog=${ECHO:-@ECHO@}
! idprog=${ID:-@ID@}
! suprog=${SU:-@SU@}
! 
! if [ `${idprog} -u` != 0 ]; then
! 	${echoprog} "Becoming root@`/bin/hostname` to create a binary package"
! 	${echoprog} -n "`${echoprog} ${suprog} | ${awkprog} '{ print $$1 }'` ";\
! 	exec ${suprog} root -c "$0 $@"
  fi
  
! pkgdbdir=${PKG_DBDIR:-@PKG_DBDIR@}
! pkgsufx=${PKG_SUFX:-@PKG_SUFX@}
  
  PKGREPOSITORY=${PKGREPOSITORY:-/tmp}
  
  PKG="$1"
  rPKG="`pkg_info -e \"$PKG\"`"
  
! if [ "$PKG" = "" -o "$rPKG" = "" -o -f "${PKG_DBDIR}/${rPKG}" ]
  then
       ${ECHO} Usage: $0 installed_pkg
       exit 1
***************
*** 48,71 ****
  	fi
  }
  
! check_and_add -c ${pkgdbdir}/${PKG}/+COMMENT
! check_and_add -d ${pkgdbdir}/${PKG}/+DESC
! check_and_add -b ${pkgdbdir}/${PKG}/+BUILD_VERSION
! check_and_add -B ${pkgdbdir}/${PKG}/+BUILD_INFO
! check_and_add -s ${pkgdbdir}/${PKG}/+SIZE_PKG
! check_and_add -S ${pkgdbdir}/${PKG}/+SIZE_ALL
! check_and_add -i ${pkgdbdir}/${PKG}/+INSTALL
! check_and_add -k ${pkgdbdir}/${PKG}/+DEINSTALL
! check_and_add -r ${pkgdbdir}/${PKG}/+REQUIRE
! check_and_add -D ${pkgdbdir}/${PKG}/+DISPLAY
! check_and_add -m ${pkgdbdir}/${PKG}/+MTREE		#NOTYET#
  
  PLIST=/tmp/+CONTENTS.$$
  sed -n \
      -e '/^@comment MD5:/d' \
      -e '/^@cwd \.$/,$d' \
      -e '/\$NetBSD/,$p' \
!     <${pkgdbdir}/${PKG}/+CONTENTS >$PLIST
  
  # Duplicate first @cwd (work around pkg_create "feature" ...)
  grep '^@cwd' $PLIST | head -1 >$PLIST.1
--- 58,81 ----
  	fi
  }
  
! check_and_add -c ${PKG_DBDIR}/${PKG}/+COMMENT
! check_and_add -d ${PKG_DBDIR}/${PKG}/+DESC
! check_and_add -b ${PKG_DBDIR}/${PKG}/+BUILD_VERSION
! check_and_add -B ${PKG_DBDIR}/${PKG}/+BUILD_INFO
! check_and_add -s ${PKG_DBDIR}/${PKG}/+SIZE_PKG
! check_and_add -S ${PKG_DBDIR}/${PKG}/+SIZE_ALL
! check_and_add -i ${PKG_DBDIR}/${PKG}/+INSTALL
! check_and_add -k ${PKG_DBDIR}/${PKG}/+DEINSTALL
! check_and_add -r ${PKG_DBDIR}/${PKG}/+REQUIRE
! check_and_add -D ${PKG_DBDIR}/${PKG}/+DISPLAY
! check_and_add -m ${PKG_DBDIR}/${PKG}/+MTREE		#NOTYET#
  
  PLIST=/tmp/+CONTENTS.$$
  sed -n \
      -e '/^@comment MD5:/d' \
      -e '/^@cwd \.$/,$d' \
      -e '/\$NetBSD/,$p' \
!     <${PKG_DBDIR}/${PKG}/+CONTENTS >$PLIST
  
  # Duplicate first @cwd (work around pkg_create "feature" ...)
  grep '^@cwd' $PLIST | head -1 >$PLIST.1
***************
*** 100,114 ****
  exit 0
  
  
  
  
  mtree file considerations:
   - keeping uncompressed mtree file adds ~10% to the size of /var/db/pkg
   - could gzip file, space saving: 5kb->850b (plus some intelligence to
     uncompress them when needed)
   - not keeping mtree file results in pkgs w/o mtree file (but should work)
  
  integration:
   - how/where?  I'd prefer not to have yet another pkg_* utility flying
     around, integration into pkg_admin would be nice.  But how merge a
!    shell script into a C executable?
--- 110,132 ----
  exit 0
  
  
+ +REQUIRED_BY:
+ 
+  - maybe the squirelling away of +REQUIRED_BY should be done here
+    instead of in the bsd.pkg.mk framework that normally calls this.
  
  
  mtree file considerations:
+ 
   - keeping uncompressed mtree file adds ~10% to the size of /var/db/pkg
+ 
   - could gzip file, space saving: 5kb->850b (plus some intelligence to
     uncompress them when needed)
+ 
   - not keeping mtree file results in pkgs w/o mtree file (but should work)
  
  integration:
+ 
   - how/where?  I'd prefer not to have yet another pkg_* utility flying
     around, integration into pkg_admin would be nice.  But how merge a
!    shell script into a C executable?  REWRITE in C of course!  ;-)
>Release-Note:
>Audit-Trail:
>Unformatted: