summaryrefslogtreecommitdiffstats
path: root/scripts/makepkg.sh.in
diff options
context:
space:
mode:
authorAllan McRae <allan@archlinux.org>2015-05-17 14:57:44 +0200
committerAllan McRae <allan@archlinux.org>2015-05-19 15:43:00 +0200
commit1a17249159d2425dfd5103b8699673f72394a385 (patch)
treeaf92d99475be9f34511dc751b589f8fe62baf604 /scripts/makepkg.sh.in
parent366adc3bb07f0082c8417e60fe7fc41fff211123 (diff)
downloadpacman-1a17249159d2425dfd5103b8699673f72394a385.tar.gz
pacman-1a17249159d2425dfd5103b8699673f72394a385.tar.xz
libmakepkg: extract functions for handling source URLs
Signed-off-by: Allan McRae <allan@archlinux.org>
Diffstat (limited to 'scripts/makepkg.sh.in')
-rw-r--r--scripts/makepkg.sh.in119
1 files changed, 0 insertions, 119 deletions
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index cc1fea49..140bb1a2 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -170,130 +170,11 @@ clean_up() {
remove_deps
}
-
enter_fakeroot() {
msg "$(gettext "Entering %s environment...")" "fakeroot"
fakeroot -- $0 -F "${ARGLIST[@]}" || exit $?
}
-
-# a source entry can have two forms :
-# 1) "filename::http://path/to/file"
-# 2) "http://path/to/file"
-
-# Return the absolute filename of a source entry
-get_filepath() {
- local file="$(get_filename "$1")"
- local proto="$(get_protocol "$1")"
-
- case $proto in
- bzr*|git*|hg*|svn*)
- if [[ -d "$startdir/$file" ]]; then
- file="$startdir/$file"
- elif [[ -d "$SRCDEST/$file" ]]; then
- file="$SRCDEST/$file"
- else
- return 1
- fi
- ;;
- *)
- if [[ -f "$startdir/$file" ]]; then
- file="$startdir/$file"
- elif [[ -f "$SRCDEST/$file" ]]; then
- file="$SRCDEST/$file"
- else
- return 1
- fi
- ;;
- esac
-
- printf "%s\n" "$file"
-}
-
-# extract the filename from a source entry
-get_filename() {
- local netfile=$1
-
- # if a filename is specified, use it
- if [[ $netfile = *::* ]]; then
- printf "%s\n" ${netfile%%::*}
- return
- fi
-
- local proto=$(get_protocol "$netfile")
-
- case $proto in
- bzr*|git*|hg*|svn*)
- filename=${netfile%%#*}
- filename=${filename%/}
- filename=${filename##*/}
- if [[ $proto = bzr* ]]; then
- filename=${filename#*lp:}
- fi
- if [[ $proto = git* ]]; then
- filename=${filename%%.git*}
- fi
- ;;
- *)
- # if it is just an URL, we only keep the last component
- filename="${netfile##*/}"
- ;;
- esac
- printf "%s\n" "${filename}"
-}
-
-# extract the URL from a source entry
-get_url() {
- # strip an eventual filename
- printf "%s\n" "${1#*::}"
-}
-
-# extract the protocol from a source entry - return "local" for local sources
-get_protocol() {
- if [[ $1 = *://* ]]; then
- # strip leading filename
- local proto="${1#*::}"
- printf "%s\n" "${proto%%://*}"
- elif [[ $1 = *lp:* ]]; then
- local proto="${1#*::}"
- printf "%s\n" "${proto%%lp:*}"
- else
- printf "%s\n" local
- fi
-}
-
-get_downloadclient() {
- local proto=$1
-
- # loop through DOWNLOAD_AGENTS variable looking for protocol
- local i
- for i in "${DLAGENTS[@]}"; do
- local handler="${i%%::*}"
- if [[ $proto = "$handler" ]]; then
- local agent="${i#*::}"
- break
- fi
- done
-
- # if we didn't find an agent, return an error
- if [[ -z $agent ]]; then
- error "$(gettext "Unknown download protocol: %s")" "$proto"
- plain "$(gettext "Aborting...")"
- exit 1 # $E_CONFIG_ERROR
- fi
-
- # ensure specified program is installed
- local program="${agent%% *}"
- if [[ ! -x $program ]]; then
- local baseprog="${program##*/}"
- error "$(gettext "The download program %s is not installed.")" "$baseprog"
- plain "$(gettext "Aborting...")"
- exit 1 # $E_MISSING_PROGRAM
- fi
-
- printf "%s\n" "$agent"
-}
-
download_local() {
local netfile=$1
local filepath=$(get_filepath "$netfile")