On 12/10/16 14:28, Allan McRae wrote:
On 10/10/16 18:47, Alad Wenter wrote:
parseopts is used in makepkg and other scripts such as pacman-key as a getopt replacement.
Instead of including it in those scripts via a macro, move it to libmakepkg/util/parseopts.sh and have scripts source this file where appropriate.
To keep the parseopts test, a new variable was introduced: PM_LIBMAKEPKG_DIR
Signed-off-by: Alad Wenter <alad@archlinux.info> --- v5: update README
I did a minor rebase to get this to apply. Everything is fine with the patch apart from...
FAIL: test/scripts/pacman-db-upgrade-v9
The problem is that the in tree build is not able to determine library location. This happened with makepkg too, and I solved it with a wrapper function. Let me see if I can generalise this...
Committed on top of my last patch with the following changes: diff --git a/scripts/.gitignore b/scripts/.gitignore index b0cb23f..3a5ac8a 100644 --- a/scripts/.gitignore +++ b/scripts/.gitignore @@ -1,9 +1,9 @@ makepkg makepkg-template -makepkg-wrapper pacman-db-upgrade pacman-key pkgdelta repo-add repo-elephant repo-remove +*-wrapper diff --git a/scripts/Makefile.am b/scripts/Makefile.am index 89ac677..3d304dd 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -103,7 +103,10 @@ LIBMAKEPKG_DIST = \ $(addsuffix .in, $(LIBMAKEPKG_IN)) WRAPPER = \ - makepkg-wrapper + makepkg-wrapper \ + pacman-db-upgrade-wrapper \ + pacman-key-wrapper \ + pkgdelta-wrapper COMPLETION_IN = \ completion/bash_completion \ diff --git a/scripts/pacman-db-upgrade.sh.in b/scripts/pacman-db-upgrade.sh.in index 62f4285..2bf444e 100644 --- a/scripts/pacman-db-upgrade.sh.in +++ b/scripts/pacman-db-upgrade.sh.in @@ -28,13 +28,13 @@ export TEXTDOMAINDIR='@localedir@' declare -r myver='@PACKAGE_VERSION@' +m4_include(library/output_format.sh) + LIBRARY=${LIBRARY:-'@libmakepkgdir@'} # Import parseopts.sh source "$LIBRARY"/util/parseopts.sh -m4_include(library/parseopts.sh) - usage() { printf "pacman-db-upgrade (pacman) %s\n" "${myver}" echo