CRUX-ARM : Home

Home :: Documentation :: Download :: Development :: Community :: Ports :: Packages :: Bugs :: Links :: About :: Donors
pkgmk: add "extract only" functionality, previously suggested by Lucas Hazel and...
authorJohannes Winkelmann <jw@smts.ch>
Tue, 30 Sep 2008 18:59:37 +0000 (20:59 +0200)
committerJohannes Winkelmann <jw@smts.ch>
Tue, 30 Sep 2008 18:59:37 +0000 (20:59 +0200)
pkgmk.in

index df50de84ecd29ef87241cac7546745ce503f8acc..1cc40d60d274cb3a31e7896f3ad3ce4e2864673c 100755 (executable)
--- a/pkgmk.in
+++ b/pkgmk.in
@@ -331,20 +331,29 @@ check_footprint() {
        fi
 }
 
-build_package() {
-       local BUILD_SUCCESSFUL="no"
-       
+make_work_dir() {
        export PKG="$PKGMK_WORK_DIR/pkg"
        export SRC="$PKGMK_WORK_DIR/src"
        umask 022
        
        cd $PKGMK_ROOT
-       rm -rf $PKGMK_WORK_DIR
+       remove_work_dir
        mkdir -p $SRC $PKG
-       
+
        if [ "$PKGMK_IGNORE_MD5SUM" = "no" ]; then
                check_md5sum
        fi
+}
+
+remove_work_dir() {
+       rm -rf $PKGMK_WORK_DIR
+}
+
+
+build_package() {
+       local BUILD_SUCCESSFUL="no"
+       
+       make_work_dir
 
        if [ "$UID" != "0" ]; then
                warning "Packages should be built as root."
@@ -380,7 +389,7 @@ build_package() {
        fi
        
        if [ "$PKGMK_KEEP_WORK" = "no" ]; then
-               rm -rf $PKGMK_WORK_DIR
+               remove_work_dir
        fi
        
        if [ "$BUILD_SUCCESSFUL" = "yes" ]; then
@@ -498,6 +507,7 @@ print_help() {
        echo "  -r,   --recursive           search for and build packages recursively"
        echo "  -d,   --download            download missing source file(s)"
        echo "  -do,  --download-only       do not build, only download missing source file(s)"
+       echo "  -eo,  --extract-only        do not build, only extract source file(s)"
        echo "  -utd, --up-to-date          do not build, only check if package is up to date"
        echo "  -uf,  --update-footprint    update footprint using result from last build"
        echo "  -if,  --ignore-footprint    build package without checking footprint"
@@ -527,6 +537,8 @@ parse_options() {
                        -do|--download-only)
                                PKGMK_DOWNLOAD="yes"
                                PKGMK_DOWNLOAD_ONLY="yes" ;;
+                       -eo|--extract-only)
+                               PKGMK_EXTRACT_ONLY="yes" ;;
                        -utd|--up-to-date)
                                PKGMK_UP_TO_DATE="yes" ;;
                        -uf|--update-footprint)
@@ -616,6 +628,14 @@ main() {
                exit 0
        fi
        
+       if [ "$PKGMK_EXTRACT_ONLY" = "yes" ]; then
+               download_source
+               make_work_dir
+               info "Extracting sources of package '$name-$version'."
+               unpack_source
+               exit 0
+       fi
+       
        if [ "$PKGMK_UP_TO_DATE" = "yes" ]; then
                if [ "`build_needed`" = "yes" ]; then
                        info "Package '$TARGET' is not up to date."
@@ -662,6 +682,7 @@ PKGMK_INSTALL="no"
 PKGMK_RECURSIVE="no"
 PKGMK_DOWNLOAD="no"
 PKGMK_DOWNLOAD_ONLY="no"
+PKGMK_EXTRACT_ONLY="no"
 PKGMK_UP_TO_DATE="no"
 PKGMK_UPDATE_FOOTPRINT="no"
 PKGMK_IGNORE_FOOTPRINT="no"