summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
Diffstat (limited to 'scripts')
-rw-r--r--scripts/Makefile.am16
-rw-r--r--scripts/makepkg.sh.in232
-rw-r--r--scripts/repo-add.sh.in21
3 files changed, 155 insertions, 114 deletions
diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index 10e179e1..d6d9bb93 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -37,6 +37,7 @@ edit = sed \
-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|@configure_input[@]|Generated from $@.in; do not edit by hand.|g'
@@ -46,13 +47,14 @@ edit = sed \
# two 'test' lines- make sure we can handle both sh and py type scripts
# third 'test' line- make sure one of the two checks succeeded
$(OURSCRIPTS): Makefile
- rm -f $@ $@.tmp
- test -f $(srcdir)/$@.sh.in && $(edit) $(srcdir)/$@.sh.in >$@.tmp || true
- test -f $(srcdir)/$@.py.in && $(edit) $(srcdir)/$@.py.in >$@.tmp || true
- test -f $@.tmp || false
- chmod +x $@.tmp
- chmod a-w $@.tmp
- mv $@.tmp $@
+ @echo ' ' GEN $@;
+ @rm -f $@ $@.tmp
+ @test -f $(srcdir)/$@.sh.in && $(edit) $(srcdir)/$@.sh.in >$@.tmp || true
+ @test -f $(srcdir)/$@.py.in && $(edit) $(srcdir)/$@.py.in >$@.tmp || true
+ @test -f $@.tmp || false
+ @chmod +x $@.tmp
+ @chmod a-w $@.tmp
+ @mv $@.tmp $@
makepkg: $(srcdir)/makepkg.sh.in
pacman-optimize: $(srcdir)/pacman-optimize.sh.in
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index 04d2aca1..3e0781f5 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -38,11 +38,13 @@ export COMMAND_MODE='legacy'
myver='@PACKAGE_VERSION@'
confdir='@sysconfdir@'
+BUILDSCRIPT='@BUILDSCRIPT@'
startdir="$PWD"
srcdir="$startdir/src"
pkgdir="$startdir/pkg"
-known_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'ccache' 'distcc' 'makeflags' 'force')
-readonly -a known_options
+packaging_options=('strip' 'docs' 'libtool' 'emptydirs' 'zipman' 'purge')
+other_options=('ccache' 'distcc' 'makeflags' 'force')
+readonly -a packaging_options other_options
# Options
ASROOT=0
@@ -278,7 +280,7 @@ get_downloadclient() {
# if we didn't find an agent, return an error
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...")"
exit 1 # $E_CONFIG_ERROR
fi
@@ -488,6 +490,11 @@ generate_checksums() {
msg "$(gettext "Generating checksums for source files...")"
plain ""
+ if [ ! $(type -p openssl) ]; then
+ error "$(gettext "Cannot find openssl.")"
+ exit 1 # $E_MISSING_PROGRAM
+ fi
+
local integ
for integ in ${INTEGRITY_CHECK[@]}; do
integ="$(echo $integ | tr '[:upper:]' '[:lower:]')"
@@ -498,11 +505,6 @@ generate_checksums() {
exit 1;; # $E_CONFIG_ERROR
esac
- if [ ! $(type -p openssl) ]; then
- error "$(gettext "Cannot find openssl.")"
- exit 1 # $E_MISSING_PROGRAM
- fi
-
local ct=0
local numsrc=${#source[@]}
echo -n "${integ}sums=("
@@ -540,21 +542,13 @@ generate_checksums() {
}
check_checksums() {
- local integ
- for integ in ${INTEGRITY_CHECK[@]}; do
- integ="$(echo $integ | tr '[:upper:]' '[:lower:]')"
- case "$integ" in
- md5|sha1|sha256|sha384|sha512) : ;;
- *)
- error "$(gettext "Invalid integrity algorithm '%s' specified")" "$integ"
- exit 1;; # $E_CONFIG_ERROR
- esac
-
- if [ ! $(type -p openssl) ]; then
- error "$(gettext "Cannot find openssl.")"
- exit 1 # $E_MISSING_PROGRAM
- fi
+ if [ ! $(type -p openssl) ]; then
+ error "$(gettext "Cannot find openssl.")"
+ exit 1 # $E_MISSING_PROGRAM
+ fi
+ local integ required
+ for integ in md5 sha1 sha256 sha384 sha512; do
local integrity_sums=($(eval echo "\${${integ}sums[@]}"))
if [ ${#integrity_sums[@]} -eq ${#source[@]} ]; then
msg "$(gettext "Validating source files with %s...")" "${integ}sums"
@@ -592,7 +586,13 @@ check_checksums() {
exit 1 # TODO: error code
fi
else
- warning "$(gettext "Integrity checks (%s) are missing or incomplete.")" "$integ"
+ for required in ${INTEGRITY_CHECK[@]}; do
+ required="$(echo $required | tr '[:upper:]' '[:lower:]')"
+ if [ "$integ" = "$required" ]; then
+ warning "$(gettext "Integrity checks (%s) are missing or incomplete.")" "$integ"
+ break
+ fi
+ done
fi
done
}
@@ -674,7 +674,7 @@ run_build() {
cd "$srcdir"
# ensure all necessary build variables are exported
- export CFLAGS CXXFLAGS MAKEFLAGS CHOST
+ export CFLAGS CXXFLAGS MAKEFLAGS LDFLAGS CHOST
# save our shell options so build() can't override what we need
local shellopts=$(shopt -p)
@@ -713,16 +713,31 @@ tidy_install() {
msg "$(gettext "Tidying install...")"
if [ "$(check_option docs)" = "n" ]; then
- msg2 "$(gettext "Removing info/doc files...")"
+ msg2 "$(gettext "Removing doc files...")"
#fix flyspray bug #5021
rm -rf ${DOC_DIRS[@]}
fi
+ if [ "$(check_option purge)" = "y" -a -n "PURGE_TARGETS" ]; then
+ msg2 "$(gettext "Removing pugre targets...")"
+ local pt
+ for pt in "${PURGE_TARGETS[@]}"; do
+ if [ "${pt}" == "${pt//\/}" ]; then
+ find . -type f -name "${pt}" -exec rm -f -- '{}' \;
+ else
+ rm -f ${pt}
+ fi
+ done
+ fi
+
if [ "$(check_option zipman)" = "y" ]; then
- msg2 "$(gettext "Compressing man pages...")"
- local manpage mandirs ext file link hardlinks hl
- mandirs="usr/man usr/share/man usr/local/man usr/local/share/man opt/*/man"
- find ${mandirs} -type f 2>/dev/null |
+ msg2 "$(gettext "Compressing man and info pages...")"
+ local manpage ext file link hardlinks hl
+ if [ -z "${MAN_DIRS[*]}" ]; then
+ # fall back to default value
+ MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
+ fi
+ find ${MAN_DIRS[@]} -type f 2>/dev/null |
while read manpage ; do
# check file still exists (potentially compressed with hard link)
if [ -f ${manpage} ]; then
@@ -730,7 +745,7 @@ tidy_install() {
file="${manpage##*/}"
if [ "$ext" != "gz" -a "$ext" != "bz2" ]; then
# update symlinks to this manpage
- find ${mandirs} -lname "$file" 2>/dev/null |
+ find ${MAN_DIRS[@]} -lname "$file" 2>/dev/null |
while read link ; do
rm -f "$link"
ln -sf "${file}.gz" "${link}.gz"
@@ -738,7 +753,7 @@ tidy_install() {
# find hard links and remove them
# the '|| true' part keeps the script from bailing if find returned an
# error, such as when one of the man directories doesn't exist
- hardlinks="$(find ${mandirs} \! -name "$file" -samefile "$manpage" 2>/dev/null)" || true
+ hardlinks="$(find ${MAN_DIRS[@]} \! -name "$file" -samefile "$manpage" 2>/dev/null)" || true
for hl in ${hardlinks}; do
rm -f "${hl}";
done
@@ -754,7 +769,6 @@ tidy_install() {
done
fi
-
if [ "$(check_option strip)" = "y" ]; then
msg2 "$(gettext "Stripping debugging symbols from binaries and libraries...")"
local binary
@@ -850,6 +864,16 @@ create_package() {
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
+ else
+ echo "makepkgopt = !$it" >>.PKGINFO
+ fi
+ fi
+ done
# TODO maybe remove this at some point
# warn if license array is not present or empty
@@ -877,13 +901,21 @@ create_package() {
# tar it up
msg2 "$(gettext "Compressing package...")"
+ local TAR_OPT
+ case "$PKGEXT" in
+ *tar.gz) TAR_OPT="z" ;;
+ *tar.bz2) TAR_OPT="j" ;;
+ *) warning "$(gettext "'%s' is not a valid archive extension.")" \
+ "$PKGEXT" ;;
+ esac
+
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}"
# when fileglobbing, we want * in an empty directory to expand to
# the null string rather than itself
shopt -s nullglob
- if ! bsdtar -czf "$pkg_file" $comp_files *; then
+ if ! bsdtar -c${TAR_OPT}f "$pkg_file" $comp_files *; then
error "$(gettext "Failed to create package file.")"
exit 1 # TODO: error code
fi
@@ -998,12 +1030,20 @@ create_srcpackage() {
fi
done
+ local TAR_OPT
+ case "$SRCEXT" in
+ *tar.gz) TAR_OPT="z" ;;
+ *tar.bz2) TAR_OPT="j" ;;
+ *) warning "$(gettext "'%s' is not a valid archive extension.")" \
+ "$SRCEXT" ;;
+ esac
+
local pkg_file="$PKGDEST/${pkgname}-${pkgver}-${pkgrel}${SRCEXT}"
# tar it up
msg2 "$(gettext "Compressing source package...")"
cd "${srclinks}"
- if ! bsdtar -czLf "$pkg_file" ${pkgname}; then
+ if ! bsdtar -c${TAR_OPT}Lf "$pkg_file" ${pkgname}; then
error "$(gettext "Failed to create source package file.")"
exit 1 # TODO: error code
fi
@@ -1027,6 +1067,10 @@ devel_check() {
if [ "$HOLDVER" = "1" ]; then
return
fi
+ # Cannot update pkgver/pkgrel if reading PKGBUILD from pipe
+ if [ ! -f "./$BUILDSCRIPT" ]; then
+ return
+ fi
if [ "$FORCE_VER" = "" ]; then
# Check if this is a svn/cvs/etc PKGBUILD; set $newpkgver if so.
# This will only be used on the first call to makepkg; subsequent
@@ -1094,9 +1138,11 @@ devel_update() {
#
if [ "$newpkgver" != "" ]; then
if [ "$newpkgver" != "$pkgver" ]; then
- sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "./$BUILDSCRIPT"
- sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" "./$BUILDSCRIPT"
- source "$BUILDSCRIPT"
+ if [ -f "./$BUILDSCRIPT" ]; then
+ sed -i "s/^pkgver=[^ ]*/pkgver=$newpkgver/" "./$BUILDSCRIPT"
+ sed -i "s/^pkgrel=[^ ]*/pkgrel=1/" "./$BUILDSCRIPT"
+ source "$BUILDSCRIPT"
+ fi
fi
fi
}
@@ -1197,6 +1243,7 @@ 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")"
@@ -1244,36 +1291,12 @@ fi
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.
OPT_SHORT="AbcCdefFghiLmop:rRsV"
OPT_LONG="allsource,asroot,ignorearch,builddeps,clean,cleancache,nodeps"
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,syncdeps,version"
+OPT_LONG="$OPT_LONG,syncdeps,version,config:"
# Pacman Options
OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')"
@@ -1296,6 +1319,7 @@ while true; do
-A|--ignorearch) IGNOREARCH=1 ;;
-c|--clean) CLEANUP=1 ;;
-C|--cleancache) CLEANCACHE=1 ;;
+ --config) shift; MAKEPKG_CONF=$1 ;;
-d|--nodeps) NODEPS=1 ;;
-e|--noextract) NOEXTRACT=1 ;;
-f|--force) FORCE=1 ;;
@@ -1323,6 +1347,34 @@ while true; do
shift
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
# The '\\0' is here to prevent gettext from thinking --holdver is an option
error "$(gettext "\\0--holdver and --forcever cannot both be specified" )"
@@ -1354,14 +1406,14 @@ if [ "$CLEANCACHE" = "1" ]; then
fi
else
# $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.")"
exit 1
fi
fi
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
fi
@@ -1380,13 +1432,13 @@ if [ "$INFAKEROOT" = "0" ]; then
elif [ "$(check_buildenv fakeroot)" = "y" -a $EUID -gt 0 ]; then
if [ ! $(type -p fakeroot) ]; then
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
fi
elif [ $EUID -gt 0 ]; then
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 %s.")" "$MAKEPKG_CONF"
sleep 1
fi
else
@@ -1412,8 +1464,19 @@ unset replaces depends conflicts backup source install build makedepends
unset optdepends options noextract
if [ ! -f "$BUILDSCRIPT" ]; then
- error "$(gettext "%s does not exist.")" "$BUILDSCRIPT"
- exit 1
+ if [ -t 0 ]; then
+ error "$(gettext "%s does not exist.")" "$BUILDSCRIPT"
+ exit 1
+ else
+ # PKGBUILD passed through a pipe
+ BUILDSCRIPT=/dev/stdin
+ fi
+else
+ crlftest=$(file $BUILDSCRIPT | grep -F 'CRLF' || true)
+ if [ "$crlftest" != "" ]; then
+ error "$(gettext "%s contains CRLF characters and cannot be sourced.")" "$BUILDSCRIPT"
+ exit 1
+ fi
fi
source "$BUILDSCRIPT"
@@ -1458,10 +1521,6 @@ if ! in_array $CARCH ${arch[@]}; then
plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
plain "$(gettext "such as arch=('%s').")" "$CARCH"
exit 1
- else
- warning "$(gettext "%s is not available for the '%s' architecture.")" "$pkgname" "$CARCH"
- plain "$(gettext "Note that many packages may need a line added to their %s")" "$BUILDSCRIPT"
- plain "$(gettext "such as arch=('%s').")" "$CARCH"
fi
fi
@@ -1482,7 +1541,7 @@ valid_options=1
for opt in ${options[@]}; do
known=0
# check if option matches a known option or its inverse
- for kopt in ${known_options[@]}; do
+ for kopt in ${packaging_options[@]} ${other_options[@]}; do
if [ "${opt}" = "${kopt}" -o "${opt}" = "!${kopt}" ]; then
known=1
fi
@@ -1517,11 +1576,8 @@ if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}-${CARCH}${PKGEXT}" \
fi
# Run the bare minimum in fakeroot
-# fix flyspray bug 6208 -- using makepkg with fakeroot gives an error
if [ "$INFAKEROOT" = "1" ]; then
- if [ "$REPKG" = "1" ]; then
- warning "$(gettext "Skipping build.")"
- else
+ if [ "$REPKG" = "0" ]; then
run_build
tidy_install
fi
@@ -1534,10 +1590,6 @@ fi
msg "$(gettext "Making package: %s")" "$pkgname $pkgver-$pkgrel $CARCH ($(date))"
-if [ $EUID -eq 0 ]; then
- warning "$(gettext "Running makepkg as root...")"
-fi
-
# if we are creating a source-only package, go no further
if [ "$SOURCEONLY" != "0" ]; then
if [ -f "$PKGDEST/${pkgname}-${pkgver}-${pkgrel}${SRCEXT}" \
@@ -1552,10 +1604,10 @@ fi
# fix flyspray bug #5973
if [ "$NODEPS" = "1" -o "$NOBUILD" = "1" -o "$REPKG" = "1" ]; then
+ # no warning message needed for nobuild, repkg
if [ "$NODEPS" = "1" ]; then
warning "$(gettext "Skipping dependency checks.")"
fi
- # skip printing a warning message for the others: nobuild, repkg
elif [ $(type -p pacman) ]; then
unset pkgdeps # Set by resolve_deps() and used by remove_deps()
deperr=0
@@ -1581,7 +1633,7 @@ umask 0022
mkdir -p "$srcdir"
cd "$srcdir"
-if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
+if [ "$NOEXTRACT" = "1" ]; then
warning "$(gettext "Skipping source retrieval -- using existing src/ tree")"
warning "$(gettext "Skipping source integrity checks -- using existing src/ tree")"
warning "$(gettext "Skipping source extraction -- using existing src/ tree")"
@@ -1590,11 +1642,11 @@ if [ "$NOEXTRACT" = "1" -o "$REPKG" = "1" ]; then
error "$(gettext "The source directory is empty, there is nothing to build!")"
plain "$(gettext "Aborting...")"
exit 1
- elif [ "$REPKG" = "1" -a \( ! -d "$pkgdir" -o "$(ls "$pkgdir" 2>/dev/null)" = "" \) ]; then
- error "$(gettext "The package directory is empty, there is nothing to repackage!")"
- plain "$(gettext "Aborting...")"
- exit 1
fi
+elif [ "$REPKG" = "1" -a \( ! -d "$pkgdir" -o "$(ls "$pkgdir" 2>/dev/null)" = "" \) ]; then
+ error "$(gettext "The package directory is empty, there is nothing to repackage!")"
+ plain "$(gettext "Aborting...")"
+ exit 1
else
download_sources
check_checksums
@@ -1613,11 +1665,9 @@ else
mkdir -p "$pkgdir"
cd "$startdir"
+ # if we are root or if fakeroot is not enabled, then we don't use it
if [ "$(check_buildenv fakeroot)" != "y" -o $EUID -eq 0 ]; then
- # if we are root or if fakeroot is not enabled, then we don't use it
- if [ "$REPKG" = "1" ]; then
- warning "$(gettext "Skipping build.")"
- else
+ if [ "$REPKG" = "0" ]; then
devel_update
run_build
tidy_install
diff --git a/scripts/repo-add.sh.in b/scripts/repo-add.sh.in
index be0859ea..4f9639ca 100644
--- a/scripts/repo-add.sh.in
+++ b/scripts/repo-add.sh.in
@@ -305,18 +305,6 @@ else
exit 1 # $E_MISSING_PROGRAM
fi
-# source system and user makepkg.conf
-if [ -r "$confdir/makepkg.conf" ]; then
- source "$confdir/makepkg.conf"
-else
- error "$(gettext "%s not found. Cannot continue.")" "$confdir/makepkg.conf"
- exit 1 # $E_CONFIG_ERROR
-fi
-
-if [ -r ~/.makepkg.conf ]; then
- source ~/.makepkg.conf
-fi
-
# main routine
gstmpdir=$(mktemp -d /tmp/repo-tools.XXXXXXXXXX) || (\
error "$(gettext "Cannot create temp directory for database building.")"; \
@@ -387,10 +375,11 @@ if [ $success -eq 1 ]; then
[ -f "${REPO_DB_FILE}.old" ] && rm "${REPO_DB_FILE}.old"
[ -f "$REPO_DB_FILE" ] && mv "$REPO_DB_FILE" "${REPO_DB_FILE}.old"
- case "$DB_COMPRESSION" in
- gz) TAR_OPT="z" ;;
- bz2) TAR_OPT="j" ;;
- *) warning "$(gettext "No compression set.")" ;;
+ case "$REPO_DB_FILE" in
+ *tar.gz) TAR_OPT="z" ;;
+ *tar.bz2) TAR_OPT="j" ;;
+ *) warning "$(gettext "'%s' does not have a valid archive extension.")" \
+ "$REPO_DB_FILE" ;;
esac
bsdtar -c${TAR_OPT}f "$REPO_DB_FILE" *