summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--configure.ac1
-rw-r--r--etc/pacman.conf.in1
-rw-r--r--lib/libalpm/Makefile.am5
-rw-r--r--lib/libalpm/alpm.h2
-rw-r--r--lib/libalpm/handle.c17
-rw-r--r--lib/libalpm/util.c9
-rwxr-xr-xpactest/pmtest.py5
-rwxr-xr-xpactest/util.py2
-rw-r--r--scripts/pacman-optimize.in2
-rw-r--r--src/pacman/Makefile.am1
-rw-r--r--src/pacman/pacman.c10
11 files changed, 15 insertions, 40 deletions
diff --git a/configure.ac b/configure.ac
index 7ff9db5a..24d7219b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -255,7 +255,6 @@ $PACKAGE_STRING:
sysconfdir : $(eval echo ${sysconfdir})
conf file : $(eval echo ${sysconfdir})/pacman.conf
localstatedir : $(eval echo ${localstatedir})
- lock file : $(eval echo ${localstatedir})/run/pacman.lck
database dir : $(eval echo ${localstatedir})/lib/pacman/
cache dir : $(eval echo ${localstatedir})/cache/pacman/pkg/
compiler : ${CC}
diff --git a/etc/pacman.conf.in b/etc/pacman.conf.in
index bfc4265d..33ef1814 100644
--- a/etc/pacman.conf.in
+++ b/etc/pacman.conf.in
@@ -10,7 +10,6 @@
RootDir = @ROOTDIR@
DBPath = @localstatedir@/lib/pacman/
CacheDir = @localstatedir@/cache/pacman/pkg/
-LockFile = @localstatedir@/run/pacman.lck
LogFile = @localstatedir@/log/pacman.log
HoldPkg = pacman glibc
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
diff --git a/lib/libalpm/Makefile.am b/lib/libalpm/Makefile.am
index afbfed0e..be49c297 100644
--- a/lib/libalpm/Makefile.am
+++ b/lib/libalpm/Makefile.am
@@ -2,11 +2,6 @@ AUTOMAKE_OPTIONS = gnu
SUBDIRS = po
-# paths set at make time
-lockfile = ${localstatedir}/run/pacman.lck
-dbpath = ${localstatedir}/lib/pacman/
-cachedir = ${localstatedir}/cache/pacman/pkg/
-
lib_LTLIBRARIES = libalpm.la
include_HEADERS = alpm_list.h alpm.h
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index add835d2..d1363803 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -106,7 +106,7 @@ const char *alpm_option_get_logfile();
void alpm_option_set_logfile(const char *logfile);
const char *alpm_option_get_lockfile();
-void alpm_option_set_lockfile(const char *lockfile);
+/* no set_lockfile, path is determined from dbpath */
unsigned short alpm_option_get_usesyslog();
void alpm_option_set_usesyslog(unsigned short usesyslog);
diff --git a/lib/libalpm/handle.c b/lib/libalpm/handle.c
index 6f9e3330..7cee5020 100644
--- a/lib/libalpm/handle.c
+++ b/lib/libalpm/handle.c
@@ -181,6 +181,7 @@ void SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
ALPM_LOG_FUNC;
if(handle->dbpath) FREE(handle->dbpath);
+ if(handle->lockfile) FREE(handle->lockfile);
if(dbpath) {
/* verify dbpath ends in a '/' */
int dbpathlen = strlen(dbpath);
@@ -190,7 +191,13 @@ void SYMEXPORT alpm_option_set_dbpath(const char *dbpath)
handle->dbpath = calloc(dbpathlen+1, sizeof(char));
strncpy(handle->dbpath, dbpath, dbpathlen);
handle->dbpath[dbpathlen-1] = '/';
+
+ const char *lf = "db.lck";
+ int lockfilelen = strlen(handle->dbpath) + strlen(lf);
+ handle->lockfile = calloc(lockfilelen + 1, sizeof(char));
+ snprintf(handle->lockfile, lockfilelen, "%s%s", handle->dbpath, lf);
}
+
}
void SYMEXPORT alpm_option_add_cachedir(const char *cachedir)
@@ -235,16 +242,6 @@ void SYMEXPORT alpm_option_set_logfile(const char *logfile)
}
}
-void SYMEXPORT alpm_option_set_lockfile(const char *lockfile)
-{
- ALPM_LOG_FUNC;
-
- if(handle->lockfile) FREE(handle->lockfile);
- if(lockfile) {
- handle->lockfile = strdup(lockfile);
- }
-}
-
void SYMEXPORT alpm_option_set_usesyslog(unsigned short usesyslog)
{
handle->usesyslog = usesyslog;
diff --git a/lib/libalpm/util.c b/lib/libalpm/util.c
index e67a13ad..ec6c1df1 100644
--- a/lib/libalpm/util.c
+++ b/lib/libalpm/util.c
@@ -264,8 +264,7 @@ char *_alpm_strreplace(const char *str, const char *needle, const char *replace)
}
-/* Create a lock file
-*/
+/* Create a lock file */
int _alpm_lckmk()
{
int fd, count = 0;
@@ -293,8 +292,7 @@ int _alpm_lckmk()
return(fd > 0 ? fd : -1);
}
-/* Remove a lock file
-*/
+/* Remove a lock file */
int _alpm_lckrm()
{
const char *file = alpm_option_get_lockfile();
@@ -304,8 +302,7 @@ int _alpm_lckrm()
return(0);
}
-/* Compression functions
-*/
+/* Compression functions */
int _alpm_unpack(const char *archive, const char *prefix, const char *fn)
{
diff --git a/pactest/pmtest.py b/pactest/pmtest.py
index dd524211..00dd3cbc 100755
--- a/pactest/pmtest.py
+++ b/pactest/pmtest.py
@@ -192,13 +192,12 @@ class pmtest:
cmd.append("libtool gdb --args")
if pacman["valgrind"]:
cmd.append("valgrind --tool=memcheck --leak-check=full --show-reachable=yes")
- cmd.append("%s --config=%s --root=%s --dbpath=%s --cachedir=%s --lock=%s" \
+ cmd.append("%s --config=%s --root=%s --dbpath=%s --cachedir=%s" \
% (pacman["bin"],
os.path.join(self.root, PACCONF),
self.root,
os.path.join(self.root, PM_DBPATH),
- os.path.join(self.root, PM_CACHEDIR),
- os.path.join(self.root, PM_LOCK) ))
+ os.path.join(self.root, PM_CACHEDIR)))
if not pacman["manual-confirm"]:
cmd.append("--noconfirm")
if pacman["debug"]:
diff --git a/pactest/util.py b/pactest/util.py
index 98c22a5c..d3203428 100755
--- a/pactest/util.py
+++ b/pactest/util.py
@@ -27,8 +27,8 @@ import stat
# ALPM
PM_ROOT = "/"
PM_DBPATH = "var/lib/pacman"
+PM_LOCK = "var/lib/pacman/db.lck"
PM_CACHEDIR = "var/cache/pacman/pkg"
-PM_LOCK = "var/run/pacman.lck"
PM_EXT_PKG = ".pkg.tar.gz"
PM_EXT_DB = ".db.tar.gz"
PM_PACNEW = ".pacnew"
diff --git a/scripts/pacman-optimize.in b/scripts/pacman-optimize.in
index 3f7f51f7..d4c926d8 100644
--- a/scripts/pacman-optimize.in
+++ b/scripts/pacman-optimize.in
@@ -27,7 +27,7 @@ export TEXTDOMAINDIR='@localedir@'
myver='@PACKAGE_VERSION@'
dbroot='@localstatedir@/lib/pacman/'
-lockfile='@localstatedir@/run/pacman.lck'
+lockfile="${dbroot}db.lck"
msg() {
local mesg=$1; shift
diff --git a/src/pacman/Makefile.am b/src/pacman/Makefile.am
index 1ab59166..39e65920 100644
--- a/src/pacman/Makefile.am
+++ b/src/pacman/Makefile.am
@@ -2,7 +2,6 @@ SUBDIRS = po
# paths set at make time
conffile = ${sysconfdir}/pacman.conf
-lockfile = ${localstatedir}/run/pacman.lck
bin_PROGRAMS = pacman pacman.static
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index e0f9ba68..a345977d 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -149,7 +149,6 @@ static void usage(int op, char *myname)
printf(_(" -r, --root <path> set an alternate installation root\n"));
printf(_(" -b, --dbpath <path> set an alternate database location\n"));
printf(_(" --cachedir <dir> set an alternate package cache location\n"));
- printf(_(" --lock <file> set an alternate lockfile location\n"));
}
}
@@ -293,7 +292,6 @@ static int parseargs(int argc, char *argv[])
{"noscriptlet", no_argument, 0, 1005},
{"ask", required_argument, 0, 1006},
{"cachedir", required_argument, 0, 1007},
- {"lock", required_argument, 0, 1008},
{0, 0, 0, 0}
};
struct stat st;
@@ -347,9 +345,6 @@ static int parseargs(int argc, char *argv[])
}
alpm_option_add_cachedir(optarg);
break;
- case 1008:
- alpm_option_set_lockfile(optarg);
- break;
case 'A': config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_ADD); break;
case 'F':
config->op = (config->op != PM_OP_MAIN ? 0 : PM_OP_UPGRADE);
@@ -636,11 +631,6 @@ static int _parseconfig(const char *file, const char *givensection,
alpm_option_set_logfile(ptr);
pm_printf(PM_LOG_DEBUG, _("config: logfile: %s\n"), ptr);
}
- } else if (strcmp(key, "LockFile") == 0 || strcmp(upperkey, "LOCKFILE") == 0) {
- if(alpm_option_get_lockfile() == NULL) {
- alpm_option_set_lockfile(ptr);
- pm_printf(PM_LOG_DEBUG, _("config: lockfile: %s\n"), ptr);
- }
} else if (strcmp(key, "XferCommand") == 0 || strcmp(upperkey, "XFERCOMMAND") == 0) {
alpm_option_set_xfercommand(ptr);
pm_printf(PM_LOG_DEBUG, _("config: xfercommand: %s\n"), ptr);