Another checkpoint in progress for binpkgs.
--HG-- extra : convert_revision : 38f4a4106a2d61757e1feacaec5eaef01f812d59
This commit is contained in:
parent
b2c180348e
commit
8373117030
5 changed files with 185 additions and 129 deletions
73
README
73
README
|
@ -1,9 +1,14 @@
|
|||
-----------------------------------------------------------------------------
|
||||
WHAT IS IT?
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
xbps - xtraeme's build package system.
|
||||
|
||||
It is a simple build package system that installs packages inside of
|
||||
a chroot in a destination directory. Once the package has been installed
|
||||
into this directory, you can make it appear/unappear at the master directory
|
||||
at any time.
|
||||
at any time. It's in spirit the same than GNU stow, but the files are just
|
||||
copied (there are no soft/hard links).
|
||||
|
||||
xbps has been designed for Linux, and for the moment I'm not interested to
|
||||
make it work on any other random OS. I've been a NetBSD developer for some
|
||||
|
@ -11,39 +16,69 @@ years and I do not want to come back... also the experience has helped to
|
|||
me to start xbps and not to use pkgsrc, which is very portable but also
|
||||
not so fast.
|
||||
|
||||
-----------------------------------------------------------------------------
|
||||
REQUIREMENTS
|
||||
-----------------------------------------------------------------------------
|
||||
|
||||
xbps uses proplib, a property container object library and it's almost the
|
||||
same one available for NetBSD. Be sure to have it installed before using
|
||||
xbps. You can get it at:
|
||||
|
||||
http://code.google.com/p/portableproplib/
|
||||
|
||||
I'm also the human maintaining the portable proplib package.
|
||||
I'm also the human maintaining the portable proplib package. I'd suggest you
|
||||
to install it into /usr/local to avoid issues with your distribution packages.
|
||||
|
||||
Additionally the following software is required to be able to use xbps:
|
||||
|
||||
* GNU Make
|
||||
* GNU Binutils
|
||||
* GNU GCC (plus GMP and MPFR) development packages.
|
||||
* GNU Bison
|
||||
* GNU m4
|
||||
* wget
|
||||
* fakeroot
|
||||
|
||||
Super-user privileges are required as well, because all packages are built
|
||||
in a chroot (except the ones that are included in a virtual package to be
|
||||
able to build a minimal system for the chroot).
|
||||
|
||||
PLEASE NOTE THAT fakechroot or fakeroot-ng DO NOT WORK.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
HOW TO USE IT
|
||||
------------------------------------------------------------------------------
|
||||
|
||||
Before using xbps, some required utilities need to be built and installed into
|
||||
the utils/ directory. You can do this by issuing a "make" command in the
|
||||
top level directory.
|
||||
the utils/ directory. You can do this by issuing "make" in the top level
|
||||
directory and edit the configuration file located at the xbps directory.
|
||||
By default it uses the xbps directory in your $HOME.
|
||||
|
||||
Once you download it, you should edit the configuration file located at the
|
||||
xbps directory. By default it uses the xbps directory in your $HOME.
|
||||
|
||||
If XBPS_CONFIG_FILE is not set or specified from the command line with the
|
||||
If configuration file is not specified from the command line with the
|
||||
-c flag, it will first try to use the default location at
|
||||
/usr/local/etc/xbps.conf, and as last resort in current directory.
|
||||
/etc/xbps.conf, and as last resort in current directory.
|
||||
|
||||
To avoid problems with libtool and configure scripts finding stuff that is
|
||||
available in the host system, you should install the xbps-base-chroot package
|
||||
as the first thing once the xbps.conf file is ok.
|
||||
available in the host system, almost all packages must be built inside of a
|
||||
chroot. So the first thing would be to create the binary packages with:
|
||||
|
||||
Once xbps-base-chroot has been installed, all packages that aren't part
|
||||
of this will require root permission to be used in the chroot. Think about it,
|
||||
all is done at the chroot, less stuff to break with missing dependencies and
|
||||
incompatibilities found by the configure scripts.
|
||||
$ xbps.sh build-chroot
|
||||
|
||||
Let's explain some more about the targets that you can use. To start
|
||||
This will build all required binary packages via fakeroot, therefore you
|
||||
can run it as normal user. Next commands will require super-user privileges
|
||||
and all package handling will be done within the chroot. I believe it's the
|
||||
most easier and faster way to handle clean dependencies; another reason would
|
||||
be that xbps packages are meant to be used in a system and not just for
|
||||
ordinary users. So once all packages are built, you can create the chroot with:
|
||||
|
||||
$ sudo xbps.sh chroot
|
||||
|
||||
Press Control + D to exit from the chroot. The following targets will require
|
||||
to be done in the chroot:
|
||||
|
||||
build, configure, install, install-destdir, remove, stow and unstow.
|
||||
|
||||
Now let's explain some more about the targets that you can use. To start
|
||||
installing packages you should use the install target:
|
||||
|
||||
$ xbps.sh install glib
|
||||
|
@ -59,7 +94,7 @@ To remove a currently installed (and stowned) package, you can use:
|
|||
Please note that when you remove it, the package will also be removed
|
||||
from XBPS_DESTDIR and previously "unstowned".
|
||||
|
||||
Summary, to stow an already installed package (into XBPS_DESTDIR/<pkgname>):
|
||||
To stow an already installed package (from XBPS_DESTDIR/<pkgname>):
|
||||
|
||||
$ xbps.sh stow glib
|
||||
|
||||
|
@ -67,7 +102,7 @@ and to unstow an already installed (stowned) package:
|
|||
|
||||
$ xbps.sh unstow glib
|
||||
|
||||
You can also print some stuff about any template, e.g:
|
||||
You can also print some stuff about any template build file, e.g:
|
||||
|
||||
$ xbps.sh info glib
|
||||
|
||||
|
@ -96,8 +131,6 @@ into destination directory first:
|
|||
|
||||
$ xbps.sh listfiles blob
|
||||
|
||||
That's all for now folks. I hope you find it useful, as I do.
|
||||
|
||||
------------------------------------------------------------------------------
|
||||
PERFORMANCE
|
||||
------------------------------------------------------------------------------
|
||||
|
|
|
@ -16,8 +16,6 @@ write_metadata()
|
|||
exit 1
|
||||
fi
|
||||
|
||||
echo -n "=> Writing package metadata ... "
|
||||
|
||||
# Write the files list.
|
||||
local TMPFLIST=$(mktemp -t flist.XXXXXXXXXX) || exit 1
|
||||
find $destdir | sort -ur | \
|
||||
|
@ -68,8 +66,6 @@ _EOF
|
|||
cp -f $TMPFPROPS $destdir/xbps-metadata/props.plist
|
||||
chmod 644 $destdir/xbps-metadata/*
|
||||
rm -f $TMPFLIST $TMPFPROPS
|
||||
|
||||
echo "done."
|
||||
}
|
||||
|
||||
make_archive()
|
||||
|
@ -79,14 +75,11 @@ make_archive()
|
|||
|
||||
cd $destdir || exit 1
|
||||
|
||||
echo -n "=> Building package ... "
|
||||
tar cfjp $XBPS_DESTDIR/$pkgname-$version-xbps.tbz2 .
|
||||
[ $? -eq 0 ] && echo "done."
|
||||
|
||||
tar cfjp $destdir-xbps.tbz2 .
|
||||
[ ! -d $pkgsdir ] && mkdir -p $pkgsdir
|
||||
mv -f $XBPS_DESTDIR/$pkgname-$version-xbps.tbz2 $pkgsdir
|
||||
mv -f $destdir-xbps.tbz2 $pkgsdir
|
||||
|
||||
echo "=> Built package: ${destdir}-xbps.tbz2"
|
||||
echo "=> Built package: $pkgname-$version-xbps.tbz2."
|
||||
}
|
||||
|
||||
pkg=$1
|
||||
|
|
|
@ -25,8 +25,6 @@ fi
|
|||
|
||||
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
|
||||
echo -n "==> Preparing chroot on $XBPS_MASTERDIR... "
|
||||
chown -R root:root $XBPS_MASTERDIR/*
|
||||
chmod +s $XBPS_MASTERDIR/usr/libexec/pt_chown
|
||||
cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts \
|
||||
/etc/resolv.conf $XBPS_MASTERDIR/etc
|
||||
touch $XBPS_MASTERDIR/.xbps_perms_done
|
||||
|
@ -81,8 +79,8 @@ chroot_pkg_handler()
|
|||
if [ "$action" = "chroot" ]; then
|
||||
env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash
|
||||
else
|
||||
env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh \
|
||||
$action $pkg
|
||||
env in_chroot=yes chroot $XBPS_MASTERDIR \
|
||||
/xbps/xbps.sh $action $pkg
|
||||
fi
|
||||
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
|
||||
umount_chroot_fs
|
||||
|
|
|
@ -32,7 +32,7 @@
|
|||
|
||||
#include <prop/proplib.h>
|
||||
|
||||
#define _XBPS_PKGDB_DEFPATH "/var/xbps/.xbps-pkgdb.plist"
|
||||
#define _XBPS_PKGDB_DEFPATH "/var/cache/xbps/pkgdb.plist"
|
||||
|
||||
typedef struct pkg_data {
|
||||
const char *pkgname;
|
||||
|
@ -359,7 +359,8 @@ main(int argc, char **argv)
|
|||
/* Check if pkg is already registered. */
|
||||
pkgdict = find_pkg_in_dict(dbdict, argv[2]);
|
||||
if (pkgdict != NULL) {
|
||||
printf("=> Package %s-%s already registered.\n",
|
||||
printf("%s=> Package %s-%s already registered.\n",
|
||||
in_chroot ? "[chroot] " : "",
|
||||
argv[2], argv[3]);
|
||||
exit(0);
|
||||
}
|
||||
|
|
217
xbps.sh
217
xbps.sh
|
@ -30,33 +30,39 @@ trap "echo && exit 1" INT QUIT
|
|||
: ${XBPS_CONFIG_FILE:=/etc/xbps.conf}
|
||||
|
||||
: ${progname:=$(basename $0)}
|
||||
: ${fakeroot_cmd:=fakeroot}
|
||||
: ${fetch_cmd:=wget}
|
||||
: ${xbps_machine:=$(uname -m)}
|
||||
|
||||
usage()
|
||||
{
|
||||
cat << _EOF
|
||||
$progname: [-C] [-c <config_file>] <target> [package_name]
|
||||
$progname: [-C] [-c <config_file>] <target> <pkg>
|
||||
|
||||
Targets:
|
||||
build Builds a package, only build phase is done.
|
||||
chroot Enters to the chroot in masterdir.
|
||||
configure Configure a package, only configure phase is done.
|
||||
extract Extract distribution file(s) into build directory.
|
||||
fetch Download distribution file(s).
|
||||
info Show information about <package_name>.
|
||||
install-destdir build + configure + install into destdir.
|
||||
install install-destdir + stow.
|
||||
list Lists all currently installed packages.
|
||||
listfiles Lists files installed from <package_name>.
|
||||
remove Remove package completely (destdir + masterdir).
|
||||
stow Copy files from destdir/<pkgname> into masterdir.
|
||||
unstow Remove <pkgname> files from masterdir.
|
||||
build <pkg> Build a package (fetch + extract + configure + build).
|
||||
build-chroot Build binary packages required for chroot.
|
||||
build-pkg <pkg> Build a binary package from <pkg>.
|
||||
Package must be installed into destdir before it.
|
||||
chroot Enter to the chroot in masterdir.
|
||||
configure <pkg> Configure a package (fetch + extract + configure).
|
||||
extract <pkg> Extract distribution file(s) into build directory.
|
||||
fetch <pkg> Download distribution file(s).
|
||||
info <pkg> Show information about <pkg>.
|
||||
install-destdir <pkg> build + install into destdir.
|
||||
install <pkg> install-destdir + stow + build-pkg.
|
||||
list List installed packages in masterdir.
|
||||
listfiles <pkg> List installed files from <pkg>.
|
||||
remove <pkg> Remove package completely (destdir + masterdir).
|
||||
stow <pkg> Copy <pkg> files from destdir into masterdir and
|
||||
register package in database.
|
||||
unstow <pkg> Remove <pkg> files from masterdir and unregister
|
||||
package from database.
|
||||
|
||||
Options:
|
||||
-C Do not remove build directory after successful installation.
|
||||
-c Path to global configuration file:
|
||||
if not specified /etc/xbps.conf is used.
|
||||
-C Do not remove build directory after successful installation.
|
||||
-c Path to global configuration file:
|
||||
if not specified /etc/xbps.conf is used.
|
||||
_EOF
|
||||
exit 1
|
||||
}
|
||||
|
@ -65,10 +71,11 @@ set_defvars()
|
|||
{
|
||||
local i=
|
||||
|
||||
# Directories
|
||||
: ${XBPS_TEMPLATESDIR:=$XBPS_DISTRIBUTIONDIR/templates}
|
||||
: ${XBPS_HELPERSDIR:=$XBPS_DISTRIBUTIONDIR/helpers}
|
||||
: ${XBPS_PKGDB_FPATH:=$XBPS_DESTDIR/.xbps-pkgdb.plist}
|
||||
: ${XBPS_CACHEDIR:=$XBPS_MASTERDIR/var/cache/xbps}
|
||||
: ${XBPS_PKGDB_FPATH:=$XBPS_CACHEDIR/pkgdb.plist}
|
||||
: ${XBPS_PKGMETADIR:=$XBPS_CACHEDIR/metadata}
|
||||
: ${XBPS_UTILSDIR:=$XBPS_DISTRIBUTIONDIR/utils}
|
||||
: ${XBPS_DIGEST_CMD:=$XBPS_UTILSDIR/xbps-digest}
|
||||
: ${XBPS_PKGDB_CMD:=$XBPS_UTILSDIR/xbps-pkgdb}
|
||||
|
@ -114,6 +121,17 @@ run_func()
|
|||
[ $? -eq 0 ] && $func
|
||||
}
|
||||
|
||||
rootcmd_run()
|
||||
{
|
||||
local lenv=
|
||||
|
||||
[ -n "$in_chroot" ] && unset fakeroot_cmd
|
||||
|
||||
lenv="XBPS_DESTDIR=$XBPS_DESTDIR"
|
||||
lenv="XBPS_DISTRIBUTIONDIR=$XBPS_DISTRIBUTIONDIR $lenv"
|
||||
env ${lenv} ${fakeroot_cmd} $@
|
||||
}
|
||||
|
||||
msg_error()
|
||||
{
|
||||
[ -z "$1" ] && return 1
|
||||
|
@ -259,11 +277,11 @@ setup_tmpl()
|
|||
{
|
||||
local pkg="$1"
|
||||
|
||||
[ -z "$pkg" ] && msg_error "missing package name after target." && usage
|
||||
[ -z "$pkg" ] && msg_error "missing package name after target."
|
||||
|
||||
if [ -f "$XBPS_TEMPLATESDIR/$pkg.tmpl" ]; then
|
||||
if [ "$pkgname" != "$pkg" ]; then
|
||||
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
. $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
fi
|
||||
prepare_tmpl
|
||||
else
|
||||
|
@ -934,7 +952,7 @@ make_install()
|
|||
#
|
||||
# Install package via make.
|
||||
#
|
||||
${make_cmd} ${make_install_target} ${make_install_args}
|
||||
rootcmd_run ${make_cmd} ${make_install_target} ${make_install_args}
|
||||
if [ "$?" -ne 0 ]; then
|
||||
msg_error "installing $pkgname-$version."
|
||||
exit 1
|
||||
|
@ -967,7 +985,7 @@ add_dependency_tolist()
|
|||
|
||||
if [ "$pkgname" != "${curpkg%-[0-9]*.*}" ]; then
|
||||
reset_tmpl_vars
|
||||
run_file $XBPS_TEMPLATESDIR/${curpkg%-[0-9]*.*}.tmpl
|
||||
. $XBPS_TEMPLATESDIR/${curpkg%-[0-9]*.*}.tmpl
|
||||
fi
|
||||
|
||||
for j in ${build_depends}; do
|
||||
|
@ -1062,7 +1080,7 @@ install_dependencies_pkg()
|
|||
|
||||
doing_deps=true
|
||||
|
||||
echo -n "=> Calculating dependency list for $pkgname-$version... "
|
||||
echo -n "==> Calculating dependency list for $pkgname-$version... "
|
||||
add_dependency_tolist $pkg
|
||||
find_dupdeps_inlist installed
|
||||
find_dupdeps_inlist notinstalled
|
||||
|
@ -1073,11 +1091,11 @@ install_dependencies_pkg()
|
|||
msg_normal "Required dependencies for $(basename $pkg):"
|
||||
for i in ${installed_deps_list}; do
|
||||
fpkg="$($XBPS_PKGDB_CMD list|awk '{print $1}'|grep -w ${i%-[0-9]*.*})"
|
||||
echo " $i: found $fpkg."
|
||||
echo " $i >= found $fpkg."
|
||||
done
|
||||
|
||||
for i in ${deps_list}; do
|
||||
echo " $i: not found."
|
||||
echo " $i >= not found."
|
||||
done
|
||||
|
||||
for i in ${deps_list}; do
|
||||
|
@ -1101,7 +1119,7 @@ install_builddeps_required_pkg()
|
|||
[ -z "$pkg" ] && return 1
|
||||
|
||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
. $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
fi
|
||||
|
||||
for dep in ${build_depends}; do
|
||||
|
@ -1127,7 +1145,7 @@ check_installed_pkg()
|
|||
|
||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||
reset_tmpl_vars
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
. $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
fi
|
||||
|
||||
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
||||
|
@ -1151,14 +1169,30 @@ check_build_depends_pkg()
|
|||
|
||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||
reset_tmpl_vars
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
. $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||
fi
|
||||
|
||||
if [ -n "$build_depends" ]; then
|
||||
return 0
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
}
|
||||
|
||||
return 1
|
||||
#
|
||||
# Builds a binary package.
|
||||
#
|
||||
build_binpkg()
|
||||
{
|
||||
local pkg="$1"
|
||||
|
||||
[ -z $pkg ] && return 1
|
||||
|
||||
cd $XBPS_BUILDDIR || exit 1
|
||||
if [ "$(whoami)" != "root" ]; then
|
||||
echo "==> Building binary package via fakeroot."
|
||||
fi
|
||||
rootcmd_run $XBPS_DISTRIBUTIONDIR/binpkg/create.sh $pkg
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -1184,7 +1218,7 @@ install_pkg()
|
|||
fi
|
||||
|
||||
reset_tmpl_vars
|
||||
run_file $cur_tmpl
|
||||
. $cur_tmpl
|
||||
pkg="$curpkgn-$version"
|
||||
|
||||
#
|
||||
|
@ -1194,8 +1228,9 @@ install_pkg()
|
|||
[ -z "$origin_tmpl" ] && origin_tmpl=$pkgname
|
||||
|
||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
||||
. $XBPS_HELPERSDIR/chroot.sh
|
||||
chroot_pkg_handler install $curpkgn
|
||||
build_binpkg $curpkgn
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
@ -1242,12 +1277,16 @@ install_pkg()
|
|||
#
|
||||
if [ "$build_style" = "meta-template" ]; then
|
||||
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
||||
[ $? -eq 0 ] && \
|
||||
msg_normal "Installed meta-template: $pkg." && \
|
||||
if [ $? -eq 0 ]; then
|
||||
msg_normal "Installed meta-template: $pkg."
|
||||
return 0
|
||||
return 1
|
||||
else
|
||||
return 1
|
||||
fi
|
||||
fi
|
||||
|
||||
[ -z "$in_chroot" ] && build_binpkg $curpkgn
|
||||
|
||||
#
|
||||
# Do not stow package if it wasn't requested.
|
||||
#
|
||||
|
@ -1261,17 +1300,13 @@ list_pkg_files()
|
|||
{
|
||||
local pkg="$1"
|
||||
local ver=
|
||||
|
||||
|
||||
[ -z $pkg ] && msg_error "unexistent package, aborting."
|
||||
|
||||
ver=$($XBPS_PKGDB_CMD version $pkg)
|
||||
[ -z "$ver" ] && msg_error "$pkg is not installed."
|
||||
|
||||
if [ ! -d "$XBPS_DESTDIR/$pkg-$ver" ]; then
|
||||
msg_error "cannot find $pkg in $XBPS_DESTDIR."
|
||||
fi
|
||||
|
||||
cat $XBPS_DESTDIR/$pkg-$ver/xbps-metadata/flist
|
||||
cat $XBPS_PKGMETADIR/$pkg-$ver/flist
|
||||
}
|
||||
|
||||
#
|
||||
|
@ -1288,15 +1323,14 @@ remove_pkg()
|
|||
msg_error "cannot find template build file."
|
||||
fi
|
||||
|
||||
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
. $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
|
||||
#
|
||||
# If it's a meta-template, just unregister it from the db.
|
||||
#
|
||||
if [ "$build_style" = "meta-template" ]; then
|
||||
$XBPS_PKGDB_CMD unregister $pkgname $version
|
||||
[ $? -eq 0 ] && \
|
||||
echo "=> Removed meta-template: $pkg."
|
||||
[ $? -eq 0 ] && msg_normal "Removed meta-template: $pkg."
|
||||
return $?
|
||||
fi
|
||||
|
||||
|
@ -1325,7 +1359,7 @@ stow_pkg()
|
|||
if [ -n "$stow_flag" ]; then
|
||||
pkg=$XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
if [ "$pkgname" != "$pkg" ]; then
|
||||
run_file $pkg
|
||||
. $pkg
|
||||
fi
|
||||
pkg=$pkgname-$version
|
||||
#
|
||||
|
@ -1334,14 +1368,21 @@ stow_pkg()
|
|||
[ "$build_style" = "meta-template" ] && return 0
|
||||
fi
|
||||
|
||||
# Copy files into masterdir.
|
||||
cd $XBPS_DESTDIR/$pkgname-$version || exit 1
|
||||
cp -ar . $XBPS_MASTERDIR
|
||||
|
||||
# Build a binary package.
|
||||
env XBPS_DESTDIR=$XBPS_DESTDIR \
|
||||
XBPS_DISTRIBUTIONDIR=$XBPS_DISTRIBUTIONDIR \
|
||||
$XBPS_DISTRIBUTIONDIR/binpkg/create.sh $pkgname
|
||||
# Copy metadata files.
|
||||
if [ -f xbps-metadata/flist -a -f xbps-metadata/props.plist ]; then
|
||||
local metadir=$XBPS_PKGMETADIR/$pkgname-$version
|
||||
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
|
||||
|
||||
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
||||
[ $? -ne 0 ] && exit 1
|
||||
|
@ -1350,7 +1391,7 @@ stow_pkg()
|
|||
# Run template postinstall helpers if requested.
|
||||
#
|
||||
if [ "$pkgname" != "${pkg%%-$version}" ]; then
|
||||
run_file $XBPS_TEMPLATESDIR/${pkg%%-$version}.tmpl
|
||||
. $XBPS_TEMPLATESDIR/${pkg%%-$version}.tmpl
|
||||
fi
|
||||
|
||||
for i in ${postinstall_helpers}; do
|
||||
|
@ -1371,7 +1412,7 @@ unstow_pkg()
|
|||
[ -z $pkg ] && msg_error "template wasn't specified?"
|
||||
|
||||
if [ "$pkgname" != "$pkg" ]; then
|
||||
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
. $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||
fi
|
||||
|
||||
ver=$($XBPS_PKGDB_CMD version $pkg)
|
||||
|
@ -1384,13 +1425,14 @@ unstow_pkg()
|
|||
#
|
||||
[ "$build_style" = "meta-template" ] && return 0
|
||||
|
||||
cd $XBPS_DESTDIR/$pkgname-$ver/xbps-metadata || exit 1
|
||||
cd $XBPS_PKGMETADIR/$pkgname-$version || exit 1
|
||||
if [ ! -f flist ]; then
|
||||
msg_error "$pkg is incomplete, missing flist."
|
||||
elif [ ! -O flist ]; then
|
||||
msg_error "$pkg cannot be removed (permission denied)."
|
||||
fi
|
||||
|
||||
# Remove installed files.
|
||||
for f in $(cat flist); do
|
||||
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
||||
rm $XBPS_MASTERDIR/$f >/dev/null 2>&1
|
||||
|
@ -1409,6 +1451,9 @@ unstow_pkg()
|
|||
fi
|
||||
done
|
||||
|
||||
# Remove metadata dir.
|
||||
rm -rf $XBPS_PKGMETADIR/$pkgname-$version
|
||||
|
||||
$XBPS_PKGDB_CMD unregister $pkgname $ver
|
||||
return $?
|
||||
}
|
||||
|
@ -1441,66 +1486,52 @@ set_defvars
|
|||
|
||||
# Main switch
|
||||
case "$target" in
|
||||
build)
|
||||
build|configure)
|
||||
setup_tmpl $2
|
||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
||||
chroot_pkg_handler build $2
|
||||
. $XBPS_HELPERSDIR/chroot.sh
|
||||
if [ "$target" = "build" ]; then
|
||||
chroot_pkg_handler build $2
|
||||
else
|
||||
chroot_pkg_handler configure $2
|
||||
fi
|
||||
else
|
||||
fetch_distfiles $2
|
||||
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
||||
extract_distfiles $2
|
||||
fi
|
||||
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
||||
if [ "$target" = "configure" ]; then
|
||||
configure_src_phase $2
|
||||
else
|
||||
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
||||
configure_src_phase $2
|
||||
fi
|
||||
build_src_phase $2
|
||||
fi
|
||||
build_src_phase $2
|
||||
fi
|
||||
;;
|
||||
build-chroot)
|
||||
. $XBPS_HELPERSDIR/build-chroot-binpkgs.sh
|
||||
build_chroot_binpkgs
|
||||
;;
|
||||
chroot)
|
||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
||||
. $XBPS_HELPERSDIR/chroot.sh
|
||||
chroot_pkg_handler chroot dummy
|
||||
;;
|
||||
configure)
|
||||
setup_tmpl $2
|
||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
||||
chroot_pkg_handler configure $2
|
||||
else
|
||||
fetch_distfiles $2
|
||||
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
||||
extract_distfiles $2
|
||||
fi
|
||||
configure_src_phase $2
|
||||
fi
|
||||
;;
|
||||
extract)
|
||||
extract|fetch|info)
|
||||
setup_tmpl $2
|
||||
[ "$target" = "info" ] && info_tmpl $2 && return $?
|
||||
fetch_distfiles $2
|
||||
[ "$target" = "fetch" ] && return $?
|
||||
extract_distfiles $2
|
||||
;;
|
||||
fetch)
|
||||
setup_tmpl $2
|
||||
fetch_distfiles $2
|
||||
;;
|
||||
info)
|
||||
setup_tmpl $2
|
||||
info_tmpl $2
|
||||
;;
|
||||
install-destdir)
|
||||
install|install-destdir)
|
||||
[ -z "$2" ] && msg_error "missing package name after target."
|
||||
install_destdir_target=yes
|
||||
[ "$target" = "install-destdir" ] && install_destdir_target=yes
|
||||
install_pkg $2
|
||||
;;
|
||||
install)
|
||||
[ -z "$2" ] && msg_error "missing package name after target."
|
||||
install_pkg $2
|
||||
;;
|
||||
list)
|
||||
$XBPS_PKGDB_CMD list
|
||||
;;
|
||||
listfiles)
|
||||
[ -z "$2" ] && msg_error "missing package after target."
|
||||
list|listfiles)
|
||||
[ "$target" = "list" ] && $XBPS_PKGDB_CMD list && return $?
|
||||
list_pkg_files $2
|
||||
;;
|
||||
remove)
|
||||
|
|
Loading…
Reference in a new issue