xbps-src: new layout in masterdir to use a common directory from host.

XBPS_CACHEDIR has been replaced by XBPS_HOSTDIR in configuration file,
and this expects the following structure:

/host
  |_ /build (previously /pkg-builddir)
  |_ /binpkgs (previously /pkg-binpkgs)
  |_ /repocache (previously /cachedir)
  |_ /sources (previously /pkg-srcdistdir)

Thanks to str1ngs for the great idea!
This commit is contained in:
Juan RP 2011-07-08 02:07:38 +02:00
parent c335a73af5
commit b6c21b960b
5 changed files with 40 additions and 37 deletions

View File

@ -15,10 +15,23 @@ XBPS_DISTRIBUTIONDIR=@@XBPS_DISTRIBDIR@@
XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir
#
# Cache directory for downloaded binary packages; it's bind mounted
# to $XBPS_MASTERDIR/cachedir for chroot operations.
# Host directory to be bind mounted into the chroot (masterdir) containing
# directories for downloaded cached packages from xbps-bin(8), packages
# created by xbps-src, source distribution tarballs downloaded required
# to build packages from source, etc.
#
#XBPS_CACHEDIR=/path/to/cachedir/with/user/permissions/to/write
# Basically your directory must contain this structure:
#
# /yourdir
# |_ /build
# |_ /binpkgs
# |_ /repocache
# |_ /sources
#
# Those names are constants so you cannot change them, even they are
# case sensitive.
#
#XBPS_HOSTDIR=/path/to/your/host/directory
#
# Compilation flags for C and C++.
@ -60,7 +73,7 @@ XBPS_COMPRESS_LEVEL=9
#
# Install required build time dependencies from binary packages,
# Local repository associated with the masterdir at <masterdir>/pkg-binpkgs,
# Local repository associated with the masterdir at <masterdir>/host/binpkgs,
# and remote repositories specified in XBPS_REPO_LIST will be used
# to resolve build dependencies.
#

View File

