Infrastructure changes to simplify the conf file.

* Removed the following vars from the conf file: XBPS_BUILDDIR,
  XBPS_PACKAGESDIR and XBPS_SRCDISTDIR. They are always relative
  to XBPS_MASTERDIR and cannot be changed.
* Removed XBPS_INSTALLDIR, it was unused in the code.
* Prepend /tools/bin in PATH for the chroot.
* Don't register a repo in the chroot if the XBPS_PREFER_BINPKG_DEPS
  is not set.

--HG--
extra : convert_revision : 4df03ffa64f0bbf81cd1dd0baf38f1b7e4f47549
This commit is contained in:
Juan RP 2010-04-26 02:51:48 +02:00
parent 7c38045a0f
commit 6673252679
6 changed files with 32 additions and 59 deletions

View File

@ -4,12 +4,9 @@ CONF_FILE = xbps-src.conf
.PHONY: all .PHONY: all
all: all:
sed -e "s|@@XBPS_INSTALL_PREFIX@@|$(PREFIX)|g" \
$(CONF_FILE).in > $(CONF_FILE)
.PHONY: clean .PHONY: clean
clean: clean:
-rm -f $(CONF_FILE)
.PHONY: install .PHONY: install
install: install:

View File

@ -2,12 +2,6 @@
# Configuration file for xbps-src. # Configuration file for xbps-src.
# #
#
# Directory where xbps-src has been installed. By default /usr/local.
# Usually you don't have to change this one, it's set by "make install".
#
XBPS_INSTALLDIR=@@XBPS_INSTALL_PREFIX@@
# #
# Directory where the xbps-src GIT repository is stored. This is # Directory where the xbps-src GIT repository is stored. This is
# required to be mounted in the chroot. # required to be mounted in the chroot.
@ -19,23 +13,6 @@ XBPS_DISTRIBUTIONDIR=$HOME/xbps-templates
# #
XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir XBPS_MASTERDIR=$XBPS_DISTRIBUTIONDIR/masterdir
#
# Directory where a local binary package repository is available
# (or will be created from). Packages will be stored here.
#
XBPS_PACKAGESDIR=$XBPS_DISTRIBUTIONDIR/packages
#
# Directory where source files will be extracted to and build object
# files will live on.
#
XBPS_BUILDDIR=$XBPS_DISTRIBUTIONDIR/builddir
#
# Directory where source distribution files are stored.
#
XBPS_SRCDISTDIR=$XBPS_DISTRIBUTIONDIR/srcdistdir
# #
# Compilation flags for cc and c++. # Compilation flags for cc and c++.
# #

View File

