[devscripts] 03/03: debchange: utf-8 decode Maintainer when parsing changelog

James McCoy jamessan at debian.org
Sat Jun 7 19:48:08 UTC 2014


This is an automated email from the git hooks/post-receive script.

jamessan pushed a commit to branch master
in repository devscripts.

commit c3ff74aebb30502e8c6100bfc4886d663414ef5d
Author: James McCoy <jamessan at debian.org>
Date:   Sat Jun 7 15:46:10 2014 -0400

    debchange: utf-8 decode Maintainer when parsing changelog
    
    Signed-off-by: James McCoy <jamessan at debian.org>
---
 debian/changelog     |  2 ++
 scripts/debchange.pl |  1 +
 test/test_debchange  | 55 +++++++++++++++++++++++++++++++++++++++++++++++++---
 3 files changed, 55 insertions(+), 3 deletions(-)

diff --git a/debian/changelog b/debian/changelog
index 36d0e04..bb2b052 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -3,6 +3,8 @@ devscripts (2.14.5) UNRELEASED; urgency=medium
   * debchange:
     + Verify $opt_vendor is defined before trying to use it to avoid a warning
       about an unitialized variable.
+    + utf-8 decode the maintainer name when reading it from the changelog.
+      (Closes: #750855)
 
  -- James McCoy <jamessan at debian.org>  Sat, 07 Jun 2014 15:31:54 -0400
 
diff --git a/scripts/debchange.pl b/scripts/debchange.pl
index 0ad61b5..640e944 100755
--- a/scripts/debchange.pl
+++ b/scripts/debchange.pl
@@ -644,6 +644,7 @@ if (! $opt_create || ($opt_create && $opt_news)) {
     $VERSION=$changelog->{Version};
     fatal "No maintainer in changelog!"
 	unless exists $changelog->{Maintainer};
+    $changelog->{Maintainer} = decode_utf8($changelog->{Maintainer});
     ($MAINTAINER,$EMAIL) = ($changelog->{Maintainer} =~ /^([^<]+) <(.*)>/);
     fatal "No distribution in changelog!"
 	unless exists $changelog->{Distribution};
diff --git a/test/test_debchange b/test/test_debchange
index 681e212..4b69cb2 100755
--- a/test/test_debchange
+++ b/test/test_debchange
@@ -23,6 +23,17 @@ fi
 
 . "${0%/*}/shunit2-helper-functions.sh"
 
+setUp() {
+    CHANGELOG="${SHUNIT_TMPDIR}/changelog"
+    DEBFULLNAME="Raphaël Hertzog"
+    DEBEMAIL="hertzog at debian.org"
+    export DEBFULLNAME DEBEMAIL
+}
+
+tearDown() {
+    unset CHANGELOG DEBFULLNAME DEBEMAIL
+}
+
 runCommand2() {
     local param="$1"
     local exp_stdout="$2"
@@ -43,7 +54,7 @@ runCommand2() {
 }
 
 success() {
-    runCommand2 "-c ${SHUNIT_TMPDIR}/changelog $1" "" "" 0
+    runCommand2 "-c \"$CHANGELOG\" $1" "" "" 0
 }
 
 checkVersion() {
@@ -51,10 +62,10 @@ checkVersion() {
     local param="$2"
     local start_version="$3"
     local expected_version="$4"
-    rm -f ${SHUNIT_TMPDIR}/changelog
+    rm -f "$CHANGELOG"
     success "--create $start_param --package test-package -v $start_version \"Devscripts Test Suite.\""
     success "$param \"Version test.\""
-    local version=$(dpkg-parsechangelog -l${SHUNIT_TMPDIR}/changelog | sed -n 's/^Version: //p')
+    local version=$(dpkg-parsechangelog -l"$CHANGELOG" | sed -n 's/^Version: //p')
     assertEquals "\"dch $param\" from version $start_version" "$expected_version" "$version"
 }
 
@@ -110,4 +121,42 @@ testUbuntuRebuild() {
     checkUbuntuVersion "-R" "0.1-2build3" "0.1-2build4"
 }
 
+verifyMaintainer() {
+    local maintainer="$(dpkg-parsechangelog -l"$CHANGELOG" | sed -n 's/^Maintainer: //p')"
+    assertEquals "\"$1\"" "$DEBFULLNAME <$DEBEMAIL>" "$maintainer"
+}
+
+testEncoding() {
+    rm -f "$CHANGELOG"
+    success "--create -D unstable --package test-package -v 1.0-1 \"First upload\""
+    verifyMaintainer "dch --create"
+
+    success "-a \"Some change\""
+    verifyMaintainer "dch -a"
+
+    success "-i \"Second upload\""
+    verifyMaintainer "dch -i"
+
+    success "-e \"Another change\""
+    verifyMaintainer "dch -e"
+
+    success "-n NMU"
+    verifyMaintainer "dch -n"
+
+    success "-v 1.1-1 \"New upstream\""
+    verifyMaintainer "dch -v"
+
+    success "--bin-nmu \"Rebuild against libfoo\""
+    verifyMaintainer "dch --bin-nmu"
+
+    success "-q \"QA upload\""
+    verifyMaintainer "dch -q"
+
+    success "-s \"Security upload\""
+    verifyMaintainer "dch -s"
+
+    success "--bpo \"Backporrts upload\""
+    verifyMaintainer "dch --bpo"
+}
+
 . shunit2

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/devscripts.git



More information about the devscripts-devel mailing list