Updated control files for adding changelog entries. master
authorFredrik Tolf <fredrik@dolda2000.com>
Mon, 24 Mar 2008 21:56:02 +0000 (22:56 +0100)
committerFredrik Tolf <fredrik@dolda2000.com>
Mon, 24 Mar 2008 21:56:02 +0000 (22:56 +0100)
dcp-init

index 262a2bb..f8f3667 100755 (executable)
--- a/dcp-init
+++ b/dcp-init
@@ -61,6 +61,11 @@ readconf() {
             export "CONF_\$key"="\$val"
         done <"\$HOME/.dcp-build-conf"
     fi
+    if [ -r "/etc/dcp-conf" ]; then
+        while read key val; do
+            export "CONF_\$key"="\$val"
+        done <"/etc/dcp-conf"
+    fi
     while read key val; do
         export "CONF_\$key"="\$val"
     done <control/conf
@@ -69,6 +74,24 @@ readconf() {
 rungit() {
     (cd repo; git "\$@") || false
 }
+
+logchange() {
+    tag="\${CONF_VERTAG:-dcp}"
+    ver="\$(dpkg-parsechangelog -lrepo/src/debian/changelog | sed -n 's/^Version: \(.*\)$/\1/p')"
+    [ -n "\$ver" ]
+    maint="\$CONF_MAINTAINER"
+    if [ -z "\$maint" ]; then
+        maint="\$(id -un) <\$(id -un)@\$(hostname -f)>"
+    fi
+    cat - repo/src/debian/changelog >repo/src/debian/changelog.new <<ENDCL
+\${CONF_APTPKG} (\${ver}+\${tag}1) unstable; urgency=low
+  
+  * Remerged changes in DCP
+
+ -- \${maint}  \$(date -R)
+ENDCL
+    mv -f repo/src/debian/changelog.new repo/src/debian/changelog
+}
 EOF
     cat >"$td/control/build" <<EOF
 #!/bin/sh
@@ -91,6 +114,7 @@ set -e
 . control/functions
 readconf
 
+updated=n
 for branch in repo/.git/refs/heads/*; do
     branch="\${branch##*/}"
     if [ -x "control/update.d/\$branch" ]; then
@@ -101,9 +125,16 @@ for branch in repo/.git/refs/heads/*; do
         rungit checkout master
         if [ "\$newrev" != "\$lastrev" ]; then
             rungit merge -n "\$branch"
+            updated=y
         fi
     fi
 done
+
+if [ "\$updated" = y ]; then
+    for file in control/update.d/post-*; do
+        if [ -x "\$file" ]; then "\$file"; fi
+    done
+fi
 EOF
     chmod 755 "$td/control/update"
     rungit add control
@@ -132,12 +163,24 @@ EOF
 
 set -e
 
+. control/functions
+
 cd repo
 dcp-update-apt "\$CONF_APTPKG"
-
 EOF
     chmod 755 "$td/control/update.d/upstream"
     rungit add control/update.d/upstream
+    cat >"$td/control/update.d/post-logchange" <<EOF
+#!/bin/sh
+
+set -e
+. control/functions
+
+logchange
+rungit add src/debian/changelog
+rungit commit -q -m "Added changelog entry"
+
+EOF
     echo "APTPKG $pkg" >>"$td/control/conf"
     rungit add control/conf
 }