[pacman-dev] [PATCH] Fix pactest when scriptlet shell is specified

Allan McRae allan at archlinux.org
Wed May 2 06:25:45 EDT 2012


If --with-scriptlet-shell is specified, sylimk the shell to /bin/sh
in order for the "make check" to pass.

Signed-off-by: Allan McRae <allan at archlinux.org>
---

This at least works with --with-scriptlet-shell=/bin/bash...

 test/pacman/Makefile.am                 |    9 +++++++++
 test/pacman/{pmtest.py => pmtest.py.in} |    3 +++
 2 files changed, 12 insertions(+)
 rename test/pacman/{pmtest.py => pmtest.py.in} (98%)

diff --git a/test/pacman/Makefile.am b/test/pacman/Makefile.am
index d198ba2..b821458 100644
--- a/test/pacman/Makefile.am
+++ b/test/pacman/Makefile.am
@@ -19,4 +19,13 @@ EXTRA_DIST = \
 	ldconfig.stub \
 	$(check_SCRIPTS)
 
+CLEANFILES = pmtest.py
+
+edit = sed \
+  -e 's|@SCRIPTLET_SHELL[@]|$(SCRIPTLET_SHELL)|g'
+
+pmtest.py: pmtest.py.in Makefile
+	$(AM_V_at)$(RM) $@
+	$(AM_V_GEN)test -f $(srcdir)/$@.in && $(edit) $(srcdir)/$@.in >$@
+
 # vim:set ts=2 sw=2 noet:
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py.in
similarity index 98%
rename from test/pacman/pmtest.py
rename to test/pacman/pmtest.py.in
index 1a02686..ace532d 100644
--- a/test/pacman/pmtest.py
+++ b/test/pacman/pmtest.py.in
@@ -127,6 +127,9 @@ def generate(self):
                 os.makedirs(sys_dir, 0755)
         # Only the dynamically linked binary is needed for fakechroot
         shutil.copy("/bin/sh", bindir)
+        shell = "@SCRIPTLET_SHELL@"
+        if not shell == "/bin/sh":
+            os.symlink("/bin/sh", os.path.join(self.root, shell[1:]))
         shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"),
             os.path.join(sbindir, "ldconfig"))
         ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
-- 
1.7.10



More information about the pacman-dev mailing list