Add pkg metadata into /var/cache/xbps/metadata and not /xbps-metadata.

With this change it's possible to use a binary package just by unpacking
it into the destination directory.

--HG--
extra : convert_revision : 5f025a5e5d7593555fa55d08d5652c26736a139e
This commit is contained in:
Juan RP 2008-12-17 08:27:28 +01:00
parent ca40133cbe
commit ef2601f4eb
3 changed files with 28 additions and 34 deletions

View file

@ -6,13 +6,15 @@ with gzip, bzip2 or lzma and has the following structure:
/var ------| => Package structure that will be installed. /var ------| => Package structure that will be installed.
/etc ------| /etc ------|
... ...
/xbps-metadata /var/cache/xbps/metadata/$pkgname
/xbps-metadata/flist /var/cache/xbps/metadata/$pkgname/flist
/xbps-metadata/props.plist /var/cache/xbps/metadata/$pkgname/props.plist
/xbps-metadata/postpre-action.sh /var/cache/xbps/metadata/$pkgname/postpre-action.sh
The xbps-metadata directory contains all the metadata related to this Metadata info is stored in the "/var/cache/xbps/metadata/$pkgname"
package. The flist file contains the list of files that the package will directory and two files will be always be present: flist and props.plist.
The flist file contains the list of files that the package will
install. The props.plist file is a proplib(3) property list and install. The props.plist file is a proplib(3) property list and
has the following structure: has the following structure:
@ -36,5 +38,5 @@ has the following structure:
This plist might be extended in the future if it's required or useful. This plist might be extended in the future if it's required or useful.
The postpre-action.sh script will be run as specified in the script, Additional scripts might be added to trigger some actions at pre/post
and will do post/pre installation steps required for this package. installation stages.

View file

@ -30,25 +30,17 @@
xbps_write_metadata_pkg() xbps_write_metadata_pkg()
{ {
local destdir=$XBPS_DESTDIR/$pkgname-$version local destdir=$XBPS_DESTDIR/$pkgname-$version
local metadir=$destdir/var/cache/xbps/metadata/$pkgname
if [ ! -d "$destdir" ]; then if [ ! -d "$destdir" ]; then
echo "ERROR: $pkgname not installed into destdir." echo "ERROR: $pkgname not installed into destdir."
exit 1 exit 1
fi fi
if [ ! -d $destdir/xbps-metadata ]; then
mkdir -p $destdir/xbps-metadata >/dev/null 2>&1
if [ $? -ne 0 ]; then
echo "ERROR: you don't have enough perms for this."
exit 1
fi
fi
# Write the files list. # Write the files list.
local TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1 local TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
find $destdir | sort -ur | \ find $destdir | sort -ur | \
sed -e "s|$destdir||g;s|^\/$||g;s|/xbps-metadata||g;/^$/d" \ sed -e "s|$destdir||g;s|^\/$||g;/^$/d" > $TMPFLIST
> $TMPFLIST
# Write the property list file. # Write the property list file.
local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1 local TMPFPROPS=$(mktemp -t fprops.XXXXXXXXXX) || exit 1
@ -101,10 +93,19 @@ _EOF
# Terminate the property list file. # Terminate the property list file.
printf "</dict>\n</plist>\n" >> $TMPFPROPS printf "</dict>\n</plist>\n" >> $TMPFPROPS
# Write metadata files into destdir and cleanup. if [ ! -d $metadir ]; then
cp -f $TMPFLIST $destdir/xbps-metadata/flist mkdir -p $metadir >/dev/null 2>&1
cp -f $TMPFPROPS $destdir/xbps-metadata/props.plist if [ $? -ne 0 ]; then
chmod 644 $destdir/xbps-metadata/* echo "ERROR: you don't have enough perms for this."
rm -f $TMPFLIST $TMPFPROPS
exit 1
fi
fi
# Write metadata files and cleanup.
cp -f $TMPFLIST $metadir/flist
cp -f $TMPFPROPS $metadir/props.plist
chmod 644 $metadir/*
rm -f $TMPFLIST $TMPFPROPS rm -f $TMPFLIST $TMPFPROPS
} }

View file

@ -31,12 +31,12 @@ stow_pkg()
{ {
local pkg="$1" local pkg="$1"
local i= local i=
local destdir=$XBPS_DESTDIR/$pkgname-$version
[ -z "$pkg" ] && return 2 [ -z "$pkg" ] && return 2
if [ "$build_style" = "meta-template" ]; then if [ "$build_style" = "meta-template" ]; then
[ ! -d $XBPS_DESTDIR/$pkgname-$version ] && \ [ ! -d $destdir ] && mkdir -p $destdir
mkdir -p $XBPS_DESTDIR/$pkgname-$version
fi fi
if [ -n "$stow_flag" ]; then if [ -n "$stow_flag" ]; then
@ -47,23 +47,14 @@ stow_pkg()
pkg=$pkgname-$version pkg=$pkgname-$version
fi fi
cd $XBPS_DESTDIR/$pkgname-$version || exit 1 cd $destdir || exit 1
# Write pkg metadata. # Write pkg metadata.
. $XBPS_SHUTILSDIR/binpkg.sh . $XBPS_SHUTILSDIR/binpkg.sh
xbps_write_metadata_pkg xbps_write_metadata_pkg
# Copy metadata files into masterdir.
if [ -f xbps-metadata/flist -a -f xbps-metadata/props.plist ]; then
local metadir=$XBPS_PKGMETADIR/$pkgname
mkdir -p $metadir
cp -f xbps-metadata/flist $metadir
cp -f xbps-metadata/props.plist $metadir
fi
# Copy files into masterdir. # Copy files into masterdir.
for i in $(echo *); do for i in $(echo *); do
[ "$i" = "xbps-metadata" ] && continue
cp -ar ${i} $XBPS_MASTERDIR cp -ar ${i} $XBPS_MASTERDIR
done done