From aedff1c1178ea350963ce737780f4165ac85f745 Mon Sep 17 00:00:00 2001 From: Dan McGee Date: Sun, 27 May 2007 17:01:49 -0400 Subject: makepkg: fakeroot-related changes and other misc output A few changes to undo my stupid mistake earlier wrt fakeroot checking, and unify the output and usage of 'makepkg.conf'. Signed-off-by: Dan McGee --- etc/makepkg.conf.in | 2 +- scripts/makepkg.in | 29 +++++++++++++++-------------- 2 files changed, 16 insertions(+), 15 deletions(-) diff --git a/etc/makepkg.conf.in b/etc/makepkg.conf.in index 0ac2645f..7ca1080e 100644 --- a/etc/makepkg.conf.in +++ b/etc/makepkg.conf.in @@ -38,7 +38,7 @@ CXXFLAGS="-@ARCHSWITCH@=@CARCHFLAGS@ -O2 -pipe" # BUILD ENVIRONMENT ######################################################################### # -# Defaults: BUILDENV=(!fakeroot !distcc color !ccache) +# Defaults: BUILDENV=(fakeroot !distcc color !ccache) # A negated environment option will do the opposite of the comments below. # #-- fakeroot: Allow building packages as a non-root user diff --git a/scripts/makepkg.in b/scripts/makepkg.in index 6bba36bc..3e1be96e 100755 --- a/scripts/makepkg.in +++ b/scripts/makepkg.in @@ -199,7 +199,7 @@ getdownloadclient() { # if we didn't find an agent, return an error if [ -z "$agent" ]; then - error "$(eval_gettext "There is no agent set up to handle \$proto URLs. Check /etc/makepkg.conf.")" + error "$(eval_gettext "There is no agent set up to handle \$proto URLs. Check makepkg.conf.")" error "$(gettext "Aborting...")" exit 1 # $E_CONFIG_ERROR # TODO: error code fi @@ -265,7 +265,7 @@ handledeps() { # install missing deps by building them from source. # we look for each package name in $SRCROOT and build it. if [ "$SRCROOT" = "" ]; then - error "$(gettext "Source root cannot be found - please make sure it is specified in /etc/makepkg.conf")" + error "$(gettext "Source root cannot be found - ensure it is specified in makepkg.conf.")" exit 1 fi # TODO: handle version comparators (eg, glibc>=2.2.5) @@ -762,24 +762,30 @@ if [ "$CLEANCACHE" = "1" ]; then fi fi +if [ -z $BUILDSCRIPT ]; then + error "$(eval_gettext "BUILDSCRIPT is undefined! Ensure you have updated makepkg.conf.")" + exit 1 +fi + if [ "$INFAKEROOT" = "0" ]; then if [ $EUID -eq 0 -a $ASROOT -eq 0 ]; then # Warn those who like to live dangerously. - warning "$(gettext "Running makepkg as root is a BAD idea and can cause")" + error "$(gettext "Running makepkg as root is a BAD idea and can cause")" plain "$(gettext "permanent, catastrophic damage to your system. If you")" plain "$(gettext "you wish to run as root, please use the --asroot option.")" plain "" exit 1 # $E_USER_ABORT - elif [ "$(check_buildenv fakeroot)" = "y" -a ! $(type -p fakeroot) ]; then - warning "$(gettext "Fakeroot is not installed. Building as an unprivileged user")" - plain "$(gettext "will result in non-root ownership of the packaged files. Install")" - plain "$(gettext "the fakeroot package to correctly build as a non-root user.")" + elif [ "$(check_buildenv fakeroot)" = "y" ]; then + if [ ! $(type -p fakeroot) ]; then + error "$(gettext "fakeroot must be installed if using the 'fakeroot' option")" + plain "$(gettext "in the BUILDENV array in makepkg.conf.")" plain "" - sleep 1 + exit 1 + fi else warning "$(gettext "Running makepkg as an unprivileged user will result in non-root")" plain "$(gettext "ownership of the packaged files. Try using the fakeroot environment by")" - plain "$(gettext "placing 'fakeroot' in the BUILDENV array in makepkg.conf")" + plain "$(gettext "placing 'fakeroot' in the BUILDENV array in makepkg.conf.")" plain "" sleep 1 fi @@ -794,11 +800,6 @@ unset pkgname pkgver pkgrel pkgdesc url license groups provides md5sums force unset replaces depends conflicts backup source install build makedepends unset options noextract -if [ -z $BUILDSCRIPT ]; then - error "$(eval_gettext "BUILDSCRIPT is undefined! Ensure you have updated makepkg.conf.")" - exit 1 -fi - if [ ! -f $BUILDSCRIPT ]; then error "$(eval_gettext "\$BUILDSCRIPT does not exist.")" exit 1 -- cgit v1.2.3-70-g09d2