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.
/etc ------|
...
/xbps-metadata
/xbps-metadata/flist
/xbps-metadata/props.plist
/xbps-metadata/postpre-action.sh
/var/cache/xbps/metadata/$pkgname
/var/cache/xbps/metadata/$pkgname/flist
/var/cache/xbps/metadata/$pkgname/props.plist
/var/cache/xbps/metadata/$pkgname/postpre-action.sh
The xbps-metadata directory contains all the metadata related to this
package. The flist file contains the list of files that the package will
Metadata info is stored in the "/var/cache/xbps/metadata/$pkgname"
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
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.
The postpre-action.sh script will be run as specified in the script,
and will do post/pre installation steps required for this package.
Additional scripts might be added to trigger some actions at pre/post
installation stages.

View file

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

View file

@ -31,12 +31,12 @@ stow_pkg()
{
local pkg="$1"
local i=
local destdir=$XBPS_DESTDIR/$pkgname-$version
[ -z "$pkg" ] && return 2
if [ "$build_style" = "meta-template" ]; then
[ ! -d $XBPS_DESTDIR/$pkgname-$version ] && \
mkdir -p $XBPS_DESTDIR/$pkgname-$version
[ ! -d $destdir ] && mkdir -p $destdir
fi
if [ -n "$stow_flag" ]; then
@ -47,23 +47,14 @@ stow_pkg()
pkg=$pkgname-$version
fi
cd $XBPS_DESTDIR/$pkgname-$version || exit 1
cd $destdir || exit 1
# Write pkg metadata.
. $XBPS_SHUTILSDIR/binpkg.sh
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.
for i in $(echo *); do
[ "$i" = "xbps-metadata" ] && continue
cp -ar ${i} $XBPS_MASTERDIR
done