From b6c21b960b73062dea0866bbf13342488e2e6c79 Mon Sep 17 00:00:00 2001 From: Juan RP Date: Fri, 8 Jul 2011 02:07:38 +0200 Subject: [PATCH] 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! --- xbps-src/etc/xbps-src.conf.in | 21 ++++++++++++++---- xbps-src/libexec/xbps-src-chroot-helper.sh.in | 22 ++++++------------- xbps-src/shutils/chroot.sh.in | 8 +++---- xbps-src/shutils/init_funcs.sh.in | 16 ++++++-------- xbps-src/xbps-src.sh.in | 10 ++++----- 5 files changed, 40 insertions(+), 37 deletions(-) diff --git a/xbps-src/etc/xbps-src.conf.in b/xbps-src/etc/xbps-src.conf.in index 81534e2158..15ed6fcdea 100644 --- a/xbps-src/etc/xbps-src.conf.in +++ b/xbps-src/etc/xbps-src.conf.in @@ -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 /pkg-binpkgs, +# Local repository associated with the masterdir at /host/binpkgs, # and remote repositories specified in XBPS_REPO_LIST will be used # to resolve build dependencies. # diff --git a/xbps-src/libexec/xbps-src-chroot-helper.sh.in b/xbps-src/libexec/xbps-src-chroot-helper.sh.in index 6e3c099e6c..304a8454fd 100644 --- a/xbps-src/libexec/xbps-src-chroot-helper.sh.in +++ b/xbps-src/libexec/xbps-src-chroot-helper.sh.in @@ -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 diff --git a/xbps-src/shutils/chroot.sh.in b/xbps-src/shutils/chroot.sh.in index b31444ab41..7c9e63a907 100644 --- a/xbps-src/shutils/chroot.sh.in +++ b/xbps-src/shutils/chroot.sh.in @@ -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 diff --git a/xbps-src/shutils/init_funcs.sh.in b/xbps-src/shutils/init_funcs.sh.in index 7844addc33..274ee6d1f9 100644 --- a/xbps-src/shutils/init_funcs.sh.in +++ b/xbps-src/shutils/init_funcs.sh.in @@ -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" diff --git a/xbps-src/xbps-src.sh.in b/xbps-src/xbps-src.sh.in index 346597faf2..cec552063e 100644 --- a/xbps-src/xbps-src.sh.in +++ b/xbps-src/xbps-src.sh.in @@ -80,7 +80,7 @@ Targets: extract [pkgname] Extract package source distribution file(s) into the build directory. - By default set to /pkg-builddir. + By default set to /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 . By default set to - /pkg-binpkgs. To specify another repo, use -p . + /host/binpkgs. To specify another repo, use -p . remove [pkgname] Remove package completely from and . @@ -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 to package's destination directory set - to /pkg-destdir/-. + to /host/destdir/-. -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 - /pkg-binpkgs. + /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 - /pkg-srcdistdir. + /host/sources. _EOF }