[dpkg] 62/200: dpkg-maintscript-helper: Use the new --validate-version command
Ximin Luo
infinity0 at debian.org
Wed Apr 5 15:17:17 UTC 2017
This is an automated email from the git hooks/post-receive script.
infinity0 pushed a commit to branch master
in repository dpkg.
commit b51bc4ff0cd540b82e131470053eeed1c3d2f026
Author: Guillem Jover <guillem at debian.org>
Date: Sun Dec 4 22:52:42 2016 +0100
dpkg-maintscript-helper: Use the new --validate-version command
Do not abuse the --compare-versions command to perform version
validation, use the new --validate-version command expressly added
now to perform such task. Because the latter returns appropriate exit
codes, does not print messages in debug mode and is the correct
interface to use.
Closes: #844701
---
debian/changelog | 3 +++
scripts/dpkg-maintscript-helper.sh | 10 ++++------
2 files changed, 7 insertions(+), 6 deletions(-)
diff --git a/debian/changelog b/debian/changelog
index a05bfdb..a58dbec 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -15,6 +15,9 @@ dpkg (1.18.16) UNRELEASED; urgency=medium
* Add new dpkg --validate-<thing> commands to validate the syntax of
various <thing>s, where the current list is «pkgname», «trigname»,
«archname» and «version».
+ * Use the new dpkg --validate-version command in dpkg-maintscript-helper,
+ instead of abusing the --compare-versions command to perform version
+ validation. Closes: #844701
* Perl modules:
- Whitelist DPKG_GENSYMBOLS_CHECK_LEVEL, DPKG_ROOT, DPKG_ADMINDIR and
DPKG_DATADIR environment variables in Dpkg::Build::Info.
diff --git a/scripts/dpkg-maintscript-helper.sh b/scripts/dpkg-maintscript-helper.sh
index f20d826..dd65a43 100755
--- a/scripts/dpkg-maintscript-helper.sh
+++ b/scripts/dpkg-maintscript-helper.sh
@@ -48,9 +48,8 @@ rm_conffile() {
error "environment variable DPKG_MAINTSCRIPT_NAME is required"
[ "${CONFFILE}" != "${CONFFILE#/}" ] || \
error "conffile '$CONFFILE' is not an absolute path"
- # Use --compare-versions to validate the version number.
- [ -z "$(dpkg --compare-versions -- "$LASTVERSION" eq '0' 2>&1)" ] || \
- error "version '$LASTVERSION' is not valid"
+ VERSIONCHECK=$(dpkg --validate-version -- "$LASTVERSION" 2>&1) || \
+ error "$VERSIONCHECK"
debug "Executing $0 rm_conffile in $DPKG_MAINTSCRIPT_NAME" \
"of $DPKG_MAINTSCRIPT_PACKAGE"
@@ -162,9 +161,8 @@ mv_conffile() {
error "old-conffile '$OLDCONFFILE' is not an absolute path"
[ "${NEWCONFFILE}" != "${NEWCONFFILE#/}" ] || \
error "new-conffile '$NEWCONFFILE' is not an absolute path"
- # Use --compare-versions to validate the version number.
- [ -z "$(dpkg --compare-versions -- "$LASTVERSION" eq '0' 2>&1)" ] || \
- error "version '$LASTVERSION' is not valid"
+ VERSIONCHECK=$(dpkg --validate-version -- "$LASTVERSION" 2>&1) || \
+ error "$VERSIONCHECK"
debug "Executing $0 mv_conffile in $DPKG_MAINTSCRIPT_NAME" \
"of $DPKG_MAINTSCRIPT_PACKAGE"
--
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