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 <dan@archlinux.org>
This commit is contained in:
Dan McGee 2007-05-27 17:01:49 -04:00
parent bc6ce2a190
commit aedff1c117
2 changed files with 16 additions and 15 deletions

View file

@ -38,7 +38,7 @@ CXXFLAGS="-@ARCHSWITCH@=@CARCHFLAGS@ -O2 -pipe"
# BUILD ENVIRONMENT # 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. # A negated environment option will do the opposite of the comments below.
# #
#-- fakeroot: Allow building packages as a non-root user #-- fakeroot: Allow building packages as a non-root user

View file

@ -199,7 +199,7 @@ getdownloadclient() {
# if we didn't find an agent, return an error # if we didn't find an agent, return an error
if [ -z "$agent" ]; then 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...")" error "$(gettext "Aborting...")"
exit 1 # $E_CONFIG_ERROR # TODO: error code exit 1 # $E_CONFIG_ERROR # TODO: error code
fi fi
@ -265,7 +265,7 @@ handledeps() {
# install missing deps by building them from source. # install missing deps by building them from source.
# we look for each package name in $SRCROOT and build it. # we look for each package name in $SRCROOT and build it.
if [ "$SRCROOT" = "" ]; then 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 exit 1
fi fi
# TODO: handle version comparators (eg, glibc>=2.2.5) # TODO: handle version comparators (eg, glibc>=2.2.5)
@ -762,24 +762,30 @@ if [ "$CLEANCACHE" = "1" ]; then
fi fi
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 [ "$INFAKEROOT" = "0" ]; then
if [ $EUID -eq 0 -a $ASROOT -eq 0 ]; then if [ $EUID -eq 0 -a $ASROOT -eq 0 ]; then
# Warn those who like to live dangerously. # 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 "permanent, catastrophic damage to your system. If you")"
plain "$(gettext "you wish to run as root, please use the --asroot option.")" plain "$(gettext "you wish to run as root, please use the --asroot option.")"
plain "" plain ""
exit 1 # $E_USER_ABORT exit 1 # $E_USER_ABORT
elif [ "$(check_buildenv fakeroot)" = "y" -a ! $(type -p fakeroot) ]; then elif [ "$(check_buildenv fakeroot)" = "y" ]; then
warning "$(gettext "Fakeroot is not installed. Building as an unprivileged user")" if [ ! $(type -p fakeroot) ]; then
plain "$(gettext "will result in non-root ownership of the packaged files. Install")" error "$(gettext "fakeroot must be installed if using the 'fakeroot' option")"
plain "$(gettext "the fakeroot package to correctly build as a non-root user.")" plain "$(gettext "in the BUILDENV array in makepkg.conf.")"
plain "" plain ""
sleep 1 exit 1
fi
else else
warning "$(gettext "Running makepkg as an unprivileged user will result in non-root")" 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 "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 "" plain ""
sleep 1 sleep 1
fi 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 replaces depends conflicts backup source install build makedepends
unset options noextract 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 if [ ! -f $BUILDSCRIPT ]; then
error "$(eval_gettext "\$BUILDSCRIPT does not exist.")" error "$(eval_gettext "\$BUILDSCRIPT does not exist.")"
exit 1 exit 1