summaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2009-09-06 15:54:11 -0500
committerDan McGee <dan@archlinux.org>2009-09-06 15:54:11 -0500
commitb9dd8ce2334daea7e3949370c17c64e973b7c6db (patch)
treeb7a5a48da1764b93a69133a5ffbdb83dbb0c9be7 /scripts
parent65c1f06be5a9c4bdb197b61563da7c2e28162392 (diff)
parent1e51b81c6392125899c94761b5aa35bb6a0e032c (diff)
downloadpacman-b9dd8ce2334daea7e3949370c17c64e973b7c6db.tar.xz
Merge branch 'maint'
Diffstat (limited to 'scripts')
-rw-r--r--scripts/makepkg.sh.in62
1 files changed, 42 insertions, 20 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index daa95856..8bf39efa 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1,6 +1,6 @@
#!/bin/bash -e
#
-# makepkg - make packages compatable for use with pacman
+# makepkg - make packages compatible for use with pacman
# @configure_input@
#
# Copyright (c) 2006-2009 Pacman Development Team <pacman-dev@archlinux.org>
@@ -58,6 +58,7 @@ DEP_BIN=0
FORCE=0
INFAKEROOT=0
GENINTEG=0
+SKIPINTEG=0
INSTALL=0
NOBUILD=0
NODEPS=0
@@ -177,7 +178,7 @@ clean_up() {
trap 'clean_up' 0
trap 'trap_exit "$(gettext "TERM signal caught. Exiting...")"' TERM HUP QUIT
trap 'trap_exit "$(gettext "Aborted by user! Exiting...")"' INT
-trap 'trap_exit "$(gettext "An unknown error has occured. Exiting...")"' ERR
+trap 'trap_exit "$(gettext "An unknown error has occurred. Exiting...")"' ERR
# a source entry can have two forms :
# 1) "filename::http://path/to/file"
@@ -187,11 +188,11 @@ trap 'trap_exit "$(gettext "An unknown error has occured. Exiting...")"' ERR
get_filename() {
# if a filename is specified, use it
local filename=$(echo $1 | sed 's|::.*||')
- # if it is just an url, we only keep the last component
+ # if it is just an URL, we only keep the last component
echo "$filename" | sed 's|^.*://.*/||g'
}
-# extract the url from a source entry
+# extract the URL from a source entry
get_url() {
# strip an eventual filename
echo $1 | sed 's|.*::||'
@@ -278,7 +279,7 @@ in_array() {
}
get_downloadclient() {
- # $1 = url with valid protocol prefix
+ # $1 = URL with valid protocol prefix
local url=$1
local proto=$(echo "$url" | sed 's|://.*||')
@@ -314,11 +315,11 @@ get_downloadclient() {
download_file() {
# download command
local dlcmd=$1
- # url of the file
+ # URL of the file
local url=$2
# destination file
local file=$3
- # temporary download file, default to last component of the url
+ # temporary download file, default to last component of the URL
local dlfile=$(echo "$url" | sed 's|^.*://.*/||g')
# replace %o by the temporary dlfile if it exists
@@ -326,7 +327,7 @@ download_file() {
dlcmd=${dlcmd//\%o/\"$file.part\"}
dlfile="$file.part"
fi
- # add the url, either in place of %u or at the end
+ # add the URL, either in place of %u or at the end
if echo "$dlcmd" | grep -q "%u" ; then
dlcmd=${dlcmd//\%u/\"$url\"}
else
@@ -613,8 +614,12 @@ check_checksums() {
done
if [ $correlation -eq 0 ]; then
- error "$(gettext "Integrity checks are missing.")"
- exit 1 # TODO: error code
+ if [ $SKIPINTEG -eq 1 ]; then
+ warning "$(gettext "Integrity checks are missing.")"
+ else
+ error "$(gettext "Integrity checks are missing.")"
+ exit 1 # TODO: error code
+ fi
fi
}
@@ -641,16 +646,26 @@ extract_sources() {
# fix flyspray #6246
local file_type=$(file -bizL "$file")
+ local ext=${file##*.}
local cmd=''
case "$file_type" in
*application/x-tar*|*application/zip*|*application/x-zip*|*application/x-cpio*)
- cmd="bsdtar -x -f" ;;
+ cmd="bsdtar" ;;
*application/x-gzip*)
- cmd="gunzip -d -f" ;;
+ case "$ext" in
+ gz|z|Z) cmd="gzip" ;;
+ *) continue;;
+ esac ;;
*application/x-bzip*)
- cmd="bunzip2 -f" ;;
+ case "$ext" in
+ bz2|bz) cmd="bzip2" ;;
+ *) continue;;
+ esac ;;
*application/x-xz*)
- cmd="xz -d -f" ;;
+ case "$ext" in
+ xz) cmd="xz" ;;
+ *) continue;;
+ esac ;;
*)
# Don't know what to use to extract this file,
# skip to the next file
@@ -658,8 +673,13 @@ extract_sources() {
esac
local ret=0
- msg2 '%s' "$cmd \"$file\""
- $cmd "$file" || ret=$?
+ msg2 "$(gettext "extracting %s with %s")" "$file" "$cmd"
+ if [ "$cmd" = "bsdtar" ]; then
+ $cmd -xf "$file" || ret=?
+ else
+ rm -f "${file%.*}"
+ $cmd -dcf "$file" > "${file%.*}" || ret=?
+ fi
if [ $ret -ne 0 ]; then
error "$(gettext "Failed to extract %s")" "$file"
plain "$(gettext "Aborting...")"
@@ -766,7 +786,7 @@ run_package() {
mv "$BUILDLOG" "$BUILDLOG.$i"
fi
- # ensure overridden package variables suvrive tee with split packages
+ # ensure overridden package variables survive tee with split packages
logpipe=$(mktemp -u "$startdir/logpipe.XXXXXXXX")
mknod "$logpipe" p
exec 3>&1
@@ -849,7 +869,7 @@ tidy_install() {
local binary
find ${STRIP_DIRS[@]} -type f 2>/dev/null | while read binary ; do
case "$(file -biz "$binary")" in
- *compressed-encoding*) # Skip compressed binarys
+ *compressed-encoding*) # Skip compressed binaries
;;
*application/x-sharedlib*) # Libraries (.so)
/usr/bin/strip -S "$binary";;
@@ -1399,6 +1419,7 @@ usage() {
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")"
@@ -1447,8 +1468,8 @@ ARGLIST=$@
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,rmdeps,repackage,source"
-OPT_LONG="$OPT_LONG,syncdeps,version,config:"
+OPT_LONG="$OPT_LONG,install,log,nocolor,nobuild,rmdeps,repackage,skipinteg"
+OPT_LONG="$OPT_LONG,source,syncdeps,version,config:"
# Pacman Options
OPT_LONG="$OPT_LONG,noconfirm,noprogressbar"
OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@" || echo 'PARSE_OPTIONS FAILED')"
@@ -1487,6 +1508,7 @@ while true; do
-p) shift; BUILDFILE=$1 ;;
-r|--rmdeps) RMDEPS=1 ;;
-R|--repackage) REPKG=1 ;;
+ --skipinteg) SKIPINTEG=1 ;;
--source) SOURCEONLY=1 ;;
-s|--syncdeps) DEP_BIN=1 ;;