@ -31,8 +31,7 @@ HANDLER="$1"
. @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf . @@XBPS_INSTALL_ETCDIR@@/xbps-src.conf
EXTDIRS="xbps xbps_builddir xbps_packagesdir xbps_srcdistdir" REQFS="sys proc dev xbps"
REQFS="sys proc dev ${EXTDIRS}"
mount_chroot_fs() mount_chroot_fs()
{ {
@ -46,9 +45,6 @@ mount_chroot_fs()
fi fi
case ${f} in case ${f} in
xbps) blah=${XBPS_DISTRIBUTIONDIR};; xbps) blah=${XBPS_DISTRIBUTIONDIR};;
xbps_builddir) blah=${XBPS_BUILDDIR};;
xbps_srcdistdir) blah=${XBPS_SRCDISTDIR};;
xbps_packagesdir) blah=${XBPS_PACKAGESDIR};;
*) blah=/${f};; *) blah=/${f};;
esac esac
[ ! -d ${blah} ] && echo "failed." && continue [ ! -d ${blah} ] && echo "failed." && continue
@ -91,10 +87,8 @@ umount_chroot_fs()
done done
# Remove created dirs # Remove created dirs
for dir in ${EXTDIRS}; do [ -f ${XBPS_MASTERDIR}/.xbps_mount_bind_done ] && continue
[ -f ${XBPS_MASTERDIR}/.${dir}_mount_bind_done ] && continue [ -d ${XBPS_MASTERDIR}/xbps ] && rmdir ${XBPS_MASTERDIR}/xbps
[ -d ${XBPS_MASTERDIR}/${dir} ] && rmdir ${XBPS_MASTERDIR}/${dir}
done
} }
if [ $# -ne 1 ]; then if [ $# -ne 1 ]; then

View File

@ -60,9 +60,6 @@ XBPSSRC_CF=$XBPS_MASTERDIR/usr/local/etc/xbps-src.conf
echo "XBPS_DISTRIBUTIONDIR=/xbps" > $XBPSSRC_CF echo "XBPS_DISTRIBUTIONDIR=/xbps" > $XBPSSRC_CF
echo "XBPS_MASTERDIR=/" >> $XBPSSRC_CF echo "XBPS_MASTERDIR=/" >> $XBPSSRC_CF
echo "XBPS_PACKAGESDIR=/xbps_packagesdir" >> $XBPSSRC_CF
echo "XBPS_BUILDDIR=/xbps_builddir" >> $XBPSSRC_CF
echo "XBPS_SRCDISTDIR=/xbps_srcdistdir" >> $XBPSSRC_CF
echo "XBPS_CFLAGS=\"$XBPS_CFLAGS\"" >> $XBPSSRC_CF echo "XBPS_CFLAGS=\"$XBPS_CFLAGS\"" >> $XBPSSRC_CF
echo "XBPS_CXXFLAGS=\"\$XBPS_CFLAGS\"" >> $XBPSSRC_CF echo "XBPS_CXXFLAGS=\"\$XBPS_CFLAGS\"" >> $XBPSSRC_CF
echo "XBPS_FETCH_CMD='xbps-uhelper.static fetch'" >> $XBPSSRC_CF echo "XBPS_FETCH_CMD='xbps-uhelper.static fetch'" >> $XBPSSRC_CF
@ -141,12 +138,18 @@ ff02::2 ip6-allrouters
ff02::3 ip6-allhosts ff02::3 ip6-allhosts
_EOF _EOF
# Create /bin/sh symlink to bash create_binsh_symlink
cd $XBPS_MASTERDIR/bin && ln -sf bash sh
touch $XBPS_MASTERDIR/.xbps_perms_done touch $XBPS_MASTERDIR/.xbps_perms_done
} }
create_binsh_symlink()
{
if [ ! -h $XBPS_MASTERDIR/bin/sh ]; then
cd $XBPS_MASTERDIR/bin && ln -sf bash sh
fi
}
prepare_binpkg_repos() prepare_binpkg_repos()
{ {
if [ ! -f "$XBPS_MASTERDIR/.xbps_added_local_repo" ]; then if [ ! -f "$XBPS_MASTERDIR/.xbps_added_local_repo" ]; then
@ -206,7 +209,7 @@ xbps_chroot_handler()
local pkg="$2" local pkg="$2"
local only_destdir="$3" local only_destdir="$3"
local norm_builddir="$4" local norm_builddir="$4"
local path="/usr/local/sbin:/bin::/sbin:/usr/bin:/usr/sbin:/usr/local/bin" local path="/tools/bin:/usr/local/sbin:/usr/local/bin:/bin:/sbin:/usr/bin:/usr/sbin"
[ -z "$action" -o -z "$pkg" ] && return 1 [ -z "$action" -o -z "$pkg" ] && return 1
[ "$action" != "configure" -a "$action" != "build" -a \ [ "$action" != "configure" -a "$action" != "build" -a \
@ -218,11 +221,14 @@ xbps_chroot_handler()
echo "done." echo "done."
fi fi
create_binsh_symlink
create_busybox_links create_busybox_links
install_xbps_utils install_xbps_utils
${sudo_cmd} @@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount ${sudo_cmd} @@XBPS_INSTALL_LIBEXECDIR@@/xbps-src-chroot-helper mount
[ $? -ne 0 ] && return $? [ $? -ne 0 ] && return $?
prepare_binpkg_repos if [ -n "$XBPS_PREFER_BINPKG_DEPS" ]; then
prepare_binpkg_repos
fi
# Reinstall xbps-src in the chroot # Reinstall xbps-src in the chroot
if [ ! -f $XBPS_MASTERDIR/usr/local/sbin/xbps-src ]; then if [ ! -f $XBPS_MASTERDIR/usr/local/sbin/xbps-src ]; then

View File

@ -37,11 +37,15 @@ set_defvars()
: ${XBPS_META_PATH:=$XBPS_DBDIR/} : ${XBPS_META_PATH:=$XBPS_DBDIR/}
: ${XBPS_PKGMETADIR:=$XBPS_DBDIR/metadata} : ${XBPS_PKGMETADIR:=$XBPS_DBDIR/metadata}
: ${XBPS_SRCPKGDIR:=$XBPS_DISTRIBUTIONDIR/srcpkgs} : ${XBPS_SRCPKGDIR:=$XBPS_DISTRIBUTIONDIR/srcpkgs}
if [ -n "$in_chroot" ]; then : ${XBPS_DESTDIR:=$XBPS_MASTERDIR/pkg-destdir}
: ${XBPS_DESTDIR:=/pkg-destdir} : ${XBPS_PACKAGESDIR:=$XBPS_MASTERDIR/pkg-binpkgs}
else : ${XBPS_BUILDDIR:=$XBPS_MASTERDIR/pkg-builddir}
: ${XBPS_DESTDIR:=$XBPS_MASTERDIR/pkg-destdir} : ${XBPS_SRCDISTDIR:=$XBPS_MASTERDIR/pkg-srcdistdir}
fi
for i in DESTDIR PACKAGESDIR BUILDDIR SRCDISTDIR; do
eval val="\$XBPS_$i"
[ ! -d "$val" ] && mkdir -p $val
done
DDIRS="XBPS_TRIGGERSDIR XBPS_HELPERSDIR" DDIRS="XBPS_TRIGGERSDIR XBPS_HELPERSDIR"
DDIRS="$DDIRS XBPS_COMMONVARSDIR XBPS_SHUTILSDIR" DDIRS="$DDIRS XBPS_COMMONVARSDIR XBPS_SHUTILSDIR"

View File

@ -99,7 +99,7 @@ run_file()
check_config_vars() check_config_vars()
{ {
local cffound f local val cffound f
if [ -z "$config_file_specified" ]; then if [ -z "$config_file_specified" ]; then
config_file_paths="$XBPS_CONFIG_FILE ./etc/xbps-src.conf" config_file_paths="$XBPS_CONFIG_FILE ./etc/xbps-src.conf"
@ -117,17 +117,12 @@ check_config_vars()
msg_error "cannot find configuration file: $XBPS_CONFIG_FILE" msg_error "cannot find configuration file: $XBPS_CONFIG_FILE"
fi fi
local XBPS_VARS="XBPS_MASTERDIR XBPS_BUILDDIR XBPS_SRCDISTDIR \ eval val="\$XBPS_MASTERDIR"
XBPS_PACKAGESDIR" [ -z "$val" ] && msg_error "'XBPS_MASTERDIR' not set in configuration file"
for f in ${XBPS_VARS}; do if [ ! -d "$val" ]; then
eval val="\$$f" mkdir "$val"
[ -z "$val" ] && msg_error "'$f' not set in configuration file" [ $? -ne 0 ] && msg_error "couldn't create 'XBPS_MASTERDIR' directory"
fi
if [ ! -d "$val" ]; then
mkdir "$val"
[ $? -ne 0 ] && msg_error "couldn't create '$f' directory"
fi
done
export PATH="@@XBPS_INSTALL_PREFIX@@/sbin:$PATH" export PATH="@@XBPS_INSTALL_PREFIX@@/sbin:$PATH"
} }