diff --git a/helper-templates/chroot.sh b/helper-templates/chroot.sh index e46c44e920..a434ed5110 100644 --- a/helper-templates/chroot.sh +++ b/helper-templates/chroot.sh @@ -18,13 +18,14 @@ if [ "$(id -u)" -ne 0 ]; then fi if [ ! -f $XBPS_MASTERDIR/.xbps_perms_done ]; then - echo "==> 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 $XBPS_MASTERDIR/etc touch $XBPS_MASTERDIR/.xbps_perms_done + echo "done." else - echo "==> Entering into the chroot on $XBPS_MASTERDIR..." + echo "==> Entering into the chroot on $XBPS_MASTERDIR." fi for f in bin sbin tmp var sys proc dev xbps xbps_builddir xbps_destdir; do @@ -72,6 +73,30 @@ rebuild_ldso_cache() echo " done." } +configure_chroot_pkg() +{ + local pkg="$1" + + [ -z "$pkg" ] && return 1 + + rebuild_ldso_cache + env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh configure $pkg + echo "==> Exiting from the chroot on $XBPS_MASTERDIR." + umount_chroot_fs +} + +build_chroot_pkg() +{ + local pkg="$1" + + [ -z "$pkg" ] && return 1 + + rebuild_ldso_cache + env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh build $pkg + echo "==> Exiting from the chroot on $XBPS_MASTERDIR." + umount_chroot_fs +} + install_chroot_pkg() { local pkg="$1" @@ -79,17 +104,17 @@ install_chroot_pkg() [ -z "$pkg" ] && return 1 rebuild_ldso_cache - chroot $XBPS_MASTERDIR /xbps/xbps.sh install $pkg + env in_chroot=yes chroot $XBPS_MASTERDIR /xbps/xbps.sh install $pkg + echo "==> Exiting from the chroot on $XBPS_MASTERDIR." umount_chroot_fs - echo "==> Exiting from the chroot on $XBPS_MASTERDIR..." } enter_chroot() { rebuild_ldso_cache - chroot $XBPS_MASTERDIR /bin/bash + env in_chroot=yes chroot $XBPS_MASTERDIR /bin/bash + echo "==> Exiting from the chroot on $XBPS_MASTERDIR." umount_chroot_fs - echo "==> Exiting from the chroot on $XBPS_MASTERDIR..." } umount_chroot_fs() diff --git a/templates/binutils.tmpl b/templates/binutils.tmpl index 35b1d668fa..3cf50734f5 100644 --- a/templates/binutils.tmpl +++ b/templates/binutils.tmpl @@ -21,3 +21,5 @@ long_desc=" strings for outputing the printable characters in files, strip for stripping out symbols (like debugging information) from object files, and other tools." + +base_chroot=yes diff --git a/templates/bison.tmpl b/templates/bison.tmpl index 2e24f6512c..963d9923e1 100644 --- a/templates/bison.tmpl +++ b/templates/bison.tmpl @@ -11,5 +11,6 @@ long_desc=" Bison is the GNU replacement for yacc(1). Some programs depend on extensions present in Bison." +base_chroot=yes build_depends="m4-1.4.12" run_depends="m4-1.4.12 glibc-2.8" diff --git a/templates/bzip2.tmpl b/templates/bzip2.tmpl index 97de8ea347..d04a016ca0 100644 --- a/templates/bzip2.tmpl +++ b/templates/bzip2.tmpl @@ -9,3 +9,5 @@ short_desc="The bzip2 compression library" maintainer="Juan RP " checksum=f7bf5368309d76e5daf3a89d4d1bea688dac7780742e7a0ae1af19be9316fe22 long_desc= + +base_chroot=yes diff --git a/templates/coreutils.tmpl b/templates/coreutils.tmpl index 473cafe667..f95b323ea4 100644 --- a/templates/coreutils.tmpl +++ b/templates/coreutils.tmpl @@ -12,4 +12,5 @@ long_desc=" utilities of the GNU operating system. These are the core utilities which are expected to exist on every operating system." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/diffutils.tmpl b/templates/diffutils.tmpl index 05e77f24d7..6e9a668f3f 100644 --- a/templates/diffutils.tmpl +++ b/templates/diffutils.tmpl @@ -11,5 +11,6 @@ long_desc=" features are a superset of the Unix features and they are significantly faster. Cmp has been moved into this package from the GNU textutils package. These programs are usually used for creating patch files." - + +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/file.tmpl b/templates/file.tmpl index a85488bf2b..f24e9aa990 100644 --- a/templates/file.tmpl +++ b/templates/file.tmpl @@ -11,5 +11,6 @@ long_desc=" File attempts to classify files depending on their contents and prints a description if a match is found." +base_chroot=yes build_depends="zlib-1.2.3" run_depends="glibc-2.8 zlib-1.2.3" diff --git a/templates/findutils.tmpl b/templates/findutils.tmpl index e2172ebc5d..18f32f5fd2 100644 --- a/templates/findutils.tmpl +++ b/templates/findutils.tmpl @@ -12,4 +12,5 @@ long_desc=" other programs to provide modular and powerful directory search and file locating capabilities to other commands." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/gawk.tmpl b/templates/gawk.tmpl index daad5a1925..af6d0c9869 100644 --- a/templates/gawk.tmpl +++ b/templates/gawk.tmpl @@ -8,5 +8,6 @@ maintainer="Juan RP " checksum=06dd872da7145088ae08475f7b11e5b9e810b8ead7d78d039003e671bb76ec65 long_desc=" The GNU AWK utility, a pattern scanning and processing tool." - + +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/gcc.tmpl b/templates/gcc.tmpl index a43d0c44ec..4c80a9d1de 100644 --- a/templates/gcc.tmpl +++ b/templates/gcc.tmpl @@ -17,7 +17,9 @@ checksum=bfbf487731ad5dca37efe480a837417de071bd67e685d5c1df6a290707575165 long_desc=" The GNU C Compiler suite, with support for C, C++, Fortran, ObjC." +base_chroot=yes build_depends="mpfr-2.3.2 binutils-2.18" +run_depends="glibc-2.8" # As specified in the LFS book, disable installing libiberty. pre_configure() diff --git a/templates/gmp.tmpl b/templates/gmp.tmpl index 6eab886c3a..8322fbddb5 100644 --- a/templates/gmp.tmpl +++ b/templates/gmp.tmpl @@ -21,4 +21,5 @@ long_desc=" The advantage for GNU MP increases with the operand sizes for certain operations, since GNU MP in many cases has asymptotically faster algorithms." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/grep.tmpl b/templates/grep.tmpl index e8e8abfd1a..2ad46ec29f 100644 --- a/templates/grep.tmpl +++ b/templates/grep.tmpl @@ -15,5 +15,6 @@ long_desc=" full regexp matcher without necessarily having to look at every character. The result is typically many times faster than Unix grep or egrep." +base_chroot=yes build_depends="texinfo-4.13a" run_depends="glibc-2.8" diff --git a/templates/gzip.tmpl b/templates/gzip.tmpl index 1374c2846b..050949104d 100644 --- a/templates/gzip.tmpl +++ b/templates/gzip.tmpl @@ -12,4 +12,5 @@ long_desc=" and freedom from patented algorithms. The GNU Project uses it as the standard compression program for its system." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/linux-headers.tmpl b/templates/linux-headers.tmpl index 027722a7b8..12e6a21240 100644 --- a/templates/linux-headers.tmpl +++ b/templates/linux-headers.tmpl @@ -12,3 +12,5 @@ maintainer="Juan RP " checksum=52d9526ea8df33c9fab3df4564b0147b1866c76b0fd31474b92592567384a02c long_desc=" This package provides the linux kernel headers for use in userspace." + +base_chroot=yes diff --git a/templates/m4.tmpl b/templates/m4.tmpl index 5b0d1cad09..3ea384a97d 100644 --- a/templates/m4.tmpl +++ b/templates/m4.tmpl @@ -15,4 +15,5 @@ long_desc=" shell commands, doing arithmetic, etc. Autoconf needs GNU m4 for generating configure scripts, but not for running them." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/make.tmpl b/templates/make.tmpl index 39fe497f4a..848fa6a975 100644 --- a/templates/make.tmpl +++ b/templates/make.tmpl @@ -11,4 +11,5 @@ long_desc=" program need to be recompiled and issues the commands to recompile them, when necessary." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/mpfr.tmpl b/templates/mpfr.tmpl index 57c9d174ad..09162b324f 100644 --- a/templates/mpfr.tmpl +++ b/templates/mpfr.tmpl @@ -14,5 +14,6 @@ long_desc=" see more on the credit page. MPFR is based on the GMP multiple-precision library." +base_chroot=yes build_depends="gmp-4.2.4" run_depends="glibc-2.8 gmp-4.2.4" diff --git a/templates/ncurses.tmpl b/templates/ncurses.tmpl index ca746fe41c..a2d136eefd 100644 --- a/templates/ncurses.tmpl +++ b/templates/ncurses.tmpl @@ -17,4 +17,5 @@ long_desc=" ecompiler infocmp, clear, tput, tset, and a termcap conversion tool captoinfo. Full manual pages are provided for the library and tools." +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/patch.tmpl b/templates/patch.tmpl index af1f98a98a..a94e816960 100644 --- a/templates/patch.tmpl +++ b/templates/patch.tmpl @@ -12,5 +12,6 @@ long_desc=" more original files, producing patched versions. This is the GPL version from the Free Software Foundation." - + +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/proplib.tmpl b/templates/proplib.tmpl index baca2c7266..03609f24f2 100644 --- a/templates/proplib.tmpl +++ b/templates/proplib.tmpl @@ -21,3 +21,6 @@ long_desc=" This proplib version is the same version than is available on NetBSD, but with the exception that NetBSD specific code has been removed and it has been converted to be built through the GNU autotools." + +base_chroot=yes +run_depends="glibc-2.8" diff --git a/templates/sed.tmpl b/templates/sed.tmpl index ca458fcd94..be3976feb2 100644 --- a/templates/sed.tmpl +++ b/templates/sed.tmpl @@ -10,5 +10,6 @@ checksum=be955bef7a81d69222e929689e0de0ecf64c13dc5b15b2ee5696d5ef66fdeec0 long_desc=" Sed, the GNU Stream Editor, copies the named files (standard input default) to the standard output, edited according to a script of commands." - + +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/texinfo.tmpl b/templates/texinfo.tmpl index 2122e541e3..4eff7266a0 100644 --- a/templates/texinfo.tmpl +++ b/templates/texinfo.tmpl @@ -12,5 +12,6 @@ long_desc=" invented by Richard Stallman and Bob Chassell many years ago, loosely based on Brian Reid's Scribe and other formatting languages of the time. It is used by many non-GNU projects as well." - + +base_chroot=yes run_depends="glibc-2.8" diff --git a/templates/zlib.tmpl b/templates/zlib.tmpl index 954bcdae6d..af91fb1d70 100644 --- a/templates/zlib.tmpl +++ b/templates/zlib.tmpl @@ -13,4 +13,5 @@ long_desc=" is thread safe. The data format used by the library is described by RFCs (Request for Comments) 1950 to 1952." +base_chroot=yes run_depends="glibc-2.8" diff --git a/xbps-pkgdb/xbps-pkgdb.c b/xbps-pkgdb/xbps-pkgdb.c index d04379ce91..98c6391972 100644 --- a/xbps-pkgdb/xbps-pkgdb.c +++ b/xbps-pkgdb/xbps-pkgdb.c @@ -53,7 +53,8 @@ main(int argc, char **argv) prop_object_iterator_t dbditer; prop_object_t obj, obj2; prop_string_t pkg; - char dbfile[PATH_MAX], *dbfileenv, *tmppath; + char dbfile[PATH_MAX], *dbfileenv, *tmppath, *in_chroot_env; + bool in_chroot = false; if (argc < 2) usage(); @@ -73,6 +74,10 @@ main(int argc, char **argv) /* nul terminate string */ dbfile[sizeof(dbfile) - 1] = '\0'; + in_chroot_env = getenv("in_chroot"); + if (in_chroot_env != NULL) + in_chroot = true; + if (strcmp(argv[1], "installed") == 0) { /* Returns 0 if pkg is installed, 1 otherwise */ if (argc != 3) @@ -121,7 +126,9 @@ main(int argc, char **argv) exit(1); } } - printf("==> %s-%s registered successfully.\n", argv[2], argv[3]); + + printf("%s==> %s-%s registered successfully.\n", + in_chroot ? "[chroot] " : "", argv[2], argv[3]); } else if (strcmp(argv[1], "unregister") == 0) { /* Unregisters a package from the database */ @@ -145,7 +152,8 @@ main(int argc, char **argv) exit(1); } - printf("==> %s-%s unregistered successfully.\n", argv[2], argv[3]); + printf("%s==> %s-%s unregistered successfully.\n", + in_chroot ? "[chroot] " : "", argv[2], argv[3]); } else if (strcmp(argv[1], "list") == 0) { /* Lists packages currently registered in database */ diff --git a/xbps.sh b/xbps.sh index b98516d2cf..c498a78df6 100755 --- a/xbps.sh +++ b/xbps.sh @@ -128,10 +128,43 @@ run_func() [ -z "$func" ] && return 1 - type $func | grep -q 'shell function' + type -t $func | grep -q 'shell function' [ $? -eq 0 ] && $func } +msg_error() +{ + [ -z "$1" ] && return 1 + + if [ -n "$in_chroot" ]; then + echo "[chroot] *** ERROR: $1 ***" + else + echo "*** ERROR: $1 ***" + fi +} + +msg_warn() +{ + [ -z "$1" ] && return 1 + + if [ -n "$in_chroot" ]; then + echo "[chroot] *** WARNING: $1 ***" + else + echo "*** WARNING: $1 ***" + fi +} + +msg_normal() +{ + [ -z "$1" ] && return 1 + + if [ -n "$in_chroot" ]; then + echo "[chroot] ==> $1" + else + echo "==> $1" + fi +} + # # Shows info about a template. # @@ -176,8 +209,7 @@ check_config_vars() cffound=yes && break done if [ -z "$cffound" ]; then - echo -n "*** ERROR: config file not specified " - echo "and not in default location or current dir ***" + msg_error "cannot find a config file" exit 1 fi fi @@ -186,8 +218,7 @@ check_config_vars() XBPS_CONFIG_FILE=$path_fixed if [ ! -f "$XBPS_CONFIG_FILE" ]; then - echo -n "*** ERROR: cannot find configuration file: " - echo "'$XBPS_CONFIG_FILE' ***" + msg_error "cannot find configuration file: $XBPS_CONFIG_FILE" exit 1 fi @@ -197,16 +228,14 @@ check_config_vars() for f in ${XBPS_VARS}; do eval val="\$$f" if [ -z "$val" ]; then - echo -n "**** ERROR: '$f' not set in configuration " - echo "file, aborting ***" + msg_error "'$f' not set in configuration file" exit 1 fi if [ ! -d "$val" ]; then mkdir "$val" if [ "$?" -ne 0 ]; then - echo -n "*** ERROR: couldn't create '$f'" - echo " directory, aborting ***" + msg_error "couldn't create '$f' directory" exit 1 fi fi @@ -251,7 +280,7 @@ setup_tmpl() fi prepare_tmpl else - echo "*** ERROR: cannot find $pkg template file ***" + msg_error "cannot find $pkg template file" exit 1 fi } @@ -274,8 +303,7 @@ prepare_tmpl() for i in ${REQ_VARS}; do eval val="\$$i" if [ -z "$val" -o -z "$i" ]; then - echo -n "*** ERROR: \"$i\" not set on $pkgname " - echo "template ***" + msg_error "\"$i\" not set on $pkgname template" exit 1 fi done @@ -292,8 +320,10 @@ prepare_tmpl() XBPS_BUILD_DONE="$wrksrc/.xbps_build_done" XBPS_INSTALL_DONE="$wrksrc/.xbps_install_done" - export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin" - export PATH="$PATH:$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin" + if [ -z "$in_chroot" ]; then + export PATH="$XBPS_MASTERDIR/bin:$XBPS_MASTERDIR/sbin" + export PATH="$PATH:$XBPS_MASTERDIR/usr/bin:$XBPS_MASTERDIR/usr/sbin" + fi export PATH="$PATH:/bin:/sbin:/usr/bin:/usr/sbin" } @@ -327,14 +357,13 @@ extract_distfiles() if [ $count -gt 1 ]; then if [ -z "$wrksrc" ]; then - echo -n "*** ERROR: \$wrksrc must be defined with " - echo "multiple distfiles ***" + msg_error "\$wrksrc must be defined with multiple distfiles" exit 1 fi mkdir $wrksrc fi - echo "==> Extracting '$pkgname-$version' distfiles." + msg_normal "Extracting '$pkgname-$version' distfile(s)." if [ -n "$tar_override_cmd" ]; then ltar_cmd="$tar_override_cmd" @@ -357,24 +386,21 @@ extract_distfiles() .tar.bz2|.tbz) $ltar_cmd xfj $XBPS_SRCDISTDIR/$curfile -C $lwrksrc if [ $? -ne 0 ]; then - echo -n "*** ERROR extracting $curfile into " - echo "$lwrksrc ***" + msg_error "extracting $curfile into $lwrksrc" exit 1 fi ;; .tar.gz|.tgz) $ltar_cmd xfz $XBPS_SRCDISTDIR/$curfile -C $lwrksrc if [ $? -ne 0 ]; then - echo -n "*** ERROR extracting $curfile into " - echo "$lwrksrc ***" + msg_error "extracting $curfile into $lwrksrc" exit 1 fi ;; .tar) $ltar_cmd xf $XBPS_SRCDISTDIR/$curfile -C $lwrksrc if [ $? -ne 0 ]; then - echo -n "*** ERROR extracting $curfile into " - echo "$lwrksrc ***" + msg_error "extracting $curfile into $lwrksrc" exit 1 fi ;; @@ -391,20 +417,18 @@ extract_distfiles() lwrksrc=$tmpwrksrc unset tmpf tmpsufx tmpwrksrc else - echo "*** ERROR: cannot find unzip helper ***" + msg_error "cannot find unzip helper" exit 1 fi extract_unzip $XBPS_SRCDISTDIR/$curfile $lwrksrc if [ $? -ne 0 ]; then - echo -n "*** ERROR extracting $curfile into " - echo "$lwrksrc ***" + msg_error "extracting $curfile into $lwrksrc" exit 1 fi ;; *) - echo -n "*** ERROR: cannot guess $curfile extract " - echo "suffix ***" + msg_error "cannot guess $curfile extract suffix" exit 1 ;; esac @@ -426,11 +450,11 @@ verify_sha256_cksum() filesum=$($XBPS_DIGEST_CMD $XBPS_SRCDISTDIR/$file) if [ "$origsum" != "$filesum" ]; then - echo "*** ERROR: SHA256 checksum doesn't match for $file ***" + msg_error "SHA256 checksum doesn't match for $file" exit 1 fi - echo "=> SHA256 checksum OK for $file." + msg_normal "SHA256 checksum OK for $file." } # @@ -468,8 +492,7 @@ fetch_distfiles() done if [ -z $found ]; then - echo -n "*** ERROR: cannot find checksum for " - echo "$curfile ***" + msg_error "cannot find checksum for $curfile" exit 1 fi @@ -482,7 +505,7 @@ fetch_distfiles() fi fi - echo "==> Fetching distfile: \`$curfile'." + msg_normal "Fetching distfile: \`$curfile'." if [ -n "$distfiles" ]; then localurl="$f" @@ -495,11 +518,9 @@ fetch_distfiles() if [ $? -ne 0 ]; then unset localurl if [ ! -f $XBPS_SRCDISTDIR/$curfile ]; then - echo -n "*** ERROR: couldn't fetch '$curfile', " - echo "aborting ***" + msg_error "couldn't fetch '$curfile'" else - echo -n "*** ERROR: there was an error " - echo "fetching '$curfile', aborting ***" + msg_error "there was an error fetching '$curfile'" fi exit 1 else @@ -518,8 +539,7 @@ fetch_distfiles() done if [ -z $found ]; then - echo -n "*** ERROR: cannot find checksum for " - echo "$curfile ***" + msg_error "cannot find checksum for $curfile" exit 1 fi @@ -542,7 +562,7 @@ libtool_fixup_file() [ -n "$no_libtool_fixup" ] && return 0 # If we are being invoked by a chroot, don't transform stuff. - [ "$XBPS_MASTERDIR" = "/" ] && return 0 + [ -n "$in_chroot" ] && return 0 sed -i -e \ 's|^hardcode_libdir_flag_spec=.*|hardcode_libdir_flag_spec="-Wl,-rpath /usr/lib"|g' \ @@ -559,7 +579,7 @@ libtool_fixup_la_files() [ "$pkgname" = "libtool" ] && return 0 # If we are being invoked by a chroot, don't transform stuff. - [ "$XBPS_MASTERDIR" = "/" ] && return 0 + [ -n "$in_chroot" ] && return 0 [ ! -f "$wrksrc/libtool" -o ! -f "$wrksrc/ltmain.sh" ] && return 0 @@ -574,7 +594,7 @@ libtool_fixup_la_files() for f in $(find $where -type f -name \*.la*); do if [ -f $f ]; then - echo "=> Fixing up libtool archive: ${f##$where/}" + msg_normal "Fixing up libtool archive: ${f##$where/}" sed -i -e "s|\/..\/lib||g;s|\/\/lib|/usr/lib|g" \ -e "s|$XBPS_MASTERDIR||g;s|$wrksrc||g" \ -e "s|$XBPS_DESTDIR/$pkgname-$version||g" $f @@ -586,7 +606,7 @@ libtool_fixup_la_files() set_build_vars() { - [ "$XBPS_MASTERDIR" = "/" ] && return 0 + [ -n "$in_chroot" ] && return 0 LDFLAGS="-L$XBPS_MASTERDIR/usr/lib" SAVE_LDLIBPATH=$LD_LIBRARY_PATH @@ -606,7 +626,7 @@ set_build_vars() unset_build_vars() { - [ "$XBPS_MASTERDIR" = "/" ] && return 0 + [ -n "$in_chroot" ] && return 0 unset LDFLAGS CFLAGS CXXFLAGS CPPFLAGS PKG_CONFIG LD_LIBRARY_PATH export LD_LIBRARY_PATH=$SAVE_LDLIBPATH @@ -636,7 +656,7 @@ apply_tmpl_patches() for i in ${patch_files}; do patch="$XBPS_TEMPLATESDIR/$i" if [ ! -f "$patch" ]; then - echo "*** WARNING: unexistent patch: $i ***" + msg_warn "unexistent patch: $i" continue fi @@ -652,15 +672,15 @@ apply_tmpl_patches() elif $(echo $patch|$grep_cmd -q .diff); then patch=$i else - echo "*** WARNING: unknown patch type: $i ***" + msg_warn "unknown patch type: $i" continue fi cd $wrksrc && patch -p0 < $patch 2>/dev/null if [ "$?" -eq 0 ]; then - echo "=> Patch applied: $i." + msg_normal "Patch applied: $i." else - echo "*** ERROR: couldn't apply patch: $i." + msg_error "couldn't apply patch: $i." exit 1 fi done @@ -688,7 +708,7 @@ configure_src_phase() "$build_style" = "only-install" ] && return 0 if [ ! -d $wrksrc ]; then - echo "*** ERROR: unexistent build directory $wrksrc ***" + msg_error "unexistent build directory $wrksrc" exit 1 fi @@ -703,7 +723,7 @@ configure_src_phase() export "$f" done - echo "=> Running configure phase for $pkgname-$version." + msg_normal "Running configure phase for $pkgname-$version." set_build_vars @@ -755,12 +775,12 @@ configure_src_phase() # Unknown build_style type won't work :-) # else - echo "*** ERROR unknown build_style: $build_style ***" + msg_error "unknown build_style: $build_style" exit 1 fi if [ "$build_style" != "perl_module" -a "$?" -ne 0 ]; then - echo "*** ERROR building (configure state) $pkg ***" + msg_error "building (configure state) $pkg" exit 1 fi @@ -794,7 +814,7 @@ build_src_phase() "$build_style" = "only-install" ] && return 0 if [ ! -d $wrksrc ]; then - echo "*** ERROR: unexistent build directory: $wrksrc ***" + msg_error "unexistent build directory: $wrksrc" exit 1 fi @@ -823,14 +843,14 @@ build_src_phase() libtool_fixup_file set_build_vars - echo "=> Running build phase for $pkg." + msg_normal "Running build phase for $pkg." # # Build package via make. # ${make_cmd} ${makejobs} ${make_build_args} ${make_build_target} if [ "$?" -ne 0 ]; then - echo "*** ERROR building (make stage) $pkg ***" + msg_error "building (make stage) $pkg" exit 1 fi @@ -875,13 +895,13 @@ install_src_phase() [ "$build_style" = "meta-template" ] && return 0 if [ ! -d $wrksrc ]; then - echo "*** ERROR: unexistent build directory: $wrksrc ***" + msg_error "unexistent build directory: $wrksrc" exit 1 fi cd $wrksrc || exit 1 - echo "=> Running install phase for: $pkgname-$version." + msg_normal "Running install phase for: $pkgname-$version." set_build_vars # @@ -889,7 +909,7 @@ install_src_phase() # ${make_cmd} ${make_install_target} ${make_install_args} if [ "$?" -ne 0 ]; then - echo "*** ERROR installing $pkgname-$version ***" + msg_error "installing $pkgname-$version" exit 1 fi @@ -910,7 +930,7 @@ install_src_phase() # Unset build vars. unset_build_vars - echo "==> Installed $pkgname-$version into $XBPS_DESTDIR." + msg_normal "Installed $pkgname-$version into $XBPS_DESTDIR." touch -f $XBPS_INSTALL_DONE @@ -920,7 +940,7 @@ install_src_phase() if [ -d "$wrksrc" -a -z "$dontrm_builddir" ]; then rm -rf $wrksrc [ "$?" -eq 0 ] && \ - echo "=> Removed $pkgname-$version build directory." + msg_normal "Removed $pkgname-$version build directory." fi cd $XBPS_BUILDDIR @@ -1183,7 +1203,7 @@ install_pkg() local cur_tmpl="$XBPS_TEMPLATESDIR/$curpkgn.tmpl" if [ -z $cur_tmpl -o ! -f $cur_tmpl ]; then - echo "*** ERROR: cannot find $cur_tmpl template file ***" + msg_error "cannot find $cur_tmpl template file" exit 1 fi @@ -1250,7 +1270,7 @@ install_pkg() if [ "$build_style" = "meta-template" ]; then register_pkg_handler register $pkgname $version [ $? -eq 0 ] && \ - echo "==> Installed meta-template: $pkg." && \ + msg_normal "Installed meta-template: $pkg." && \ return 0 return 1 fi @@ -1476,9 +1496,19 @@ build) fi if [ ! -f "$XBPS_CONFIGURE_DONE" ]; then - configure_src_phase $2 + if [ -z "$base_chroot" -a -z "$in_chroot" ]; then + run_file $XBPS_TMPLHELPDIR/chroot.sh + configure_chroot_pkg $2 + else + configure_src_phase $2 + fi + fi + if [ -z "$base_chroot" -a -z "$in_chroot" ]; then + run_file $XBPS_TMPLHELPDIR/chroot.sh + build_chroot_pkg $2 + else + build_src_phase $2 fi - build_src_phase $2 ;; chroot) run_file $XBPS_TMPLHELPDIR/chroot.sh @@ -1490,7 +1520,12 @@ configure) if [ ! -f "$XBPS_EXTRACT_DONE" ]; then extract_distfiles $2 fi - configure_src_phase $2 + if [ -z "$base_chroot" -a -z "$in_chroot" ]; then + run_file $XBPS_TMPLHELPDIR/chroot.sh + configure_chroot_pkg $2 + else + configure_src_phase $2 + fi ;; extract) setup_tmpl $2 @@ -1505,17 +1540,22 @@ info) setup_tmpl $2 info_tmpl $2 ;; -install-chroot) - setup_tmpl $2 - run_file $XBPS_TMPLHELPDIR/chroot.sh - install_chroot_pkg $2 - ;; install-destdir) install_destdir_target=yes - install_pkg $2 + if [ -z "$base_chroot" -a -z "$in_chroot" ]; then + run_file $XBPS_TMPLHELPDIR/chroot.sh + install_chroot_pkg $2 + else + install_pkg $2 + fi ;; install) - install_pkg $2 + if [ -z "$base_chroot" -a -z "$in_chroot" ]; then + run_file $XBPS_TMPLHELPDIR/chroot.sh + install_chroot_pkg $2 + else + install_pkg $2 + fi ;; list) list_pkgs