summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am1
-rw-r--r--scripts/makepkg.sh.in346
-rw-r--r--scripts/rankmirrors.sh.in2
3 files changed, 168 insertions, 181 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 0fde3345..31e8fb5d 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -38,7 +38,6 @@ edit = sed \
-e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
-e 's|@PACKAGE_BUGREPORT[@]|$(PACKAGE_BUGREPORT)|g' \
-e 's|@PACKAGE_NAME[@]|$(PACKAGE_NAME)|g' \
- -e 's|@DBEXT[@]|$(DBEXT)|g' \
-e 's|@BUILDSCRIPT[@]|$(BUILDSCRIPT)|g' \
-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
-e 's|@SEDINPLACE[@]|$(SEDINPLACE)|g' \
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index ec664692..de243387 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -135,6 +135,8 @@ clean_up() {
fi
if (( ! EXIT_CODE && CLEANUP )); then
+ local pkg file
+
# If it's a clean exit and -c/--clean has been passed...
msg "$(gettext "Cleaning up...")"
rm -rf "$pkgdir" "$srcdir"
@@ -153,7 +155,7 @@ clean_up() {
# clean up dangling symlinks to packages
for pkg in ${pkgname[@]}; do
- for file in ${pkg}-*-*-${CARCH}${PKGEXT}; do
+ for file in ${pkg}-*-*-${CARCH}{${PKGEXT},${SRCEXT}}; do
if [[ -h $file && ! -e $file ]]; then
rm -f $file
fi
@@ -308,7 +310,7 @@ get_downloadclient() {
for i in "${DLAGENTS[@]}"; do
local handler="${i%%::*}"
if [[ $proto = $handler ]]; then
- agent="${i##*::}"
+ local agent="${i##*::}"
break
fi
done
@@ -323,7 +325,7 @@ get_downloadclient() {
# ensure specified program is installed
local program="${agent%% *}"
if [[ ! -x $program ]]; then
- local baseprog=$(basename $program)
+ local baseprog="${program##*/}"
error "$(gettext "The download program %s is not installed.")" "$baseprog"
plain "$(gettext "Aborting...")"
exit 1 # $E_MISSING_PROGRAM
@@ -370,7 +372,7 @@ download_file() {
run_pacman() {
local cmd
printf -v cmd "%q " "$PACMAN" $PACMAN_OPTS "$@"
- if (( ! ASROOT )) && [[ $1 != "-T" && $1 != "-Qq" ]]; then
+ if (( ! ASROOT )) && [[ ! $1 =~ ^-(T|Qq)$ ]]; then
if [ "$(type -p sudo)" ]; then
cmd="sudo $cmd"
else
@@ -387,6 +389,7 @@ check_deps() {
# Also, a non-zero return value is not unexpected and we are manually dealing them
set +E
local ret=0
+ local pmout
pmout=$(run_pacman -T "$@") || ret=$?
set -E
@@ -543,7 +546,7 @@ generate_checksums() {
msg "$(gettext "Generating checksums for source files...")"
plain ""
- if [ ! $(type -p openssl) ]; then
+ if ! type -p openssl >/dev/null; then
error "$(gettext "Cannot find openssl.")"
exit 1 # $E_MISSING_PROGRAM
fi
@@ -593,7 +596,7 @@ generate_checksums() {
check_checksums() {
(( ! ${#source[@]} )) && return 0
- if [ ! $(type -p openssl) ]; then
+ if ! type -p openssl >/dev/null; then
error "$(gettext "Cannot find openssl.")"
exit 1 # $E_MISSING_PROGRAM
fi
@@ -654,7 +657,7 @@ extract_sources() {
msg "$(gettext "Extracting Sources...")"
local netfile
for netfile in "${source[@]}"; do
- file=$(get_filename "$netfile")
+ local file=$(get_filename "$netfile")
if in_array "$file" ${noextract[@]}; then
#skip source files in the noextract=() array
# these are marked explicitly to NOT be extracted
@@ -685,9 +688,12 @@ extract_sources() {
*) continue;;
esac ;;
*)
- # Don't know what to use to extract this file,
- # skip to the next file
- continue;;
+ # See if bsdtar can recognize the file
+ if bsdtar -tf "$file" -q '*' &>/dev/null; then
+ cmd="bsdtar"
+ else
+ continue
+ fi ;;
esac
local ret=0
@@ -717,6 +723,7 @@ error_function() {
fi
# first exit all subshells, then print the error
if (( ! BASH_SUBSHELL )); then
+ error "$(gettext "A failure occurred in %s().")" "$1"
plain "$(gettext "Aborting...")"
remove_deps
fi
@@ -727,7 +734,7 @@ run_function() {
if [[ -z $1 ]]; then
return 1
fi
- pkgfunc="$1"
+ local pkgfunc="$1"
# clear user-specified makeflags if requested
if [[ $(check_option makeflags) = "n" ]]; then
@@ -743,8 +750,9 @@ run_function() {
local shellopts=$(shopt -p)
local ret=0
+ local restoretrap
if (( LOGGING )); then
- BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log"
+ local BUILDLOG="${startdir}/${pkgbase}-${pkgver}-${pkgrel}-${CARCH}-$pkgfunc.log"
if [[ -f $BUILDLOG ]]; then
local i=1
while true; do
@@ -764,7 +772,7 @@ run_function() {
tee "$BUILDLOG" < "$logpipe" &
exec 1>"$logpipe" 2>"$logpipe"
restoretrap=$(trap -p ERR)
- trap 'error_function' ERR
+ trap 'error_function $pkgfunc' ERR
$pkgfunc 2>&1
eval $restoretrap
sync
@@ -772,7 +780,7 @@ run_function() {
rm "$logpipe"
else
restoretrap=$(trap -p ERR)
- trap 'error_function' ERR
+ trap 'error_function $pkgfunc' ERR
$pkgfunc 2>&1
eval $restoretrap
fi
@@ -799,6 +807,7 @@ run_build() {
}
run_package() {
+ local pkgfunc
if [[ -z $1 ]]; then
pkgfunc="package"
else
@@ -905,56 +914,41 @@ write_pkginfo() {
size="$(( ${size%%[^0-9]*} * 1024 ))"
msg2 "$(gettext "Generating .PKGINFO file...")"
- echo "# Generated by makepkg $myver" >.PKGINFO
+ echo "# Generated by makepkg $myver"
if (( INFAKEROOT )); then
- echo "# using $(fakeroot -v)" >>.PKGINFO
- fi
- echo "# $(LC_ALL=C date -u)" >>.PKGINFO
- echo "pkgname = $1" >>.PKGINFO
- (( SPLITPKG )) && echo pkgbase = $pkgbase >>.PKGINFO
- echo "pkgver = $pkgver-$pkgrel" >>.PKGINFO
- echo "pkgdesc = $pkgdesc" >>.PKGINFO
- echo "url = $url" >>.PKGINFO
- echo "builddate = $builddate" >>.PKGINFO
- echo "packager = $packager" >>.PKGINFO
- echo "size = $size" >>.PKGINFO
- echo "arch = $PKGARCH" >>.PKGINFO
+ echo "# using $(fakeroot -v)"
+ fi
+ echo "# $(LC_ALL=C date -u)"
+ echo "pkgname = $1"
+ (( SPLITPKG )) && echo pkgbase = $pkgbase
+ echo "pkgver = $pkgver-$pkgrel"
+ echo "pkgdesc = $pkgdesc"
+ echo "url = $url"
+ echo "builddate = $builddate"
+ echo "packager = $packager"
+ echo "size = $size"
+ echo "arch = $PKGARCH"
if [[ $(check_option force) = "y" ]]; then
- echo "force = true" >> .PKGINFO
+ echo "force = true"
fi
+ [[ $license ]] && printf "license = %s\n" "${license[@]}"
+ [[ $replaces ]] && printf "replaces = %s\n" "${replaces[@]}"
+ [[ $groups ]] && printf "group = %s\n" "${groups[@]}"
+ [[ $depends ]] && printf "depend = %s\n" "${depends[@]}"
+ [[ $optdepends ]] && printf "optdepend = %s\n" "${optdepends[@]}"
+ [[ $conflicts ]] && printf "conflict = %s\n" "${conflicts[@]}"
+ [[ $provides ]] && printf "provides = %s\n" "${provides[@]}"
+ [[ $backup ]] && printf "backup = %s\n" "${backup[@]}"
+
local it
- for it in "${license[@]}"; do
- echo "license = $it" >>.PKGINFO
- done
- for it in "${replaces[@]}"; do
- echo "replaces = $it" >>.PKGINFO
- done
- for it in "${groups[@]}"; do
- echo "group = $it" >>.PKGINFO
- done
- for it in "${depends[@]}"; do
- echo "depend = $it" >>.PKGINFO
- done
- for it in "${optdepends[@]}"; do
- echo "optdepend = $it" >>.PKGINFO
- done
- for it in "${conflicts[@]}"; do
- echo "conflict = $it" >>.PKGINFO
- done
- for it in "${provides[@]}"; do
- echo "provides = $it" >>.PKGINFO
- done
- for it in "${backup[@]}"; do
- echo "backup = $it" >>.PKGINFO
- done
for it in "${packaging_options[@]}"; do
local ret="$(check_option $it)"
if [[ $ret != "?" ]]; then
if [[ $ret = y ]]; then
- echo "makepkgopt = $it" >>.PKGINFO
+ echo "makepkgopt = $it"
else
- echo "makepkgopt = !$it" >>.PKGINFO
+ echo "makepkgopt = !$it"
fi
fi
done
@@ -974,7 +968,7 @@ check_package() {
local file
for file in "${backup[@]}"; do
if [[ ! -f $file ]]; then
- warning "$(gettext "Invalid backup entry : %s")" "$file"
+ warning "$(gettext "Backup entry file not in package : %s")" "$file"
fi
done
@@ -996,6 +990,7 @@ create_package() {
cd "$pkgdir"
msg "$(gettext "Creating package...")"
+ local nameofpkg
if [[ -z $1 ]]; then
nameofpkg="$pkgname"
else
@@ -1008,55 +1003,54 @@ create_package() {
PKGARCH=$CARCH
fi
- write_pkginfo $nameofpkg
+ write_pkginfo $nameofpkg > .PKGINFO
local comp_files=".PKGINFO"
- # check for an install script
- if [[ -n $install ]]; then
- msg2 "$(gettext "Adding install script...")"
- cp "$startdir/$install" .INSTALL
- chmod 644 .INSTALL
- comp_files="$comp_files .INSTALL"
- fi
-
- # do we have a changelog?
- if [[ -n $changelog ]]; then
- msg2 "$(gettext "Adding package changelog...")"
- cp "$startdir/$changelog" .CHANGELOG
- chmod 644 .CHANGELOG
- comp_files="$comp_files .CHANGELOG"
- fi
+ # check for changelog/install files
+ for i in 'changelog' 'install'; do
+ orig=${!i}
+ dest=$(tr '[:lower:]' '[:upper:]' <<<".$i")
+
+ if [[ -n $orig ]]; then
+ msg2 "$(gettext "Adding %s file...")" "$i"
+ cp "$startdir/$orig" "$dest"
+ chmod 644 "$dest"
+ comp_files+=" $dest"
+ fi
+ done
# tar it up
msg2 "$(gettext "Compressing package...")"
+ local EXT
case "$PKGEXT" in
*tar.gz) EXT=${PKGEXT%.gz} ;;
*tar.bz2) EXT=${PKGEXT%.bz2} ;;
*tar.xz) EXT=${PKGEXT%.xz} ;;
+ *tar) EXT=${PKGEXT} ;;
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$PKGEXT" ; EXT=$PKGEXT ;;
esac
- local tar_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${EXT}"
- local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
+ local pkg_file="$PKGDEST/${nameofpkg}-${pkgver}-${pkgrel}-${PKGARCH}${PKGEXT}"
local ret=0
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself
shopt -s nullglob
- bsdtar -cf - $comp_files * > "$tar_file" || ret=$?
- shopt -u nullglob
+ # TODO: Maybe this can be set globally for robustness
+ shopt -s -o pipefail
+ bsdtar -cf - $comp_files * |
+ case "$PKGEXT" in
+ *tar.gz) gzip -c -f -n ;;
+ *tar.bz2) bzip2 -c -f ;;
+ *tar.xz) xz -c -z - ;;
+ *tar) cat ;;
+ esac > ${pkg_file} || ret=$?
- if (( ! ret )); then
- case "$PKGEXT" in
- *tar.gz) gzip -f -n "$tar_file" ;;
- *tar.bz2) bzip2 -f "$tar_file" ;;
- *tar.xz) xz -z -f "$tar_file" ;;
- esac
- ret=$?
- fi
+ shopt -u nullglob
+ shopt -u -o pipefail
if (( ret )); then
error "$(gettext "Failed to create package file.")"
@@ -1129,6 +1123,7 @@ create_srcpackage() {
*tar.gz) TAR_OPT="z" ;;
*tar.bz2) TAR_OPT="j" ;;
*tar.xz) TAR_OPT="J" ;;
+ *tar) TAR_OPT="" ;;
*) warning "$(gettext "'%s' is not a valid archive extension.")" \
"$SRCEXT" ;;
esac
@@ -1142,6 +1137,16 @@ create_srcpackage() {
error "$(gettext "Failed to create source package file.")"
exit 1 # TODO: error code
fi
+
+ if (( ! ret )) && [[ "$SRCPKGDEST" != "${startdir}" ]]; then
+ ln -sf "${pkg_file}" "${pkg_file/$SRCPKGDEST/$startdir}"
+ ret=$?
+ fi
+
+ if (( ret )); then
+ warning "$(gettext "Failed to create symlink to source package file.")"
+ fi
+
cd "${startdir}"
rm -rf "${srclinks}"
}
@@ -1155,12 +1160,12 @@ install_package() {
msg "$(gettext "Installing %s package group with %s -U...")" "$pkgbase" "$PACMAN"
fi
- local pkglist
+ local pkg pkglist
for pkg in ${pkgname[@]}; do
if [[ -f $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT} ]]; then
- pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
+ pkglist+=" $PKGDEST/${pkg}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
else
- pkglist="${pkglist} $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}"
+ pkglist+=" $PKGDEST/${pkg}-${pkgver}-${pkgrel}-any${PKGEXT}"
fi
done
@@ -1172,22 +1177,16 @@ install_package() {
check_sanity() {
# check for no-no's in the build script
- if [[ -z $pkgname ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgname"
- return 1
- fi
- if [[ -z $pkgver ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgver"
- return 1
- fi
- if [[ -z $pkgrel ]]; then
- error "$(gettext "%s is not allowed to be empty.")" "pkgrel"
- return 1
- fi
+ local i
+ for i in 'pkgname' 'pkgrel' 'pkgver'; do
+ if [[ -z ${!i} ]]; then
+ error "$(gettext "%s is not allowed to be empty.")" "$i"
+ return 1
+ fi
+ done
- local name
- for name in "${pkgname[@]}"; do
- if [[ ${name:0:1} = "-" ]]; then
+ for i in "${pkgname[@]}"; do
+ if [[ ${i:0:1} = "-" ]]; then
error "$(gettext "%s is not allowed to start with a hyphen.")" "pkgname"
return 1
fi
@@ -1217,31 +1216,27 @@ check_sanity() {
fi
fi
- local provide
- for provide in ${provides[@]}; do
- if [[ $provide != ${provide//</} || $provide != ${provide//>/} ]]; then
+ for i in ${provides[@]}; do
+ if [[ $i != ${i//</} || $i != ${i//>/} ]]; then
error "$(gettext "Provides array cannot contain comparison (< or >) operators.")"
return 1
fi
done
- local file
- for file in "${backup[@]}"; do
- if [[ ${file:0:1} = "/" ]]; then
- error "$(gettext "Invalid backup entry : %s")" "$file"
+ for i in "${backup[@]}"; do
+ if [[ ${i:0:1} = "/" ]]; then
+ error "$(gettext "Backup entry should not contain leading slash : %s")" "$i"
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"
+ for i in "${optdepends[@]}"; do
+ local pkg=${i%%:*}
+ if [[ ! $pkg =~ ^[[:alnum:]\>\<\=\.\+\_\-]+$ ]]; then
+ error "$(gettext "Invalid syntax for optdepend : '%s'")" "$i"
fi
done
- local i
for i in 'changelog' 'install'; do
local filelist=$(sed -n "s/^[[:space:]]*$i=//p" "$BUILDFILE")
local file
@@ -1256,17 +1251,17 @@ check_sanity() {
done
local valid_options=1
- local opt known kopt
- for opt in ${options[@]}; do
+ local known kopt
+ for i in ${options[@]}; do
known=0
# check if option matches a known option or its inverse
for kopt in ${packaging_options[@]} ${other_options[@]}; do
- if [[ ${opt} = ${kopt} || ${opt} = "!${kopt}" ]]; then
+ if [[ ${i} = ${kopt} || ${i} = "!${kopt}" ]]; then
known=1
fi
done
if (( ! known )); then
- error "$(gettext "options array contains unknown option '%s'")" "$opt"
+ error "$(gettext "options array contains unknown option '%s'")" "$i"
valid_options=0
fi
done
@@ -1275,22 +1270,20 @@ check_sanity() {
fi
if (( ${#pkgname[@]} > 1 )); then
- for pkg in ${pkgname[@]}; do
- if [ "$(type -t package_${pkg})" != "function" ]; then
- error "$(gettext "missing package function for split package '%s'")" "$pkg"
+ for i in ${pkgname[@]}; do
+ if ! declare -f package_${i} >/dev/null; then
+ error "$(gettext "missing package function for split package '%s'")" "$i"
return 1
fi
done
fi
- if [[ -n "${PKGLIST[@]}" ]]; then
- for pkg in ${PKGLIST[@]}; do
- if ! in_array $pkg ${pkgname[@]}; then
- error "$(gettext "requested package %s is not provided in %s")" "$pkg" "$BUILDFILE"
- return 1
- fi
- done
- fi
+ for i in ${PKGLIST[@]}; do
+ if ! in_array $i ${pkgname[@]}; then
+ error "$(gettext "requested package %s is not provided in %s")" "$i" "$BUILDFILE"
+ return 1
+ fi
+ done
return 0
}
@@ -1313,27 +1306,27 @@ devel_check() {
# Also do a brief check to make sure we have the VCS tool available.
oldpkgver=$pkgver
if [[ -n ${_darcstrunk} && -n ${_darcsmod} ]] ; then
- [ $(type -p darcs) ] || return 0
+ type -p darcs >/dev/null || return 0
msg "$(gettext "Determining latest darcs revision...")"
newpkgver=$(date +%Y%m%d)
elif [[ -n ${_cvsroot} && -n ${_cvsmod} ]] ; then
- [ $(type -p cvs) ] || return 0
+ type -p cvs >/dev/null || return 0
msg "$(gettext "Determining latest cvs revision...")"
newpkgver=$(date +%Y%m%d)
elif [[ -n ${_gitroot} && -n ${_gitname} ]] ; then
- [ $(type -p git) ] || return 0
+ type -p git >/dev/null || return 0
msg "$(gettext "Determining latest git revision...")"
newpkgver=$(date +%Y%m%d)
elif [[ -n ${_svntrunk} && -n ${_svnmod} ]] ; then
- [ $(type -p svn) ] || return 0
+ type -p svn >/dev/null || return 0
msg "$(gettext "Determining latest svn revision...")"
newpkgver=$(LC_ALL=C svn info $_svntrunk | sed -n 's/^Last Changed Rev: \([0-9]*\)$/\1/p')
elif [[ -n ${_bzrtrunk} && -n ${_bzrmod} ]] ; then
- [ $(type -p bzr) ] || return 0
+ type -p bzr >/dev/null || return 0
msg "$(gettext "Determining latest bzr revision...")"
newpkgver=$(bzr revno ${_bzrtrunk})
elif [[ -n ${_hgroot} && -n ${_hgrepo} ]] ; then
- [ $(type -p hg) ] || return 0
+ type -p hg >/dev/null || return 0
msg "$(gettext "Determining latest hg revision...")"
if [[ -d ./src/$_hgrepo ]] ; then
cd ./src/$_hgrepo
@@ -1380,15 +1373,17 @@ devel_update() {
}
backup_package_variables() {
+ local var
for var in ${splitpkg_overrides[@]}; do
- indirect="${var}_backup"
+ local indirect="${var}_backup"
eval "${indirect}=(\"\${$var[@]}\")"
done
}
restore_package_variables() {
+ local var
for var in ${splitpkg_overrides[@]}; do
- indirect="${var}_backup"
+ local indirect="${var}_backup"
if [[ -n ${!indirect} ]]; then
eval "${var}=(\"\${$indirect[@]}\")"
else
@@ -1397,12 +1392,27 @@ restore_package_variables() {
done
}
+run_split_packaging() {
+ for pkg in ${pkgname[@]}; do
+ pkgdir="$pkgdir/$pkg"
+ mkdir -p "$pkgdir"
+ chmod a-s "$pkgdir"
+ backup_package_variables
+ run_package $pkg
+ tidy_install
+ create_package $pkg
+ restore_package_variables
+ pkgdir="${pkgdir%/*}"
+ done
+}
+
# getopt like parser
parse_options() {
local short_options=$1; shift;
local long_options=$1; shift;
local ret=0;
local unused_options=""
+ local i
while [[ -n $1 ]]; do
if [[ ${1:0:2} = '--' ]]; then
@@ -1438,7 +1448,7 @@ parse_options() {
elif [[ ${1:0:1} = '-' ]]; then
for ((i=1; i<${#1}; i++)); do
if [[ $short_options =~ ${1:i:1} ]]; then
- if [[ $short_options =~ "${1:i:1}:" ]]; then
+ if [[ $short_options =~ ${1:i:1}: ]]; then
if [[ -n ${1:$i+1} ]]; then
printf ' -%s' "${1:i:1}"
printf " '%s'" "${1:$i+1}"
@@ -1535,7 +1545,7 @@ There is NO WARRANTY, to the extent permitted by law.\n")"
# PROGRAM START
# determine whether we have gettext; make it a no-op if we do not
-if [ ! $(type -t gettext) ]; then
+if ! type -p gettext >/dev/null; then
gettext() {
echo "$@"
}
@@ -1546,11 +1556,11 @@ ARGLIST=("$@")
# Parse Command Line Options.
OPT_SHORT="AcCdefFghiLmop:rRsV"
OPT_LONG="allsource,asroot,ignorearch,clean,cleancache,nodeps"
-OPT_LONG="$OPT_LONG,noextract,force,forcever:,geninteg,help,holdver"
-OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,pkg:,rmdeps,repackage,skipinteg"
-OPT_LONG="$OPT_LONG,source,syncdeps,version,config:"
+OPT_LONG+=",noextract,force,forcever:,geninteg,help,holdver"
+OPT_LONG+=",install,log,nocolor,nobuild,pkg:,rmdeps,repackage,skipinteg"
+OPT_LONG+=",source,syncdeps,version,config:"
# Pacman Options
-OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
+OPT_LONG+=",noconfirm,noprogressbar"
OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')"
if [[ $OPT_TEMP = *'PARSE_OPTIONS FAILED'* ]]; then
# This is a small hack to stop the script bailing with 'set -e'
@@ -1562,8 +1572,8 @@ unset OPT_SHORT OPT_LONG OPT_TEMP
while true; do
case "$1" in
# Pacman Options
- --noconfirm) PACMAN_OPTS="$PACMAN_OPTS --noconfirm" ;;
- --noprogressbar) PACMAN_OPTS="$PACMAN_OPTS --noprogressbar" ;;
+ --noconfirm) PACMAN_OPTS+=" --noconfirm" ;;
+ --noprogressbar) PACMAN_OPTS+=" --noprogressbar" ;;
# Makepkg Options
--allsource) SOURCEONLY=2 ;;
@@ -1719,7 +1729,7 @@ if (( ! INFAKEROOT )); then
plain "$(gettext "Please rerun makepkg without the --asroot flag.")"
exit 1 # $E_USER_ABORT
elif [[ $(check_buildenv fakeroot) = "y" ]] && (( EUID > 0 )); then
- if [ ! $(type -p fakeroot) ]; then
+ if ! type -p fakeroot >/dev/null; then
error "$(gettext "Fakeroot must be installed if using the 'fakeroot' option")"
plain "$(gettext "in the BUILDENV array in %s.")" "$MAKEPKG_CONF"
exit 1
@@ -1739,7 +1749,7 @@ fi
# check for sudo if we will need it during makepkg execution
if (( ! ( ASROOT || INFAKEROOT ) && ( DEP_BIN || RMDEPS || INSTALL ) )); then
- if [ ! "$(type -p sudo)" ]; then
+ if ! type -p sudo >/dev/null; then
warning "$(gettext "Sudo can not be found. Will use su to acquire root privileges.")"
fi
fi
@@ -1795,14 +1805,12 @@ if (( ${#pkgname[@]} > 1 )); then
fi
# test for available PKGBUILD functions
-# The exclamation mark is required here to avoid triggering the ERR trap when
-# a tested function does not exist.
-if [[ $(! type -t build) = "function" ]]; then
+if declare -f build >/dev/null; then
BUILDFUNC=1
fi
-if [ "$(type -t package)" = "function" ]; then
+if declare -f package >/dev/null; then
PKGFUNC=1
-elif [ $SPLITPKG -eq 0 -a "$(type -t package_${pkgname})" = "function" ]; then
+elif [[ $SPLITPKG -eq 0 ]] && declare -f package_${pkgname} >/dev/null; then
SPLITPKG=1
fi
@@ -1875,17 +1883,7 @@ if (( INFAKEROOT )); then
fi
create_package
else
- for pkg in ${pkgname[@]}; do
- pkgdir="$pkgdir/$pkg"
- mkdir -p "$pkgdir"
- chmod a-s "$pkgdir"
- backup_package_variables
- run_package $pkg
- tidy_install
- create_package $pkg
- restore_package_variables
- pkgdir="${pkgdir%/*}"
- done
+ run_split_packaging
fi
msg "$(gettext "Leaving fakeroot environment.")"
@@ -1911,20 +1909,20 @@ if (( NODEPS || ( (NOBUILD || REPKG) && !DEP_BIN ) )); then
if (( NODEPS || ( REPKG && PKGFUNC ) )); then
warning "$(gettext "Skipping dependency checks.")"
fi
-elif [ $(type -p "${PACMAN%% *}") ]; then
+elif type -p "${PACMAN%% *}" >/dev/null; then
if (( RMDEPS )); then
- original_pkglist=($(run_pacman -Qq | sort)) # required by remove_dep
+ original_pkglist=($(run_pacman -Qq)) # required by remove_dep
fi
deperr=0
- msg "$(gettext "Checking Runtime Dependencies...")"
+ msg "$(gettext "Checking runtime dependencies...")"
resolve_deps ${depends[@]} || deperr=1
- msg "$(gettext "Checking Buildtime Dependencies...")"
+ msg "$(gettext "Checking buildtime dependencies...")"
resolve_deps ${makedepends[@]} || deperr=1
if (( RMDEPS )); then
- current_pkglist=($(run_pacman -Qq | sort)) # required by remove_deps
+ current_pkglist=($(run_pacman -Qq)) # required by remove_deps
fi
if (( deperr )); then
@@ -2003,17 +2001,7 @@ else
fi
create_package
else
- for pkg in ${pkgname[@]}; do
- pkgdir="$pkgdir/$pkg"
- mkdir -p "$pkgdir"
- chmod a-s "$pkgdir"
- backup_package_variables
- run_package $pkg
- tidy_install
- create_package $pkg
- restore_package_variables
- pkgdir="${pkgdir%/*}"
- done
+ run_split_packaging
fi
else
if (( ! REPKG && ( PKGFUNC || SPLITPKG ) )); then
diff --git a/scripts/rankmirrors.sh.in b/scripts/rankmirrors.sh.in
index b0dc1ab7..0cd4c083 100644
--- a/scripts/rankmirrors.sh.in
+++ b/scripts/rankmirrors.sh.in
@@ -85,7 +85,7 @@ getfetchurl() {
if [[ -z $reponame || $reponame = $replacedurl ]]; then
echo "fail"
else
- local fetchurl="${replacedurl}/$reponame@DBEXT@"
+ local fetchurl="${replacedurl}/$reponame.db"
echo "$fetchurl"
fi
}