Git-Url: 
http://git.frugalware.org/gitweb/gitweb.cgi?p=pacman-g2.git;a=commitdiff;h=82d59bde3f69b1271e105559fe559c05ebba3e6d

commit 82d59bde3f69b1271e105559fe559c05ebba3e6d
Author: Michel Hermier <[email protected]>
Date:   Fri Nov 23 08:55:56 2012 +0100

scripts/makepkg

* Make source extraction a function.
* Move some conditions at head of functions (ease readbility).

diff --git a/scripts/makepkg b/scripts/makepkg
index 53df567..a62020d 100755
--- a/scripts/makepkg
+++ b/scripts/makepkg
@@ -895,10 +895,14 @@ sources_sha1sum_validate() {
}

sources_sha1sum_generate() {
+       if [ "$GENSHA1" -ne 1 ]; then
+               return 0
+       fi
if [ ! `type -p sha1sum` ]; then
error "Cannot find the sha1sum program."
exit 1
fi
+
msg "Generating SHA1sums for source files"
plain ""
ct=0
@@ -1001,6 +1005,20 @@ sources_gpg_validate() {
fi
}

+sources_extract() {
+       if [ "$NOEXTRACT" -eq 1 ]; then
+               warning "Skipping source extraction -- using existing src/ tree"
+               return 0
+       fi
+
+       msg "Extracting Sources..."
+       for netfile in "${source[@]}"; do
+               unziphack=0
+               file=$(strip_url $netfile)
+               Fextract "${file}"
+       done
+}
+
buildenv_distcc() {
if [ -d /usr/lib/distcc/bin ]; then
export PATH=/usr/lib/distcc/bin:$PATH
@@ -1494,6 +1512,21 @@ makepkg_build() {
export LDFLAGS

buildenv_build
+
+       makepkg_document
+
+       # NOTE: _P_subpkgsfixes hook registration order is important.
+       #if ! check_option NOREMOVEEMPTYDIR; then
+               _P_subpkgsfixes+=(_pkg_removeemptydirs_hook)
+       #fi
+
+       if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
+               _P_subpkgsfixes+=(_pkg_strip_hook)
+       fi
+
+       _P_subpkgsfixes+=(_pkg_check_links)
+       _P_subpkgsfixes+=(create_pkg)
+       pkg_foreach "${_P_subpkgsfixes[@]}"
}

# FIXME: This code rely on "$startdir/pkg/" path
@@ -1968,26 +2001,14 @@ sources_download

if [ "$GENSHA1" = "0" ]; then
if [ "$NOEXTRACT" = "1" ]; then
-               warning "Skipping source extraction       -- using existing 
src/ tree"
warning "Skipping source integrity checks -- using existing src/ tree"
else
sources_sha1sum_validate
sources_gpg_validate
-
-               # extract sources
-               msg "Extracting Sources..."
-               for netfile in "${source[@]}"; do
-                       unziphack=0
-                       file=$(strip_url $netfile)
-                       Fextract "${file}"
-               done
fi
+       sources_extract
else
-       # this condition is always true, but leave it here in case in the
-       # future we want to add support for other hash algorithms
-       if [ "$GENSHA1" = "1" ]; then
-               sources_sha1sum_generate
-       fi
+       sources_sha1sum_generate
fi

if [ "`id -u`" = "0" ]; then
@@ -2003,20 +2024,6 @@ if [ "$NOBUILD" = "1" ]; then
exit 0
else
makepkg_build
-       makepkg_document
-
-       # NOTE: _P_subpkgsfixes hook registration order is important.
-       #if ! check_option NOREMOVEEMPTYDIR; then
-               _P_subpkgsfixes+=(_pkg_removeemptydirs_hook)
-       #fi
-
-       if [ ! "`check_option NOSTRIP`" -a "$NOSTRIP" = "0" ]; then
-               _P_subpkgsfixes+=(_pkg_strip_hook)
-       fi
-
-       _P_subpkgsfixes+=(_pkg_check_links)
-       _P_subpkgsfixes+=(create_pkg)
-       pkg_foreach "${_P_subpkgsfixes[@]}"
fi

cd $startdir
_______________________________________________
Frugalware-git mailing list
[email protected]
http://frugalware.org/mailman/listinfo/frugalware-git

Reply via email to