[Reproducible-commits] [dpkg] 40/63: dpkg-maintscript-helper: Allow broken versions starting with a dash
Jérémy Bobbio
lunar at moszumanska.debian.org
Fri Mar 4 17:44:44 UTC 2016
This is an automated email from the git hooks/post-receive script.
lunar pushed a commit to branch pu/buildinfo
in repository dpkg.
commit 0500e0e73c609aaa8499cd73fb8b6e7b12be2f68
Author: Carsten Hey <carsten at debian.org>
Date: Sun Feb 21 12:07:01 2016 +0100
dpkg-maintscript-helper: Allow broken versions starting with a dash
Such versions are not allowed by dpkg by default, but existing systems
might have them on installed packages, or the user might have used
--force-bad-version.
Allow these versions in the version comparison, so that old packages
can be fixed using the maintscript-helper.
Signed-off-by: Guillem Jover <guillem at debian.org>
---
debian/changelog | 2 ++
scripts/dpkg-maintscript-helper.sh | 20 ++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index b7ee445..ec2fc9e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -33,6 +33,8 @@ dpkg (1.18.5) UNRELEASED; urgency=medium
Thanks to Carsten Hey <carsten at debian.org>.
* Anchor pathnames in sed and grep regexes in dpkg-maintscript-helper.
Thanks to Carsten Hey <carsten at debian.org>.
+ * Allow broken versions starting with a dash in dpkg-maintscript-helper.
+ Thanks to Carsten Hey <carsten at debian.org>.
* Portability:
- Move DPKG_ADMINDIR environment variable name out from update-alternatives
code, to make life easier for non-dpkg-based systems.
diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index beea63d..176920e 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -54,13 +54,13 @@ rm_conffile() {
case "$DPKG_MAINTSCRIPT_NAME" in
preinst)
if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
prepare_rm_conffile "$CONFFILE" "$PACKAGE"
fi
;;
postinst)
if [ "$1" = "configure" ] && [ -n "$2" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
finish_rm_conffile "$CONFFILE"
fi
;;
@@ -71,7 +71,7 @@ rm_conffile() {
fi
if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] &&
[ -n "$2" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
abort_rm_conffile "$CONFFILE" "$PACKAGE"
fi
;;
@@ -160,20 +160,20 @@ mv_conffile() {
case "$DPKG_MAINTSCRIPT_NAME" in
preinst)
if [ "$1" = "install" -o "$1" = "upgrade" ] && [ -n "$2" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
prepare_mv_conffile "$OLDCONFFILE" "$PACKAGE"
fi
;;
postinst)
if [ "$1" = "configure" ] && [ -n "$2" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
finish_mv_conffile "$OLDCONFFILE" "$NEWCONFFILE" "$PACKAGE"
fi
;;
postrm)
if [ "$1" = "abort-install" -o "$1" = "abort-upgrade" ] &&
[ -n "$2" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
abort_mv_conffile "$OLDCONFFILE" "$PACKAGE"
fi
;;
@@ -271,7 +271,7 @@ symlink_to_dir() {
if [ "$1" = "install" -o "$1" = "upgrade" ] &&
[ -n "$2" ] && [ -h "$SYMLINK" ] &&
symlink_match "$SYMLINK" "$SYMLINK_TARGET" &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
mv -f "$SYMLINK" "${SYMLINK}.dpkg-backup"
fi
;;
@@ -294,7 +294,7 @@ symlink_to_dir() {
[ -n "$2" ] &&
[ ! -e "$SYMLINK" ] && [ -h "${SYMLINK}.dpkg-backup" ] &&
symlink_match "${SYMLINK}.dpkg-backup" "$SYMLINK_TARGET" &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
echo "Restoring backup of $SYMLINK ..."
mv "${SYMLINK}.dpkg-backup" "$SYMLINK"
fi
@@ -346,7 +346,7 @@ dir_to_symlink() {
if [ "$1" = "install" -o "$1" = "upgrade" ] &&
[ -n "$2" ] &&
[ ! -h "$PATHNAME" ] && [ -d "$PATHNAME" ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
prepare_dir_to_symlink "$PACKAGE" "$PATHNAME"
fi
;;
@@ -374,7 +374,7 @@ dir_to_symlink() {
\( -h "$PATHNAME" -a \
\( "$(readlink "$PATHNAME")" = "$SYMLINK_TARGET" -o \
"$(readlink -f "$PATHNAME")" = "$SYMLINK_TARGET" \) \) ] &&
- dpkg --compare-versions "$2" le-nl "$LASTVERSION"; then
+ dpkg --compare-versions -- "$2" le-nl "$LASTVERSION"; then
abort_dir_to_symlink "$PATHNAME"
fi
;;
--
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/reproducible/dpkg.git
More information about the Reproducible-commits
mailing list