[pacman-dev] [PATCH] Fix pactest when scriptlet shell is specified
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@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
On 02/05/12 20:25, Allan McRae wrote:
If --with-scriptlet-shell is specified, sylimk the shell to /bin/sh in order for the "make check" to pass.
The missing .gitignore addition is added on my working branch.
Signed-off-by: Allan McRae <allan@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")
On Wed, May 2, 2012 at 5:25 AM, Allan McRae <allan@archlinux.org> wrote:
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@archlinux.org>
Hmm. I'm not a fan of doing this in the sed/.in style at all; namely because pactest can be used to test the installed binary on the system as well as the one in the tree. Thus, tailoring it to the configure options without a way of undoing that seems like bad news. I'd much rather just add a new option to the invocation of pactest (--scriptlet-shell= or something) and add that to our one automated invocation in the toplevel Makefile.in; the substitution could thus be performed there instead. Finally, do we need to symlink it, or can we simply copy in only that binary (derferencing symlinks, of course)? -Dan
---
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
On 02/05/12 22:17, Dan McGee wrote:
On Wed, May 2, 2012 at 5:25 AM, Allan McRae <allan@archlinux.org> wrote:
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@archlinux.org>
Hmm. I'm not a fan of doing this in the sed/.in style at all; namely because pactest can be used to test the installed binary on the system as well as the one in the tree. Thus, tailoring it to the configure options without a way of undoing that seems like bad news.
I'd much rather just add a new option to the invocation of pactest (--scriptlet-shell= or something) and add that to our one automated invocation in the toplevel Makefile.in; the substitution could thus be performed there instead.
OK, sounds easy enough to do.
Finally, do we need to symlink it, or can we simply copy in only that binary (derferencing symlinks, of course)?
The only thing that could go wrong is a shell being used that does not support "echo". I'm not sure if that is even possible, but "python -c" works so...
-Dan
---
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
participants (2)
-
Allan McRae
-
Dan McGee