xbps-src: build binpkgs compressed with xz by default.

- Added two new options for xbps-src.conf:
    XBPS_COMPRESS_CMD by default set to xz.
    XBPS_COMPRESS_LEVEL by default not set.

Change these options to override the behaviour.

--HG--
extra : convert_revision : cbf096e3ff8c290ec0dfd96e5e7cf81f82cbf26a
This commit is contained in:
Juan RP 2009-10-20 15:19:09 +02:00
parent 4a26a07d56
commit ef3da70478
2 changed files with 35 additions and 34 deletions

View File

@ -8,14 +8,13 @@
XBPS_INSTALLDIR=@@XBPS_INSTALL_PREFIX@@ XBPS_INSTALLDIR=@@XBPS_INSTALL_PREFIX@@
# #
# Global directory where the xbps distribution files are stored. # Directory where you downloaded the GIT xbps-src/templates repository.
# Templates, patches and helper files should all be in that directory.
# #
XBPS_DISTRIBUTIONDIR=$HOME/xbps XBPS_DISTRIBUTIONDIR=$HOME/xbps
# #
# Master directory: this is where all symlinks will be # Master directory: this is where all packages files are copied from
# created pointing at packages installed in XBPS_DESTDIR. # XBPS_DESTDIR, to resolve dependencies.
# #
XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir
@ -57,6 +56,19 @@ XBPS_CXXFLAGS="$XBPS_CFLAGS"
# #
XBPS_FETCH_CMD=wget 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. # Cross compilation stuff.
# #

View File

@ -48,8 +48,7 @@ xbps_make_binpkg()
# #
xbps_make_binpkg_real() xbps_make_binpkg_real()
{ {
local binpkg pkgdir arch use_sudo lver local mfiles binpkg pkgdir arch use_sudo lver dirs _dirs d clevel
local tar_flags="cfp"
if [ ! -d ${DESTDIR} ]; then if [ ! -d ${DESTDIR} ]; then
echo "$pkgname: unexistent destdir... skipping!" 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 # this is to ensure that it's run before any other file is
# unpacked. # unpacked.
# #
if [ -x ./INSTALL ]; then if [ -x ./INSTALL -a -x ./REMOVE ]; then
run_rootcmd $use_sudo tar $tar_flags \ mfiles="./INSTALL ./REMOVE"
$XBPS_BUILDDIR/$binpkg ./INSTALL elif [ -x ./INSTALL ]; then
[ $? -ne 0 ] && msg_error "Failed to add INSTALL script." mfiles="./INSTALL"
elif [ -x ./REMOVE ]; then
mfiles="./REMOVE"
fi fi
if [ -x ./REMOVE ]; then mfiles="$mfiles ./files.plist ./props.plist"
if [ -x ./INSTALL ]; then _dirs=$(find . -maxdepth 1 -type d)
tar_flags="rfp" for d in ${_dirs}; do
fi [ "$d" = "." ] && continue
run_rootcmd $use_sudo tar $tar_flags \ dirs="$d $dirs"
$XBPS_BUILDDIR/$binpkg ./REMOVE done
[ $? -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."
run_rootcmd $use_sudo tar rfp $XBPS_BUILDDIR/$binpkg . \ [ -n "$XBPS_COMPRESS_LEVEL" ] && clevel="-$XBPS_COMPRESS_LEVEL"
--exclude "./INSTALL" --exclude "./REMOVE" \
--exclude "./files.plist" --exclude "./props.plist" \ [ ! -d $pkgdir ] && mkdir -p $pkgdir
--exclude "./var/db/xbps/metadata/*/flist" && \ run_rootcmd $use_sudo tar --exclude "var/db/xbps/metadata/*/flist" \
bzip2 -9 $XBPS_BUILDDIR/$binpkg && \ -cpf - ${mfiles} ${dirs} | \
mv $XBPS_BUILDDIR/$binpkg.bz2 $XBPS_BUILDDIR/$binpkg $XBPS_COMPRESS_CMD ${clevel} -qf > $pkgdir/$binpkg
if [ $? -eq 0 ]; then if [ $? -eq 0 ]; then
[ ! -d $pkgdir ] && mkdir -p $pkgdir
mv -f $XBPS_BUILDDIR/$binpkg $pkgdir
echo "=> Built package: $binpkg" echo "=> Built package: $binpkg"
fi fi