summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2014-10-01 01:57:44 -0400
committerAllan McRae <allan@archlinux.org>2015-01-21 14:27:47 +1000
commit926280cfc7da5aa6d8a4e7dc60f9831176758e7e (patch)
tree4465c6d1d69d744af94fc4b80ad2da2b2db4ce16
parenta82a5cf3f71e38c54a5ac1b5eaf3c83374d0e515 (diff)
remove support for .pacorig files
Leave user files in place and save new config files with a .pacnew extension. This reduces the complexity of file extraction and respects the principle that pacman shouldn't modify files it didn't create. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
-rw-r--r--README4
-rw-r--r--contrib/README2
-rw-r--r--contrib/pacdiff.sh.in4
-rw-r--r--doc/pacman.8.txt5
-rw-r--r--lib/libalpm/add.c82
-rw-r--r--lib/libalpm/alpm.h15
-rw-r--r--src/pacman/callback.c16
-rw-r--r--test/pacman/README1
-rw-r--r--test/pacman/pmrule.py3
-rw-r--r--test/pacman/tests/upgrade015.py1
-rw-r--r--test/pacman/tests/upgrade016.py5
-rw-r--r--test/pacman/tests/upgrade027.py1
-rw-r--r--test/pacman/tests/upgrade028.py1
-rw-r--r--test/pacman/tests/upgrade029.py1
14 files changed, 36 insertions, 105 deletions
diff --git a/README b/README
index 4aeb8435..8c17d335 100644
--- a/README
+++ b/README
@@ -568,6 +568,10 @@ API CHANGES BETWEEN 4.2 AND 5.0
[REMOVED]
- alpm_siglevel_t - removed members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
+- ALPM_EVENT_PACORIG_CREATED
+- alpm_event_pacorig_created_t
+- alpm_event_t.pacorig_created
+
[ADDED]
- pkgbase accessor
- alpm_pkg_get_base()
diff --git a/contrib/README b/contrib/README
index bcb4b853..befd3c1d 100644
--- a/contrib/README
+++ b/contrib/README
@@ -16,7 +16,7 @@ sync databases (for safety on rolling release distributions).
paccache - a flexible package cache cleaning utility that allows greater
control over which packages are removed.
-pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
+pacdiff - a simple pacnew/pacsave updater for /etc/.
paclist - list all packages installed from a given repository. Useful for
seeing which packages you may have installed from the testing repository,
diff --git a/contrib/pacdiff.sh.in b/contrib/pacdiff.sh.in
index ecb6ae29..3f0a3c69 100644
--- a/contrib/pacdiff.sh.in
+++ b/contrib/pacdiff.sh.in
@@ -1,5 +1,5 @@
#!/bin/bash
-# pacdiff : a simple pacnew/pacorig/pacsave updater
+# pacdiff : a simple pacnew/pacsave updater
#
# Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
# Copyright (c) 2013-2014 Pacman Development Team <pacman-dev@archlinux.org>
@@ -35,7 +35,7 @@ usage() {
cat <<EOF
${myname} (pacman) v${myver}
-A simple program to merge or remove pacnew/pacorig/pacsave files.
+A simple program to merge or remove pacnew/pacsave files.
Usage: $myname [-l | -f | -p] [--nocolor]
diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index 3fef08dc..5c57450b 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -484,8 +484,9 @@ original=X, current=Y, new=Z::
original=NULL, current=Y, new=Z::
The package was not previously installed, and the file already exists on the
- file system. Save the current file with a '.pacorig' extension, install the
- new file, and warn the user.
+ file system. Install the new file with a '.pacnew' extension and warn the
+ user. The user must then manually merge any necessary changes into the
+ original file.
Examples
diff --git a/lib/libalpm/add.c b/lib/libalpm/add.c
index f6f62f32..d4f77185 100644
--- a/lib/libalpm/add.c
+++ b/lib/libalpm/add.c
@@ -333,69 +333,33 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
} else {
/* none of the three files matched another, unpack the new file alongside
* the local file */
+ char *newpath;
+ size_t newlen = strlen(filename) + strlen(".pacnew") + 1;
- if(oldpkg) {
- char *newpath;
- size_t newlen = strlen(filename) + strlen(".pacnew") + 1;
-
- _alpm_log(handle, ALPM_LOG_DEBUG,
- "action: keeping current file and installing"
- " new one with .pacnew ending\n");
-
- MALLOC(newpath, newlen,
- errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
- snprintf(newpath, newlen, "%s.pacnew", filename);
-
- if(try_rename(handle, checkfile, newpath)) {
- errors++;
- } else {
- alpm_event_pacnew_created_t event = {
- .type = ALPM_EVENT_PACNEW_CREATED,
- .from_noupgrade = 0,
- .oldpkg = oldpkg,
- .newpkg = newpkg,
- .file = filename
- };
- EVENT(handle, &event);
- alpm_logaction(handle, ALPM_CALLER_PREFIX,
- "warning: %s installed as %s\n", filename, newpath);
- }
+ _alpm_log(handle, ALPM_LOG_DEBUG,
+ "action: keeping current file and installing"
+ " new one with .pacnew ending\n");
- free(newpath);
- } else {
- char *newpath;
- size_t newlen = strlen(filename) + strlen(".pacorig") + 1;
-
- _alpm_log(handle, ALPM_LOG_DEBUG,
- "action: saving existing file with a .pacorig ending"
- " and installing a new one\n");
-
- MALLOC(newpath, newlen,
- errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
- snprintf(newpath, newlen, "%s.pacorig", filename);
-
- /* move the existing file to the "pacorig" */
- if(try_rename(handle, filename, newpath)) {
- errors++; /* failed rename filename -> filename.pacorig */
- errors++; /* failed rename checkfile -> filename */
- } else {
- /* rename the file we extracted to the real name */
- if(try_rename(handle, checkfile, filename)) {
- errors++;
- } else {
- alpm_event_pacorig_created_t event = {
- .type = ALPM_EVENT_PACORIG_CREATED,
- .newpkg = newpkg,
- .file = filename
- };
- EVENT(handle, &event);
- alpm_logaction(handle, ALPM_CALLER_PREFIX,
- "warning: %s saved as %s\n", filename, newpath);
- }
- }
+ MALLOC(newpath, newlen,
+ errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
+ snprintf(newpath, newlen, "%s.pacnew", filename);
- free(newpath);
+ if(try_rename(handle, checkfile, newpath)) {
+ errors++;
+ } else {
+ alpm_event_pacnew_created_t event = {
+ .type = ALPM_EVENT_PACNEW_CREATED,
+ .from_noupgrade = 0,
+ .oldpkg = oldpkg,
+ .newpkg = newpkg,
+ .file = filename
+ };
+ EVENT(handle, &event);
+ alpm_logaction(handle, ALPM_CALLER_PREFIX,
+ "warning: %s installed as %s\n", filename, newpath);
}
+
+ free(newpath);
}
needbackup_cleanup:
diff --git a/lib/libalpm/alpm.h b/lib/libalpm/alpm.h
index 53793b4b..23ec2427 100644
--- a/lib/libalpm/alpm.h
+++ b/lib/libalpm/alpm.h
@@ -442,10 +442,7 @@ typedef enum _alpm_event_type_t {
ALPM_EVENT_PACNEW_CREATED,
/** A .pacsave file was created; See alpm_event_pacsave_created_t for
* arguments */
- ALPM_EVENT_PACSAVE_CREATED,
- /** A .pacorig file was created; See alpm_event_pacorig_created_t for
- * arguments */
- ALPM_EVENT_PACORIG_CREATED
+ ALPM_EVENT_PACSAVE_CREATED
} alpm_event_type_t;
typedef struct _alpm_event_any_t {
@@ -536,15 +533,6 @@ typedef struct _alpm_event_pacsave_created_t {
const char *file;
} alpm_event_pacsave_created_t;
-typedef struct _alpm_event_pacorig_created_t {
- /** Type of event. */
- alpm_event_type_t type;
- /** New package. */
- alpm_pkg_t *newpkg;
- /** Filename of the file without the .pacorig suffix. */
- const char *file;
-} alpm_event_pacorig_created_t;
-
/** Events.
* This is an union passed to the callback, that allows the frontend to know
* which type of event was triggered (via type). It is then possible to
@@ -561,7 +549,6 @@ typedef union _alpm_event_t {
alpm_event_pkgdownload_t pkgdownload;
alpm_event_pacnew_created_t pacnew_created;
alpm_event_pacsave_created_t pacsave_created;
- alpm_event_pacorig_created_t pacorig_created;
} alpm_event_t;
/** Event callback. */
diff --git a/src/pacman/callback.c b/src/pacman/callback.c
index d566d738..0d87fd35 100644
--- a/src/pacman/callback.c
+++ b/src/pacman/callback.c
@@ -315,22 +315,6 @@ void cb_event(alpm_event_t *event)
}
}
break;
- case ALPM_EVENT_PACORIG_CREATED:
- {
- alpm_event_pacorig_created_t *e = &event->pacorig_created;
- if(on_progress) {
- char *string = NULL;
- pm_sprintf(&string, ALPM_LOG_WARNING, _("%s saved as %s.pacorig\n"),
- e->file, e->file);
- if(string != NULL) {
- output = alpm_list_add(output, string);
- }
- } else {
- pm_printf(ALPM_LOG_WARNING, _("%s saved as %s.pacorig\n"),
- e->file, e->file);
- }
- }
- break;
/* all the simple done events, with fallthrough for each */
case ALPM_EVENT_FILECONFLICTS_DONE:
case ALPM_EVENT_CHECKDEPS_DONE:
diff --git a/test/pacman/README b/test/pacman/README
index 8d8354ab..6c601b2f 100644
--- a/test/pacman/README
+++ b/test/pacman/README
@@ -310,7 +310,6 @@ its DEPENDS field.
FILE_TYPE=path/to/file|type (possible types: dir, file, link)
FILE_PACNEW=path/to/file
FILE_PACSAVE=path/to/file
- FILE_PACORIG=path/to/file
Example:
FILE_EXIST=etc/test.conf
diff --git a/test/pacman/pmrule.py b/test/pacman/pmrule.py
index c2336c5d..8e6b2c0c 100644
--- a/test/pacman/pmrule.py
+++ b/test/pacman/pmrule.py
@@ -146,9 +146,6 @@ class pmrule(object):
elif case == "PACNEW":
if not os.path.isfile("%s.pacnew" % filename):
success = 0
- elif case == "PACORIG":
- if not os.path.isfile("%s.pacorig" % filename):
- success = 0
elif case == "PACSAVE":
if not os.path.isfile("%s.pacsave" % filename):
success = 0
diff --git a/test/pacman/tests/upgrade015.py b/test/pacman/tests/upgrade015.py
index ea6046cb..64fe2813 100644
--- a/test/pacman/tests/upgrade015.py
+++ b/test/pacman/tests/upgrade015.py
@@ -12,4 +12,3 @@ self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
self.addrule("FILE_MODIFIED=etc/dummy.conf")
self.addrule("!FILE_PACNEW=etc/dummy.conf")
-self.addrule("!FILE_PACORIG=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade016.py b/test/pacman/tests/upgrade016.py
index b6b3f3ae..ddf57e8c 100644
--- a/test/pacman/tests/upgrade016.py
+++ b/test/pacman/tests/upgrade016.py
@@ -11,6 +11,5 @@ self.args = "-U --force %s" % p.filename()
self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_EXIST=dummy")
-self.addrule("FILE_MODIFIED=etc/dummy.conf")
-self.addrule("!FILE_PACNEW=etc/dummy.conf")
-self.addrule("FILE_PACORIG=etc/dummy.conf")
+self.addrule("!FILE_MODIFIED=etc/dummy.conf")
+self.addrule("FILE_PACNEW=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade027.py b/test/pacman/tests/upgrade027.py
index 99087f34..3dd694af 100644
--- a/test/pacman/tests/upgrade027.py
+++ b/test/pacman/tests/upgrade027.py
@@ -18,5 +18,4 @@ self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1.0-2")
self.addrule("FILE_PACNEW=etc/dummy.conf")
self.addrule("!FILE_PACSAVE=etc/dummy.conf")
-self.addrule("!FILE_PACORIG=etc/dummy.conf")
self.addrule("FILE_EXIST=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade028.py b/test/pacman/tests/upgrade028.py
index 18a10f57..1e31aa31 100644
--- a/test/pacman/tests/upgrade028.py
+++ b/test/pacman/tests/upgrade028.py
@@ -18,5 +18,4 @@ self.addrule("PACMAN_RETCODE=0")
self.addrule("PKG_VERSION=dummy|1.0-2")
self.addrule("!FILE_PACNEW=etc/dummy.conf")
self.addrule("!FILE_PACSAVE=etc/dummy.conf")
-self.addrule("!FILE_PACORIG=etc/dummy.conf")
self.addrule("FILE_EXIST=etc/dummy.conf")
diff --git a/test/pacman/tests/upgrade029.py b/test/pacman/tests/upgrade029.py
index c308f426..eef5c700 100644
--- a/test/pacman/tests/upgrade029.py
+++ b/test/pacman/tests/upgrade029.py
@@ -20,5 +20,4 @@ self.addrule("PACMAN_RETCODE=1")
self.addrule("PKG_VERSION=dummy|1.0-1")
self.addrule("!FILE_PACNEW=etc/dummy.conf")
self.addrule("!FILE_PACSAVE=etc/dummy.conf")
-self.addrule("!FILE_PACORIG=etc/dummy.conf")
self.addrule("FILE_EXIST=etc/dummy.conf")