tech-pkg archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Proper selection of compression algorithm



Hi all,
I'm not sure if the discussion about this was public or just at some
pkgsrcCon or so. The only mechanism currently in place to choose the
compression algorithm for binary packages is  by changing PKG_SUFX.
That is clumsy and doesn't really scale. E.g. some FTP server don't
allow full glob patterns and there is support for XZ on the horizon too.

I would like to stop messing with the package name as the tools no longer
have to care. I don't mind changing the default to .pkg or whatever at
some point after phasing in the needed pkg_install changes, but that's a
side issue. The attached patch basically just allows switching between
gzip/bzip2/none without changing the name of the package. Comments?

Joerg
Index: defaults/mk.conf
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/mk/defaults/mk.conf,v
retrieving revision 1.186
diff -u -p -r1.186 mk.conf
--- defaults/mk.conf    13 Sep 2009 13:28:46 -0000      1.186
+++ defaults/mk.conf    1 Feb 2010 23:38:44 -0000
@@ -79,10 +79,11 @@ GZIP?=      -9
 # Possible: defined, not defined
 # Default: not defined
 
-#PKG_SUFX= .tbz
-# Create binary packages with bzip2(1) or gzip(1).
-# Possible: .tbz, .tgz
-# Default: .tgz
+PKG_COMPRESSION?=      gzip
+# Compression algorithm for binary packages.
+# Possible: gzip, bzip2, none
+# Default: gzip
+# Supersedes the PKG_SUFX option and keeps the name consistent.
 
 PKGSRC_LOCKTYPE?= none
 #      The type of locking that will be done if competing processes
Index: flavor/pkg/package.mk
===================================================================
RCS file: /home/joerg/repo/netbsd/pkgsrc/mk/flavor/pkg/package.mk,v
retrieving revision 1.19
diff -u -p -r1.19 package.mk
--- flavor/pkg/package.mk       5 Nov 2009 15:39:42 -0000       1.19
+++ flavor/pkg/package.mk       1 Feb 2010 23:43:23 -0000
@@ -1,5 +1,15 @@
 # $NetBSD: package.mk,v 1.19 2009/11/05 15:39:42 joerg Exp $
 
+.if defined(PKG_SUFX)
+WARNINGS+=             "PKG_SUFX is deprecated, please use PKG_COMPRESSION"
+.  if ${PKG_SUFX} == ".tgz"
+PKG_COMPRESSION=       gzip
+.  elif ${PKG_SUFX} == ".tbz"
+PKG_COMPRESSION=       bzip2
+.  else
+WARNINGS+=             "Unsupported value for PKG_SUFX"
+.  endif
+.endif
 PKG_SUFX?=             .tgz
 PKGFILE?=              ${PKGREPOSITORY}/${PKGNAME}${PKG_SUFX}
 PKGREPOSITORY?=                ${PACKAGES}/${PKGREPOSITORYSUBDIR}
@@ -25,6 +35,7 @@ package-check-installed:
 package-create: package-remove ${PKGFILE} package-links
 
 _PKG_ARGS_PACKAGE+=    ${_PKG_CREATE_ARGS}
+_PKG_ARGS_PACKAGE+=    -F ${PKG_COMPRESSION}
 .if ${_USE_DESTDIR} == "no"
 _PKG_ARGS_PACKAGE+=    -p ${PREFIX}
 .else


Home | Main Index | Thread Index | Old Index