mirror of
https://github.com/moparisthebest/pacman
synced 2024-12-22 15:58:50 -05:00
makepkg : add --config option for an alternate config file.
Signed-off-by: Xavier Chantry <shiningxc@gmail.com> Signed-off-by: Dan McGee <dan@archlinux.org>
This commit is contained in:
parent
7e8f1469c4
commit
4b183bf9a9
@ -52,6 +52,9 @@ Options
|
|||||||
Removes all cached source files from the directory specified in `SRCDEST`
|
Removes all cached source files from the directory specified in `SRCDEST`
|
||||||
in linkman:makepkg.conf[5].
|
in linkman:makepkg.conf[5].
|
||||||
|
|
||||||
|
*--config* <`/path/to/config`>::
|
||||||
|
Use an alternate config file instead of the `/etc/makepkg.conf` default;
|
||||||
|
|
||||||
*-d, \--nodeps*::
|
*-d, \--nodeps*::
|
||||||
Do not perform any dependency checks. This will let you override and
|
Do not perform any dependency checks. This will let you override and
|
||||||
ignore any dependencies required. There is a good chance this option
|
ignore any dependencies required. There is a good chance this option
|
||||||
|
@ -266,7 +266,7 @@ get_downloadclient() {
|
|||||||
|
|
||||||
# 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 "$(gettext "There is no agent set up to handle %s URLs. Check %s.")" "$proto" "$confdir/makepkg.conf"
|
error "$(gettext "There is no agent set up to handle %s URLs. Check %s.")" "$proto" "$MAKEPKG_CONF"
|
||||||
plain "$(gettext "Aborting...")"
|
plain "$(gettext "Aborting...")"
|
||||||
exit 1 # $E_CONFIG_ERROR
|
exit 1 # $E_CONFIG_ERROR
|
||||||
fi
|
fi
|
||||||
@ -1077,6 +1077,7 @@ usage() {
|
|||||||
printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT"
|
printf "$(gettext " -A, --ignorearch Ignore incomplete arch field in %s")\n" "$BUILDSCRIPT"
|
||||||
echo "$(gettext " -c, --clean Clean up work files after build")"
|
echo "$(gettext " -c, --clean Clean up work files after build")"
|
||||||
echo "$(gettext " -C, --cleancache Clean up source files from the cache")"
|
echo "$(gettext " -C, --cleancache Clean up source files from the cache")"
|
||||||
|
printf "$(gettext " --config <config> Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf"
|
||||||
echo "$(gettext " -d, --nodeps Skip all dependency checks")"
|
echo "$(gettext " -d, --nodeps Skip all dependency checks")"
|
||||||
echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")"
|
echo "$(gettext " -e, --noextract Do not extract source files (use existing src/ dir)")"
|
||||||
echo "$(gettext " -f, --force Overwrite existing package")"
|
echo "$(gettext " -f, --force Overwrite existing package")"
|
||||||
@ -1124,36 +1125,12 @@ fi
|
|||||||
|
|
||||||
ARGLIST=$@
|
ARGLIST=$@
|
||||||
|
|
||||||
#preserve environment variables
|
|
||||||
_PKGDEST=${PKGDEST}
|
|
||||||
_SRCDEST=${SRCDEST}
|
|
||||||
|
|
||||||
# Source makepkg.conf; fail if it is not found
|
|
||||||
if [ -r "$confdir/makepkg.conf" ]; then
|
|
||||||
source "$confdir/makepkg.conf"
|
|
||||||
else
|
|
||||||
error "$(gettext "%s not found.")" "$confdir/makepkg.conf"
|
|
||||||
plain "$(gettext "Aborting...")"
|
|
||||||
exit 1 # $E_CONFIG_ERROR
|
|
||||||
fi
|
|
||||||
|
|
||||||
# Source user-specific makepkg.conf overrides
|
|
||||||
if [ -r ~/.makepkg.conf ]; then
|
|
||||||
source ~/.makepkg.conf
|
|
||||||
fi
|
|
||||||
|
|
||||||
# override settings with an environment variable for batch processing
|
|
||||||
PKGDEST=${_PKGDEST:-$PKGDEST}
|
|
||||||
PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
|
|
||||||
SRCDEST=${_SRCDEST:-$SRCDEST}
|
|
||||||
SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
|
|
||||||
|
|
||||||
# Parse Command Line Options.
|
# Parse Command Line Options.
|
||||||
OPT_SHORT="AbcCdefFghiLmop:rRsV"
|
OPT_SHORT="AbcCdefFghiLmop:rRsV"
|
||||||
OPT_LONG="allsource,asroot,ignorearch,builddeps,clean,cleancache,nodeps"
|
OPT_LONG="allsource,asroot,ignorearch,builddeps,clean,cleancache,nodeps"
|
||||||
OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver"
|
OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver"
|
||||||
OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,source"
|
OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,source"
|
||||||
OPT_LONG="$OPT_LONG,syncdeps,version"
|
OPT_LONG="$OPT_LONG,syncdeps,version,config:"
|
||||||
# Pacman Options
|
# Pacman Options
|
||||||
OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
|
OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
|
||||||
OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')"
|
OPT_TEMP="$(getopt -o "$OPT_SHORT" -l "$OPT_LONG" -n "$(basename "$0")" -- "$@" || echo 'GETOPT GO BANG!')"
|
||||||
@ -1176,6 +1153,7 @@ while true; do
|
|||||||
-A|--ignorearch) IGNOREARCH=1 ;;
|
-A|--ignorearch) IGNOREARCH=1 ;;
|
||||||
-c|--clean) CLEANUP=1 ;;
|
-c|--clean) CLEANUP=1 ;;
|
||||||
-C|--cleancache) CLEANCACHE=1 ;;
|
-C|--cleancache) CLEANCACHE=1 ;;
|
||||||
|
--config) shift; MAKEPKG_CONF=$1 ;;
|
||||||
-d|--nodeps) NODEPS=1 ;;
|
-d|--nodeps) NODEPS=1 ;;
|
||||||
-e|--noextract) NOEXTRACT=1 ;;
|
-e|--noextract) NOEXTRACT=1 ;;
|
||||||
-f|--force) FORCE=1 ;;
|
-f|--force) FORCE=1 ;;
|
||||||
@ -1203,6 +1181,34 @@ while true; do
|
|||||||
shift
|
shift
|
||||||
done
|
done
|
||||||
|
|
||||||
|
#preserve environment variables
|
||||||
|
_PKGDEST=${PKGDEST}
|
||||||
|
_SRCDEST=${SRCDEST}
|
||||||
|
|
||||||
|
# default config is makepkg.conf
|
||||||
|
MAKEPKG_CONF=${MAKEPKG_CONF:-$confdir/makepkg.conf}
|
||||||
|
|
||||||
|
# Source the config file; fail if it is not found
|
||||||
|
if [ -r "$MAKEPKG_CONF" ]; then
|
||||||
|
source "$MAKEPKG_CONF"
|
||||||
|
else
|
||||||
|
error "$(gettext "%s not found.")" "$MAKEPKG_CONF"
|
||||||
|
plain "$(gettext "Aborting...")"
|
||||||
|
exit 1 # $E_CONFIG_ERROR
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Source user-specific makepkg.conf overrides
|
||||||
|
if [ -r ~/.makepkg.conf ]; then
|
||||||
|
source ~/.makepkg.conf
|
||||||
|
fi
|
||||||
|
|
||||||
|
# override settings with an environment variable for batch processing
|
||||||
|
PKGDEST=${_PKGDEST:-$PKGDEST}
|
||||||
|
PKGDEST=${PKGDEST:-$startdir} #default to $startdir if undefined
|
||||||
|
SRCDEST=${_SRCDEST:-$SRCDEST}
|
||||||
|
SRCDEST=${SRCDEST:-$startdir} #default to $startdir if undefined
|
||||||
|
|
||||||
|
|
||||||
if [ "$HOLDVER" = "1" -a "$FORCE_VER" != "" ]; then
|
if [ "$HOLDVER" = "1" -a "$FORCE_VER" != "" ]; then
|
||||||
# The '\\0' is here to prevent gettext from thinking --holdver is an option
|
# The '\\0' is here to prevent gettext from thinking --holdver is an option
|
||||||
error "$(gettext "\\0--holdver and --forcever cannot both be specified" )"
|
error "$(gettext "\\0--holdver and --forcever cannot both be specified" )"
|
||||||
@ -1234,14 +1240,14 @@ if [ "$CLEANCACHE" = "1" ]; then
|
|||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
# $SRCDEST is $startdir, two possibilities
|
# $SRCDEST is $startdir, two possibilities
|
||||||
error "$(gettext "Source destination must be defined in makepkg.conf.")"
|
error "$(gettext "Source destination must be defined in %s.")" "$MAKEPKG_CONF"
|
||||||
plain "$(gettext "In addition, please run makepkg -C outside of your cache directory.")"
|
plain "$(gettext "In addition, please run makepkg -C outside of your cache directory.")"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z $BUILDSCRIPT ]; then
|
if [ -z $BUILDSCRIPT ]; then
|
||||||
error "$(gettext "BUILDSCRIPT is undefined! Ensure you have updated %s.")" "$confdir/makepkg.conf"
|
error "$(gettext "BUILDSCRIPT is undefined! Ensure you have updated %s.")" "$MAKEPKG_CONF"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -1260,13 +1266,13 @@ if [ "$INFAKEROOT" = "0" ]; then
|
|||||||
elif [ "$(check_buildenv fakeroot)" = "y" -a $EUID -gt 0 ]; then
|
elif [ "$(check_buildenv fakeroot)" = "y" -a $EUID -gt 0 ]; then
|
||||||
if [ ! $(type -p fakeroot) ]; then
|
if [ ! $(type -p fakeroot) ]; then
|
||||||
error "$(gettext "Fakeroot must be installed if using the 'fakeroot' option")"
|
error "$(gettext "Fakeroot must be installed if using the 'fakeroot' option")"
|
||||||
plain "$(gettext "in the BUILDENV array in %s.")" "$confdir/makepkg.conf"
|
plain "$(gettext "in the BUILDENV array in %s.")" "$MAKEPKG_CONF"
|
||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
elif [ $EUID -gt 0 ]; then
|
elif [ $EUID -gt 0 ]; then
|
||||||
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 %s.")" "$MAKEPKG_CONF"
|
||||||
sleep 1
|
sleep 1
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user