MSYS2-packages/pacman/0012-Remove-ldconfig.patch
2025-06-08 07:57:35 +02:00

256 lines
8.5 KiB
Diff

From 1922afb088a7496804363bc47e63535202992f8a Mon Sep 17 00:00:00 2001
From: Christoph Reiter <reiter.christoph@gmail.com>
Date: Fri, 21 May 2021 22:53:34 +0200
Subject: [PATCH 12/N] Remove ldconfig
---
lib/libalpm/add.c | 9 ++++++++-
lib/libalpm/remove.c | 4 ++++
lib/libalpm/util.c | 2 ++
test/pacman/ldconfig.stub | 4 ----
test/pacman/meson.build | 4 ----
test/pacman/pactest.py | 4 ----
test/pacman/pmtest.py | 8 +-------
test/pacman/tests/TESTS | 3 ---
test/pacman/tests/ldconfig001.py | 9 ---------
test/pacman/tests/ldconfig002.py | 13 -------------
test/pacman/tests/ldconfig003.py | 9 ---------
11 files changed, 15 insertions(+), 54 deletions(-)
delete mode 100755 test/pacman/ldconfig.stub
delete mode 100644 test/pacman/tests/ldconfig001.py
delete mode 100644 test/pacman/tests/ldconfig002.py
delete mode 100644 test/pacman/tests/ldconfig003.py
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index e08ff84..c21c884 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -657,7 +657,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
int _alpm_upgrade_packages(alpm_handle_t *handle)
{
size_t pkg_count, pkg_current;
- int skip_ldconfig = 0, ret = 0;
+#ifndef __MSYS__
+ int skip_ldconfig = 0;
+#endif
+ int ret = 0;
alpm_list_t *targ;
alpm_trans_t *trans = handle->trans;
@@ -680,18 +683,22 @@ int _alpm_upgrade_packages(alpm_handle_t *handle)
/* something screwed up on the commit, abort the trans */
trans->state = STATE_INTERRUPTED;
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
+#ifndef __MSYS__
/* running ldconfig at this point could possibly screw system */
skip_ldconfig = 1;
+#endif
ret = -1;
}
pkg_current++;
}
+#ifndef __MSYS__
if(!skip_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle);
}
+#endif
return ret;
}
diff --git a/lib/libalpm/remove.c b/lib/libalpm/remove.c
index f44eac7..48c6def 100644
--- a/lib/libalpm/remove.c
+++ b/lib/libalpm/remove.c
@@ -767,18 +767,22 @@ int _alpm_remove_packages(alpm_handle_t *handle, int run_ldconfig)
if(_alpm_remove_single_package(handle, pkg, NULL,
targ_count, pkg_count) == -1) {
handle->pm_errno = ALPM_ERR_TRANS_ABORT;
+#ifndef __MSYS__
/* running ldconfig at this point could possibly screw system */
run_ldconfig = 0;
+#endif
ret = -1;
}
targ_count++;
}
+#ifndef __MSYS__
if(run_ldconfig) {
/* run ldconfig if it exists */
_alpm_ldconfig(handle);
}
+#endif
return ret;
}
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index 83160f0..95f30a4 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -794,6 +794,7 @@ cleanup:
return retval;
}
+#ifndef __MSYS__
/** Run ldconfig in a chroot.
* @param handle the context handle
* @return 0 on success, 1 on error
@@ -817,6 +818,7 @@ int _alpm_ldconfig(alpm_handle_t *handle)
return 0;
}
+#endif
/** Helper function for comparing strings using the alpm "compare func"
* signature.
diff --git a/test/pacman/ldconfig.stub b/test/pacman/ldconfig.stub
deleted file mode 100755
index d261a04..0000000
--- a/test/pacman/ldconfig.stub
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/sh
-# A simple stub to copy into the chroot to fake ldconfig.
-# Simply appends a line to /etc/ld.so.cache if called.
-echo "ldconfig called" >> /etc/ld.so.cache
diff --git a/test/pacman/meson.build b/test/pacman/meson.build
index c26ce0f..5653b1c 100644
--- a/test/pacman/meson.build
+++ b/test/pacman/meson.build
@@ -80,9 +80,6 @@ pacman_tests = [
'tests/ignore006.py',
'tests/ignore007.py',
'tests/ignore008.py',
- 'tests/ldconfig001.py',
- 'tests/ldconfig002.py',
- 'tests/ldconfig003.py',
'tests/mode001.py',
'tests/mode002.py',
'tests/mode003.py',
@@ -359,7 +356,6 @@ foreach input : pacman_tests
join_paths(meson.current_source_dir(), 'pactest.py'),
'--scriptlet-shell', get_option('scriptlet-shell'),
'--bindir', meson.project_build_root(),
- '--ldconfig', LDCONFIG,
'--verbose',
join_paths(meson.current_source_dir(), input)
]
diff --git a/test/pacman/pactest.py b/test/pacman/pactest.py
index c6add23..d9f0445 100755
--- a/test/pacman/pactest.py
+++ b/test/pacman/pactest.py
@@ -104,9 +104,6 @@ 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")
parser.add_option("--review", action = "store_true",
dest = "review", default = False,
help = "review test files, test output, and saved logs")
@@ -146,7 +143,6 @@ if __name__ == "__main__":
env.pacman["valgrind"] = opts.valgrind
env.pacman["manual-confirm"] = opts.manualconfirm
env.pacman["scriptlet-shell"] = opts.scriptletshell
- env.pacman["ldconfig"] = opts.ldconfig
env.config["gpg"] = not opts.missing_gpg
env.config["nls"] = not opts.missing_nls
env.config["curl"] = not opts.missing_curl
diff --git a/test/pacman/pmtest.py b/test/pacman/pmtest.py
index 47a7cf4..742db1a 100644
--- a/test/pacman/pmtest.py
+++ b/test/pacman/pmtest.py
@@ -134,12 +134,10 @@ class pmtest(object):
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")
- 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,
- ldconfigdir, shelldir]
+ shelldir]
for sys_dir in sys_dirs:
if not os.path.isdir(sys_dir):
vprint("\t%s" % sys_dir[len(self.root)+1:])
@@ -148,10 +146,6 @@ class pmtest(object):
shutil.copy("/bin/sh", bindir)
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(ldconfigdir, ldconfig))
- ld_so_conf = open(os.path.join(etcdir, "ld.so.conf"), "w")
- ld_so_conf.close()
# Configuration file
vprint(" Creating configuration file")
diff --git a/test/pacman/tests/TESTS b/test/pacman/tests/TESTS
index 74c8f67..b29181b 100644
--- a/test/pacman/tests/TESTS
+++ b/test/pacman/tests/TESTS
@@ -78,9 +78,6 @@ TESTS += test/pacman/tests/ignore005.py
TESTS += test/pacman/tests/ignore006.py
TESTS += test/pacman/tests/ignore007.py
TESTS += test/pacman/tests/ignore008.py
-TESTS += test/pacman/tests/ldconfig001.py
-TESTS += test/pacman/tests/ldconfig002.py
-TESTS += test/pacman/tests/ldconfig003.py
TESTS += test/pacman/tests/mode001.py
TESTS += test/pacman/tests/mode002.py
TESTS += test/pacman/tests/mode003.py
diff --git a/test/pacman/tests/ldconfig001.py b/test/pacman/tests/ldconfig001.py
deleted file mode 100644
index a97f28c..0000000
--- a/test/pacman/tests/ldconfig001.py
+++ /dev/null
@@ -1,9 +0,0 @@
-self.description = "Make sure ldconfig runs on an upgrade operation"
-
-p = pmpkg("dummy")
-self.addpkg(p)
-
-self.args = "-U %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff --git a/test/pacman/tests/ldconfig002.py b/test/pacman/tests/ldconfig002.py
deleted file mode 100644
index 07f2ec6..0000000
--- a/test/pacman/tests/ldconfig002.py
+++ /dev/null
@@ -1,13 +0,0 @@
-self.description = "Make sure ldconfig runs on an upgrade operation"
-
-lp = pmpkg("dummy")
-self.addpkg2db("local", lp)
-
-p = pmpkg("dummy", "1.0-2")
-self.addpkg(p)
-
-self.args = "-U %s" % p.filename()
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_VERSION=dummy|1.0-2")
-self.addrule("FILE_EXIST=etc/ld.so.cache")
diff --git a/test/pacman/tests/ldconfig003.py b/test/pacman/tests/ldconfig003.py
deleted file mode 100644
index 9b2967e..0000000
--- a/test/pacman/tests/ldconfig003.py
+++ /dev/null
@@ -1,9 +0,0 @@
-self.description = "Make sure ldconfig runs on a sync operation"
-
-sp = pmpkg("dummy")
-self.addpkg2db("sync", sp)
-
-self.args = "-S %s" % sp.name
-
-self.addrule("PACMAN_RETCODE=0")
-self.addrule("FILE_EXIST=etc/ld.so.cache")