[pacman-dev] [PATCH] makepkg: separate dl and extract for vcs sources
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent. Signed-off-by: William Giokas <1007380@gmail.com> --- This isn't really needed, I know, but it would facilitate the --verify function skipping the extraction/cloning of vcs sources while still downloading/updateing them. Using `download_sources fast` would make sense to me to skip the version updating, as that will fail without any $srcdir/. scripts/makepkg.sh.in | 375 ++++++++++++++++++++++++++++---------------------- 1 file changed, 212 insertions(+), 163 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index bd29d73..60bf81a 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -431,28 +431,11 @@ download_bzr() { warning "$(gettext "Failure while pulling %s")" "${displaylocation}" fi fi - - msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr" - pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - if ! bzr checkout "$dir" --lightweight; then - error "$(gettext "Failure while creating working copy of %s %s repo")" "${dir}" "bzr" - plain "$(gettext "Aborting...")" - exit 1 - fi - - popd &>/dev/null } download_git() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -485,54 +468,11 @@ download_git() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git" fi fi - - msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" - pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - if ! git clone "$dir"; then - error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" - plain "$(gettext "Aborting...")" - exit 1 - fi - - cd_safe "${dir##*/}" - - local ref - if [[ -n $fragment ]]; then - case ${fragment%%=*} in - commit|tag) - ref=${fragment##*=} - ;; - branch) - ref=origin/${fragment##*=} - ;; - *) - error "$(gettext "Unrecognized reference: %s")" "${fragment}" - plain "$(gettext "Aborting...")" - exit 1 - esac - fi - - if [[ -n $ref ]]; then - if ! git checkout -b makepkg $ref; then - error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" - plain "$(gettext "Aborting...")" - exit 1 - fi - fi - - popd &>/dev/null } download_hg() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -558,41 +498,11 @@ download_hg() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg" fi fi - - msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" - pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - local ref - if [[ -n $fragment ]]; then - case ${fragment%%=*} in - branch|revision|tag) - ref=('-u' "${fragment##*=}") - ;; - *) - error "$(gettext "Unrecognized reference: %s")" "${fragment}" - plain "$(gettext "Aborting...")" - exit 1 - esac - fi - - if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then - error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg" - plain "$(gettext "Aborting...")" - exit 1 - fi - - popd &>/dev/null } download_svn() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -620,30 +530,6 @@ download_svn() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn" fi fi - - msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" - pushd "$srcdir" &>/dev/null - rm -rf "${dir##*/}" - - local ref - if [[ -n $fragment ]]; then - case ${fragment%%=*} in - revision) - ref=('-r' "${fragment##*=}") - ;; - *) - error "$(gettext "Unrecognized reference: %s")" "${fragment}" - plain "$(gettext "Aborting...")" - exit 1 - esac - fi - - if ! svn export ${ref[@]} "$dir"; then - error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn" - plain "$(gettext "Aborting...")" - fi - - popd &>/dev/null } download_sources() { @@ -1222,63 +1108,195 @@ check_source_integrity() { fi } -extract_sources() { - msg "$(gettext "Extracting sources...")" - local netfile - for netfile in "${source[@]}"; do - 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 - continue - fi +extract_bzr() { + local netfile=$1 + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr" + pushd "$srcdir" &>/dev/null + rm -rf "${dir##*/}" + + if ! bzr checkout "$dir" --lightweight; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${dir}" "bzr" + plain "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} + +extract_git() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + msg "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" + pushd "$srcdir" &>/dev/null + rm -rf "${dir##*/}" - # 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" ;; - *application/x-gzip*) - case "$ext" in - gz|z|Z) cmd="gzip" ;; - *) continue;; - esac ;; - *application/x-bzip*) - case "$ext" in - bz2|bz) cmd="bzip2" ;; - *) continue;; - esac ;; - *application/x-xz*) - case "$ext" in - xz) cmd="xz" ;; - *) continue;; - esac ;; + if ! git clone "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" + plain "$(gettext "Aborting...")" + exit 1 + fi + + cd_safe "${dir##*/}" + + local ref + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + commit|tag) + ref=${fragment##*=} + ;; + branch) + ref=origin/${fragment##*=} + ;; *) - # See if bsdtar can recognize the file - if bsdtar -tf "$file" -q '*' &>/dev/null; then - cmd="bsdtar" - else - continue - fi ;; + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plain "$(gettext "Aborting...")" + exit 1 esac + fi - local ret=0 - 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 )); then - error "$(gettext "Failed to extract %s")" "$file" + if [[ -n $ref ]]; then + if ! git checkout -b makepkg $ref; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "git" plain "$(gettext "Aborting...")" exit 1 fi - done + fi + + popd &>/dev/null +} + +extract_hg() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" + pushd "$srcdir" &>/dev/null + rm -rf "${dir##*/}" + + local ref + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + branch|revision|tag) + ref=('-u' "${fragment##*=}") + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plain "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! hg clone "${ref[@]}" "$dir" "${dir##*/}"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "hg" + plain "$(gettext "Aborting...")" + exit 1 + fi + + popd &>/dev/null +} + +extract_svn() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" + pushd "$srcdir" &>/dev/null + rm -rf "${dir##*/}" + + local ref + if [[ -n $fragment ]]; then + case ${fragment%%=*} in + revision) + ref=('-r' "${fragment##*=}") + ;; + *) + error "$(gettext "Unrecognized reference: %s")" "${fragment}" + plain "$(gettext "Aborting...")" + exit 1 + esac + fi + + if ! svn export ${ref[@]} "$dir"; then + error "$(gettext "Failure while creating working copy of %s %s repo")" "${repo}" "svn" + plain "$(gettext "Aborting...")" + fi + + popd &>/dev/null +} + +extract_file() { + local file=$1 + + # 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" ;; + *application/x-gzip*) + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; + *application/x-bzip*) + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; + *application/x-xz*) + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; + *) + # See if bsdtar can recognize the file + if bsdtar -tf "$file" -q '*' &>/dev/null; then + cmd="bsdtar" + else + continue + fi ;; + esac + + local ret=0 + 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 )); then + error "$(gettext "Failed to extract %s")" "$file" + plain "$(gettext "Aborting...")" + exit 1 + fi if (( EUID == 0 )); then # change perms of all source files to root user & root group @@ -1286,6 +1304,37 @@ extract_sources() { fi } +extract_sources() { + msg "$(gettext "Preparing sources...")" + local netfile + for netfile in "${source[@]}"; do + 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 + continue + fi + local proto=$(get_protocol "$netfile") + case "$proto" in + bzr*) + extract_bzr "$netfile" + ;; + git*) + extract_git "$netfile" + ;; + hg*) + extract_hg "$netfile" + ;; + svn*) + extract_svn "$netfile" + ;; + *) + extract_file "$file" + ;; + esac + done +} + error_function() { if [[ -p $logpipe ]]; then rm "$logpipe" -- 1.8.2.rc0.22.gb3600c3
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent. Signed-off-by: William Giokas <1007380@gmail.com> --- Instead of separating out the extract functions into a separate part of makepkg, I just grouped them with the download_* functions. Saved quite a few deletions. scripts/makepkg.sh.in | 253 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 188 insertions(+), 65 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c9661e9..58c403e 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -379,6 +379,59 @@ download_file() { ln -s "$SRCDEST/$filename" "$srcdir/" } +extract_file() { + local file=$1 + # 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" ;; + *application/x-gzip*) + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; + *application/x-bzip*) + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; + *application/x-xz*) + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; + *) + # See if bsdtar can recognize the file + if bsdtar -tf "$file" -q '*' &>/dev/null; then + cmd="bsdtar" + else + continue + fi ;; + esac + + local ret=0 + 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 )); then + error "$(gettext "Failed to extract %s")" "$file" + plain "$(gettext "Aborting...")" + exit 1 + fi + + if (( EUID == 0 )); then + # change perms of all source files to root user & root group + chown -R 0:0 "$srcdir" + fi +} + download_bzr() { local netfile=$1 @@ -386,11 +439,6 @@ download_bzr() { url=${url##*bzr+} url=${url%%#*} - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local displaylocation="$url" local revision=('-r-1') @@ -431,6 +479,18 @@ download_bzr() { warning "$(gettext "Failure while pulling %s")" "${displaylocation}" fi fi +} + +extract_bzr() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr" pushd "$srcdir" &>/dev/null @@ -448,11 +508,6 @@ download_bzr() { download_git() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -485,6 +540,22 @@ download_git() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git" fi fi +} + +extract_git() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local repo=${netfile##*/} + repo=${repo%%#*} + repo=${repo%%.git*} + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null @@ -528,11 +599,6 @@ download_git() { download_hg() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -558,6 +624,21 @@ download_hg() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg" fi fi +} + +extract_hg() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null @@ -620,6 +701,21 @@ download_svn() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn" fi fi +} + +extract_svn() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null @@ -682,12 +778,6 @@ download_sources() { esac done - if (( PKGVERFUNC && GET_VCS )); then - update_pkgver - check_pkgver || exit 1 - check_build_status - fi - popd &>/dev/null } @@ -1224,6 +1314,12 @@ check_source_integrity() { extract_sources() { msg "$(gettext "Extracting sources...")" + + local GET_VCS=1 + if [[ $1 == "fast" ]]; then + GET_VCS=0 + fi + local netfile for netfile in "${source[@]}"; do local file=$(get_filename "$netfile") @@ -1232,54 +1328,81 @@ extract_sources() { # these are marked explicitly to NOT be extracted continue fi - - - # 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" ;; - *application/x-gzip*) - case "$ext" in - gz|z|Z) cmd="gzip" ;; - *) continue;; - esac ;; - *application/x-bzip*) - case "$ext" in - bz2|bz) cmd="bzip2" ;; - *) continue;; - esac ;; - *application/x-xz*) - case "$ext" in - xz) cmd="xz" ;; - *) continue;; - esac ;; + local proto=$(get_protocol "$netfile") + case "$proto" in + bzr*) + extract_bzr "$netfile" + ;; + git*) + extract_git "$netfile" + ;; + hg*) + extract_hg "$netfile" + ;; + svn*) + extract_svn "$netfile" + ;; *) - # See if bsdtar can recognize the file - if bsdtar -tf "$file" -q '*' &>/dev/null; then - cmd="bsdtar" - else - continue - fi ;; + extract_file "$file" + ;; esac - - local ret=0 - 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 )); then - error "$(gettext "Failed to extract %s")" "$file" - plain "$(gettext "Aborting...")" - exit 1 - fi done + if (( PKGVERFUNC && GET_VCS )); then + update_pkgver + check_pkgver || exit 1 + check_build_status + fi +} + + +extract_file() { + local file=$1 + # 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" ;; + *application/x-gzip*) + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; + *application/x-bzip*) + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; + *application/x-xz*) + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; + *) + # See if bsdtar can recognize the file + if bsdtar -tf "$file" -q '*' &>/dev/null; then + cmd="bsdtar" + else + continue + fi ;; + esac + + local ret=0 + 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 )); then + error "$(gettext "Failed to extract %s")" "$file" + plain "$(gettext "Aborting...")" + exit 1 + fi + if (( EUID == 0 )); then # change perms of all source files to root user & root group chown -R 0:0 "$srcdir" -- 1.8.2.rc1.24.g06d67b8
On 09/03/13 04:25, William Giokas wrote:
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent.
Signed-off-by: William Giokas <1007380@gmail.com> ---
Instead of separating out the extract functions into a separate part of makepkg, I just grouped them with the download_* functions. Saved quite a few deletions.
Great - also makes it much easier to review...
scripts/makepkg.sh.in | 253 +++++++++++++++++++++++++++++++++++++------------- 1 file changed, 188 insertions(+), 65 deletions(-)
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c9661e9..58c403e 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -379,6 +379,59 @@ download_file() { ln -s "$SRCDEST/$filename" "$srcdir/" }
+extract_file() { + local file=$1 + # fix flyspray #6246 + local file_type=$(file -bizL "$file") + local ext=${file##*.}
<snip>
+extract_file() { + local file=$1 + # fix flyspray #6246 + local file_type=$(file -bizL "$file") + local ext=${file##*.}
There is a nice duplication there... Allan
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent. Signed-off-by: William Giokas <1007380@gmail.com> --- Oops. Forgot to delete that function. Thanks for the catch. scripts/makepkg.sh.in | 205 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 68 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c9661e9..9686c86 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -379,6 +379,59 @@ download_file() { ln -s "$SRCDEST/$filename" "$srcdir/" } +extract_file() { + local file=$1 + # 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" ;; + *application/x-gzip*) + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; + *application/x-bzip*) + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; + *application/x-xz*) + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; + *) + # See if bsdtar can recognize the file + if bsdtar -tf "$file" -q '*' &>/dev/null; then + cmd="bsdtar" + else + continue + fi ;; + esac + + local ret=0 + 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 )); then + error "$(gettext "Failed to extract %s")" "$file" + plain "$(gettext "Aborting...")" + exit 1 + fi + + if (( EUID == 0 )); then + # change perms of all source files to root user & root group + chown -R 0:0 "$srcdir" + fi +} + download_bzr() { local netfile=$1 @@ -386,11 +439,6 @@ download_bzr() { url=${url##*bzr+} url=${url%%#*} - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local displaylocation="$url" local revision=('-r-1') @@ -431,6 +479,18 @@ download_bzr() { warning "$(gettext "Failure while pulling %s")" "${displaylocation}" fi fi +} + +extract_bzr() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr" pushd "$srcdir" &>/dev/null @@ -448,11 +508,6 @@ download_bzr() { download_git() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -485,6 +540,22 @@ download_git() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git" fi fi +} + +extract_git() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local repo=${netfile##*/} + repo=${repo%%#*} + repo=${repo%%.git*} + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null @@ -528,11 +599,6 @@ download_git() { download_hg() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -558,6 +624,21 @@ download_hg() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg" fi fi +} + +extract_hg() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null @@ -620,6 +701,21 @@ download_svn() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn" fi fi +} + +extract_svn() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null @@ -682,12 +778,6 @@ download_sources() { esac done - if (( PKGVERFUNC && GET_VCS )); then - update_pkgver - check_pkgver || exit 1 - check_build_status - fi - popd &>/dev/null } @@ -1224,6 +1314,12 @@ check_source_integrity() { extract_sources() { msg "$(gettext "Extracting sources...")" + + local GET_VCS=1 + if [[ $1 == "fast" ]]; then + GET_VCS=0 + fi + local netfile for netfile in "${source[@]}"; do local file=$(get_filename "$netfile") @@ -1232,57 +1328,30 @@ extract_sources() { # these are marked explicitly to NOT be extracted continue fi - - - # 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" ;; - *application/x-gzip*) - case "$ext" in - gz|z|Z) cmd="gzip" ;; - *) continue;; - esac ;; - *application/x-bzip*) - case "$ext" in - bz2|bz) cmd="bzip2" ;; - *) continue;; - esac ;; - *application/x-xz*) - case "$ext" in - xz) cmd="xz" ;; - *) continue;; - esac ;; + local proto=$(get_protocol "$netfile") + case "$proto" in + bzr*) + extract_bzr "$netfile" + ;; + git*) + extract_git "$netfile" + ;; + hg*) + extract_hg "$netfile" + ;; + svn*) + extract_svn "$netfile" + ;; *) - # See if bsdtar can recognize the file - if bsdtar -tf "$file" -q '*' &>/dev/null; then - cmd="bsdtar" - else - continue - fi ;; + extract_file "$file" + ;; esac - - local ret=0 - 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 )); then - error "$(gettext "Failed to extract %s")" "$file" - plain "$(gettext "Aborting...")" - exit 1 - fi done - if (( EUID == 0 )); then - # change perms of all source files to root user & root group - chown -R 0:0 "$srcdir" + if (( PKGVERFUNC && GET_VCS )); then + update_pkgver + check_pkgver || exit 1 + check_build_status fi } -- 1.8.2.rc1.24.g06d67b8
On 09/03/13 07:34, William Giokas wrote:
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent.
Signed-off-by: William Giokas <1007380@gmail.com> ---
Oops. Forgot to delete that function. Thanks for the catch.
scripts/makepkg.sh.in | 205 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 68 deletions(-)
One more thing.... <snip>
@@ -1224,6 +1314,12 @@ check_source_integrity() {
extract_sources() { msg "$(gettext "Extracting sources...")" + + local GET_VCS=1 + if [[ $1 == "fast" ]]; then + GET_VCS=0 + fi + local netfile for netfile in "${source[@]}"; do local file=$(get_filename "$netfile")
<snip>
+ if (( PKGVERFUNC && GET_VCS )); then + update_pkgver + check_pkgver || exit 1 + check_build_status fi
There is no "extract_sources fast" so this is wrong... I'd guess where it is now, the pkgver update should just be "if (( PKGVERFUNC ))". The first sections setting GET_VCS can be removed. Allan
On Sat, Mar 09, 2013 at 06:05:28PM +1000, Allan McRae wrote:
On 09/03/13 07:34, William Giokas wrote:
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent.
Signed-off-by: William Giokas <1007380@gmail.com> ---
Oops. Forgot to delete that function. Thanks for the catch.
scripts/makepkg.sh.in | 205 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 137 insertions(+), 68 deletions(-)
One more thing....
<snip>
@@ -1224,6 +1314,12 @@ check_source_integrity() {
extract_sources() { msg "$(gettext "Extracting sources...")" + + local GET_VCS=1 + if [[ $1 == "fast" ]]; then + GET_VCS=0 + fi + local netfile for netfile in "${source[@]}"; do local file=$(get_filename "$netfile")
<snip>
+ if (( PKGVERFUNC && GET_VCS )); then + update_pkgver + check_pkgver || exit 1 + check_build_status fi
There is no "extract_sources fast" so this is wrong... I'd guess where it is now, the pkgver update should just be "if (( PKGVERFUNC ))". The first sections setting GET_VCS can be removed.
Allan
Alright, I'll send that when I wake up. -- William Giokas | KaiSforza GnuPG Key: 0x73CD09CF Fingerprint: F73F 50EF BBE2 9846 8306 E6B8 6902 06D8 73CD 09CF
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent. Signed-off-by: William Giokas <1007380@gmail.com> --- Okay, fixed. scripts/makepkg.sh.in | 200 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 132 insertions(+), 68 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c9661e9..43328b5 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -379,6 +379,59 @@ download_file() { ln -s "$SRCDEST/$filename" "$srcdir/" } +extract_file() { + local file=$1 + # 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" ;; + *application/x-gzip*) + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; + *application/x-bzip*) + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; + *application/x-xz*) + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; + *) + # See if bsdtar can recognize the file + if bsdtar -tf "$file" -q '*' &>/dev/null; then + cmd="bsdtar" + else + continue + fi ;; + esac + + local ret=0 + 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 )); then + error "$(gettext "Failed to extract %s")" "$file" + plain "$(gettext "Aborting...")" + exit 1 + fi + + if (( EUID == 0 )); then + # change perms of all source files to root user & root group + chown -R 0:0 "$srcdir" + fi +} + download_bzr() { local netfile=$1 @@ -386,11 +439,6 @@ download_bzr() { url=${url##*bzr+} url=${url%%#*} - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local displaylocation="$url" local revision=('-r-1') @@ -431,6 +479,18 @@ download_bzr() { warning "$(gettext "Failure while pulling %s")" "${displaylocation}" fi fi +} + +extract_bzr() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr" pushd "$srcdir" &>/dev/null @@ -448,11 +508,6 @@ download_bzr() { download_git() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -485,6 +540,22 @@ download_git() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git" fi fi +} + +extract_git() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local repo=${netfile##*/} + repo=${repo%%#*} + repo=${repo%%.git*} + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null @@ -528,11 +599,6 @@ download_git() { download_hg() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -558,6 +624,21 @@ download_hg() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg" fi fi +} + +extract_hg() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null @@ -620,6 +701,21 @@ download_svn() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn" fi fi +} + +extract_svn() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null @@ -682,12 +778,6 @@ download_sources() { esac done - if (( PKGVERFUNC && GET_VCS )); then - update_pkgver - check_pkgver || exit 1 - check_build_status - fi - popd &>/dev/null } @@ -1224,6 +1314,7 @@ check_source_integrity() { extract_sources() { msg "$(gettext "Extracting sources...")" + local netfile for netfile in "${source[@]}"; do local file=$(get_filename "$netfile") @@ -1232,57 +1323,30 @@ extract_sources() { # these are marked explicitly to NOT be extracted continue fi - - - # 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" ;; - *application/x-gzip*) - case "$ext" in - gz|z|Z) cmd="gzip" ;; - *) continue;; - esac ;; - *application/x-bzip*) - case "$ext" in - bz2|bz) cmd="bzip2" ;; - *) continue;; - esac ;; - *application/x-xz*) - case "$ext" in - xz) cmd="xz" ;; - *) continue;; - esac ;; + local proto=$(get_protocol "$netfile") + case "$proto" in + bzr*) + extract_bzr "$netfile" + ;; + git*) + extract_git "$netfile" + ;; + hg*) + extract_hg "$netfile" + ;; + svn*) + extract_svn "$netfile" + ;; *) - # See if bsdtar can recognize the file - if bsdtar -tf "$file" -q '*' &>/dev/null; then - cmd="bsdtar" - else - continue - fi ;; + extract_file "$file" + ;; esac - - local ret=0 - 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 )); then - error "$(gettext "Failed to extract %s")" "$file" - plain "$(gettext "Aborting...")" - exit 1 - fi done - if (( EUID == 0 )); then - # change perms of all source files to root user & root group - chown -R 0:0 "$srcdir" + if (( PKGVERFUNC )); then + update_pkgver + check_pkgver || exit 1 + check_build_status fi } -- 1.8.2.rc1.24.g06d67b8
Previously makepkg would clone vcs sources in the download function, regardless of the noextract settings. Now the download_* functions only download or update the vcs sources, and the new extract_* functions just create working copies using the specified protocols. The extract_sources function will call the needed extract function for the protocol specified. The tarball extraction has also been moved into its own extract_file function to keep things consistent. Signed-off-by: William Giokas <1007380@gmail.com> --- Fix unneeded newline there. My bad. scripts/makepkg.sh.in | 199 +++++++++++++++++++++++++++++++++----------------- 1 file changed, 131 insertions(+), 68 deletions(-) diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in index c9661e9..9cb21cc 100644 --- a/scripts/makepkg.sh.in +++ b/scripts/makepkg.sh.in @@ -379,6 +379,59 @@ download_file() { ln -s "$SRCDEST/$filename" "$srcdir/" } +extract_file() { + local file=$1 + # 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" ;; + *application/x-gzip*) + case "$ext" in + gz|z|Z) cmd="gzip" ;; + *) continue;; + esac ;; + *application/x-bzip*) + case "$ext" in + bz2|bz) cmd="bzip2" ;; + *) continue;; + esac ;; + *application/x-xz*) + case "$ext" in + xz) cmd="xz" ;; + *) continue;; + esac ;; + *) + # See if bsdtar can recognize the file + if bsdtar -tf "$file" -q '*' &>/dev/null; then + cmd="bsdtar" + else + continue + fi ;; + esac + + local ret=0 + 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 )); then + error "$(gettext "Failed to extract %s")" "$file" + plain "$(gettext "Aborting...")" + exit 1 + fi + + if (( EUID == 0 )); then + # change perms of all source files to root user & root group + chown -R 0:0 "$srcdir" + fi +} + download_bzr() { local netfile=$1 @@ -386,11 +439,6 @@ download_bzr() { url=${url##*bzr+} url=${url%%#*} - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local displaylocation="$url" local revision=('-r-1') @@ -431,6 +479,18 @@ download_bzr() { warning "$(gettext "Failure while pulling %s")" "${displaylocation}" fi fi +} + +extract_bzr() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${dir}" "bzr" pushd "$srcdir" &>/dev/null @@ -448,11 +508,6 @@ download_bzr() { download_git() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -485,6 +540,22 @@ download_git() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "git" fi fi +} + +extract_git() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local repo=${netfile##*/} + repo=${repo%%#*} + repo=${repo%%.git*} + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "git" pushd "$srcdir" &>/dev/null @@ -528,11 +599,6 @@ download_git() { download_hg() { local netfile=$1 - local fragment=${netfile#*#} - if [[ $fragment = "$netfile" ]]; then - unset fragment - fi - local dir=$(get_filepath "$netfile") [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" @@ -558,6 +624,21 @@ download_hg() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "hg" fi fi +} + +extract_hg() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "hg" pushd "$srcdir" &>/dev/null @@ -620,6 +701,21 @@ download_svn() { warning "$(gettext "Failure while updating %s %s repo")" "${repo}" "svn" fi fi +} + +extract_svn() { + local netfile=$1 + + local fragment=${netfile#*#} + if [[ $fragment = "$netfile" ]]; then + unset fragment + fi + + local dir=$(get_filepath "$netfile") + [[ -z "$dir" ]] && dir="$SRCDEST/$(get_filename "$netfile")" + + local repo=${netfile##*/} + repo=${repo%%#*} msg2 "$(gettext "Creating working copy of %s %s repo...")" "${repo}" "svn" pushd "$srcdir" &>/dev/null @@ -682,12 +778,6 @@ download_sources() { esac done - if (( PKGVERFUNC && GET_VCS )); then - update_pkgver - check_pkgver || exit 1 - check_build_status - fi - popd &>/dev/null } @@ -1232,57 +1322,30 @@ extract_sources() { # these are marked explicitly to NOT be extracted continue fi - - - # 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" ;; - *application/x-gzip*) - case "$ext" in - gz|z|Z) cmd="gzip" ;; - *) continue;; - esac ;; - *application/x-bzip*) - case "$ext" in - bz2|bz) cmd="bzip2" ;; - *) continue;; - esac ;; - *application/x-xz*) - case "$ext" in - xz) cmd="xz" ;; - *) continue;; - esac ;; + local proto=$(get_protocol "$netfile") + case "$proto" in + bzr*) + extract_bzr "$netfile" + ;; + git*) + extract_git "$netfile" + ;; + hg*) + extract_hg "$netfile" + ;; + svn*) + extract_svn "$netfile" + ;; *) - # See if bsdtar can recognize the file - if bsdtar -tf "$file" -q '*' &>/dev/null; then - cmd="bsdtar" - else - continue - fi ;; + extract_file "$file" + ;; esac - - local ret=0 - 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 )); then - error "$(gettext "Failed to extract %s")" "$file" - plain "$(gettext "Aborting...")" - exit 1 - fi done - if (( EUID == 0 )); then - # change perms of all source files to root user & root group - chown -R 0:0 "$srcdir" + if (( PKGVERFUNC )); then + update_pkgver + check_pkgver || exit 1 + check_build_status fi } -- 1.8.2.rc1.24.g06d67b8
participants (2)
-
Allan McRae
-
William Giokas