From ef2601f4ebc769721401999f8c2563f121578a0e Mon Sep 17 00:00:00 2001 From: Juan RP Date: Wed, 17 Dec 2008 08:27:28 +0100 Subject: [PATCH] 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 --- doc/BINPKG_INFO.txt | 18 ++++++++++-------- utils/sh/binpkg.sh | 29 +++++++++++++++-------------- utils/sh/stow_funcs.sh | 15 +++------------ 3 files changed, 28 insertions(+), 34 deletions(-) diff --git a/doc/BINPKG_INFO.txt b/doc/BINPKG_INFO.txt index 3a0d30497f..a97f2e8029 100644 --- a/doc/BINPKG_INFO.txt +++ b/doc/BINPKG_INFO.txt @@ -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. diff --git a/utils/sh/binpkg.sh b/utils/sh/binpkg.sh index 0e426707ab..770190bf4f 100644 --- a/utils/sh/binpkg.sh +++ b/utils/sh/binpkg.sh @@ -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 "\n\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 } diff --git a/utils/sh/stow_funcs.sh b/utils/sh/stow_funcs.sh index 810b429f7e..a42872e4b5 100644 --- a/utils/sh/stow_funcs.sh +++ b/utils/sh/stow_funcs.sh @@ -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