[pacman-dev] [PATCH 3/4] Remove leading / for pactest paths
The leading / makes the pactest suite look for the file in the users filesystem. This meant the ldconfig tests always passed (even when broken in pacman...). Signed-off-by: Allan McRae <allan@archlinux.org> --- test/pacman/tests/ldconfig001.py | 2 +- test/pacman/tests/ldconfig002.py | 2 +- test/pacman/tests/ldconfig003.py | 2 +- test/pacman/tests/sync700.py | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py index a264326..a97f28c 100644 --- a/test/pacman/tests/ldconfig001.py +++ b/test/pacman/tests/ldconfig001.py @@ -6,4 +6,4 @@ self.args = "-U %s" % p.filename() self.addrule("PACMAN_RETCODE=0") -self.addrule("FILE_EXIST=/etc/ld.so.cache") +self.addrule("FILE_EXIST=etc/ld.so.cache") diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py index 2628dc7..07f2ec6 100644 --- a/test/pacman/tests/ldconfig002.py +++ b/test/pacman/tests/ldconfig002.py @@ -10,4 +10,4 @@ self.addrule("PACMAN_RETCODE=0") self.addrule("PKG_VERSION=dummy|1.0-2") -self.addrule("FILE_EXIST=/etc/ld.so.cache") +self.addrule("FILE_EXIST=etc/ld.so.cache") diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py index 8d1babb..9b2967e 100644 --- a/test/pacman/tests/ldconfig003.py +++ b/test/pacman/tests/ldconfig003.py @@ -6,4 +6,4 @@ self.args = "-S %s" % sp.name self.addrule("PACMAN_RETCODE=0") -self.addrule("FILE_EXIST=/etc/ld.so.cache") +self.addrule("FILE_EXIST=etc/ld.so.cache") diff --git a/test/pacman/tests/sync700.py b/test/pacman/tests/sync700.py index 0002b64..9748c81 100644 --- a/test/pacman/tests/sync700.py +++ b/test/pacman/tests/sync700.py @@ -17,6 +17,6 @@ self.addrule("PACMAN_RETCODE=1") self.addrule("PKG_VERSION=pkg1|1.0-1") -self.addrule("FILE_EXIST=/lib/bar") +self.addrule("FILE_EXIST=lib/bar") self.expectfailure = True -- 1.8.1.1
The FHS (2.3) says having ldconfig in /sbin is optional and it is usually located in /usr/sbin. So /sbin/ldconfig should not be hard coded in pacman. Instead, provide a configure option --with-ldconfig that defaults to the current path. Signed-off-by: Allan McRae <allan@archlinux.org> --- Makefile.am | 1 + configure.ac | 10 ++++++++++ lib/libalpm/util.c | 4 ++-- test/pacman/pactest.py | 4 ++++ test/pacman/pmtest.py | 7 ++++--- 5 files changed, 21 insertions(+), 5 deletions(-) diff --git a/Makefile.am b/Makefile.am index cd69b6e..d4cc9fa 100644 --- a/Makefile.am +++ b/Makefile.am @@ -29,6 +29,7 @@ test-pacman: test/pacman src/pacman LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \ --test $(top_srcdir)/test/pacman/tests/*.py \ --scriptlet-shell $(SCRIPTLET_SHELL) \ + --ldconfig $(LDCONFIG) \ -p $(top_builddir)/src/pacman/pacman test-pacsort: test/util src/util diff --git a/configure.ac b/configure.ac index aa3305d..e202421 100644 --- a/configure.ac +++ b/configure.ac @@ -108,6 +108,12 @@ AC_ARG_WITH(scriptlet-shell, [set the full path to the shell used to run install scriptlets]), [SCRIPTLET_SHELL=$withval], [SCRIPTLET_SHELL=/bin/sh]) +# Help line for ldconfig path +AC_ARG_WITH(ldconfig, + AS_HELP_STRING([--with-ldconfig=path], + [set the full path to ldconfig]), + [LDCONFIG=$withval], [LDCONFIG=/sbin/ldconfig]) + # Help line for using OpenSSL AC_ARG_WITH(openssl, AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]), @@ -456,6 +462,10 @@ AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symb # Set shell used by install scriptlets AC_SUBST(SCRIPTLET_SHELL) AC_DEFINE_UNQUOTED([SCRIPTLET_SHELL], "$SCRIPTLET_SHELL", [The full path of the shell used to run install scriptlets]) +# Set ldconfig path +AC_SUBST(LDCONFIG) +AC_DEFINE_UNQUOTED([LDCONFIG], "$LDCONFIG", [The full path to ldconfig]) + # Configuration files AC_CONFIG_FILES([ diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c index c88326f..7d9ee63 100644 --- a/lib/libalpm/util.c +++ b/lib/libalpm/util.c @@ -621,12 +621,12 @@ int _alpm_ldconfig(alpm_handle_t *handle) snprintf(line, PATH_MAX, "%setc/ld.so.conf", handle->root); if(access(line, F_OK) == 0) { - snprintf(line, PATH_MAX, "%ssbin/ldconfig", handle->root); + snprintf(line, PATH_MAX, "%s%s", handle->root, LDCONFIG); if(access(line, X_OK) == 0) { char arg0[32]; char *argv[] = { arg0, NULL }; strcpy(arg0, "ldconfig"); - return _alpm_run_chroot(handle, "/sbin/ldconfig", argv); + return _alpm_run_chroot(handle, LDCONFIG, argv); } } diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py index ea44be5..2b1dee6 100755 --- a/test/pacman/pactest.py +++ b/test/pacman/pactest.py @@ -85,6 +85,9 @@ def create_parser(): parser.add_option("--scriptlet-shell", type = "string", dest = "scriptletshell", default = "/bin/sh", help = "specify path to shell used for install scriptlets") + parser.add_option("--ldconfig", type = "string", + dest = "ldconfig", default = "/sbin/ldconfig", + help = "specify path to ldconfig") return parser @@ -104,6 +107,7 @@ def create_parser(): env.pacman["valgrind"] = opts.valgrind env.pacman["manual-confirm"] = opts.manualconfirm env.pacman["scriptlet-shell"] = opts.scriptletshell + env.pacman["ldconfig"] = opts.ldconfig if opts.testcases is None or len(opts.testcases) == 0: print "no tests defined, nothing to do" diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py index af5d342..1d198f0 100644 --- a/test/pacman/pmtest.py +++ b/test/pacman/pmtest.py @@ -120,11 +120,12 @@ def generate(self, pacman): logdir = os.path.join(self.root, os.path.dirname(util.LOGFILE)) etcdir = os.path.join(self.root, os.path.dirname(util.PACCONF)) bindir = os.path.join(self.root, "bin") - sbindir = os.path.join(self.root, "sbin") + ldconfig = os.path.basename(pacman["ldconfig"]) + ldconfigdir = os.path.join(self.root, os.path.dirname(pacman["ldconfig"][1:])) shell = pacman["scriptlet-shell"][1:] shelldir = os.path.join(self.root, os.path.dirname(shell)) sys_dirs = [dbdir, cachedir, syncdir, tmpdir, logdir, etcdir, bindir, - sbindir, shelldir] + ldconfigdir, shelldir] for sys_dir in sys_dirs: if not os.path.isdir(sys_dir): vprint("\t%s" % sys_dir[len(self.root)+1:]) @@ -134,7 +135,7 @@ def generate(self, pacman): if shell != "bin/sh": shutil.copy("/bin/sh", os.path.join(self.root, shell)) shutil.copy(os.path.join(util.SELFPATH, "ldconfig.stub"), - os.path.join(sbindir, "ldconfig")) + os.path.join(ldconfigdir, ldconfig)) ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w") ld_so_conf.close() -- 1.8.1.1
participants (1)
-
Allan McRae