diff options
author | Levente Polyak <anthraxx@archlinux.org> | 2019-09-12 21:28:34 +0200 |
---|---|---|
committer | Levente Polyak <anthraxx@archlinux.org> | 2019-09-28 00:15:48 +0200 |
commit | 5246cb9aa5bdc390c793dc261b28f3439aaad4c0 (patch) | |
tree | 42c391e3fae0eca76c83344c2598d446aa857811 /checkpkg.in | |
parent | 144f8966608211f85fb492a4cce3c159989dd2eb (diff) | |
download | devtools-5246cb9aa5bdc390c793dc261b28f3439aaad4c0.tar.xz |
checkpkg: add option to avoid keeping the tmp dir
In some cases, like default makechrootpkg execution, the temporary
directory used to assemble the differences is not required. Add an
option to checkpkg that allows to get rid of that directory after
run and call it automatically like that in makechrootpkg.
Signed-off-by: Levente Polyak <anthraxx@archlinux.org>
Diffstat (limited to 'checkpkg.in')
-rw-r--r-- | checkpkg.in | 45 |
1 files changed, 44 insertions, 1 deletions
diff --git a/checkpkg.in b/checkpkg.in index 335174c..e3d2c16 100644 --- a/checkpkg.in +++ b/checkpkg.in @@ -22,6 +22,48 @@ elif [[ -r "$HOME/.makepkg.conf" ]]; then source "$HOME/.makepkg.conf" fi +usage() { + cat <<- _EOF_ + Usage: ${BASH_SOURCE[0]##*/} [OPTIONS] + + Searches for a locally built package corresponding to the PKGBUILD, and + downloads the last version of that package from the Pacman repositories. + It then compares the list of .so files provided by each version of the + package and outputs if there are soname differences for the new package. + A directory is also created using mktemp with files containing a file + list for both packages and a library list for both packages. + + OPTIONS + -r, --rmdir Remove the temporary directory + -h, --help Show this help text +_EOF_ +} + +RMDIR=0 + +OPT_SHORT='rh' +OPT_LONG=('rmdir' 'help') +if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then + exit 1 +fi +set -- "${OPTRET[@]}" + +while :; do + case $1 in + -r|--rmdir) + RMDIR=1 + ;; + -h|--help) + usage + exit 0 + ;; + --) + shift; break + ;; + esac + shift +done + if [[ ! -f PKGBUILD ]]; then die 'This must be run in the directory of a built package.' fi @@ -33,6 +75,7 @@ if [[ ${arch[0]} == 'any' ]]; then fi STARTDIR=$(pwd) +(( RMDIR )) && trap 'rm -rf $TEMPDIR' EXIT INT TERM QUIT TEMPDIR=$(mktemp -d --tmpdir checkpkg-script.XXXX) for _pkgname in "${pkgname[@]}"; do @@ -92,4 +135,4 @@ for _pkgname in "${pkgname[@]}"; do fi done -msg "Files saved to %s" "$TEMPDIR" +(( RMDIR )) || msg "Files saved to %s" "$TEMPDIR" |