[pkg-java-scripts] 01/01: Added a new script updating the Vcs-* fields

Emmanuel Bourg ebourg-guest at moszumanska.debian.org
Mon Nov 7 10:48:35 UTC 2016


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

ebourg-guest pushed a commit to branch master
in repository pkg-java-scripts.

commit f1a69ac0bd60a32fe70a9a2ca155668beaa813b6
Author: Emmanuel Bourg <ebourg at apache.org>
Date:   Mon Nov 7 11:47:39 2016 +0100

    Added a new script updating the Vcs-* fields
---
 README.txt   |  3 +++
 vcsfields.sh | 58 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 2 files changed, 61 insertions(+)

diff --git a/README.txt b/README.txt
index 3f07862..6ef03ef 100644
--- a/README.txt
+++ b/README.txt
@@ -24,6 +24,9 @@ Here are the scripts available:
  * stdver.sh
         Update the Standards-Version field in debian/control
 
+ * vcsfields.sh
+        Update the Vcs-* field using secure https:// URLs
+
  * gbp-import-orig.sh
         Import an upstream tarball into the current package. The script
         automatically resets the state of the working copy and calls
diff --git a/vcsfields.sh b/vcsfields.sh
new file mode 100755
index 0000000..155a94d
--- /dev/null
+++ b/vcsfields.sh
@@ -0,0 +1,58 @@
+#!/bin/bash
+#
+# Update the Vcs-* fields in debian/control
+#
+
+echo "Updating the Vcs-* fields..."
+echo ""
+
+
+VCS_GIT_UPDATED=0
+grep -q 'Vcs-Git: git' debian/control
+if [ $? -eq 0 ]; then
+    VCS_GIT_UPDATED=1
+fi
+
+VCS_BROWSER_UPDATED=0
+grep -q 'Vcs-Browser: http://' debian/control
+if [ $? -eq 0 ]; then
+    VCS_BROWSER_UPDATED=1
+fi
+
+sed -i "s#git://anonscm.debian.org/pkg-java/\([^/]*\)/\?#https://anonscm.debian.org/git/pkg-java/\1#g" debian/control
+sed -i "s#http://anonscm.debian.org/cgit/pkg-java/\([^/]*\)/\?#https://anonscm.debian.org/cgit/pkg-java/\1#g" debian/control
+
+# Add an entry to debian/changelog
+if [ $VCS_GIT_UPDATED == 1 ] && [ $VCS_BROWSER_UPDATED == 1 ]; then
+    MSG="Use secure Vcs-* URLs"
+elif [ $VCS_GIT_UPDATED == 1 ]; then
+    MSG="Use a secure Vcs-Git URL"
+elif [ $VCS_BROWSER_UPDATED == 1 ]; then
+    MSG="Use a secure Vcs-Browser URL"
+else
+    echo "Vcs-* fields are up to date"
+    exit;
+fi
+
+dch $MSG
+
+# Prepare to commit and review the changes
+git add debian/control debian/changelog
+git diff --staged
+
+echo ""
+
+while true; do
+    read -p "Commit changes? [yN] " choice
+    case $choice in
+        [Yy]* ) break;;
+        * )
+          # Revert the staged changes
+          git reset HEAD debian/control debian/changelog
+          git checkout debian/control debian/changelog
+          exit
+          ;;
+    esac
+done
+
+git commit -m "$MSG"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-java/pkg-java-scripts.git



More information about the pkg-java-commits mailing list