summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in333
1 files changed, 179 insertions, 154 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 13e4ed5e..25fb8d93 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -27,8 +27,8 @@
# makepkg uses quite a few external programs during its execution. You
# need to have at least the following installed for makepkg to function:
-# awk, bsdtar (libarchive), bzip2, coreutils, fakeroot, find (findutils),
-# getopt (util-linux), gettext, grep, gzip, openssl, sed
+# bsdtar (libarchive), bzip2, coreutils, fakeroot, find (findutils),
+# getopt (util-linux), gettext, grep, gzip, openssl, sed, tput (ncurses)
# gettext initialization
export TEXTDOMAIN='pacman'
@@ -46,8 +46,9 @@ pkgdir="$startdir/pkg"
packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
other_options=('ccache' 'distcc' 'makeflags' 'force')
-splitpkg_overrides=('pkgdesc' 'license' 'groups' 'depends' 'optdepends' 'provides' \
- 'conflicts' 'replaces' 'backup' 'options' 'install')
+splitpkg_overrides=('pkgver' 'pkgrel' 'pkgdesc' 'arch' 'license' 'groups' \
+ 'depends' 'optdepends' 'provides' 'conflicts' 'replaces' \
+ 'backup' 'options' 'install' 'changelog')
readonly -a packaging_options other_options splitpkg_overrides
# Options
@@ -71,7 +72,6 @@ IGNOREARCH=0
HOLDVER=0
PKGFUNC=0
SPLITPKG=0
-COLORMSG=0
# Forces the pkgver of the current PKGBUILD. Used by the fakeroot call
# when dealing with svn/cvs/etc PKGBUILDs.
@@ -83,47 +83,27 @@ PACMAN_OPTS=
plain() {
local mesg=$1; shift
- if [ $COLORMSG -eq 1 ]; then
- printf "\033[1;1m ${mesg}\033[1;0m\n" "$@" >&2
- else
- printf " ${mesg}\n" "$@" >&2
- fi
+ printf "${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg() {
local mesg=$1; shift
- if [ $COLORMSG -eq 1 ]; then
- printf "\033[1;32m==>\033[1;0m\033[1;1m ${mesg}\033[1;0m\n" "$@" >&2
- else
- printf "==> ${mesg}\n" "$@" >&2
- fi
+ printf "${GREEN}==>${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
msg2() {
local mesg=$1; shift
- if [ $COLORMSG -eq 1 ]; then
- printf "\033[1;34m ->\033[1;0m\033[1;1m ${mesg}\033[1;0m\n" "$@" >&2
- else
- printf " -> ${mesg}\n" "$@" >&2
- fi
+ printf "${BLUE} ->${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
warning() {
local mesg=$1; shift
- if [ $COLORMSG -eq 1 ]; then
- printf "\033[1;33m==> $(gettext "WARNING:")\033[1;0m\033[1;1m ${mesg}\033[1;0m\n" "$@" >&2
- else
- printf "==> $(gettext "WARNING:") ${mesg}\n" "$@" >&2
- fi
+ printf "${YELLOW}==> $(gettext "WARNING:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
error() {
local mesg=$1; shift
- if [ $COLORMSG -eq 1 ]; then
- printf "\033[1;31m==> $(gettext "ERROR:")\033[1;0m\033[1;1m ${mesg}\033[1;0m\n" "$@" >&2
- else
- printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
- fi
+ printf "${RED}==> $(gettext "ERROR:")${ALL_OFF}${BOLD} ${mesg}${ALL_OFF}\n" "$@" >&2
}
@@ -155,7 +135,7 @@ clean_up() {
# If it's a clean exit and -c/--clean has been passed...
msg "$(gettext "Cleaning up...")"
rm -rf "$pkgdir" "$srcdir"
- if [ -n "$pkgname" ]; then
+ if [ -n "$pkgbase" ]; then
# Can't do this unless the BUILDSCRIPT has been sourced.
rm -f "${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"*
if [ "$PKGFUNC" -eq 1 ]; then
@@ -175,6 +155,7 @@ clean_up() {
##
# Signal Traps
##
+set -E
trap 'clean_up' 0
trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
@@ -187,15 +168,15 @@ trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
# extract the filename from a source entry
get_filename() {
# if a filename is specified, use it
- local filename=$(echo $1 | sed 's|::.*||')
+ local filename="${1%%::*}"
# if it is just an URL, we only keep the last component
- echo "$filename" | sed 's|^.*://.*/||g'
+ echo "${filename##*/}"
}
# extract the URL from a source entry
get_url() {
# strip an eventual filename
- echo $1 | sed 's|.*::||'
+ echo "${1#*::}"
}
##
@@ -245,11 +226,11 @@ check_buildenv() {
# ? - not found
##
in_opt_array() {
- local needle=$(echo $1 | tr '[:upper:]' '[:lower:]'); shift
+ local needle="${1,,}"; shift
local opt
for opt in "$@"; do
- opt=$(echo $opt | tr '[:upper:]' '[:lower:]')
+ opt="${opt,,}"
if [ "$opt" = "$needle" ]; then
echo 'y' # Enabled
return
@@ -281,14 +262,14 @@ in_array() {
get_downloadclient() {
# $1 = URL with valid protocol prefix
local url=$1
- local proto=$(echo "$url" | sed 's|://.*||')
+ local proto="${url%%://*}"
# loop through DOWNLOAD_AGENTS variable looking for protocol
local i
for i in "${DLAGENTS[@]}"; do
- local handler=$(echo $i | sed 's|::.*||')
+ local handler="${i%%::*}"
if [ "$proto" = "$handler" ]; then
- agent=$(echo $i | sed 's|^.*::||')
+ agent="${i##*::}"
break
fi
done
@@ -301,7 +282,7 @@ get_downloadclient() {
fi
# ensure specified program is installed
- local program="$(echo $agent | awk '{print $1 }')"
+ local program="${agent%% *}"
if [ ! -x "$program" ]; then
local baseprog=$(basename $program)
error "$(gettext "The download program %s is not installed.")" "$baseprog"
@@ -320,7 +301,7 @@ download_file() {
# destination file
local file=$3
# temporary download file, default to last component of the URL
- local dlfile=$(echo "$url" | sed 's|^.*://.*/||g')
+ local dlfile="${url##*/}"
# replace %o by the temporary dlfile if it exists
if echo "$dlcmd" | grep -q "%o" ; then
@@ -334,7 +315,12 @@ download_file() {
dlcmd="$dlcmd \"$url\""
fi
- eval $dlcmd || return $?
+ local ret=0
+ eval "$dlcmd || ret=\$?"
+ if [ $ret -gt 0 ]; then
+ [ ! -s "$dlfile" ] && rm -f -- "$dlfile"
+ return $ret
+ fi
# rename the temporary download file to the final destination
if [ "$dlfile" != "$file" ]; then
@@ -355,7 +341,7 @@ check_deps() {
fi
}
-handledeps() {
+handle_deps() {
local R_DEPS_SATISFIED=0
local R_DEPS_MISSING=1
@@ -403,7 +389,7 @@ resolve_deps() {
return $R_DEPS_SATISFIED
fi
- if handledeps $deplist; then
+ if handle_deps $deplist; then
pkgdeps="$pkgdeps $deplist"
# check deps again to make sure they were resolved
deplist="$(check_deps $*)"
@@ -430,7 +416,7 @@ remove_deps() {
local dep depstrip deplist
deplist=""
for dep in $pkgdeps; do
- depstrip=$(echo $dep | sed -e 's|=.*$||' -e 's|>.*$||' -e 's|<.*$||')
+ depstrip="${dep%%[<=>]*}"
deplist="$deplist $depstrip"
done
@@ -512,7 +498,7 @@ generate_checksums() {
local integ
for integ in ${INTEGRITY_CHECK[@]}; do
- integ="$(echo $integ | tr '[:upper:]' '[:lower:]')"
+ integ="${integ,,}"
case "$integ" in
md5|sha1|sha256|sha384|sha512) : ;;
*)
@@ -545,7 +531,8 @@ generate_checksums() {
fi
fi
- local sum="$(openssl dgst -${integ} "$file" | awk '{print $NF}')"
+ local sum="$(openssl dgst -${integ} "$file")"
+ sum=${sum##* }
[ $ct -gt 0 ] && echo -n "$indent"
echo -n "'$sum'"
ct=$(($ct+1))
@@ -590,8 +577,9 @@ check_checksums() {
fi
if [ $found -gt 0 ] ; then
- local expectedsum="$(echo ${integrity_sums[$idx]} | tr '[A-F]' '[a-f]')"
- local realsum="$(openssl dgst -${integ} "$file" | awk '{print $NF}')"
+ local expectedsum="${integrity_sums[$idx],,}"
+ local realsum="$(openssl dgst -${integ} "$file")"
+ realsum="${realsum##* }"
if [ "$expectedsum" = "$realsum" ]; then
echo "$(gettext "Passed")" >&2
else
@@ -693,72 +681,23 @@ extract_sources() {
fi
}
-run_build() {
- # use distcc if it is requested (check buildenv and PKGBUILD opts)
- if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
- [ -d /usr/lib/distcc/bin ] && export PATH="/usr/lib/distcc/bin:$PATH"
- export DISTCC_HOSTS
- elif [ "$(check_option distcc)" = "n" ]; then
- # if it is not wanted, clear the makeflags too
- MAKEFLAGS=""
- fi
-
- # use ccache if it is requested (check buildenv and PKGBUILD opts)
- if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
- [ -d /usr/lib/ccache/bin ] && export PATH="/usr/lib/ccache/bin:$PATH"
- fi
-
- # clear user-specified makeflags if requested
- if [ "$(check_option makeflags)" = "n" ]; then
- MAKEFLAGS=""
- fi
-
- msg "$(gettext "Starting build()...")"
- cd "$srcdir"
-
- # ensure all necessary build variables are exported
- export CFLAGS CXXFLAGS MAKEFLAGS LDFLAGS CHOST
- # save our shell options so build() can't override what we need
- local shellopts=$(shopt -p)
-
- local ret=0
- if [ "$LOGGING" -eq 1 ]; then
- BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-build.log"
- if [ -f "$BUILDLOG" ]; then
- local i=1
- while true; do
- if [ -f "$BUILDLOG.$i" ]; then
- i=$(($i +1))
- else
- break
- fi
- done
- mv "$BUILDLOG" "$BUILDLOG.$i"
- fi
-
- build 2>&1 | tee "$BUILDLOG"; ret=${PIPESTATUS[0]}
- else
- build 2>&1 || ret=$?
+error_function() {
+ if [ -p "$logpipe" ]; then
+ rm "$logpipe"
fi
- # reset our shell options
- eval "$shellopts"
-
- if [ $ret -gt 0 ]; then
- error "$(gettext "Build Failed.")"
+ # first exit all subshells, then print the error
+ if [ $BASH_SUBSHELL -eq 0 ]; then
plain "$(gettext "Aborting...")"
remove_deps
- exit 2 # $E_BUILD_FAILED
fi
+ exit 2 # $E_BUILD_FAILED
}
-run_package() {
+run_function() {
if [ -z "$1" ]; then
- pkgfunc="package"
- nameofpkg="$pkgname"
- else
- pkgfunc="package_$1"
- nameofpkg="$1"
+ return 1
fi
+ pkgfunc="$1"
# clear user-specified makeflags if requested
if [ "$(check_option makeflags)" = "n" ]; then
@@ -770,10 +709,12 @@ run_package() {
# ensure all necessary build variables are exported
export CFLAGS CXXFLAGS LDFLAGS MAKEFLAGS CHOST
+ # save our shell options so pkgfunc() can't override what we need
+ local shellopts=$(shopt -p)
local ret=0
if [ "$LOGGING" -eq 1 ]; then
- BUILDLOG="${startdir}/${nameofpkg}-${pkgver}-${pkgrel}-${CARCH}-package.log"
+ BUILDLOG="${startdir}/${pkgname}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log"
if [ -f "$BUILDLOG" ]; then
local i=1
while true; do
@@ -792,20 +733,49 @@ run_package() {
exec 3>&1
tee "$BUILDLOG" < "$logpipe" &
exec 1>"$logpipe" 2>"$logpipe"
- $pkgfunc 2>&1 || ret=$?
+ restoretrap=$(trap -p ERR)
+ trap 'error_function' ERR
+ $pkgfunc 2>&1
+ eval $restoretrap
sync
exec 1>&3 2>&3 3>&-
rm "$logpipe"
else
- $pkgfunc 2>&1 || ret=$?
+ restoretrap=$(trap -p ERR)
+ trap 'error_function' ERR
+ $pkgfunc 2>&1
+ eval $restoretrap
fi
+ # reset our shell options
+ eval "$shellopts"
+}
- if [ $ret -gt 0 ]; then
- error "$(gettext "Packaging Failed.")"
- plain "$(gettext "Aborting...")"
- remove_deps
- exit 2 # $E_BUILD_FAILED
+run_build() {
+ # use distcc if it is requested (check buildenv and PKGBUILD opts)
+ if [ "$(check_buildenv distcc)" = "y" -a "$(check_option distcc)" != "n" ]; then
+ [ -d /usr/lib/distcc/bin ] && export PATH="/usr/lib/distcc/bin:$PATH"
+ export DISTCC_HOSTS
+ elif [ "$(check_option distcc)" = "n" ]; then
+ # if it is not wanted, clear the makeflags too
+ MAKEFLAGS=""
+ fi
+
+ # use ccache if it is requested (check buildenv and PKGBUILD opts)
+ if [ "$(check_buildenv ccache)" = "y" -a "$(check_option ccache)" != "n" ]; then
+ [ -d /usr/lib/ccache/bin ] && export PATH="/usr/lib/ccache/bin:$PATH"
+ fi
+
+ run_function "build"
+}
+
+run_package() {
+ if [ -z "$1" ]; then
+ pkgfunc="package"
+ else
+ pkgfunc="package_$1"
fi
+
+ run_function "$pkgfunc"
}
tidy_install() {
@@ -899,7 +869,8 @@ write_pkginfo() {
else
local packager="Unknown Packager"
fi
- local size=$(du -sk | awk '{print $1 * 1024}')
+ local size="$(du -sk)"
+ size="$(( ${size%%[^0-9]*} * 1024 ))"
msg2 "$(gettext "Generating .PKGINFO file...")"
echo "# Generated by makepkg $myver" >.PKGINFO
@@ -915,9 +886,7 @@ write_pkginfo() {
echo "builddate = $builddate" >>.PKGINFO
echo "packager = $packager" >>.PKGINFO
echo "size = $size" >>.PKGINFO
- if [ -n "$CARCH" ]; then
- echo "arch = $CARCH" >>.PKGINFO
- fi
+ echo "arch = $PKGARCH" >>.PKGINFO
if [ "$(check_option force)" = "y" ]; then
echo "force = true" >> .PKGINFO
fi
@@ -966,6 +935,18 @@ write_pkginfo() {
fi
}
+check_package() {
+ cd "$pkgdir"
+
+ # check existence of backup files
+ local file
+ for file in "${backup[@]}"; do
+ if [ ! -f "$file" ]; then
+ warning "$(gettext "Invalid backup entry : %s")" "$file"
+ fi
+ done
+}
+
create_package() {
if [ ! -d "$pkgdir" ]; then
error "$(gettext "Missing pkg/ directory.")"
@@ -973,6 +954,8 @@ create_package() {
exit 1 # $E_MISSING_PKGDIR
fi
+ check_package
+
cd "$pkgdir"
msg "$(gettext "Creating package...")"
@@ -982,6 +965,12 @@ create_package() {
nameofpkg="$1"
fi
+ if [ "$arch" = "any" ]; then
+ PKGARCH="any"
+ else
+ PKGARCH=$CARCH
+ fi
+
write_pkginfo $nameofpkg
local comp_files=".PKGINFO"
@@ -994,9 +983,9 @@ create_package() {
fi
# do we have a changelog?
- if [ -f "$startdir/ChangeLog" ]; then
+ if [ -n "$changelog" ]; then
msg2 "$(gettext "Adding package changelog...")"
- cp "$startdir/ChangeLog" .CHANGELOG
+ cp "$startdir/$changelog" .CHANGELOG
comp_files="$comp_files .CHANGELOG"
fi
@@ -1010,7 +999,7 @@ create_package() {
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
- local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${CARCH}${EXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
local ret=0
@@ -1058,13 +1047,17 @@ create_srcpackage() {
msg2 "$(gettext "Adding install script...")"
ln -s "${startdir}/$install" "${srclinks}/${pkgbase}/"
else
- error "$(gettext "Install script %s not found.")" "$install"
+ error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
fi
fi
- if [ -f ChangeLog ]; then
- msg2 "$(gettext "Adding %s...")" "ChangeLog"
- ln -s "${startdir}/ChangeLog" "${srclinks}/${pkgbase}"
+ if [ -n "$changelog" ]; then
+ if [ -f "$changelog" ]; then
+ msg2 "$(gettext "Adding package changelog...")"
+ ln -s "${startdir}/$changelog" "${srclinks}/${pkgbase}/"
+ else
+ error "$(gettext "Changelog file (%s) does not exist.")" "$changelog"
+ fi
fi
local netfile
@@ -1112,7 +1105,11 @@ install_package() {
local pkglist
for pkg in ${pkgname[@]}; do
- pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+ if [ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]; then
+ pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+ else
+ pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}"
+ fi
done
local ret=0
@@ -1155,15 +1152,14 @@ check_sanity() {
return 1
fi
- if [ "$arch" = 'any' ]; then
- CARCH='any'
- fi
- if ! in_array $CARCH ${arch[@]}; then
- if [ "$IGNOREARCH" -eq 0 ]; then
- error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH"
- plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
- plain "$(gettext "such as arch=('%s').")" "$CARCH"
- return 1
+ if [ "$arch" != 'any' ]; then
+ if ! in_array $CARCH ${arch[@]}; then
+ if [ "$IGNOREARCH" -eq 0 ]; then
+ error "$(gettext "%s is not available for the '%s' architecture.")" "$pkgbase" "$CARCH"
+ plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
+ plain "$(gettext "such as arch=('%s').")" "$CARCH"
+ return 1
+ fi
fi
fi
@@ -1175,11 +1171,32 @@ check_sanity() {
fi
done
+ local file
+ for file in "${backup[@]}"; do
+ if [ "${file:0:1}" = "/" ]; then
+ error "$(gettext "Invalid backup entry : %s")" "$file"
+ return 1
+ fi
+ done
+
+ local optdepend
+ for optdepend in "${optdepends[@]}"; do
+ pkg=${optdepend%%:*}
+ if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]*$ ]]; then
+ error "$(gettext "Invalid syntax for optdepend : '%s'")" "$optdepend"
+ fi
+ done
+
if [ "$install" -a ! -f "$install" ]; then
error "$(gettext "Install scriptlet (%s) does not exist.")" "$install"
return 1
fi
+ if [ -n "$changelog" -a ! -f "$changelog" ]; then
+ error "$(gettext "Changelog file (%s) does not exist.")" "$changelog"
+ return 1
+ fi
+
local valid_options=1
local opt known kopt
for opt in ${options[@]}; do
@@ -1409,31 +1426,30 @@ usage() {
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, --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 " -e, --noextract Do not extract source files (use existing src/ dir)")"
echo "$(gettext " -f, --force Overwrite existing package")"
echo "$(gettext " -g, --geninteg Generate integrity checks for source files")"
- echo "$(gettext " --skipinteg Do not fail when integrity checks are missing")"
echo "$(gettext " -h, --help This help")"
echo "$(gettext " -i, --install Install package after successful build")"
echo "$(gettext " -L, --log Log package build process")"
echo "$(gettext " -m, --nocolor Disable colorized output messages")"
echo "$(gettext " -o, --nobuild Download and extract files only")"
- printf "$(gettext " -p <buildscript> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
+ printf "$(gettext " -p <file> Use an alternate build script (instead of '%s')")\n" "$BUILDSCRIPT"
echo "$(gettext " -r, --rmdeps Remove installed dependencies after a successful build")"
- # fix flyspray feature request #2978
echo "$(gettext " -R, --repackage Repackage contents of the package without rebuilding")"
echo "$(gettext " -s, --syncdeps Install missing dependencies with pacman")"
- echo "$(gettext " --allsource Generate a source-only tarball including downloaded sources")"
- echo "$(gettext " --asroot Allow makepkg to run as root user")"
- echo "$(gettext " --holdver Prevent automatic version bumping for development PKGBUILDs")"
- echo "$(gettext " --source Generate a source-only tarball without downloaded sources")"
+ echo "$(gettext " --allsource Generate a source-only tarball including downloaded sources")"
+ echo "$(gettext " --asroot Allow makepkg to run as root user")"
+ printf "$(gettext " --config <file> Use an alternate config file (instead of '%s')")\n" "$confdir/makepkg.conf"
+ echo "$(gettext " --holdver Prevent automatic version bumping for development PKGBUILDs")"
+ echo "$(gettext " --skipinteg Do not fail when integrity checks are missing")"
+ echo "$(gettext " --source Generate a source-only tarball without downloaded sources")"
echo
echo "$(gettext "These options can be passed to pacman:")"
echo
- echo "$(gettext " --noconfirm Do not ask for confirmation when resolving dependencies")"
- echo "$(gettext " --noprogressbar Do not show a progress bar when downloading files")"
+ echo "$(gettext " --noconfirm Do not ask for confirmation when resolving dependencies")"
+ echo "$(gettext " --noprogressbar Do not show a progress bar when downloading files")"
echo
printf "$(gettext "If -p is not specified, makepkg will look for '%s'")\n" "$BUILDSCRIPT"
echo
@@ -1538,9 +1554,16 @@ if [ -r ~/.makepkg.conf ]; then
fi
# check if messages are to be printed using color
+unset ALL_OFF BOLD BLUE GREEN RED YELLOW
if [ -t 2 -a ! "$USE_COLOR" = "n" -a "$(check_buildenv color)" = "y" ]; then
- COLORMSG=1
+ ALL_OFF="$(tput sgr0)"
+ BOLD="$(tput bold)"
+ BLUE="${BOLD}$(tput setaf 4)"
+ GREEN="${BOLD}$(tput setaf 2)"
+ RED="${BOLD}$(tput setaf 1)"
+ YELLOW="${BOLD}$(tput setaf 3)"
fi
+readonly ALL_OFF BOLD BLUE GREEN RED YELLOW
# override settings with an environment variable for batch processing
PKGDEST=${_PKGDEST:-$PKGDEST}
@@ -1562,7 +1585,7 @@ if [ "$CLEANCACHE" -eq 1 ]; then
echo -n "$(gettext " Are you sure you wish to do this? ")"
echo -n "$(gettext "[y/N]")"
read answer
- answer=$(echo $answer | tr '[:lower:]' '[:upper:]')
+ answer="${answer^^}"
if [ "$answer" = "$(gettext "YES")" -o "$answer" = "$(gettext "Y")" ]; then
rm "$SRCDEST"/*
if [ $? -ne 0 ]; then
@@ -1629,7 +1652,7 @@ if [ "$ASROOT" -eq 0 \
fi
unset pkgname pkgbase pkgver pkgrel pkgdesc url license groups provides
-unset md5sums replaces depends conflicts backup source install build
+unset md5sums replaces depends conflicts backup source install changelog build
unset makedepends optdepends options noextract
BUILDFILE=${BUILDFILE:-$BUILDSCRIPT}
@@ -1684,8 +1707,9 @@ fi
pkgbase=${pkgbase:-${pkgname[0]}}
if [ "$SPLITPKG" -eq 0 ]; then
- if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
- -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
+ if [ \( -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
+ -o -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-any${PKGEXT}" \) \
+ -a "$FORCE" -eq 0 -a "$SOURCEONLY" -eq 0 -a "$NOBUILD" -eq 0 ]; then
if [ "$INSTALL" -eq 1 ]; then
warning "$(gettext "A package has already been built, installing existing package...")"
install_package
@@ -1699,7 +1723,8 @@ else
allpkgbuilt=1
somepkgbuilt=0
for pkg in ${pkgname[@]}; do
- if [ -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" ]; then
+ if [ \( -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
+ -o -f "$PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}" \) ]; then
somepkgbuilt=1
else
allpkgbuilt=0
@@ -1754,7 +1779,7 @@ if [ "$INFAKEROOT" -eq 1 ]; then
exit 0 # $E_OK
fi
-msg "$(gettext "Making package: %s")" "$pkgbase $pkgver-$pkgrel $CARCH ($(date))"
+msg "$(gettext "Making package: %s")" "$pkgbase $pkgver-$pkgrel ($(date))"
# if we are creating a source-only package, go no further
if [ "$SOURCEONLY" -ne 0 ]; then
@@ -1878,7 +1903,7 @@ else
fi
fi
-msg "$(gettext "Finished making: %s")" "$pkgbase $pkgver-$pkgrel $CARCH ($(date))"
+msg "$(gettext "Finished making: %s")" "$pkgbase $pkgver-$pkgrel ($(date))"
install_package