Mega-commit with improvements and changes done in the past days.

- Introduce package states: unpacked, broken, installed, etc.
  Not yet finished, only unpacked and installed are used for now.

- Move package metadata files in binary packages directly to
  the top directory, this speeds up some ops and makes easier to
  continue working in future changes.

- xbps-bin: -C flag to check the hash of package files has been
  superseded by the 'check' target, which verifies the integrity
  of an installed package.

- Use the 'essential' object when upgrading packages, overwritting
  current files. This is needed for critical packages like sh, libc
  and others.

- Miscellaneous tweaks and improvements thorough the code.

--HG--
extra : convert_revision : 2073fcc123efc24b3e9327b5e22aa91752f20df6
This commit is contained in:
Juan RP
2009-08-08 22:29:48 +02:00
parent 75cac4a637
commit 17404bdb42
24 changed files with 1216 additions and 529 deletions

View File

@@ -51,6 +51,7 @@ xbps_make_binpkg()
xbps_make_binpkg_real()
{
local binpkg pkgdir arch use_sudo lver
local tar_flags="cfp"
if [ ! -d ${DESTDIR} ]; then
echo "$pkgname: unexistent destdir... skipping!"
@@ -79,25 +80,39 @@ xbps_make_binpkg_real()
binpkg=$pkgname-$lver.$arch.xbps
pkgdir=$XBPS_PACKAGESDIR/$arch
#
# Make sure that INSTALL is the first file on the archive,
# this is to ensure that it's run before any other file is
# unpacked.
#
if [ -x ./INSTALL ]; then
#
# Make sure that INSTALL is the first file on the archive,
# this is to ensure that it's run before any other file is
# unpacked.
#
run_rootcmd $use_sudo tar cfp \
$XBPS_BUILDDIR/$binpkg ./INSTALL && \
run_rootcmd $use_sudo tar rfp $XBPS_BUILDDIR/$binpkg . \
--exclude "./INSTALL" \
--exclude "./var/db/xbps/metadata/*/flist" && \
bzip2 -9 $XBPS_BUILDDIR/$binpkg && \
mv $XBPS_BUILDDIR/$binpkg.bz2 $XBPS_BUILDDIR/$binpkg
else
run_rootcmd $use_sudo tar cfp $XBPS_BUILDDIR/$binpkg . \
--exclude "./var/db/xbps/metadata/*/flist" && \
bzip2 -9 $XBPS_BUILDDIR/$binpkg && \
mv $XBPS_BUILDDIR/$binpkg.bz2 $XBPS_BUILDDIR/$binpkg
run_rootcmd $use_sudo tar $tar_flags \
$XBPS_BUILDDIR/$binpkg ./INSTALL
[ $? -ne 0 ] && msg_error "Failed to add INSTALL script."
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."
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
if [ $? -eq 0 ]; then
[ ! -d $pkgdir ] && mkdir -p $pkgdir
mv -f $XBPS_BUILDDIR/$binpkg $pkgdir

View File

@@ -346,12 +346,12 @@ _EOF
else
rm -f $TMPFLIST
fi
mv -f $TMPFPLIST $metadir/files.plist
mv -f $TMPFPROPS $metadir/props.plist
mv -f $TMPFPLIST ${DESTDIR}/files.plist
mv -f $TMPFPROPS ${DESTDIR}/props.plist
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/files.plist
$XBPS_REGPKGDB_CMD sanitize-plist $metadir/props.plist
chmod 644 $metadir/*
$XBPS_REGPKGDB_CMD sanitize-plist ${DESTDIR}/files.plist
$XBPS_REGPKGDB_CMD sanitize-plist ${DESTDIR}/props.plist
chmod 644 ${DESTDIR}/files.plist ${DESTDIR}/props.plist
#
# Update desktop-file-utils database if package contains

View File

@@ -26,7 +26,6 @@
xbps_write_metadata_scripts_pkg()
{
local action="$1"
local metadir="${DESTDIR}/var/db/xbps/metadata/$pkgname"
local tmpf=$(mktemp -t xbps-install.XXXXXXXXXX) || exit 1
local fpattern="s|${DESTDIR}||g;s|^\./$||g;/^$/d"
local targets found info_files
@@ -217,7 +216,7 @@ _EOF
rm -f $tmpf
return 0
fi
mv $tmpf ${metadir}/REMOVE && chmod 755 ${metadir}/REMOVE
mv $tmpf ${DESTDIR}/REMOVE && chmod 755 ${DESTDIR}/REMOVE
;;
esac
}