summaryrefslogtreecommitdiff
path: root/src/chroot-tools
diff options
context:
space:
mode:
authorLuke Shumaker <lukeshu@sbcglobal.net>2015-01-04 15:59:26 -0500
committerLuke Shumaker <lukeshu@sbcglobal.net>2015-01-04 15:59:26 -0500
commitc000286dabf780061b46cfdadd2121869cd9e02a (patch)
treef197dc76978ff49b98622f65fc183eb3352e8a3a /src/chroot-tools
parentec4223a6a689b341bf4a60c3e7eb0e6211b0e5f3 (diff)
Generate the duplicated code in chcleanup
Diffstat (limited to 'src/chroot-tools')
-rw-r--r--src/chroot-tools/.gitignore3
-rw-r--r--src/chroot-tools/Makefile12
-rw-r--r--[-rwxr-xr-x]src/chroot-tools/chcleanup.in (renamed from src/chroot-tools/chcleanup)43
-rwxr-xr-xsrc/chroot-tools/librechroot2
4 files changed, 28 insertions, 32 deletions
diff --git a/src/chroot-tools/.gitignore b/src/chroot-tools/.gitignore
index 3f46ed2..f0969c7 100644
--- a/src/chroot-tools/.gitignore
+++ b/src/chroot-tools/.gitignore
@@ -2,3 +2,6 @@ makechrootpkg.sh*
arch-nspawn*
mkarchroot*
!*.patch
+
+chcleanup
+chcleanup.lib
diff --git a/src/chroot-tools/Makefile b/src/chroot-tools/Makefile
index c041cc8..db18ea4 100644
--- a/src/chroot-tools/Makefile
+++ b/src/chroot-tools/Makefile
@@ -1,3 +1,5 @@
+progs = chcleanup
+clean_files = chcleanup.lib
# These files are coming from devtools
copy_files = makechrootpkg.sh.in mkarchroot.in arch-nspawn.in
# These are programs that we will use internally, but shouldn't be in PATH
@@ -13,4 +15,14 @@ include ../../common.mk
makechrootpkg.sh.in: %.sh.in: $(devtoolsdir)/%.in
cp $< $@
+chcleanup: chcleanup.in chcleanup.lib
+ m4 -P $< | $(edit) > $@
+ chmod 755 $@
+chcleanup.lib: ../lib/common.sh.top ../lib/common.sh Makefile
+ { cat $<; bash -c '. ../lib/common.sh; declare -f plain msg msg2 error'; } > $@
+
distcc-tool.pot: LIBREXGETTEXT_FLAGS+=--simple=errusage
+
+# This is so gross. I hate recursive Make. Why did I implement it this way?
+../lib/common.sh: $(devtoolsdir)/lib/common.sh ../lib/common.sh.top ../lib/Makefile
+ $(MAKE) -C ../lib common.sh
diff --git a/src/chroot-tools/chcleanup b/src/chroot-tools/chcleanup.in
index 4a11176..d76989d 100755..100644
--- a/src/chroot-tools/chcleanup
+++ b/src/chroot-tools/chcleanup.in
@@ -2,8 +2,10 @@
# Copyright (C) 2011-2012 Nicolás Reynolds <fauno@parabola.nu>
# Copyright (C) 2012-2013 Luke Shumaker <lukeshu@sbcglobal.net>
#
-# The plain, msg, msg2, and error functions are Copyright (C) their
-# authors in devtools, and are assumed to be GPLv2+.
+# If you don't see m4_include(...) below, but see function definitions
+# for msg() et al., then this is a generated file, and contains some
+# code from librelib. The the source distribution for full copyright
+# information.
#
# License: GNU GPLv3+
#
@@ -29,42 +31,19 @@ set -eE
DRYRUN=${DRYRUN:-false}
-################################################################################
-# Define these here to avoid having dependencies on outside files
-
-if type gettext &>/dev/null; then
- _() { gettext "$@"; }
-else
- _() { echo "$@"; }
-fi
-
-plain() {
- local mesg="$(_ "$1")"; shift
- printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg() {
- local mesg="$(_ "$1")"; shift
- printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-msg2() {
- local mesg="$(_ "$1")"; shift
- printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-error() {
- local mesg="$(_ "$1")"; shift
- printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
-}
-
-################################################################################
+# Statically include various library routines to avoid having
+# dependencies on outside files.
+# Begin chcleanup.lib ##########################################################
+m4_include(chcleanup.lib)
+# End chcleanup.lib ############################################################
if [[ ! -f /.arch-chroot ]] && ! ${DRYRUN}; then
error "(chcleanup): Must be run inside of a chroot"
exit 1
fi
+# Note: the in-chroot pkgconfdir is non-configurable, this is
+# intentionally hard-coded.
source /etc/libretools.d/chroot.conf
# If we're running makepkg
if [[ -f PKGBUILD ]]; then
diff --git a/src/chroot-tools/librechroot b/src/chroot-tools/librechroot
index 0fbb8f7..616d868 100755
--- a/src/chroot-tools/librechroot
+++ b/src/chroot-tools/librechroot
@@ -327,6 +327,8 @@ main() {
_makechrootpkg sync_chroot "$CHROOTDIR/$CHROOT" "$COPY"
fi
+ # Note: the in-chroot pkgconfdir is non-configurable, this is
+ # intentionally hard-coded.
mkdir -p "$copydir/etc/libretools.d"
{
if [[ ${#CHROOTEXTRAPKG[*]} -eq 0 ]]; then