X-Git-Url: http://git.grml.org/?p=grml-live.git;a=blobdiff_plain;f=scripts%2Frelease_helper.sh;h=40c532d11a58084cc2bb941a18d3df9f89f8340e;hp=3e64a9ce0d47cb720fb9ef1bed5595b0423bb09e;hb=4cd65718be7890b8dec7939c0af769da9bc8e320;hpb=d38f8785424245f5fa17a84407c5a90e067515d8;ds=sidebyside diff --git a/scripts/release_helper.sh b/scripts/release_helper.sh index 3e64a9c..40c532d 100755 --- a/scripts/release_helper.sh +++ b/scripts/release_helper.sh @@ -1,6 +1,6 @@ #!/bin/bash # Filename: scripts/release_helper.sh -# Purpose: helper script to build grml-live Debian packages (WFM style though) +# Purpose: helper script to build grml-live Debian packages # Authors: grml-team (grml.org), (c) Michael Prokop # Bug-Reports: see http://grml.org/bugs/ # License: This file is licensed under the GPL v2 or any later version. @@ -9,21 +9,59 @@ set -e set -u +export LC_ALL=C +export LANG=C + debian_version='' script_version='' -if git status --porcelain | grep -q '^?? '; then - printf "Uncommited changes in current working tree. Please commit/clean up.\n" - exit 1 +autobuild_branch="autobuild_$(date +%Y%m%d_%H%M%S)" + +if [ -n "${AUTOBUILD:-}" ] ; then + git checkout master + git pull + git checkout -b "$autobuild_branch" +else + if git status --porcelain | grep -q '^?? '; then + printf "Uncommited changes in current working tree. Please commit/clean up.\n" + exit 1 + fi fi printf "Building debian/changelog: " -git-dch --debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" \ - --since=v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') \ - --id-length=7 --meta --multimaint-merge -S -printf "OK\n" +if [ -n "${AUTOBUILD:-}" ] ; then + # since=$(git show -s --pretty="tformat:%h") + eval $(grep '^GRML_LIVE_VERSION=' grml-live) + DATE=$(date -R) + UNIXTIME=$(date +%s) + + cat > debian/changelog << EOF +grml-live (${GRML_LIVE_VERSION}+autobuild${UNIXTIME}) UNRELEASED; urgency=low + + * Automatically built package based on the state of + git repository at http://git.grml.org/?p=grml-live.git + on $DATE -> + + $(git log --format=oneline -1) + + -- grml-live Auto Build $DATE + +EOF + git add debian/changelog + git commit -m "Releasing ${GRML_LIVE_VERSION}-~autobuild${UNIXTIME} (auto build)" +else + since=v$(dpkg-parsechangelog | awk '/^Version:/ {print $2}') + git-dch --ignore-branch --since=$since \ + --id-length=7 --meta --multimaint-merge -S + printf "OK\n" +fi -$EDITOR debian/changelog +if [ -z "${AUTOBUILD:-}" ] ; then + if ! $EDITOR debian/changelog ; then + printf "Exiting as editing debian/changelog returned an error." >&2 + exit 1 + fi +fi debian_version="$(dpkg-parsechangelog | awk '/^Version:/ {print $2}')" @@ -49,13 +87,37 @@ else exit 1 fi -if $dorelease ; then +if $dorelease || [ -n "${AUTOBUILD:-}" ] ; then git add debian/changelog grml-live git commit -s -m "Release new version ${debian_version}." fi printf "Building debian packages:\n" -git-buildpackage --git-debian-branch="$(git branch | awk -F\*\ '/^* / { print $2}' )" --git-ignore-new -printf "Finished execution of $(basename $0). Do not forget to tag release ${debian_version}\n" +if [ -n "${AUTOBUILD:-}" ] ; then + [ -d ../grml-live.build-area ] || mkdir ../grml-live.build-area + rm -rf ../grml-live.build-area/grml-live* # otherwise we're keeping files forever... + git-buildpackage --git-ignore-branch --git-ignore-new --git-export-dir=../grml-live.build-area -us -uc +else + git-buildpackage --git-ignore-branch --git-ignore-new $* + printf "Finished execution of $(basename $0). Do not forget to tag release ${debian_version}\n" +fi + +if [ -n "${AUTOBUILD:-}" ] ; then + ( + cd ../grml-live.build-area + dpkg-scanpackages . /dev/null > Packages + dpkg-scanpackages . /dev/null | gzip > Packages.gz + ) + git checkout master + git branch -D ${autobuild_branch} || true + + env APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none sudo apt-get update + + PACKAGES=$(dpkg --list grml-live\* | awk '/^ii/ {print $2}') + env APT_LISTCHANGES_FRONTEND=none APT_LISTBUGS_FRONTEND=none sudo apt-get -y \ + -o DPkg::Options::=--force-confmiss \ + -o DPkg::Options::=--force-confnew \ + --allow-unauthenticated install $PACKAGES +fi ## END OF FILE #################################################################