summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDan McGee <dan@archlinux.org>2012-02-20 17:00:26 -0600
committerDan McGee <dan@archlinux.org>2012-02-20 17:00:26 -0600
commit3849c3aec130601572b9e06b42bb6af5938936de (patch)
treef298f227f4ff591390e55b4f02812f12312dd5c7
parent326c6a8eed60bfd6aa0d653dad722d8637022d68 (diff)
parent78adb71f20ee335dff49e34d33f04817a40002b6 (diff)
downloadpacman-3849c3aec130601572b9e06b42bb6af5938936de.tar.xz
Merge branch 'maint'
Conflicts: contrib/pacsysclean.in src/pacman/conf.h
-rwxr-xr-xcontrib/pacsysclean.in7
-rw-r--r--doc/pacman.8.txt7
-rw-r--r--lib/libalpm/deps.c29
-rw-r--r--lib/libalpm/diskspace.c14
-rw-r--r--lib/libalpm/dload.c4
-rw-r--r--scripts/library/parse_options.sh32
-rw-r--r--scripts/makepkg.sh.in10
-rw-r--r--scripts/pacman-key.sh.in6
-rw-r--r--scripts/pacman-optimize.sh.in3
-rw-r--r--src/pacman/conf.h1
-rw-r--r--src/pacman/pacman.c8
-rw-r--r--src/pacman/sync.c2
-rw-r--r--src/pacman/util.c10
-rw-r--r--test/pacman/tests/sync302.py8
-rw-r--r--test/pacman/tests/sync303.py3
-rw-r--r--test/pacman/tests/sync304.py2
-rw-r--r--test/pacman/tests/sync305.py3
-rw-r--r--test/pacman/tests/sync306.py1
-rw-r--r--test/pacman/tests/upgrade078.py17
19 files changed, 61 insertions, 106 deletions
diff --git a/contrib/pacsysclean.in b/contrib/pacsysclean.in
index 17f7681b..162530ef 100755
--- a/contrib/pacsysclean.in
+++ b/contrib/pacsysclean.in
@@ -1,6 +1,6 @@
#!/bin/bash
-# pacsysclean - Sort installed packages by decreasing installed size. Useful for system clean-up.
+# pacsysclean - Sort installed packages by increasing installed size. Useful for system clean-up.
declare -r myname='pacsysclean'
declare -r myver='@PACKAGE_VERSION@'
@@ -8,7 +8,7 @@ declare -r myver='@PACKAGE_VERSION@'
PACMAN_OPTS=
usage() {
- echo "$myname - Sort installed packages by decreasing installed size."
+ echo "$myname - Sort installed packages by increasing installed size."
echo
echo "Usage: $myname [options]"
echo
@@ -35,6 +35,9 @@ fi
IFS=$'\n'
name="^Name.*: (.*)$"
size="^Installed Size.*: (.*) KiB$"
+
+[[ $PACMAN_OPTS != -* ]] && PACMAN_OPTS="-$PACMAN_OPTS"
+
for line in $(LANG=C pacman -Qi $PACMAN_OPTS); do
if [[ $line =~ $name ]]; then
printf "%s\t" ${BASH_REMATCH[1]}
diff --git a/doc/pacman.8.txt b/doc/pacman.8.txt
index 0813b887..275cf965 100644
--- a/doc/pacman.8.txt
+++ b/doc/pacman.8.txt
@@ -411,13 +411,6 @@ system upgrade and install/upgrade the foo package in the same operation.
*\--needed*::
Do not reinstall the targets that are already up to date.
-*\--recursive*::
- Recursively reinstall all dependencies of the targets. This forces upgrades
- or reinstalls of all dependencies without requiring explicit version
- requirements. This is most useful in combination with the '\--needed' flag,
- which will induce a deep dependency upgrade without any unnecessary
- reinstalls.
-
Handling Config Files[[HCF]]
----------------------------
diff --git a/lib/libalpm/deps.c b/lib/libalpm/deps.c
index c58e667e..eda0648d 100644
--- a/lib/libalpm/deps.c
+++ b/lib/libalpm/deps.c
@@ -723,12 +723,6 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
return 0;
}
- if(handle->trans->flags & ALPM_TRANS_FLAG_RECURSE) {
- /* removing local packages from the equation causes the entire dep chain to
- * get pulled for each target- e.g., pactree -u output */
- localpkgs = NULL;
- }
-
/* Create a copy of the packages list, so that it can be restored
on error */
packages_copy = alpm_list_copy(*packages);
@@ -781,29 +775,6 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
alpm_list_free(deps);
}
- if(handle->trans->flags & ALPM_TRANS_FLAG_NEEDED) {
- /* remove any deps that were pulled that match installed version */
- /* odd loop syntax so we can modify the list as we iterate */
- i = *packages;
- while(i) {
- alpm_pkg_t *tpkg = i->data;
- alpm_pkg_t *local = _alpm_db_get_pkgfromcache(
- handle->db_local, tpkg->name);
- if(local && _alpm_pkg_compare_versions(tpkg, local) == 0) {
- /* with the NEEDED flag, packages up to date are not reinstalled */
- _alpm_log(handle, ALPM_LOG_DEBUG,
- "not adding dep %s-%s as it is not needed, same version\n",
- local->name, local->version);
- j = i;
- i = i->next;
- *packages = alpm_list_remove_item(*packages, j);
- free(j);
- } else {
- i = i->next;
- }
- }
- }
-
if(ret != 0) {
alpm_list_free(*packages);
*packages = packages_copy;
diff --git a/lib/libalpm/diskspace.c b/lib/libalpm/diskspace.c
index b5c87954..ac7dab00 100644
--- a/lib/libalpm/diskspace.c
+++ b/lib/libalpm/diskspace.c
@@ -188,8 +188,20 @@ static alpm_mountpoint_t *match_mount_point(const alpm_list_t *mount_points,
for(mp = mount_points; mp != NULL; mp = mp->next) {
alpm_mountpoint_t *data = mp->data;
+ /* first, check if the prefix matches */
if(strncmp(data->mount_dir, real_path, data->mount_dir_len) == 0) {
- return data;
+ /* now, the hard work- a file like '/etc/myconfig' shouldn't map to a
+ * mountpoint '/e', but only '/etc'. If the mountpoint ends in a trailing
+ * slash, we know we didn't have a mismatch, otherwise we have to do some
+ * more sanity checks. */
+ if(data->mount_dir[data->mount_dir_len - 1] == '/') {
+ return data;
+ } else if(strlen(real_path) >= data->mount_dir_len) {
+ const char next = real_path[data->mount_dir_len];
+ if(next == '/' || next == '\0') {
+ return data;
+ }
+ }
}
}
diff --git a/lib/libalpm/dload.c b/lib/libalpm/dload.c
index 7f898954..05988065 100644
--- a/lib/libalpm/dload.c
+++ b/lib/libalpm/dload.c
@@ -436,8 +436,8 @@ static int curl_download_internal(struct dload_payload *payload,
curl_easy_setopt(curl, CURLOPT_WRITEDATA, localf);
- /* ignore any SIGPIPE signals- these may occur if our FTP socket dies or
- * something along those lines. Store the old signal handler first. */
+ /* Ignore any SIGPIPE signals. With libcurl, these shouldn't be happening,
+ * but better safe than sorry. Store the old signal handler first. */
mask_signal(SIGPIPE, SIG_IGN, &orig_sig_pipe);
mask_signal(SIGINT, &inthandler, &orig_sig_int);
diff --git a/scripts/library/parse_options.sh b/scripts/library/parse_options.sh
index 48fd42cd..39038de6 100644
--- a/scripts/library/parse_options.sh
+++ b/scripts/library/parse_options.sh
@@ -23,17 +23,15 @@ parse_options() {
[[ ${match} = ${1:2}:: && -n $2 && ${2:0:1} != "-" ]] && needsargument=1
if (( ! needsargument )); then
- printf ' %s' "$1"
+ OPTRET+=("$1")
else
if [[ -n $2 ]]; then
- printf ' %s ' "$1"
+ OPTRET+=("$1" "$2")
shift
- printf "'%q" "$1"
while [[ -n $2 && ${2:0:1} != "-" ]]; do
shift
- printf " %q" "$1"
+ OPTRET+=("$1")
done
- printf "'"
else
printf "@SCRIPTNAME@: $(gettext "option %s requires an argument\n")" "'$1'" >&2
ret=1
@@ -57,26 +55,22 @@ parse_options() {
( -n ${1:$i+1} || ( -n $2 && ${2:0:1} != "-" ) ) ]] && needsargument=1
if (( ! needsargument )); then
- printf ' -%s' "${1:i:1}"
+ OPTRET+=("-${1:i:1}")
else
if [[ -n ${1:$i+1} ]]; then
- printf ' -%s ' "${1:i:1}"
- printf "'%q" "${1:$i+1}"
+ OPTRET+=("-${1:i:1}" "${1:i+1}")
while [[ -n $2 && ${2:0:1} != "-" ]]; do
shift
- printf " %q" "$1"
+ OPTRET+=("$1")
done
- printf "'"
else
if [[ -n $2 ]]; then
- printf ' -%s ' "${1:i:1}"
+ OPTRET+=("-${1:i:1}" "$2")
shift
- printf "'%q" "$1"
while [[ -n $2 && ${2:0:1} != "-" ]]; do
shift
- printf " %q" "$1"
+ OPTRET+=("$1")
done
- printf "'"
else
printf "@SCRIPTNAME@: $(gettext "option %s requires an argument\n")" "'-${1:i:1}'" >&2
@@ -91,15 +85,11 @@ parse_options() {
fi
done
else
- unused_options="${unused_options} '$1'"
+ unused_options+=("$1")
fi
shift
done
- printf " --"
- [[ $unused_options ]] && printf ' %s' "${unused_options[@]}"
- [[ $1 ]] && printf " '%s'" "$@"
- printf "\n"
-
+ OPTRET+=('--' "${unused_options[@]}")
return $ret
-} \ No newline at end of file
+}
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index aa98cfac..6e7a5562 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -36,6 +36,8 @@ export TEXTDOMAINDIR='@localedir@'
# file -i does not work on Mac OSX unless legacy mode is set
export COMMAND_MODE='legacy'
+# Ensure CDPATH doesn't screw with our cd calls
+unset CDPATH
declare -r myver='@PACKAGE_VERSION@'
declare -r confdir='@sysconfdir@'
@@ -519,7 +521,7 @@ remove_deps() {
local deplist
deplist=($(grep -xvFf <(printf "%s\n" "${original_pkglist[@]}") \
<(printf "%s\n" "${current_pkglist[@]}") || true))
- if [[ -z deplist ]]; then
+ if [[ -z $deplist ]]; then
return
fi
@@ -1924,11 +1926,11 @@ OPT_LONG+=",version,config:"
# Pacman Options
OPT_LONG+=",noconfirm,noprogressbar"
-if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
+if ! parse_options $OPT_SHORT $OPT_LONG "$@"; then
echo; usage; exit 1 # E_INVALID_OPTION;
fi
-eval set -- "$OPT_TEMP"
-unset OPT_SHORT OPT_LONG OPT_TEMP
+set -- "${OPTRET[@]}"
+unset OPT_SHORT OPT_LONG OPTRET
while true; do
case "$1" in
diff --git a/scripts/pacman-key.sh.in b/scripts/pacman-key.sh.in
index 12e0b1ab..c393370f 100644
--- a/scripts/pacman-key.sh.in
+++ b/scripts/pacman-key.sh.in
@@ -501,11 +501,11 @@ OPT_LONG="add::,config:,delete:,edit-key:,export::,finger::,gpgdir:"
OPT_LONG+=",help,import:,import-trustdb:,init,keyserver:,list-keys::,list-sigs::"
OPT_LONG+=",lsign-key:,populate::,recv-keys:,refresh-keys::,updatedb"
OPT_LONG+=",verify:,version"
-if ! OPT_TEMP="$(parse_options $OPT_SHORT $OPT_LONG "$@")"; then
+if ! parse_options $OPT_SHORT $OPT_LONG "$@"; then
echo; usage; exit 1 # E_INVALID_OPTION;
fi
-eval set -- "$OPT_TEMP"
-unset OPT_SHORT OPT_LONG OPT_TEMP
+set -- "${OPTRET[@]}"
+unset OPT_SHORT OPT_LONG OPTRET
if [[ $1 == "--" ]]; then
usage;
diff --git a/scripts/pacman-optimize.sh.in b/scripts/pacman-optimize.sh.in
index 3c6cfa88..d80435c0 100644
--- a/scripts/pacman-optimize.sh.in
+++ b/scripts/pacman-optimize.sh.in
@@ -122,8 +122,7 @@ find "$dbroot" -type f | sort | xargs md5sum > "$workdir/pacsums.old"
# step 2: tar it up
msg "$(gettext "Tar'ing up %s...")" "$dbroot"
-cd "$dbroot"
-bsdtar -czf "$workdir/pacman-db.tar.gz" ./
+bsdtar -czf "$workdir/pacman-db.tar.gz" -C "$dbroot" ./
if (( $? )); then
rm -rf "$workdir"
die_r "$(gettext "Tar'ing up %s failed.")" "$dbroot"
diff --git a/src/pacman/conf.h b/src/pacman/conf.h
index efd5a99e..d3494c75 100644
--- a/src/pacman/conf.h
+++ b/src/pacman/conf.h
@@ -127,7 +127,6 @@ enum {
OP_ARCH,
OP_PRINTFORMAT,
OP_GPGDIR,
- OP_RECURSIVE,
OP_DBONLY,
OP_FORCE
};
diff --git a/src/pacman/pacman.c b/src/pacman/pacman.c
index bf833269..107aa18c 100644
--- a/src/pacman/pacman.c
+++ b/src/pacman/pacman.c
@@ -130,7 +130,6 @@ static void usage(int op, const char * const myname)
} else if(op == PM_OP_UPGRADE) {
printf("%s: %s {-U --upgrade} [%s] <%s>\n", str_usg, myname, str_opt, str_file);
addlist(_(" --needed do not reinstall up to date packages\n"));
- addlist(_(" --recursive reinstall all dependencies of target packages\n"));
printf("%s:\n", str_opt);
} else if(op == PM_OP_QUERY) {
printf("%s: %s {-Q --query} [%s] [%s]\n", str_usg, myname, str_opt, str_pkg);
@@ -162,7 +161,6 @@ static void usage(int op, const char * const myname)
addlist(_(" -w, --downloadonly download packages but do not install/upgrade anything\n"));
addlist(_(" -y, --refresh download fresh package databases from the server\n"));
addlist(_(" --needed do not reinstall up to date packages\n"));
- addlist(_(" --recursive reinstall all dependencies of target packages\n"));
} else if(op == PM_OP_DATABASE) {
printf("%s: %s {-D --database} <%s> <%s>\n", str_usg, myname, str_opt, str_pkg);
printf("%s:\n", str_opt);
@@ -507,9 +505,6 @@ static int parsearg_remove(int opt)
case 'c': config->flags |= ALPM_TRANS_FLAG_CASCADE; break;
case 'n': config->flags |= ALPM_TRANS_FLAG_NOSAVE; break;
case 's':
- case OP_RECURSIVE:
- /* 's' is the legacy flag here, but since recursive is used in -S without
- * a shortopt, we need to do funky tricks */
if(config->flags & ALPM_TRANS_FLAG_RECURSE) {
config->flags |= ALPM_TRANS_FLAG_RECURSEALL;
} else {
@@ -532,7 +527,6 @@ static int parsearg_upgrade(int opt)
case OP_ASDEPS: config->flags |= ALPM_TRANS_FLAG_ALLDEPS; break;
case OP_ASEXPLICIT: config->flags |= ALPM_TRANS_FLAG_ALLEXPLICIT; break;
case OP_NEEDED: config->flags |= ALPM_TRANS_FLAG_NEEDED; break;
- case OP_RECURSIVE: config->flags |= ALPM_TRANS_FLAG_RECURSE; break;
case OP_IGNORE:
parsearg_util_addlist(&(config->ignorepkg));
break;
@@ -606,6 +600,7 @@ static int parseargs(int argc, char *argv[])
{"print", no_argument, 0, 'p'},
{"quiet", no_argument, 0, 'q'},
{"root", required_argument, 0, 'r'},
+ {"recursive", no_argument, 0, 's'},
{"search", no_argument, 0, 's'},
{"unrequired", no_argument, 0, 't'},
{"upgrades", no_argument, 0, 'u'},
@@ -632,7 +627,6 @@ static int parseargs(int argc, char *argv[])
{"arch", required_argument, 0, OP_ARCH},
{"print-format", required_argument, 0, OP_PRINTFORMAT},
{"gpgdir", required_argument, 0, OP_GPGDIR},
- {"recursive", no_argument, 0, OP_RECURSIVE},
{"dbonly", no_argument, 0, OP_DBONLY},
{0, 0, 0, 0}
};
diff --git a/src/pacman/sync.c b/src/pacman/sync.c
index 700bb780..f370f82f 100644
--- a/src/pacman/sync.c
+++ b/src/pacman/sync.c
@@ -975,8 +975,6 @@ int pacman_sync(alpm_list_t *targets)
FREELIST(targs);
targs = packages;
config->flags = 0;
- config->flags |= ALPM_TRANS_FLAG_RECURSE;
- config->flags |= ALPM_TRANS_FLAG_NEEDED;
config->op_s_upgrade = 0;
} else {
FREELIST(packages);
diff --git a/src/pacman/util.c b/src/pacman/util.c
index ccdc2079..1d9049ee 100644
--- a/src/pacman/util.c
+++ b/src/pacman/util.c
@@ -67,9 +67,13 @@ void trans_init_error(void)
pm_printf(ALPM_LOG_ERROR, _("failed to init transaction (%s)\n"),
alpm_strerror(err));
if(err == ALPM_ERR_HANDLE_LOCK) {
- fprintf(stderr, _(" if you're sure a package manager is not already\n"
- " running, you can remove %s\n"),
- alpm_option_get_lockfile(config->handle));
+ const char *lockfile = alpm_option_get_lockfile(config->handle);
+ pm_printf(ALPM_LOG_ERROR, _("could not lock database: %s\n"),
+ strerror(errno));
+ if(access(lockfile, F_OK) == 0) {
+ fprintf(stderr, _(" if you're sure a package manager is not already\n"
+ " running, you can remove %s\n"), lockfile);
+ }
}
}
diff --git a/test/pacman/tests/sync302.py b/test/pacman/tests/sync302.py
index b44aaed4..78e45c33 100644
--- a/test/pacman/tests/sync302.py
+++ b/test/pacman/tests/sync302.py
@@ -38,12 +38,12 @@ self.option["SyncFirst"] = ["pacman"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pacman")
self.addrule("PKG_VERSION=pacman|1.0-2")
self.addrule("PKG_EXIST=glibc")
-self.addrule("PKG_VERSION=glibc|2.15-1")
self.addrule("PKG_EXIST=curl")
-self.addrule("PKG_VERSION=curl|7.22-1")
self.addrule("PKG_EXIST=libarchive")
-self.addrule("PKG_VERSION=libarchive|2.8.5-1")
+# TODO: when SyncFirst recursive comes back, re-enable these
+#self.addrule("PKG_VERSION=glibc|2.15-1")
+#self.addrule("PKG_VERSION=curl|7.22-1")
+#self.addrule("PKG_VERSION=libarchive|2.8.5-1")
self.addrule("PKG_EXIST=zlib")
diff --git a/test/pacman/tests/sync303.py b/test/pacman/tests/sync303.py
index b717dd2c..9d7bab58 100644
--- a/test/pacman/tests/sync303.py
+++ b/test/pacman/tests/sync303.py
@@ -29,10 +29,7 @@ self.option["SyncFirst"] = ["pacman"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pacman")
self.addrule("PKG_VERSION=pacman|1.0-2")
self.addrule("PKG_EXIST=glibc-awesome")
self.addrule("PKG_VERSION=glibc-awesome|2.13-2")
self.addrule("PKG_EXIST=zlib")
-
-self.expectfailure = True
diff --git a/test/pacman/tests/sync304.py b/test/pacman/tests/sync304.py
index 4ac1a015..18058c99 100644
--- a/test/pacman/tests/sync304.py
+++ b/test/pacman/tests/sync304.py
@@ -19,9 +19,7 @@ self.option["SyncFirst"] = ["pacman"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pacman")
self.addrule("PKG_VERSION=pacman|4.0.1-1")
-self.addrule("PKG_EXIST=pyalpm")
self.addrule("PKG_VERSION=pyalpm|2-1")
self.expectfailure = True
diff --git a/test/pacman/tests/sync305.py b/test/pacman/tests/sync305.py
index 24fcee48..62005b58 100644
--- a/test/pacman/tests/sync305.py
+++ b/test/pacman/tests/sync305.py
@@ -61,7 +61,4 @@ self.option["SyncFirst"] = ["pacman"]
self.args = "-Su"
self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pacman")
self.addrule("PKG_VERSION=pacman|4.0.1-2")
-
-self.expectfailure = True
diff --git a/test/pacman/tests/sync306.py b/test/pacman/tests/sync306.py
index ca7a547e..c7401d07 100644
--- a/test/pacman/tests/sync306.py
+++ b/test/pacman/tests/sync306.py
@@ -59,5 +59,4 @@ self.addpkg2db("local", lp7)
self.args = "-S pacman"
self.addrule("PACMAN_RETCODE=0")
-self.addrule("PKG_EXIST=pacman")
self.addrule("PKG_VERSION=pacman|4.0.1-2")
diff --git a/test/pacman/tests/upgrade078.py b/test/pacman/tests/upgrade078.py
index 718d5871..8ef32456 100644
--- a/test/pacman/tests/upgrade078.py
+++ b/test/pacman/tests/upgrade078.py
@@ -20,15 +20,15 @@ expat_lpkg = pmpkg("expat", "2.0.1-6")
self.addpkg2db("local", expat_lpkg)
# Sync db
-curl_sync = pmpkg("curl", "7.21.7-1")
-self.addpkg2db("sync", curl_sync)
+perl_sync = pmpkg("perl", "5.14.1-3")
+perl_sync.depends = ["glibc"]
+self.addpkg2db("sync", perl_sync)
glibc_sync = pmpkg("glibc", "2.1.4-4")
self.addpkg2db("sync", glibc_sync)
-perl_sync = pmpkg("perl", "5.14.1-3")
-perl_sync.depends = ["glibc"]
-self.addpkg2db("sync", perl_sync)
+curl_sync = pmpkg("curl", "7.21.7-1")
+self.addpkg2db("sync", curl_sync)
expat_sync = pmpkg("expat", "2.0.1-6")
self.addpkg2db("sync", expat_sync)
@@ -46,11 +46,10 @@ self.addrule("PKG_DEPENDS=git|perl")
self.addrule("PKG_DEPENDS=perl|glibc")
self.addrule("PKG_EXIST=git")
self.addrule("PKG_VERSION=git|1.7.6-1")
-self.addrule("PKG_EXIST=curl")
self.addrule("PKG_VERSION=curl|7.21.7-1")
-self.addrule("PKG_EXIST=glibc")
self.addrule("PKG_VERSION=glibc|2.1.4-4")
-self.addrule("PKG_EXIST=perl")
self.addrule("PKG_VERSION=perl|5.14.1-3")
-self.addrule("PKG_EXIST=expat")
self.addrule("PKG_VERSION=expat|2.0.1-6")
+
+# --recursive operation was removed for now
+self.expectfailure = True