summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorHolger Levsen <holger@layer-acht.org>2014-10-26 00:14:19 +0200
committerHolger Levsen <holger@layer-acht.org>2014-10-26 00:17:37 +0200
commitf82aa51adf4ea5317ef37669319bc9651692e738 (patch)
tree9602abe1fc6447c81855b99fee4c4d909205701c /bin
parent921eb96288d6240076b8d4b9cb735e4cf76deaf0 (diff)
downloadjenkins.debian.net-f82aa51adf4ea5317ef37669319bc9651692e738.tar.xz
refactor code into new publish_changes_to_userContent()
This new function is used to publish both the Debian Edu manuals as well as the Debian Installer installation-guide to https://jenkins.debian.net/userContent/debian-edu-doc/ and https://jenkins.debian.net/userContent/installation-guide/
Diffstat (limited to 'bin')
-rwxr-xr-xbin/chroot-run.sh20
-rwxr-xr-xbin/common-functions.sh34
-rwxr-xr-xbin/d-i_manual.sh13
3 files changed, 46 insertions, 21 deletions
diff --git a/bin/chroot-run.sh b/bin/chroot-run.sh
index 19beabea..62d35dfe 100755
--- a/bin/chroot-run.sh
+++ b/bin/chroot-run.sh
@@ -80,27 +80,11 @@ cleanup() {
fi
#
- # special case debian-edu-doc
+ # special case: publish debian-edu-doc on the webserver
#
CHANGES=$(ls -1 $CHROOT_TARGET/tmp/debian-edu-doc_*.changes 2>/dev/null|| true)
if [ ! -z "$CHANGES" ] ; then
- echo "Extracting contents from .deb files..."
- NEWDOC=$(mktemp -d)
- for DEB in $(dcmd --deb $CHANGES) ; do
- dpkg --extract $DEB $NEWDOC 2>/dev/null
- done
- EDUDOC="/var/lib/jenkins/userContent/debian-edu-doc"
- rm -rf $EDUDOC
- mkdir $EDUDOC
- mv $NEWDOC/usr/share/doc/debian-edu-doc-* $EDUDOC/
- VERSION=$(echo $CHANGES | cut -d "_" -f2)
- touch "$EDUDOC/${VERSION}_git${GIT_COMMIT:0:7}"
- rm -r $NEWDOC
- MESSAGE="https://jenkins.debian.net/userContent/debian-edu-doc/ has been updated from ${GIT_COMMIT:0:7}"
- kgb-client --conf /srv/jenkins/kgb/debian-edu.conf --relay-msg "$MESSAGE"
- echo
- echo $MESSAGE
- echo
+ publish_changes_to_userContent $CHANGES debian-edu "git${GIT_COMMIT:0:7}"
fi
if [ -d $CHROOT_TARGET/proc ]; then
diff --git a/bin/common-functions.sh b/bin/common-functions.sh
index c68d4170..b8631473 100755
--- a/bin/common-functions.sh
+++ b/bin/common-functions.sh
@@ -69,3 +69,37 @@ else
fi
}
+publish_changes_to_userContent(){
+ echo "Extracting contents from .deb files..."
+ CHANGES=$1
+ CHANNEL=$2
+ SRCPKG=$(basename $CHANGES | cut -d "_" -f1)
+ if [ -z "$SRCPKG" ] ; then
+ exit 1
+ fi
+ VERSION=$(basename $CHANGES | cut -d "_" -f2)
+ TARGET="/var/lib/jenkins/userContent/$SRCPKG"
+ NEW_CONTENT=$(mktemp -d)
+ for DEB in $(dcmd --deb $CHANGES) ; do
+ dpkg --extract $DEB ${NEW_CONTENT} 2>/dev/null
+ done
+ rm -rf $TARGET
+ mkdir $TARGET
+ mv ${NEW_CONTENT}/usr/share/doc/${SRCPKG}-* $TARGET/
+ rm -r ${NEW_CONTENT}
+ if [ -z "$3" ] ; then
+ touch "$TARGET/${VERSION}"
+ FROM=""
+ else
+ touch "$TARGET/${VERSION}_$3"
+ FROM=" from $3"
+ fi
+ MESSAGE="https://jenkins.debian.net/userContent/$SRCPKG/ has been updated${FROM}."
+ echo
+ echo $MESSAGE
+ echo
+ if [ ! -z "$CHANNEL" ] ; then
+ kgb-client --conf /srv/jenkins/kgb/$CHANNEL.conf --relay-msg "$MESSAGE"
+ fi
+}
+
diff --git a/bin/d-i_manual.sh b/bin/d-i_manual.sh
index fa014e50..6c9c7e22 100755
--- a/bin/d-i_manual.sh
+++ b/bin/d-i_manual.sh
@@ -21,6 +21,10 @@ init_workspace() {
pdebuild_package() {
#
+ # only used to build the installation-guide package
+ #
+ SOURCE=installation-guide
+ #
# prepare build
#
if [ -f /var/cache/pbuilder/base.tgz ] ; then
@@ -35,9 +39,12 @@ pdebuild_package() {
cd manual
NUM_CPU=$(cat /proc/cpuinfo |grep ^processor|wc -l)
pdebuild --use-pdebuild-internal --debbuildopts "-j$NUM_CPU"
- # cleanup
- SOURCE=$(grep "^Source: " debian/control |cut -d " " -f2)
- sudo dcmd rm /var/cache/pbuilder/result/${SOURCE}_*changes
+ #
+ # publish and cleanup
+ #
+ CHANGES=$(ls /var/cache/pbuilder/result/${SOURCE}_*changes)
+ publish_changes_to_userContent $CHANGES debian-boot "svn-r$SVN_REVISION"
+ sudo dcmd rm $CHANGES
cd ..
}