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@@
#
# 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.
#

View File

@ -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