[pacman-dev] [PATCH v2 5/6] scripts: fix some inaccurate Makefile targets, and be more templated

Eli Schwartz eschwartz at archlinux.org
Wed Nov 14 04:29:17 UTC 2018


All of our scripts depend on the same pattern .sh.in, and since commit
b5d62d2c91a2caf5c18945921cdf12af6f36b2d4, they also all (not just
makepkg itself) depend on libmakepkg.

There's no real reason to include separate targets for them just to
establish dependency rules.

While we are at it, fix a longstanding bug where generated wrapper
scripts did not depend on wrapper.sh.in (which due to moving to .lib,
requires we regenerate the script too), by making the shared target
pattern depend on it. All our generated scripts now require the wrapper,
even repo-add which now uses libmakepkg.

Signed-off-by: Eli Schwartz <eschwartz at archlinux.org>
---

v2: Replace commits 3 and 4 of the previous patchset. The logic was
wrong, and the scripts *do* depend on wrapper.sh.in, since they need to
be regenerated in order to be moved to .lib/ -- the result of failing to
do this was that makepkg now broke the same way the other scripts were
already broken.

$ touch wrapper.sh.in
$ make
$ ls -l .lib/

And you'll see a bunch of files *, which are broken symlinks to *-wrapper


 scripts/Makefile.am | 16 ++--------------
 1 file changed, 2 insertions(+), 14 deletions(-)

diff --git a/scripts/Makefile.am b/scripts/Makefile.am
index ef7a1b5b..25ae9177 100644
--- a/scripts/Makefile.am
+++ b/scripts/Makefile.am
@@ -170,7 +170,7 @@ edit = sed \
 ## All the scripts depend on Makefile so that they are rebuilt when the
 ## prefix etc. changes. Use chmod -w to prevent people from editing the
 ## wrong file by accident.
-$(OURSCRIPTS): Makefile
+$(OURSCRIPTS): %: %.sh.in wrapper.sh.in $(LIBMAKEPKG_IN) Makefile
 	$(AM_V_at)$(RM) $@
 	$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
 	$(AM_V_at)chmod +x,a-w $@
@@ -191,11 +191,6 @@ $(COMPLETION_IN): %: %.in Makefile

 all-am: $(COMPLETION_IN)

-makepkg: \
-	$(srcdir)/makepkg.sh.in \
-	$(srcdir)/wrapper.sh.in \
-	$(LIBMAKEPKG_IN)
-
 makepkg-template: \
 	$(srcdir)/makepkg-template.pl.in \
 	Makefile
@@ -204,20 +199,13 @@ makepkg-template: \
 	$(AM_V_GEN)$(edit) $< > $@
 	$(AM_V_at)chmod +x,a-w $@

-pacman-db-upgrade: $(srcdir)/pacman-db-upgrade.sh.in
-
-pacman-key: $(srcdir)/pacman-key.sh.in
-
-pkgdelta: $(srcdir)/pkgdelta.sh.in
-
-repo-add: $(srcdir)/repo-add.sh.in
-
 repo-remove repo-elephant: repo-add
 	$(AM_V_at)$(RM) $@
 	$(AM_V_at)$(LN_S) repo-add $@

 .SECONDEXPANSION:
 $(WRAPPER): \
+	$(srcdir)/wrapper.sh.in \
 	$$(subst -wrapper,,$$@)

 	$(AM_V_at)$(MKDIR_P) .lib
--
2.19.1


More information about the pacman-dev mailing list