Rename prepost-{inst,rm} to just INSTALL/REMOVE.

Some other changes related for this:
 - Modify binpkg.sh to always insert the INSTALL script at head of
   the archive, and appending files after it.
 - Modify binpkg.sh to compress binpkgs with bzip2 -9 to save some bytes.

--HG--
extra : convert_revision : b651b944f11c48dede1bbcea658182bf0984e8f3
This commit is contained in:
Juan RP 2009-02-26 18:01:18 +01:00
parent a0ee2ee61b
commit a00ae944b5
7 changed files with 36 additions and 25 deletions

View File

@ -13,8 +13,8 @@ with bzip2 and has the following structure:
/var/db/xbps/metadata/$pkgname /var/db/xbps/metadata/$pkgname
/var/db/xbps/metadata/$pkgname/flist /var/db/xbps/metadata/$pkgname/flist
/var/db/xbps/metadata/$pkgname/props.plist /var/db/xbps/metadata/$pkgname/props.plist
/var/db/xbps/metadata/$pkgname/prepost-inst /var/db/xbps/metadata/$pkgname/INSTALL
/var/db/xbps/metadata/$pkgname/prepost-rm /var/db/xbps/metadata/$pkgname/REMOVE
Metadata info is stored in the "/var/db/xbps/metadata/$pkgname" Metadata info is stored in the "/var/db/xbps/metadata/$pkgname"
directory and two files will be always be present: flist and props.plist. directory and two files will be always be present: flist and props.plist.
@ -61,7 +61,7 @@ has the following structure:
... ...
</dict> </dict>
The prepost-* executables allows you to trigger any action The INSTALL/REMOVE executables allows you to trigger any action
at pre/post installation/removal of the binary package. at pre/post installation/removal of the binary package.
The package's dictionary will also be written into the repository's package The package's dictionary will also be written into the repository's package

View File

@ -189,21 +189,20 @@ xbps_remove_binary_pkg(const char *pkgname, const char *destdir, int flags)
return ENOENT; return ENOENT;
/* /*
* This length is '%s%s/metadata/%s/prepost-rm' not * This length is '%s%s/metadata/%s/REMOVE' + NULL.
* including nul.
*/ */
len = strlen(XBPS_META_PATH) + strlen(destdir) + strlen(pkgname) + 22; len = strlen(XBPS_META_PATH) + strlen(destdir) + strlen(pkgname) + 19;
buf = malloc(len + 1); buf = malloc(len);
if (buf == NULL) if (buf == NULL)
return errno; return errno;
if (snprintf(buf, len + 1, "%s%s/metadata/%s/prepost-rm", if (snprintf(buf, len, "%s%s/metadata/%s/REMOVE",
destdir, XBPS_META_PATH, pkgname) < 0) { destdir, XBPS_META_PATH, pkgname) < 0) {
free(buf); free(buf);
return -1; return -1;
} }
/* Find out if the prepost-rm file exists */ /* Find out if the REMOVE file exists */
if ((fd = open(buf, O_RDONLY)) == -1) { if ((fd = open(buf, O_RDONLY)) == -1) {
if (errno != ENOENT) { if (errno != ENOENT) {
free(buf); free(buf);

View File

@ -151,7 +151,7 @@ unpack_archive_fini(struct archive *ar, const char *destdir, int flags,
struct archive_entry *entry; struct archive_entry *entry;
struct stat st; struct stat st;
size_t len; size_t len;
const char *prepost = "./XBPS_PREPOST_INSTALL"; const char *prepost = "./INSTALL";
const char *pkgname, *version; const char *pkgname, *version;
char *buf, *path; char *buf, *path;
int rv = 0, lflags = 0; int rv = 0, lflags = 0;
@ -169,15 +169,14 @@ unpack_archive_fini(struct archive *ar, const char *destdir, int flags,
lflags = EXTRACT_FLAGS; lflags = EXTRACT_FLAGS;
/* /*
* This length is '.%s/metadata/%s/prepost-inst' not * This length is '.%s/metadata/%s/INSTALL' + NULL.
* including nul.
*/ */
len = strlen(XBPS_META_PATH) + strlen(pkgname) + 24; len = strlen(XBPS_META_PATH) + strlen(pkgname) + 20;
buf = malloc(len + 1); buf = malloc(len);
if (buf == NULL) if (buf == NULL)
return ENOMEM; return ENOMEM;
if (snprintf(buf, len + 1, ".%s/metadata/%s/prepost-inst", if (snprintf(buf, len, ".%s/metadata/%s/INSTALL",
XBPS_META_PATH, pkgname) < 0) { XBPS_META_PATH, pkgname) < 0) {
free(buf); free(buf);
return -1; return -1;

View File

@ -225,15 +225,13 @@ _EOF
chmod 644 $metadir/* chmod 644 $metadir/*
rm -f $TMPFLIST $TMPFPLIST $TMPFPROPS rm -f $TMPFLIST $TMPFPLIST $TMPFPROPS
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/prepost-inst" ]; then if [ -f "$XBPS_TEMPLATESDIR/$pkgname/INSTALL" ]; then
cp -f $XBPS_TEMPLATESDIR/$pkgname/prepost-inst \ cp -f $XBPS_TEMPLATESDIR/$pkgname/INSTALL $destdir
$destdir/XBPS_PREPOST_INSTALL chmod +x $destdir/INSTALL
chmod +x $destdir/XBPS_PREPOST_INSTALL
fi fi
if [ -f "$XBPS_TEMPLATESDIR/$pkgname/prepost-rm" ]; then if [ -f "$XBPS_TEMPLATESDIR/$pkgname/REMOVE" ]; then
cp -f $XBPS_TEMPLATESDIR/$pkgname/prepost-rm \ cp -f $XBPS_TEMPLATESDIR/$pkgname/REMOVE $metadir
$metadir/prepost-rm chmod +x $metadir/REMOVE
chmod +x $metadir/prepost-rm
fi fi
} }
@ -285,7 +283,22 @@ xbps_make_binpkg_real()
binpkg=$pkgname-$version.$arch.xbps binpkg=$pkgname-$version.$arch.xbps
pkgdir=$XBPS_PACKAGESDIR/$arch pkgdir=$XBPS_PACKAGESDIR/$arch
run_rootcmd $use_sudo tar cfjp $XBPS_DESTDIR/$binpkg . 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_DESTDIR/$binpkg ./INSTALL && \
run_rootcmd $use_sudo tar rfp $XBPS_DESTDIR/$binpkg . \
--exclude "./INSTALL" && \
run_rootcmd $use_sudo bzip2 -9 $XBPS_DESTDIR/$binpkg && \
mv $XBPS_DESTDIR/$binpkg.bz2 $XBPS_DESTDIR/$binpkg
else
run_rootcmd $use_sudo tar cfp $XBPS_DESTDIR/$binpkg . && \
bzip2 -9 $XBPS_DESTDIR/$binpkg && \
mv $XBPS_DESTDIR/$binpkg.bz2 $XBPS_DESTDIR/$binpkg
fi
# Disabled for now. # Disabled for now.
# --exclude "./var/db/xbps/metadata/*/flist" . # --exclude "./var/db/xbps/metadata/*/flist" .
# #

View File

@ -47,7 +47,7 @@ case "$2" in
pre) pre)
;; ;;
post) post)
echo "Running $3-$4 post installation hook..." echo "Running $3-$4 post installation hooks..."
if [ "$1" = "NOTSET" ]; then if [ "$1" = "NOTSET" ]; then
run_cmd="pwconv" run_cmd="pwconv"
else else