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.
|
xbps - xtraeme's build package system.
|
||||||
|
|
||||||
It is a simple build package system that installs packages inside of
|
It is a simple build package system that installs packages inside of
|
||||||
a chroot in a destination directory. Once the package has been installed
|
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
|
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
|
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
|
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
|
me to start xbps and not to use pkgsrc, which is very portable but also
|
||||||
not so fast.
|
not so fast.
|
||||||
|
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
REQUIREMENTS
|
||||||
|
-----------------------------------------------------------------------------
|
||||||
|
|
||||||
xbps uses proplib, a property container object library and it's almost the
|
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
|
same one available for NetBSD. Be sure to have it installed before using
|
||||||
xbps. You can get it at:
|
xbps. You can get it at:
|
||||||
|
|
||||||
http://code.google.com/p/portableproplib/
|
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
|
HOW TO USE IT
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
||||||
Before using xbps, some required utilities need to be built and installed into
|
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
|
the utils/ directory. You can do this by issuing "make" in the top level
|
||||||
top level directory.
|
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
|
If configuration file is not specified from the command line with 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
|
|
||||||
-c flag, it will first try to use the default location at
|
-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
|
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
|
available in the host system, almost all packages must be built inside of a
|
||||||
as the first thing once the xbps.conf file is ok.
|
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
|
$ xbps.sh build-chroot
|
||||||
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.
|
|
||||||
|
|
||||||
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:
|
installing packages you should use the install target:
|
||||||
|
|
||||||
$ xbps.sh install glib
|
$ 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
|
Please note that when you remove it, the package will also be removed
|
||||||
from XBPS_DESTDIR and previously "unstowned".
|
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
|
$ xbps.sh stow glib
|
||||||
|
|
||||||
|
@ -67,7 +102,7 @@ and to unstow an already installed (stowned) package:
|
||||||
|
|
||||||
$ xbps.sh unstow glib
|
$ 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
|
$ xbps.sh info glib
|
||||||
|
|
||||||
|
@ -96,8 +131,6 @@ into destination directory first:
|
||||||
|
|
||||||
$ xbps.sh listfiles blob
|
$ xbps.sh listfiles blob
|
||||||
|
|
||||||
That's all for now folks. I hope you find it useful, as I do.
|
|
||||||
|
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
PERFORMANCE
|
PERFORMANCE
|
||||||
------------------------------------------------------------------------------
|
------------------------------------------------------------------------------
|
||||||
|
|
|
@ -16,8 +16,6 @@ write_metadata()
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo -n "=> Writing package metadata ... "
|
|
||||||
|
|
||||||
# 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 | \
|
||||||
|
@ -68,8 +66,6 @@ _EOF
|
||||||
cp -f $TMPFPROPS $destdir/xbps-metadata/props.plist
|
cp -f $TMPFPROPS $destdir/xbps-metadata/props.plist
|
||||||
chmod 644 $destdir/xbps-metadata/*
|
chmod 644 $destdir/xbps-metadata/*
|
||||||
rm -f $TMPFLIST $TMPFPROPS
|
rm -f $TMPFLIST $TMPFPROPS
|
||||||
|
|
||||||
echo "done."
|
|
||||||
}
|
}
|
||||||
|
|
||||||
make_archive()
|
make_archive()
|
||||||
|
@ -79,14 +75,11 @@ make_archive()
|
||||||
|
|
||||||
cd $destdir || exit 1
|
cd $destdir || exit 1
|
||||||
|
|
||||||
echo -n "=> Building package ... "
|
tar cfjp $destdir-xbps.tbz2 .
|
||||||
tar cfjp $XBPS_DESTDIR/$pkgname-$version-xbps.tbz2 .
|
|
||||||
[ $? -eq 0 ] && echo "done."
|
|
||||||
|
|
||||||
[ ! -d $pkgsdir ] && mkdir -p $pkgsdir
|
[ ! -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
|
pkg=$1
|
||||||
|
|
|
@ -25,8 +25,6 @@ fi
|
||||||
|
|
||||||
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
|
if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then
|
||||||
echo -n "==> Preparing chroot on $XBPS_MASTERDIR... "
|
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 \
|
cp -af /etc/passwd /etc/shadow /etc/group /etc/hosts \
|
||||||
/etc/resolv.conf $XBPS_MASTERDIR/etc
|
/etc/resolv.conf $XBPS_MASTERDIR/etc
|
||||||
touch $XBPS_MASTERDIR/.xbps_perms_done
|
touch $XBPS_MASTERDIR/.xbps_perms_done
|
||||||
|
@ -81,8 +79,8 @@ chroot_pkg_handler()
|
||||||
if [ "$action" = "chroot" ]; then
|
if [ "$action" = "chroot" ]; then
|
||||||
env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash
|
env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash
|
||||||
else
|
else
|
||||||
env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh \
|
env in_chroot=yes chroot $XBPS_MASTERDIR \
|
||||||
$action $pkg
|
/xbps/xbps.sh $action $pkg
|
||||||
fi
|
fi
|
||||||
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
|
msg_normal "Exiting from the chroot on $XBPS_MASTERDIR."
|
||||||
umount_chroot_fs
|
umount_chroot_fs
|
||||||
|
|
|
@ -32,7 +32,7 @@
|
||||||
|
|
||||||
#include <prop/proplib.h>
|
#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 {
|
typedef struct pkg_data {
|
||||||
const char *pkgname;
|
const char *pkgname;
|
||||||
|
@ -359,7 +359,8 @@ main(int argc, char **argv)
|
||||||
/* Check if pkg is already registered. */
|
/* Check if pkg is already registered. */
|
||||||
pkgdict = find_pkg_in_dict(dbdict, argv[2]);
|
pkgdict = find_pkg_in_dict(dbdict, argv[2]);
|
||||||
if (pkgdict != NULL) {
|
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]);
|
argv[2], argv[3]);
|
||||||
exit(0);
|
exit(0);
|
||||||
}
|
}
|
||||||
|
|
203
xbps.sh
203
xbps.sh
|
@ -30,28 +30,34 @@ trap "echo && exit 1" INT QUIT
|
||||||
: ${XBPS_CONFIG_FILE:=/etc/xbps.conf}
|
: ${XBPS_CONFIG_FILE:=/etc/xbps.conf}
|
||||||
|
|
||||||
: ${progname:=$(basename $0)}
|
: ${progname:=$(basename $0)}
|
||||||
|
: ${fakeroot_cmd:=fakeroot}
|
||||||
: ${fetch_cmd:=wget}
|
: ${fetch_cmd:=wget}
|
||||||
: ${xbps_machine:=$(uname -m)}
|
: ${xbps_machine:=$(uname -m)}
|
||||||
|
|
||||||
usage()
|
usage()
|
||||||
{
|
{
|
||||||
cat << _EOF
|
cat << _EOF
|
||||||
$progname: [-C] [-c <config_file>] <target> [package_name]
|
$progname: [-C] [-c <config_file>] <target> <pkg>
|
||||||
|
|
||||||
Targets:
|
Targets:
|
||||||
build Builds a package, only build phase is done.
|
build <pkg> Build a package (fetch + extract + configure + build).
|
||||||
chroot Enters to the chroot in masterdir.
|
build-chroot Build binary packages required for chroot.
|
||||||
configure Configure a package, only configure phase is done.
|
build-pkg <pkg> Build a binary package from <pkg>.
|
||||||
extract Extract distribution file(s) into build directory.
|
Package must be installed into destdir before it.
|
||||||
fetch Download distribution file(s).
|
chroot Enter to the chroot in masterdir.
|
||||||
info Show information about <package_name>.
|
configure <pkg> Configure a package (fetch + extract + configure).
|
||||||
install-destdir build + configure + install into destdir.
|
extract <pkg> Extract distribution file(s) into build directory.
|
||||||
install install-destdir + stow.
|
fetch <pkg> Download distribution file(s).
|
||||||
list Lists all currently installed packages.
|
info <pkg> Show information about <pkg>.
|
||||||
listfiles Lists files installed from <package_name>.
|
install-destdir <pkg> build + install into destdir.
|
||||||
remove Remove package completely (destdir + masterdir).
|
install <pkg> install-destdir + stow + build-pkg.
|
||||||
stow Copy files from destdir/<pkgname> into masterdir.
|
list List installed packages in masterdir.
|
||||||
unstow Remove <pkgname> files from 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:
|
Options:
|
||||||
-C Do not remove build directory after successful installation.
|
-C Do not remove build directory after successful installation.
|
||||||
|
@ -65,10 +71,11 @@ set_defvars()
|
||||||
{
|
{
|
||||||
local i=
|
local i=
|
||||||
|
|
||||||
# Directories
|
|
||||||
: ${XBPS_TEMPLATESDIR:=$XBPS_DISTRIBUTIONDIR/templates}
|
: ${XBPS_TEMPLATESDIR:=$XBPS_DISTRIBUTIONDIR/templates}
|
||||||
: ${XBPS_HELPERSDIR:=$XBPS_DISTRIBUTIONDIR/helpers}
|
: ${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_UTILSDIR:=$XBPS_DISTRIBUTIONDIR/utils}
|
||||||
: ${XBPS_DIGEST_CMD:=$XBPS_UTILSDIR/xbps-digest}
|
: ${XBPS_DIGEST_CMD:=$XBPS_UTILSDIR/xbps-digest}
|
||||||
: ${XBPS_PKGDB_CMD:=$XBPS_UTILSDIR/xbps-pkgdb}
|
: ${XBPS_PKGDB_CMD:=$XBPS_UTILSDIR/xbps-pkgdb}
|
||||||
|
@ -114,6 +121,17 @@ run_func()
|
||||||
[ $? -eq 0 ] && $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()
|
msg_error()
|
||||||
{
|
{
|
||||||
[ -z "$1" ] && return 1
|
[ -z "$1" ] && return 1
|
||||||
|
@ -259,11 +277,11 @@ setup_tmpl()
|
||||||
{
|
{
|
||||||
local pkg="$1"
|
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 [ -f "$XBPS_TEMPLATESDIR/$pkg.tmpl" ]; then
|
||||||
if [ "$pkgname" != "$pkg" ]; then
|
if [ "$pkgname" != "$pkg" ]; then
|
||||||
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
. $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||||
fi
|
fi
|
||||||
prepare_tmpl
|
prepare_tmpl
|
||||||
else
|
else
|
||||||
|
@ -934,7 +952,7 @@ make_install()
|
||||||
#
|
#
|
||||||
# Install package via make.
|
# 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
|
if [ "$?" -ne 0 ]; then
|
||||||
msg_error "installing $pkgname-$version."
|
msg_error "installing $pkgname-$version."
|
||||||
exit 1
|
exit 1
|
||||||
|
@ -967,7 +985,7 @@ add_dependency_tolist()
|
||||||
|
|
||||||
if [ "$pkgname" != "${curpkg%-[0-9]*.*}" ]; then
|
if [ "$pkgname" != "${curpkg%-[0-9]*.*}" ]; then
|
||||||
reset_tmpl_vars
|
reset_tmpl_vars
|
||||||
run_file $XBPS_TEMPLATESDIR/${curpkg%-[0-9]*.*}.tmpl
|
. $XBPS_TEMPLATESDIR/${curpkg%-[0-9]*.*}.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for j in ${build_depends}; do
|
for j in ${build_depends}; do
|
||||||
|
@ -1062,7 +1080,7 @@ install_dependencies_pkg()
|
||||||
|
|
||||||
doing_deps=true
|
doing_deps=true
|
||||||
|
|
||||||
echo -n "=> Calculating dependency list for $pkgname-$version... "
|
echo -n "==> Calculating dependency list for $pkgname-$version... "
|
||||||
add_dependency_tolist $pkg
|
add_dependency_tolist $pkg
|
||||||
find_dupdeps_inlist installed
|
find_dupdeps_inlist installed
|
||||||
find_dupdeps_inlist notinstalled
|
find_dupdeps_inlist notinstalled
|
||||||
|
@ -1073,11 +1091,11 @@ install_dependencies_pkg()
|
||||||
msg_normal "Required dependencies for $(basename $pkg):"
|
msg_normal "Required dependencies for $(basename $pkg):"
|
||||||
for i in ${installed_deps_list}; do
|
for i in ${installed_deps_list}; do
|
||||||
fpkg="$($XBPS_PKGDB_CMD list|awk '{print $1}'|grep -w ${i%-[0-9]*.*})"
|
fpkg="$($XBPS_PKGDB_CMD list|awk '{print $1}'|grep -w ${i%-[0-9]*.*})"
|
||||||
echo " $i: found $fpkg."
|
echo " $i >= found $fpkg."
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in ${deps_list}; do
|
for i in ${deps_list}; do
|
||||||
echo " $i: not found."
|
echo " $i >= not found."
|
||||||
done
|
done
|
||||||
|
|
||||||
for i in ${deps_list}; do
|
for i in ${deps_list}; do
|
||||||
|
@ -1101,7 +1119,7 @@ install_builddeps_required_pkg()
|
||||||
[ -z "$pkg" ] && return 1
|
[ -z "$pkg" ] && return 1
|
||||||
|
|
||||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
. $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for dep in ${build_depends}; do
|
for dep in ${build_depends}; do
|
||||||
|
@ -1127,7 +1145,7 @@ check_installed_pkg()
|
||||||
|
|
||||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||||
reset_tmpl_vars
|
reset_tmpl_vars
|
||||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
. $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
iver="$($XBPS_PKGDB_CMD version $pkgname)"
|
||||||
|
@ -1151,14 +1169,30 @@ check_build_depends_pkg()
|
||||||
|
|
||||||
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
if [ "$pkgname" != "${pkg%-[0-9]*.*}" ]; then
|
||||||
reset_tmpl_vars
|
reset_tmpl_vars
|
||||||
run_file $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
. $XBPS_TEMPLATESDIR/${pkg%-[0-9]*.*}.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -n "$build_depends" ]; then
|
if [ -n "$build_depends" ]; then
|
||||||
return 0
|
return 0
|
||||||
fi
|
else
|
||||||
|
|
||||||
return 1
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
#
|
||||||
|
# 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
|
fi
|
||||||
|
|
||||||
reset_tmpl_vars
|
reset_tmpl_vars
|
||||||
run_file $cur_tmpl
|
. $cur_tmpl
|
||||||
pkg="$curpkgn-$version"
|
pkg="$curpkgn-$version"
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1194,8 +1228,9 @@ install_pkg()
|
||||||
[ -z "$origin_tmpl" ] && origin_tmpl=$pkgname
|
[ -z "$origin_tmpl" ] && origin_tmpl=$pkgname
|
||||||
|
|
||||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
. $XBPS_HELPERSDIR/chroot.sh
|
||||||
chroot_pkg_handler install $curpkgn
|
chroot_pkg_handler install $curpkgn
|
||||||
|
build_binpkg $curpkgn
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1242,11 +1277,15 @@ install_pkg()
|
||||||
#
|
#
|
||||||
if [ "$build_style" = "meta-template" ]; then
|
if [ "$build_style" = "meta-template" ]; then
|
||||||
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
||||||
[ $? -eq 0 ] && \
|
if [ $? -eq 0 ]; then
|
||||||
msg_normal "Installed meta-template: $pkg." && \
|
msg_normal "Installed meta-template: $pkg."
|
||||||
return 0
|
return 0
|
||||||
|
else
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
|
[ -z "$in_chroot" ] && build_binpkg $curpkgn
|
||||||
|
|
||||||
#
|
#
|
||||||
# Do not stow package if it wasn't requested.
|
# Do not stow package if it wasn't requested.
|
||||||
|
@ -1267,11 +1306,7 @@ list_pkg_files()
|
||||||
ver=$($XBPS_PKGDB_CMD version $pkg)
|
ver=$($XBPS_PKGDB_CMD version $pkg)
|
||||||
[ -z "$ver" ] && msg_error "$pkg is not installed."
|
[ -z "$ver" ] && msg_error "$pkg is not installed."
|
||||||
|
|
||||||
if [ ! -d "$XBPS_DESTDIR/$pkg-$ver" ]; then
|
cat $XBPS_PKGMETADIR/$pkg-$ver/flist
|
||||||
msg_error "cannot find $pkg in $XBPS_DESTDIR."
|
|
||||||
fi
|
|
||||||
|
|
||||||
cat $XBPS_DESTDIR/$pkg-$ver/xbps-metadata/flist
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#
|
#
|
||||||
|
@ -1288,15 +1323,14 @@ remove_pkg()
|
||||||
msg_error "cannot find template build file."
|
msg_error "cannot find template build file."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
. $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||||
|
|
||||||
#
|
#
|
||||||
# If it's a meta-template, just unregister it from the db.
|
# If it's a meta-template, just unregister it from the db.
|
||||||
#
|
#
|
||||||
if [ "$build_style" = "meta-template" ]; then
|
if [ "$build_style" = "meta-template" ]; then
|
||||||
$XBPS_PKGDB_CMD unregister $pkgname $version
|
$XBPS_PKGDB_CMD unregister $pkgname $version
|
||||||
[ $? -eq 0 ] && \
|
[ $? -eq 0 ] && msg_normal "Removed meta-template: $pkg."
|
||||||
echo "=> Removed meta-template: $pkg."
|
|
||||||
return $?
|
return $?
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
@ -1325,7 +1359,7 @@ stow_pkg()
|
||||||
if [ -n "$stow_flag" ]; then
|
if [ -n "$stow_flag" ]; then
|
||||||
pkg=$XBPS_TEMPLATESDIR/$pkg.tmpl
|
pkg=$XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||||
if [ "$pkgname" != "$pkg" ]; then
|
if [ "$pkgname" != "$pkg" ]; then
|
||||||
run_file $pkg
|
. $pkg
|
||||||
fi
|
fi
|
||||||
pkg=$pkgname-$version
|
pkg=$pkgname-$version
|
||||||
#
|
#
|
||||||
|
@ -1334,14 +1368,21 @@ stow_pkg()
|
||||||
[ "$build_style" = "meta-template" ] && return 0
|
[ "$build_style" = "meta-template" ] && return 0
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy files into masterdir.
|
|
||||||
cd $XBPS_DESTDIR/$pkgname-$version || exit 1
|
cd $XBPS_DESTDIR/$pkgname-$version || exit 1
|
||||||
cp -ar . $XBPS_MASTERDIR
|
|
||||||
|
|
||||||
# Build a binary package.
|
# Copy metadata files.
|
||||||
env XBPS_DESTDIR=$XBPS_DESTDIR \
|
if [ -f xbps-metadata/flist -a -f xbps-metadata/props.plist ]; then
|
||||||
XBPS_DISTRIBUTIONDIR=$XBPS_DISTRIBUTIONDIR \
|
local metadir=$XBPS_PKGMETADIR/$pkgname-$version
|
||||||
$XBPS_DISTRIBUTIONDIR/binpkg/create.sh $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
|
||||||
|
|
||||||
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
$XBPS_PKGDB_CMD register $pkgname $version "$short_desc"
|
||||||
[ $? -ne 0 ] && exit 1
|
[ $? -ne 0 ] && exit 1
|
||||||
|
@ -1350,7 +1391,7 @@ stow_pkg()
|
||||||
# Run template postinstall helpers if requested.
|
# Run template postinstall helpers if requested.
|
||||||
#
|
#
|
||||||
if [ "$pkgname" != "${pkg%%-$version}" ]; then
|
if [ "$pkgname" != "${pkg%%-$version}" ]; then
|
||||||
run_file $XBPS_TEMPLATESDIR/${pkg%%-$version}.tmpl
|
. $XBPS_TEMPLATESDIR/${pkg%%-$version}.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for i in ${postinstall_helpers}; do
|
for i in ${postinstall_helpers}; do
|
||||||
|
@ -1371,7 +1412,7 @@ unstow_pkg()
|
||||||
[ -z $pkg ] && msg_error "template wasn't specified?"
|
[ -z $pkg ] && msg_error "template wasn't specified?"
|
||||||
|
|
||||||
if [ "$pkgname" != "$pkg" ]; then
|
if [ "$pkgname" != "$pkg" ]; then
|
||||||
run_file $XBPS_TEMPLATESDIR/$pkg.tmpl
|
. $XBPS_TEMPLATESDIR/$pkg.tmpl
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ver=$($XBPS_PKGDB_CMD version $pkg)
|
ver=$($XBPS_PKGDB_CMD version $pkg)
|
||||||
|
@ -1384,13 +1425,14 @@ unstow_pkg()
|
||||||
#
|
#
|
||||||
[ "$build_style" = "meta-template" ] && return 0
|
[ "$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
|
if [ ! -f flist ]; then
|
||||||
msg_error "$pkg is incomplete, missing flist."
|
msg_error "$pkg is incomplete, missing flist."
|
||||||
elif [ ! -O flist ]; then
|
elif [ ! -O flist ]; then
|
||||||
msg_error "$pkg cannot be removed (permission denied)."
|
msg_error "$pkg cannot be removed (permission denied)."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Remove installed files.
|
||||||
for f in $(cat flist); do
|
for f in $(cat flist); do
|
||||||
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
if [ -f $XBPS_MASTERDIR/$f -o -h $XBPS_MASTERDIR/$f ]; then
|
||||||
rm $XBPS_MASTERDIR/$f >/dev/null 2>&1
|
rm $XBPS_MASTERDIR/$f >/dev/null 2>&1
|
||||||
|
@ -1409,6 +1451,9 @@ unstow_pkg()
|
||||||
fi
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
# Remove metadata dir.
|
||||||
|
rm -rf $XBPS_PKGMETADIR/$pkgname-$version
|
||||||
|
|
||||||
$XBPS_PKGDB_CMD unregister $pkgname $ver
|
$XBPS_PKGDB_CMD unregister $pkgname $ver
|
||||||
return $?
|
return $?
|
||||||
}
|
}
|
||||||
|
@ -1441,66 +1486,52 @@ set_defvars
|
||||||
|
|
||||||
# Main switch
|
# Main switch
|
||||||
case "$target" in
|
case "$target" in
|
||||||
build)
|
build|configure)
|
||||||
setup_tmpl $2
|
setup_tmpl $2
|
||||||
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
if [ -z "$base_chroot" -a -z "$in_chroot" ]; then
|
||||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
. $XBPS_HELPERSDIR/chroot.sh
|
||||||
|
if [ "$target" = "build" ]; then
|
||||||
chroot_pkg_handler build $2
|
chroot_pkg_handler build $2
|
||||||
|
else
|
||||||
|
chroot_pkg_handler configure $2
|
||||||
|
fi
|
||||||
else
|
else
|
||||||
fetch_distfiles $2
|
fetch_distfiles $2
|
||||||
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
if [ ! -f "$XBPS_EXTRACT_DONE" ]; then
|
||||||
extract_distfiles $2
|
extract_distfiles $2
|
||||||
fi
|
fi
|
||||||
|
if [ "$target" = "configure" ]; then
|
||||||
|
configure_src_phase $2
|
||||||
|
else
|
||||||
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then
|
||||||
configure_src_phase $2
|
configure_src_phase $2
|
||||||
fi
|
fi
|
||||||
build_src_phase $2
|
build_src_phase $2
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
build-chroot)
|
||||||
|
. $XBPS_HELPERSDIR/build-chroot-binpkgs.sh
|
||||||
|
build_chroot_binpkgs
|
||||||
;;
|
;;
|
||||||
chroot)
|
chroot)
|
||||||
run_file $XBPS_HELPERSDIR/chroot.sh
|
. $XBPS_HELPERSDIR/chroot.sh
|
||||||
chroot_pkg_handler chroot dummy
|
chroot_pkg_handler chroot dummy
|
||||||
;;
|
;;
|
||||||
configure)
|
extract|fetch|info)
|
||||||
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)
|
|
||||||
setup_tmpl $2
|
setup_tmpl $2
|
||||||
|
[ "$target" = "info" ] && info_tmpl $2 && return $?
|
||||||
fetch_distfiles $2
|
fetch_distfiles $2
|
||||||
|
[ "$target" = "fetch" ] && return $?
|
||||||
extract_distfiles $2
|
extract_distfiles $2
|
||||||
;;
|
;;
|
||||||
fetch)
|
install|install-destdir)
|
||||||
setup_tmpl $2
|
|
||||||
fetch_distfiles $2
|
|
||||||
;;
|
|
||||||
info)
|
|
||||||
setup_tmpl $2
|
|
||||||
info_tmpl $2
|
|
||||||
;;
|
|
||||||
install-destdir)
|
|
||||||
[ -z "$2" ] && msg_error "missing package name after target."
|
[ -z "$2" ] && msg_error "missing package name after target."
|
||||||
install_destdir_target=yes
|
[ "$target" = "install-destdir" ] && install_destdir_target=yes
|
||||||
install_pkg $2
|
install_pkg $2
|
||||||
;;
|
;;
|
||||||
install)
|
list|listfiles)
|
||||||
[ -z "$2" ] && msg_error "missing package name after target."
|
[ "$target" = "list" ] && $XBPS_PKGDB_CMD list && return $?
|
||||||
install_pkg $2
|
|
||||||
;;
|
|
||||||
list)
|
|
||||||
$XBPS_PKGDB_CMD list
|
|
||||||
;;
|
|
||||||
listfiles)
|
|
||||||
[ -z "$2" ] && msg_error "missing package after target."
|
|
||||||
list_pkg_files $2
|
list_pkg_files $2
|
||||||
;;
|
;;
|
||||||
remove)
|
remove)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue