From: Johannes Winkelmann Date: Tue, 30 Sep 2008 18:59:37 +0000 (+0200) Subject: pkgmk: add "extract only" functionality, previously suggested by Lucas Hazel and... X-Git-Url: http://gitweb/?a=commitdiff_plain;h=92dbaab6a7ea34dc55308d12578453ec7e498295;p=pkgutils-cross.git pkgmk: add "extract only" functionality, previously suggested by Lucas Hazel and Danny Rawlins --- diff --git a/pkgmk.in b/pkgmk.in index df50de8..1cc40d6 100755 --- 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"