diff --git a/xbps-src/etc/xbps-src.conf.in b/xbps-src/etc/xbps-src.conf.in index 94bc0b51418..b79631b1701 100644 --- a/xbps-src/etc/xbps-src.conf.in +++ b/xbps-src/etc/xbps-src.conf.in @@ -8,14 +8,13 @@ XBPS_INSTALLDIR=@@XBPS_INSTALL_PREFIX@@ # -# Global directory where the xbps distribution files are stored. -# Templates, patches and helper files should all be in that directory. +# Directory where you downloaded the GIT xbps-src/templates repository. # XBPS_DISTRIBUTIONDIR=$HOME/xbps # -# Master directory: this is where all symlinks will be -# created pointing at packages installed in XBPS_DESTDIR. +# Master directory: this is where all packages files are copied from +# XBPS_DESTDIR, to resolve dependencies. # XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir @@ -57,6 +56,19 @@ XBPS_CXXFLAGS="$XBPS_CFLAGS" # XBPS_FETCH_CMD=wget +# +# Compression program used to build the binary packages. +# Possible values: gzip, bzip2 or xz. Default xz. +# +XBPS_COMPRESS_CMD=xz + +# +# Compression level used in XBPS_COMPRESS_CMD to build the +# binary packages. Possible values: 1-9. If unset, default value +# by the command will be used. +# +#XBPS_COMPRESS_LEVEL=9 + # # Cross compilation stuff. # diff --git a/xbps-src/shutils/make-binpkg.sh b/xbps-src/shutils/make-binpkg.sh index f9f71e25fac..81ad4f8918e 100644 --- a/xbps-src/shutils/make-binpkg.sh +++ b/xbps-src/shutils/make-binpkg.sh @@ -48,8 +48,7 @@ xbps_make_binpkg() # xbps_make_binpkg_real() { - local binpkg pkgdir arch use_sudo lver - local tar_flags="cfp" + local mfiles binpkg pkgdir arch use_sudo lver dirs _dirs d clevel if [ ! -d ${DESTDIR} ]; then echo "$pkgname: unexistent destdir... skipping!" @@ -83,37 +82,27 @@ xbps_make_binpkg_real() # this is to ensure that it's run before any other file is # unpacked. # - if [ -x ./INSTALL ]; then - run_rootcmd $use_sudo tar $tar_flags \ - $XBPS_BUILDDIR/$binpkg ./INSTALL - [ $? -ne 0 ] && msg_error "Failed to add INSTALL script." + if [ -x ./INSTALL -a -x ./REMOVE ]; then + mfiles="./INSTALL ./REMOVE" + elif [ -x ./INSTALL ]; then + mfiles="./INSTALL" + elif [ -x ./REMOVE ]; then + mfiles="./REMOVE" fi - if [ -x ./REMOVE ]; then - if [ -x ./INSTALL ]; then - tar_flags="rfp" - fi - run_rootcmd $use_sudo tar $tar_flags \ - $XBPS_BUILDDIR/$binpkg ./REMOVE - [ $? -ne 0 ] && msg_error "Failed to add REMOVE script." - fi - if [ -x ./INSTALL -o -x ./REMOVE ]; then - tar_flags="rfp" - elif [ ! -x ./INSTALL -o ! -x ./REMOVE ]; then - tar_flags="cfp" - fi - run_rootcmd $use_sudo tar $tar_flags $XBPS_BUILDDIR/$binpkg \ - ./files.plist ./props.plist - [ $? -ne 0 ] && msg_error "Failed to add metadata files." + mfiles="$mfiles ./files.plist ./props.plist" + _dirs=$(find . -maxdepth 1 -type d) + for d in ${_dirs}; do + [ "$d" = "." ] && continue + dirs="$d $dirs" + done - run_rootcmd $use_sudo tar rfp $XBPS_BUILDDIR/$binpkg . \ - --exclude "./INSTALL" --exclude "./REMOVE" \ - --exclude "./files.plist" --exclude "./props.plist" \ - --exclude "./var/db/xbps/metadata/*/flist" && \ - bzip2 -9 $XBPS_BUILDDIR/$binpkg && \ - mv $XBPS_BUILDDIR/$binpkg.bz2 $XBPS_BUILDDIR/$binpkg + [ -n "$XBPS_COMPRESS_LEVEL" ] && clevel="-$XBPS_COMPRESS_LEVEL" + + [ ! -d $pkgdir ] && mkdir -p $pkgdir + run_rootcmd $use_sudo tar --exclude "var/db/xbps/metadata/*/flist" \ + -cpf - ${mfiles} ${dirs} | \ + $XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg if [ $? -eq 0 ]; then - [ ! -d $pkgdir ] && mkdir -p $pkgdir - mv -f $XBPS_BUILDDIR/$binpkg $pkgdir echo "=> Built package: $binpkg" fi