@ -31,11 +31,12 @@ HANDLER="$1"
if [ -n "${MASTERDIR}" ]; then
export XBPS_MASTERDIR="${MASTERDIR}"
fi
if [ -n "${CACHEDIR}" ]; then
export XBPS_CACHEDIR="${CACHEDIR}"
if [ -n "${HOSTDIR}" ]; then
export XBPS_HOSTDIR="${HOSTDIR}"
fi
REQFS="sys proc dev xbps cachedir"
REQFS="sys proc dev xbps host"
mount_chroot_fs()
{
@ -53,13 +54,13 @@ mount_chroot_fs()
blah=${XBPS_DISTRIBUTIONDIR}
dowrite="-w"
;;
cachedir)
blah=${XBPS_CACHEDIR}
host)
blah=${XBPS_HOSTDIR}
dowrite="-w"
;;
*) blah=/${f};;
esac
if [ -z "$XBPS_CACHEDIR" -a "$f" = "cachedir" ]; then
if [ -z "$XBPS_HOSTDIR" -a "$f" = "host" ]; then
echo "unset, ignoring."
continue
fi
@ -105,15 +106,6 @@ umount_chroot_fs()
fi
unset fs
done
# Remove created dirs
for fs in xbps cachedir; do
if [ ! -f ${XBPS_MASTERDIR}/.${fs}_mount_bind_done ]; then
if [ -d ${XBPS_MASTERDIR}/${fs} ]; then
rmdir ${XBPS_MASTERDIR}/${fs} 2>/dev/null
fi
fi
done
}
if [ $# -ne 1 ]; then

View File

@ -25,7 +25,7 @@
_mount()
{
MASTERDIR="${XBPS_MASTERDIR}" CACHEDIR="${XBPS_CACHEDIR}" \
MASTERDIR="${XBPS_MASTERDIR}" HOSTDIR="${XBPS_HOSTDIR}" \
${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount
return $?
@ -33,7 +33,7 @@ _mount()
_umount()
{
MASTERDIR="${XBPS_MASTERDIR}" CACHEDIR="${XBPS_CACHEDIR}" \
MASTERDIR="${XBPS_MASTERDIR}" HOSTDIR="${XBPS_HOSTDIR}" \
${sudo_cmd} \
@@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper umount
return $?
@ -86,8 +86,8 @@ _EOF
if [ -n "$XBPS_COMPRESS_LEVEL" ]; then
echo "XBPS_COMPRESS_LEVEL=$XBPS_COMPRESS_LEVEL" >> $XBPSSRC_CF
fi
if [ -n "$XBPS_CACHEDIR" ]; then
echo "XBPS_CACHEDIR=/cachedir" >> $XBPSSRC_CF
if [ -n "$XBPS_HOSTDIR" ]; then
echo "XBPS_HOSTDIR=/host" >> $XBPSSRC_CF
fi
echo "# End of configuration file." >> $XBPSSRC_CF

View File

@ -1,5 +1,5 @@
#-
# Copyright (c) 2008-2010 Juan Romero Pardines.
# Copyright (c) 2008-2011 Juan Romero Pardines.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
@ -37,13 +37,13 @@ set_defvars()
: ${XBPS_PKGMETADIR:=$XBPS_DBDIR/metadata}
: ${XBPS_SRCPKGDIR:=$XBPS_DISTRIBUTIONDIR/srcpkgs}
if [ -n "$IN_CHROOT" ]; then
: ${XBPS_DESTDIR:=/pkg-destdir}
: ${XBPS_DESTDIR:=/host/destdir}
else
: ${XBPS_DESTDIR:=$XBPS_MASTERDIR/pkg-destdir}
: ${XBPS_DESTDIR:=$XBPS_MASTERDIR/host/destdir}
fi
: ${XBPS_PACKAGESDIR:=$XBPS_MASTERDIR/pkg-binpkgs}
: ${XBPS_BUILDDIR:=$XBPS_MASTERDIR/pkg-builddir}
: ${XBPS_SRCDISTDIR:=$XBPS_MASTERDIR/pkg-srcdistdir}
: ${XBPS_PACKAGESDIR:=$XBPS_MASTERDIR/host/binpkgs}
: ${XBPS_BUILDDIR:=$XBPS_MASTERDIR/host/build}
: ${XBPS_SRCDISTDIR:=$XBPS_MASTERDIR/host/sources}
: ${XBPS_TRIGGERSDIR:=$XBPS_SRCPKGDIR/xbps-triggers/files}
DDIRS="TRIGGERSDIR HELPERSDIR SRCPKGDIR COMMONVARSDIR SHUTILSDIR"
@ -65,9 +65,7 @@ set_defvars()
if [ -n "$xver" ]; then
# XBPS utils >= 0.9.0.
xbps_conf="-C $XBPS_MASTERDIR/usr/local/etc/xbps-conf.plist"
if [ -n "$XBPS_CACHEDIR" ]; then
xbps_conf="$xbps_conf -c $XBPS_CACHEDIR"
fi
xbps_conf="$xbps_conf -c $XBPS_MASTERDIR/host/repocache"
fi
export XBPS_PKGDB_CMD="xbps-uhelper.static -r $XBPS_MASTERDIR"
export XBPS_BIN_CMD="xbps-bin.static $xbps_conf -r $XBPS_MASTERDIR"

View File

@ -80,7 +80,7 @@ Targets:
extract [pkgname]
Extract package source distribution file(s) into the build directory.
By default set to <masterdir>/pkg-builddir.
By default set to <masterdir>/host/build.
fetch [pkgname]
Download package source distribution file(s).
@ -102,7 +102,7 @@ Targets:
make-repoidx
Build a package index for the local repository associated with
the master directory <masterdir>. By default set to
<masterdir>/pkg-binpkgs. To specify another repo, use -p <dir>.
<masterdir>/host/binpkgs. To specify another repo, use -p <dir>.
remove [pkgname]
Remove package completely from <destdir> and <masterdir>.
@ -131,19 +131,19 @@ Options:
-c Path to global configuration file:
if not specified @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf is used.
-D Only install <pkgname> to package's destination directory set
to <masterdir>/pkg-destdir/<pkgname>-<version>.
to <masterdir>/host/destdir/<pkgname>-<version>.
-h Usage output.
-K Do not remove automatic package dependencies while building
or installing a package with XBPS_PREFER_BINPKG_DEPS enabled.
-m Master directory, overwritting the value set in the configuration
file xbps-src.conf.
-p Local packages repository, overwritting default path at
<masterdir>/pkg-binpkgs.
<masterdir>/host/binpkgs.
-S Overrides and disables XBPS_PREFER_BINPKG_DEPS even if it was
set in the configuration file xbps-src.conf.
it was set in the configuration file.
-s Source distribution files directory, overwritting default path at
<masterdir>/pkg-srcdistdir.
<masterdir>/host/sources.
_EOF
}