Add a -C, --cleanbuild option to clear the source directory before building a package.
Implements FS#17175. [Allan: Minor changes to output strings, fix removing of source directory] Signed-off-by: Allan McRae <allan@archlinux.org>
This commit is contained in:
parent
2f7e92ad04
commit
043f250d0e
2 changed files with 14 additions and 2 deletions
|
@ -147,6 +147,9 @@ Options
|
||||||
*-V, \--version*::
|
*-V, \--version*::
|
||||||
Display version information.
|
Display version information.
|
||||||
|
|
||||||
|
*-C, \--cleanbuild*::
|
||||||
|
Remove the $srcdir before building the package.
|
||||||
|
|
||||||
*\--allsource*::
|
*\--allsource*::
|
||||||
Do not actually build the package, but build a source-only tarball that
|
Do not actually build the package, but build a source-only tarball that
|
||||||
includes all sources, including those that are normally download via
|
includes all sources, including those that are normally download via
|
||||||
|
|
|
@ -63,6 +63,7 @@ ASROOT=0
|
||||||
CLEANUP=0
|
CLEANUP=0
|
||||||
DEP_BIN=0
|
DEP_BIN=0
|
||||||
FORCE=0
|
FORCE=0
|
||||||
|
CLEANBUILD=0
|
||||||
INFAKEROOT=0
|
INFAKEROOT=0
|
||||||
GENINTEG=0
|
GENINTEG=0
|
||||||
HOLDVER=0
|
HOLDVER=0
|
||||||
|
@ -2474,6 +2475,7 @@ usage() {
|
||||||
printf -- "$(gettext "Options:")\n"
|
printf -- "$(gettext "Options:")\n"
|
||||||
printf -- "$(gettext " -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
|
printf -- "$(gettext " -A, --ignorearch Ignore incomplete %s field in %s")\n" "arch" "$BUILDSCRIPT"
|
||||||
printf -- "$(gettext " -c, --clean Clean up work files after build")\n"
|
printf -- "$(gettext " -c, --clean Clean up work files after build")\n"
|
||||||
|
printf -- "$(gettext " -C, --cleanbuild Remove %s dir before building the package")\n" "\$srcdir/"
|
||||||
printf -- "$(gettext " -d, --nodeps Skip all dependency checks")\n"
|
printf -- "$(gettext " -d, --nodeps Skip all dependency checks")\n"
|
||||||
printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/"
|
printf -- "$(gettext " -e, --noextract Do not extract source files (use existing %s dir)")\n" "\$srcdir/"
|
||||||
printf -- "$(gettext " -f, --force Overwrite existing package")\n"
|
printf -- "$(gettext " -f, --force Overwrite existing package")\n"
|
||||||
|
@ -2537,8 +2539,8 @@ fi
|
||||||
ARGLIST=("$@")
|
ARGLIST=("$@")
|
||||||
|
|
||||||
# Parse Command Line Options.
|
# Parse Command Line Options.
|
||||||
OPT_SHORT="AcdefFghiLmop:rRsSV"
|
OPT_SHORT="AcCdefFghiLmop:rRsSV"
|
||||||
OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'config:' 'force' 'geninteg'
|
OPT_LONG=('allsource' 'asroot' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
|
||||||
'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'nobuild' 'nocolor'
|
'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'nobuild' 'nocolor'
|
||||||
'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' 'repackage' 'rmdeps'
|
'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'pkg:' 'repackage' 'rmdeps'
|
||||||
'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps'
|
'sign' 'skipchecksums' 'skipinteg' 'skippgpcheck' 'source' 'syncdeps'
|
||||||
|
@ -2566,6 +2568,7 @@ while true; do
|
||||||
--asroot) ASROOT=1 ;;
|
--asroot) ASROOT=1 ;;
|
||||||
-A|--ignorearch) IGNOREARCH=1 ;;
|
-A|--ignorearch) IGNOREARCH=1 ;;
|
||||||
-c|--clean) CLEANUP=1 ;;
|
-c|--clean) CLEANUP=1 ;;
|
||||||
|
-C|--cleanbuild) CLEANBUILD=1 ;;
|
||||||
--check) RUN_CHECK='y' ;;
|
--check) RUN_CHECK='y' ;;
|
||||||
--config) shift; MAKEPKG_CONF=$1 ;;
|
--config) shift; MAKEPKG_CONF=$1 ;;
|
||||||
-d|--nodeps) NODEPS=1 ;;
|
-d|--nodeps) NODEPS=1 ;;
|
||||||
|
@ -2975,6 +2978,12 @@ elif (( !REPKG )); then
|
||||||
download_sources
|
download_sources
|
||||||
check_source_integrity
|
check_source_integrity
|
||||||
(( VERIFYSOURCE )) && exit 0 # $E_OK
|
(( VERIFYSOURCE )) && exit 0 # $E_OK
|
||||||
|
|
||||||
|
if (( CLEANBUILD )); then
|
||||||
|
msg "$(gettext "Removing existing %s directory...")" "src/"
|
||||||
|
rm -rf "$srcdir"/*
|
||||||
|
fi
|
||||||
|
|
||||||
extract_sources
|
extract_sources
|
||||||
if (( PREPAREFUNC )); then
|
if (( PREPAREFUNC )); then
|
||||||
run_prepare
|
run_prepare
|
||||||
|
|
Loading…
Add table
Reference in a new issue