From baf582456e485e2e4272c0b888f9ccdb10cde499 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Tue, 20 Dec 2011 21:26:26 +0100 Subject: reworked buildscripts completely, so that they can be used for several projects --- bin/build+upload-all-packages | 1 + bin/build+upload-package | 1 + bin/build-all-packages | 59 +++++++++ bin/build-package | 263 ++++++++++++++++++++++++++++++++++++++ bin/gitcreate | 25 ++++ bin/gitrevno | 28 ++++ bin/nwt-build+upload-all-packages | 1 - bin/nwt-build+upload-package | 1 - bin/nwt-build-all-packages | 60 --------- bin/nwt-build-package | 253 ------------------------------------ bin/nwt-gitcreate | 17 --- bin/nwt-gitrevno | 28 ---- bin/nwt-pkgneedsbuild | 47 ------- bin/nwt-tarballrelease | 43 ------- bin/nwt-updatebuildmain | 34 ----- bin/nwt-upload-all-packages | 1 - bin/nwt-upload-package | 1 - bin/pkgneedsbuild | 47 +++++++ bin/tarballrelease | 43 +++++++ bin/updatebuildmain | 34 +++++ bin/upload-all-packages | 1 + bin/upload-package | 1 + 22 files changed, 503 insertions(+), 486 deletions(-) create mode 120000 bin/build+upload-all-packages create mode 120000 bin/build+upload-package create mode 100755 bin/build-all-packages create mode 100755 bin/build-package create mode 100755 bin/gitcreate create mode 100755 bin/gitrevno delete mode 120000 bin/nwt-build+upload-all-packages delete mode 120000 bin/nwt-build+upload-package delete mode 100755 bin/nwt-build-all-packages delete mode 100755 bin/nwt-build-package delete mode 100755 bin/nwt-gitcreate delete mode 100755 bin/nwt-gitrevno delete mode 100755 bin/nwt-pkgneedsbuild delete mode 100755 bin/nwt-tarballrelease delete mode 100755 bin/nwt-updatebuildmain delete mode 120000 bin/nwt-upload-all-packages delete mode 120000 bin/nwt-upload-package create mode 100755 bin/pkgneedsbuild create mode 100755 bin/tarballrelease create mode 100755 bin/updatebuildmain create mode 120000 bin/upload-all-packages create mode 120000 bin/upload-package (limited to 'bin') diff --git a/bin/build+upload-all-packages b/bin/build+upload-all-packages new file mode 120000 index 0000000..b8c12b0 --- /dev/null +++ b/bin/build+upload-all-packages @@ -0,0 +1 @@ +build-all-packages \ No newline at end of file diff --git a/bin/build+upload-package b/bin/build+upload-package new file mode 120000 index 0000000..2b48fdc --- /dev/null +++ b/bin/build+upload-package @@ -0,0 +1 @@ +build-package \ No newline at end of file diff --git a/bin/build-all-packages b/bin/build-all-packages new file mode 100755 index 0000000..3757c4b --- /dev/null +++ b/bin/build-all-packages @@ -0,0 +1,59 @@ +#!/bin/bash + +# Copyright (C) 2011 by Mike Gabriel +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +COMPONENT_MAIN="main" +COMPONENT_NIGHTLY="nightly" + +LIB_PACKAGES_NIGHTLY= +LIB_PACKAGES_MAIN= +APP_PACKAGES_NIGHTLY= +APP_PACKAGES_MAIN= + +PREFIX=$(echo $0 | cut -d"-" -f1) +test -f ~/.buildscripts/$PREFIX.conf && . ~/.buildscripts/$PREFIX.conf || { echo "$0 has no valid context prefix..."; exit -1; } + +test -z $1 && { echo "usage: $(basename $0) [{$COMPONENT_MAIN,$COMPONENT_NIGHTLY}]"; exit -1; } + +COMPONENT=${1:-""} + +# build the newest code... (nightly-builds) +[ "x$COMPONENT" = "x$COMPONENT_NIGHTLY" ] || [ -z $COMPONENT ] && { + echo -e $LIB_PACKAGES_NIGHTLY $APP_PACKAGES_NIGHTLY | while read pkg comp checkout; do + if [ "x$(basename $0)" = "x$PREFIX-build-all-packages" ]; then + $PREFIX-build-package $pkg $comp $checkout + elif [ "x$(basename $0)" = "x$PREFIX-upload-all-packages" ]; then + $PREFIX-upload-package $pkg $comp $checkout + elif [ "x$(basename $0)" = "x$PREFIX-build+upload-all-packages" ]; then + $PREFIX-build-package $pkg $comp $checkout && $PREFIX-upload-package $pkg $comp $checkout + fi + done +} + +# build all packages tagged as build-main +[ "x$COMPONENT" = "x$COMPONENT_MAIN" ] || [ -z $COMPONENT ] && { + echo -e $LIB_PACKAGES_MAIN $APP_PACKAGES_MAIN | while read pkg comp checkout; do + if [ "x$(basename $0)" = "x$PREFIX-build-all-packages" ]; then + $PREFIX-build-package $pkg $comp $checkout + elif [ "x$(basename $0)" = "x$PREFIX-upload-all-packages" ]; then + $PREFIX-upload-package $pkg $comp $checkout + elif [ "x$(basename $0)" = "x$PREFIX-build+upload-all-packages" ]; then + $PREFIX-build-package $pkg $comp $checkout && $PREFIX-upload-package $pkg $comp $checkout + fi + done +} diff --git a/bin/build-package b/bin/build-package new file mode 100755 index 0000000..f9c1648 --- /dev/null +++ b/bin/build-package @@ -0,0 +1,263 @@ +#!/bin/bash + +# Copyright (C) 2011 by Mike Gabriel +# +# This programme is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This programme is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +GIT_USER="gituser" +GIT_HOSTNAME="git.mydomain.org" + +DEBEMAIL="firstname.lastname@mydomain.org" +DEBFULLNAME="Firstname Lastname" +GPG_KEY= +DISTS_SUPPORTED="debian ubuntu" +BUILDS_FOR="\ +debian: squeeze wheezy sid\n\ +ubuntu: lucid precise\n\ +" + +COMPONENT_MAIN="main" +COMPONENT_NIGHTLY="nightly" +REPOS_SERVER="packages.mydomain.org" + +test -z $1 && { echo "usage: $(basename $0) [/] {main,main/,nightly,nightly/} []"; exit -1; } + +PREFIX=$(echo $0 | cut -d"-" -f1) +test -f ~/.buildscripts/$PREFIX.conf && . ~/.buildscripts/$PREFIX.conf || { echo "$0 has no valid context prefix..."; exit -1; } + +set -ex + +set_vars() { + USE_SUDO="yes" + PDEBUILD="pdebuild --pbuilder qemubuilder" + TEMP_BASE="$HOME/tmp/" + mkdir -p "$TEMP_BASE" + chmod 2770 "$TEMP_BASE" + + # first argv is the name of the Git project + PROJECT_PATH="$1" + PROJECT_PATH=${PROJECT_PATH/%.git/} + PROJECT="$(basename $PROJECT_PATH)" + + # grab repository component area from command line (2nd argv) or guess it + ARGV2_COMPONENT="$(echo "$2/" | cut -d"/" -f1)" + ARGV2_CODENAME="$(echo "$2/" | cut -d"/" -f2)" + COMPONENT="${ARGV2_COMPONENT:-${COMPONENT:-$COMPONENT_NIGHTLY}}" + CODENAMES="${ARGV2_CODENAME:-${CODENAMES}}" + [ -n "$ARGV2_CODENAME" ] && FORCE_BUILD=0 || FORCE_BUILD=-1 + if [ "x$COMPONENT" = "x$COMPONENT_MAIN" ]; then + CHECKOUT="${3:-build-main}" + elif [ "x$COMPONENT" = "x$COMPONENT_NIGHTLY" ]; then + CHECKOUT="${3:-master}" + DATE="~${DATE:-$(date +%Y%m%d)}" + else + echo "error: no such package component area for this Git project. Aborting..." + exit -1 + fi + # the DATE might be given as ,,today'' from the command line + [ "x$DATE" = "xtoday" ] && DATE="~$(date +%Y%m%d)" + + # setting paths + PROJECT_DIR="$HOME/build/$COMPONENT/$PROJECT" + PKGDIST="$HOME/pkg-dist/$COMPONENT/$PROJECT" + + # build for other architectures than amd64/i386 + EXTRA_ARCHS="${EXTRA_ARCHS:-}" + EXTRA_ARCHS_ONLY="${EXTRA_ARCHS_ONLY:-}" + + # creating paths + mkdir -p "$TEMP_BASE" + mkdir -p "$PROJECT_DIR" + mkdir -p "$PKGDIST" + + return 0 +} + +clear_pkgdist() { + + # pkgdist directory cleanup + cat "$PROJECT_DIR/BUILDS_FOR" | egrep -v '(^$|^#.*$)' | while read line; do + l_DIST="$(echo $line | cut -d":" -f1 | tr [A-Z] [a-z])" + CODENAMES="${CODENAMES:-$(echo $line | cut -d":" -f2- | tr [A-Z] [a#-z])}" + echo "$DISTS_SUPPORTED" | grep $l_DIST >/dev/null && { + for l_CODENAME in $CODENAMES; do + if [ "x$EXTRA_ARCHS_ONLY" = "x" ]; then + for l_ARCH in amd64 i386; do + mkdir -p "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.changes" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.upload" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.build" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.dsc" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.tar.gz" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/*.deb" + done + fi + for l_EXTRA_ARCH in $EXTRA_ARCHS; do + mkdir -p "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.changes" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.upload" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.build" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.dsc" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.tar.gz" + rm -f "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/*.deb" + done + done + } + done + return 0 +} + +prepare_workspace() { + # in any case remove the BUILDS_FOR file + rm -f "$PROJECT_DIR/BUILDS_FOR" + + # make sure our local working copy is up to date... + + if [ -d "$PROJECT_DIR/.git" ]; then + cd "$PROJECT_DIR" && git reset --hard + git checkout --force $CHECKOUT || git checkout --force -b $CHECKOUT + git pull origin $CHECKOUT + # and again, get the $CHECKOUT refspec in pure state + git reset --hard + else + cd "$(dirname $PROJECT_DIR)" + git clone git://$GIT_HOSTNAME/$PROJECT_PATH.git + cd "$PROJECT" + git checkout --force $CHECKOUT || git checkout --force -b $CHECKOUT; + fi + cd "$PROJECT_DIR" + + # by default we build for all current debian versions + test -f BUILDS_FOR || echo -e "$BUILDS_FOR" > BUILDS_FOR + return 0 +} + +build_packages() { + # use pbuilder for building all variants of this package + cat "$PROJECT_DIR/BUILDS_FOR" | egrep -v '(^$|^#.*$)' | while read line; do + l_DIST="$(echo $line | cut -d":" -f1 | tr [A-Z] [a-z])" + CODENAMES="${CODENAMES:-$(echo $line | cut -d":" -f2- | tr [A-Z] [a-z])}" + echo "$DISTS_SUPPORTED" | grep $l_DIST >/dev/null && { + for l_CODENAME in $CODENAMES; do + TEMP_DIR="$(mktemp -d --tmpdir=$TEMP_BASE)" + mkdir -p "$TEMP_DIR/$PROJECT" + chmod 2770 "$TEMP_DIR" -Rf + git clone --local "$PROJECT_DIR" "$TEMP_DIR/$PROJECT/" + cd "$TEMP_DIR/$PROJECT" + git checkout $CHECKOUT || git checkout master + GITREV=$(gitrevno) + # we always build native packages for our repos + test -f debian/source/format && cat debian/source/format | egrep '^3.0.*\(quilt\)$' >/dev/null && { + echo "3.0 (native)" > debian/source/format + } + # translate the version name for Debian releases + [ "x$l_CODENAME" = "xsid" ] && VERSION=unstable + [ "x$l_CODENAME" = "xwheezy" ] && VERSION=testing + [ "x$l_CODENAME" = "xsqueeze" ] && VERSION=stable + [ "x$l_CODENAME" = "xlenny" ] && VERSION=oldstable + + # modify the section for non-main package builds + [ "x$COMPONENT" != "xmain" ] || { + mv debian/control debian/control.tmp + cat debian/control.tmp | sed "s#Section:[\ ]*\(.*\)#Section: $COMPONENT/\1#g" > debian/control + } + + # modify changelog for this build + dch --distribution $VERSION --force-distribution -l "+$l_CODENAME~$COMPONENT$DATE~$GITREV~build" "Auto-built $l_DIST $l_CODENAME package for $REPOS_SERVER repository." + mkdir -p $PKGDIST/$l_DIST/$l_CODENAME/{amd64,i386} + OTHERMIRROR="deb http://$REPOS_SERVER/$l_DIST $l_CODENAME $COMPONENT" + [ "x$USE_SUDO" != "xyes" ] && { + [ "x$EXTRA_ARCHS_ONLY" = "x" ] && { + cat debian/control | egrep 'Architecture.*(all|any|amd64)' >/dev/null && { + DIST=$l_DIST CODENAME=$l_CODENAME ARCH=amd64 $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult "$PKGDIST/$l_DIST/$l_CODENAME/amd64" + } + cat debian/control | egrep 'Architecture.*(any|i386)' >/dev/null && { + DIST=$l_DIST CODENAME=$l_CODENAME ARCH=i386 $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult "$PKGDIST/$l_DIST/$l_CODENAME/i386" -- --binary-arch + } + } + for extra_arch in $EXTRA_ARCHS; do + mkdir -p "$PKGDIST/$l_DIST/$l_CODENAME/$extra_arch" + cat debian/control | egrep "Architecture.*(any|$extra_arch)" >/dev/null && { + DIST=$l_DIST CODENAME=$l_CODENAME ARCH=$extra_arch $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult "$PKGDIST/$l_DIST/$l_CODENAME/$extra_arch" -- --binary-arch + } + done + } + [ "x$USE_SUDO" = "xyes" ] && { + [ "x$EXTRA_ARCHS_ONLY" = "x" ] && { + cat debian/control | egrep 'Architecture.*(all|any|amd64)' >/dev/null && { + sudo DIST=$l_DIST CODENAME=$l_CODENAME ARCH=amd64 OTHERMIRROR="$OTHERMIRROR" $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/amd64 + } + cat debian/control | egrep 'Architecture.*(any|i386)' >/dev/null && { + sudo DIST=$l_DIST CODENAME=$l_CODENAME ARCH=i386 OTHERMIRROR="$OTHERMIRROR" $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/i386 -- --binary-arch + } + } + for extra_arch in $EXTRA_ARCHS; do + mkdir -p "$PKGDIST/$l_DIST/$l_CODENAME/$extra_arch" + cat debian/control | egrep "Architecture.*(any|$extra_arch)" >/dev/null && { + sudo DIST=$l_DIST CODENAME=$l_CODENAME ARCH=$extra_arch OTHERMIRROR="$OTHERMIRROR" $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult "$PKGDIST/$l_DIST/$l_CODENAME/$extra_arch" -- --binary-arch + } + done + } + cd - + rm -Rf "$TEMP_DIR" + done + echo + } + echo + done + echo + return 0 +} + +upload_packages() { + # dupload the new packages to the reprepro repository + cd "$PKGDIST" + cat "$PROJECT_DIR/BUILDS_FOR" | egrep -v '(^$|^#.*$)' | while read line; do + l_DIST=$(echo $line | cut -d":" -f1 | tr [A-Z] [a-z]) + CODENAMES=${CODENAMES:-$(echo $line | cut -d":" -f2- | tr [A-Z] [a-z])} + for l_CODENAME in $CODENAMES; do + if [ "x$EXTRA_ARCHS_ONLY" = "x" ]; then + for l_ARCH in amd64 i386; do + cd "$PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH" + ls "$PROJECT_*.changes" &>/dev/null && dupload --to $PREFIX-$l_DIST-$l_CODENAME "$PROJECT_*.changes" + cd - + done + fi + for l_EXTRA_ARCH in $EXTRA_ARCHS; do + cd "$PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH" + ls "$PROJECT_*.changes" &>/dev/null && dupload --to $PREFIX-$l_DIST-$l_CODENAME "$PROJECT_*.changes" + cd - + done + done + done + cd - + return 0 +} + +### MAIN ### +set_vars $@ && { + if [ "x$(basename $0)" = "x$PREFIX-build-package" ] || [ "x$(basename $0)" = "x$PREFIX-build+upload-package" ]; then + cd $PROJECT_DIR && pkgneedsbuild $CHECKOUT || [ "$FORCE_BUILD" -eq 0 ] && { + clear_pkgdist + prepare_workspace && { + build_packages + } + } + fi + if [ "x$(basename $0)" = "x$PREFIX-upload-package" ] || [ "x$(basename $0)" = "x$PREFIX-build+upload-package" ]; then + upload_packages + fi +} diff --git a/bin/gitcreate b/bin/gitcreate new file mode 100755 index 0000000..612173b --- /dev/null +++ b/bin/gitcreate @@ -0,0 +1,25 @@ +#!/bin/bash + +set -xe + +GIT_USER= +GIT_HOSTNAME= +GIT_SSH_PORT=22 + +PREFIX=$(echo $0 | cut -d"-" -f1) +. ~/.buildscripts/$PREFIX.conf + + +for pkg in "$@"; do + subdir=$(dirname $pkg)/ + pkg=$(basename $pkg) + ssh -l$GIT_USER $GIT_HOSTNAME "cd ~/git && ./setup-repository ${subdir}${pkg} '$pkg upstream project'" + ssh -l$GIT_USER $GIT_HOSTNAME "cd ~/git && ./update-repository-posixacls ${subdir}${pkg}" + test -d "$pkg" && cd "$pkg" + echo "$pkg: MASTER BRANCH" && git push ssh://$GIT_USER@$GIT_HOSTNAME:$GIT_SSH_PORT/~/git/${subdir}${pkg} master + git branch | grep upstream &>/dev/null && echo "$pkg: RELEASE BRANCH" && git push ssh://$GIT_USER@$GIT_HOSTNAME:$GIT_SSH_PORT/~/git/${subdir}${pkg} upstream + git branch | grep pristine-tar &>/dev/null && echo "$pkg: PRISTINE-TAR" && git push ssh://$GIT_USER@$GIT_HOSTNAME:$GIT_SSH_PORT/~/git/${subdir}${pkg} pristine-tar + echo "$pkg: PUSHING TAGS" && git push --tags ssh://$GIT_USER@$GIT_HOSTNAME:$GIT_SSH_PORT/~/git/${subdir}${pkg} + git remote add origin ssh://$GIT_USER@$GIT_HOSTNAME:$GIT_SSH_PORT/~/git/${subdir}${pkg} + cd .. +done diff --git a/bin/gitrevno b/bin/gitrevno new file mode 100755 index 0000000..2f121ff --- /dev/null +++ b/bin/gitrevno @@ -0,0 +1,28 @@ +#!/usr/bin/python + +# Copyright (C) 2010-2011 by Mike Gabriel +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +import subprocess +_proc = subprocess.Popen('git log --no-color --date=iso', + shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) +try: + GIT_REVISION_DATE = str(len([ x for x in _proc.communicate()[0].splitlines() if x.startswith('Date:')])) +except IndexError: + GIT_REVISION_DATE = 'unknown' + +print GIT_REVISION_DATE diff --git a/bin/nwt-build+upload-all-packages b/bin/nwt-build+upload-all-packages deleted file mode 120000 index 21d6658..0000000 --- a/bin/nwt-build+upload-all-packages +++ /dev/null @@ -1 +0,0 @@ -nwt-build-all-packages \ No newline at end of file diff --git a/bin/nwt-build+upload-package b/bin/nwt-build+upload-package deleted file mode 120000 index ce08442..0000000 --- a/bin/nwt-build+upload-package +++ /dev/null @@ -1 +0,0 @@ -nwt-build-package \ No newline at end of file diff --git a/bin/nwt-build-all-packages b/bin/nwt-build-all-packages deleted file mode 100755 index 35320f4..0000000 --- a/bin/nwt-build-all-packages +++ /dev/null @@ -1,60 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2011 by Mike Gabriel -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -LIB_PACKAGES_NIGHTLY="\ -nwt-keyring nightly master -" -LIB_PACKAGES_MAIN="\ -nwt-keyring main build-main -" - -APP_PACKAGES_NIGHTLY="\ -nwt-hostconfig nightly master -" -APP_PACKAGES_MAIN="\ -nwt-hostconfig main build-main -" - -COMPONENT=${1:-""} - -# build the newest code... (nightly-builds) -[ "x$COMPONENT" = "xnightly" ] || [ -z $COMPONENT ] && { - echo -e $LIB_PACKAGES_NIGHTLY $APP_PACKAGES_NIGHTLY | while read pkg comp checkout; do - if [ "x$(basename $0)" = "xnwt-build-all-packages" ]; then - nwt-build-package $pkg $comp $checkout - elif [ "x$(basename $0)" = "xnwt-upload-all-packages" ]; then - nwt-upload-package $pkg $comp $checkout - elif [ "x$(basename $0)" = "xnwt-build+upload-all-packages" ]; then - nwt-build-package $pkg $comp $checkout && nwt-upload-package $pkg $comp $checkout - fi - done -} - -# build all packages tagged as build-main -[ "x$COMPONENT" = "xmain" ] || [ -z $COMPONENT ] && { - echo -e $LIB_PACKAGES_MAIN $APP_PACKAGES_MAIN | while read pkg comp checkout; do - if [ "x$(basename $0)" = "xnwt-build-all-packages" ]; then - nwt-build-package $pkg $comp $checkout - elif [ "x$(basename $0)" = "xnwt-upload-all-packages" ]; then - nwt-upload-package $pkg $comp $checkout - elif [ "x$(basename $0)" = "xnwt-build+upload-all-packages" ]; then - nwt-build-package $pkg $comp $checkout && nwt-upload-package $pkg $comp $checkout - fi - done -} diff --git a/bin/nwt-build-package b/bin/nwt-build-package deleted file mode 100755 index 7531b15..0000000 --- a/bin/nwt-build-package +++ /dev/null @@ -1,253 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2011 by Mike Gabriel -# -# This programme is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This programme is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -test -z $1 && { echo "usage: {main,main/,nightly,nightly/} []"; exit -1; } - -set -ex - -export GIT_SERVER="code.das-netzwerkteam.de" -export DEBEMAIL=debian@das-netzwerkteam.de -export DEBFULLNAME="NWT Packages" -export GPG_KEY="4DC41CF116990FF8" -export DIST_SUPPORTED="debian ubuntu" - -set_vars() { - USE_SUDO="yes" - PDEBUILD="pdebuild --pbuilder qemubuilder" - TEMP_BASE="$HOME/tmp/" - mkdir -p "$TEMP_BASE" - chmod 2770 "$TEMP_BASE" - - # first argv is the name of the Git project - PROJECT=$(basename $1) - PROJECT_PATH=$1 - - # grab repository component area from command line (2nd argv) or guess it - ARGV2_COMPONENT=$(echo "$2/" | cut -d"/" -f1) - ARGV2_CODENAME=$(echo "$2/" | cut -d"/" -f2) - COMPONENT=${ARGV2_COMPONENT:-${COMPONENT:-nightly}} - CODENAMES=${ARGV2_CODENAME:-${CODENAMES}} - [ -n "$ARGV2_CODENAME" ] && FORCE_BUILD=0 || FORCE_BUILD=-1 - if [ "x$COMPONENT" = "xmain" ]; then - CHECKOUT=${3:-build-main} - elif [ "x$COMPONENT" = "xnightly" ]; then - CHECKOUT=${3:-master} - DATE="~${DATE:-$(date +%Y%m%d)}" - else - echo "error: no such package component area for NWT packages. Aborting..." - exit -1 - fi - # the DATE might be given as ,,today'' from the command line - [ "x$DATE" = "xtoday" ] && DATE="~$(date +%Y%m%d)" - - # setting paths - PROJECT_DIR=$HOME/build/$COMPONENT/$PROJECT - PKGDIST="$HOME/pkg-dist/$COMPONENT/$PROJECT" - - # build for other architectures than amd64/i386 - EXTRA_ARCHS="${EXTRA_ARCHS:-}" - EXTRA_ARCHS_ONLY="${EXTRA_ARCHS_ONLY:-}" - - # creating paths - mkdir -p "$TEMP_BASE" - mkdir -p $PROJECT_DIR - mkdir -p $PKGDIST - - return 0 -} - -clear_pkgdist() { - - # pkgdist directory cleanup - cat $PROJECT_DIR/BUILDS_FOR | egrep -v '(^$|^#.*$)' | while read line; do - l_DIST=$(echo $line | cut -d":" -f1 | tr [A-Z] [a-z]) - CODENAMES=${CODENAMES:-$(echo $line | cut -d":" -f2- | tr [A-Z] [a#-z])} - echo "$DIST_SUPPORTED" | grep $l_DIST >/dev/null && { - for l_CODENAME in $CODENAMES; do - if [ "x$EXTRA_ARCHS_ONLY" = "x" ]; then - for l_ARCH in amd64 i386; do - mkdir -p $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.changes - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.upload - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.build - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.dsc - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/$PROJECT_*.tar.gz - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH/*.deb - done - fi - for l_EXTRA_ARCH in $EXTRA_ARCHS; do - mkdir -p $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.changes - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.upload - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.build - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.dsc - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/$PROJECT_*.tar.gz - rm -f $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH/*.deb - done - done - } - done - return 0 -} - -prepare_workspace() { - # in any case remove the BUILDS_FOR file - rm -f $PROJECT_DIR/BUILDS_FOR - - # make sure our local working copy is up to date... - - if [ -d $PROJECT_DIR/.git ]; then - cd $PROJECT_DIR && git reset --hard - git checkout --force $CHECKOUT || git checkout --force -b $CHECKOUT - git pull origin $CHECKOUT - # and again, get the $CHECKOUT refspec in pure state - git reset --hard - else - cd $(dirname $PROJECT_DIR) - git clone git://$GIT_SERVER/$PROJECT_PATH.git - cd $PROJECT - git checkout --force $CHECKOUT || git checkout --force -b $CHECKOUT; - fi - cd $PROJECT_DIR - - # by default we build for all current debian versions - test -f BUILDS_FOR || cat > BUILDS_FOR </dev/null && { - for l_CODENAME in $CODENAMES; do - TEMP_DIR="$(mktemp -d --tmpdir=$TEMP_BASE)" - mkdir -p $TEMP_DIR/$PROJECT - chmod 2770 "$TEMP_DIR" -Rf - git clone --local $PROJECT_DIR $TEMP_DIR/$PROJECT/ - cd $TEMP_DIR/$PROJECT - git checkout $CHECKOUT || git checkout master - GITREV=$(nwt-gitrevno) - # we always build native packages for our repos - test -f debian/source/format && cat debian/source/format | egrep '^3.0.*\(quilt\)$' >/dev/null && { - echo "3.0 (native)" > debian/source/format - } - # translate the version name for Debian releases - [ "x$l_CODENAME" = "xsid" ] && VERSION=unstable - [ "x$l_CODENAME" = "xwheezy" ] && VERSION=testing - [ "x$l_CODENAME" = "xsqueeze" ] && VERSION=stable - [ "x$l_CODENAME" = "xlenny" ] && VERSION=oldstable - - # modify the section for non-main package builds - [ "x$COMPONENT" = "xmain" ] || { - mv debian/control debian/control.tmp - cat debian/control.tmp | sed "s#Section:[\ ]*\(.*\)#Section: $COMPONENT/\1#g" > debian/control - } - - # modify changelog for this build - dch --distribution $VERSION --force-distribution -l "+$l_CODENAME~$COMPONENT$DATE~$GITREV~build" "Auto-built $l_DIST $l_CODENAME package for packages.das-netzwerkteam.de repository." - mkdir -p $PKGDIST/$l_DIST/$l_CODENAME/{amd64,i386} - #OTHERMIRROR="deb http://packages.das-netzwerkteam.de/debian $l_CODENAME $COMPONENT" - OTHERMIRROR="" - [ "x$USE_SUDO" != "xyes" ] && { - [ "x$EXTRA_ARCHS_ONLY" = "x" ] && { - cat debian/control | egrep 'Architecture.*(all|any|amd64)' >/dev/null && { - DIST=$l_DIST CODENAME=$l_CODENAME ARCH=amd64 $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/amd64 - } - cat debian/control | egrep 'Architecture.*(any|i386)' >/dev/null && { - DIST=$l_DIST CODENAME=$l_CODENAME ARCH=i386 $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/i386 -- --binary-arch - } - } - for extra_arch in $EXTRA_ARCHS; do - mkdir -p $PKGDIST/$l_DIST/$l_CODENAME/$extra_arch - cat debian/control | egrep "Architecture.*(any|$extra_arch)" >/dev/null && { - DIST=$l_DIST CODENAME=$l_CODENAME ARCH=$extra_arch $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/$extra_arch -- --binary-arch - } - done - } - [ "x$USE_SUDO" = "xyes" ] && { - [ "x$EXTRA_ARCHS_ONLY" = "x" ] && { - cat debian/control | egrep 'Architecture.*(all|any|amd64)' >/dev/null && { - sudo DIST=$l_DIST CODENAME=$l_CODENAME ARCH=amd64 OTHERMIRROR="$OTHERMIRROR" $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/amd64 - } - cat debian/control | egrep 'Architecture.*(any|i386)' >/dev/null && { - sudo DIST=$l_DIST CODENAME=$l_CODENAME ARCH=i386 OTHERMIRROR="$OTHERMIRROR" $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/i386 -- --binary-arch - } - } - for extra_arch in $EXTRA_ARCHS; do - mkdir -p $PKGDIST/$l_DIST/$l_CODENAME/$extra_arch - cat debian/control | egrep "Architecture.*(any|$extra_arch)" >/dev/null && { - sudo DIST=$l_DIST CODENAME=$l_CODENAME ARCH=$extra_arch OTHERMIRROR="$OTHERMIRROR" $PDEBUILD --auto-debsign --debsign-k $GPG_KEY --buildresult $PKGDIST/$l_DIST/$l_CODENAME/$extra_arch -- --binary-arch - } - done - } - cd - - rm -Rf $TEMP_DIR - done - echo - } - echo - done - echo - return 0 -} - -upload_packages() { - # dupload the new packages to the reprepro repository - cd $PKGDIST - cat $PROJECT_DIR/BUILDS_FOR | egrep -v '(^$|^#.*$)' | while read line; do - l_DIST=$(echo $line | cut -d":" -f1 | tr [A-Z] [a-z]) - CODENAMES=${CODENAMES:-$(echo $line | cut -d":" -f2- | tr [A-Z] [a-z])} - for l_CODENAME in $CODENAMES; do - if [ "x$EXTRA_ARCHS_ONLY" = "x" ]; then - for l_ARCH in amd64 i386; do - cd $PKGDIST/$l_DIST/$l_CODENAME/$l_ARCH - ls $PROJECT_*.changes &>/dev/null && dupload --to nwt-$l_DIST-$l_CODENAME $PROJECT_*.changes - cd - - done - fi - for l_EXTRA_ARCH in $EXTRA_ARCHS; do - cd $PKGDIST/$l_DIST/$l_CODENAME/$l_EXTRA_ARCH - ls $PROJECT_*.changes &>/dev/null && dupload --to nwt-$l_DIST-$l_CODENAME $PROJECT_*.changes - cd - - done - done - done - cd - - return 0 -} - -### MAIN ### -set_vars $@ && { - if [ "x$(basename $0)" = "xnwt-build-package" ] || [ "x$(basename $0)" = "xnwt-build+upload-package" ]; then - cd $PROJECT_DIR && nwt-pkgneedsbuild $CHECKOUT || [ "$FORCE_BUILD" -eq 0 ] && { - clear_pkgdist - prepare_workspace && { - build_packages - } - } - fi - if [ "x$(basename $0)" = "xnwt-upload-package" ] || [ "x$(basename $0)" = "xnwt-build+upload-package" ]; then - upload_packages - fi -} diff --git a/bin/nwt-gitcreate b/bin/nwt-gitcreate deleted file mode 100755 index 27f4885..0000000 --- a/bin/nwt-gitcreate +++ /dev/null @@ -1,17 +0,0 @@ -#!/bin/bash - -set -xe - -for pkg in "$@"; do - subdir=$(dirname $pkg)/ - pkg=$(basename $pkg) - ssh -lnwt code.das-netzwerkteam.de "cd ~/git && ./setup-repository ${subdir}${pkg} '$pkg upstream project'" - ssh -lnwt code.das-netzwerkteam.de "cd ~/git && ./update-repository-posixacls ${subdir}${pkg}" - test -d "$pkg" && cd "$pkg" - echo "$pkg: MASTER BRANCH" && git push ssh://nwt@code.das-netzwerkteam.de:32032/~/git/${subdir}${pkg} master - git branch | grep upstream &>/dev/null && echo "$pkg: RELEASE BRANCH" && git push ssh://nwt@code.das-netzwerkteam.de:32032/~/git/${subdir}${pkg} upstream - git branch | grep pristine-tar &>/dev/null && echo "$pkg: PRISTINE-TAR" && git push ssh://nwt@code.das-netzwerkteam.de:32032/~/git/${subdir}${pkg} pristine-tar - echo "$pkg: PUSHING TAGS" && git push --tags ssh://nwt@code.das-netzwerkteam.de:32032/~/git/${subdir}${pkg} - git remote add origin ssh://nwt@code.das-netzwerkteam.de:32032/~/git/${subdir}${pkg} - cd .. -done diff --git a/bin/nwt-gitrevno b/bin/nwt-gitrevno deleted file mode 100755 index 2f121ff..0000000 --- a/bin/nwt-gitrevno +++ /dev/null @@ -1,28 +0,0 @@ -#!/usr/bin/python - -# Copyright (C) 2010-2011 by Mike Gabriel -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - -import subprocess -_proc = subprocess.Popen('git log --no-color --date=iso', - shell=True, stdout=subprocess.PIPE, stderr=subprocess.PIPE) -try: - GIT_REVISION_DATE = str(len([ x for x in _proc.communicate()[0].splitlines() if x.startswith('Date:')])) -except IndexError: - GIT_REVISION_DATE = 'unknown' - -print GIT_REVISION_DATE diff --git a/bin/nwt-pkgneedsbuild b/bin/nwt-pkgneedsbuild deleted file mode 100755 index 2a192eb..0000000 --- a/bin/nwt-pkgneedsbuild +++ /dev/null @@ -1,47 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2010-2011 by Mike Gabriel -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - -set -xe - -CHECKOUT=${1:-master} - -[ -d .git ] && { - - TIMESTAMP=$(date +%s) - CURRENT_BRANCH=$(git branch | grep "*" | awk '{print $2}') - - # switch to branch given as $CHECKOUT, if it does not exist locally, create it... - git checkout $CHECKOUT &>/dev/null || git checkout -b $CHECKOUT >/dev/null - - # switch to a tmp branch... - git checkout -b tmp-$TIMESTAMP &>/dev/null - - # pull $CHECKOUT from origin into the tmp branch - LANG=en_US.UTF-8 git pull origin $CHECKOUT 2>/dev/null | egrep "^Already up-to-date.$" &>/dev/null && { - # drop the tmp branch - git checkout $CURRENT_BRANCH &>/dev/null - git branch -D tmp-$TIMESTAMP >/dev/null - exit 1 - } || { - # drop the tmp branch - git checkout $CURRENT_BRANCH &>/dev/null - git branch -D tmp-$TIMESTAMP >/dev/null - exit 0 - } -} || exit 0 diff --git a/bin/nwt-tarballrelease b/bin/nwt-tarballrelease deleted file mode 100755 index 1b58077..0000000 --- a/bin/nwt-tarballrelease +++ /dev/null @@ -1,43 +0,0 @@ -#!/bin/sh - -# Copyright (C) 2011 by Mike Gabriel -# -# This is free software; you can redistribute it and/or modify -# it under the tBerms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. - -# Thanks to Jonas Smedegaard for inspiration... - -set -e - -RELEASE="$1" -test -n "$RELEASE" || { echo "usage: $(basename "$0") []"; exit 1; } - -CHECKOUT="${2:-master}" - -PROJECT="$(basename $PWD)" -TARGETDIR=".." - -MANIFEST="$(mktemp)" -TEMP_DIR="$(mktemp -d)" - -echo $MANIFEST - -trap "rm -f \"${MANIFEST}\"; rm -rf \"${TEMP_DIR}\"" 0 -git clone . "$TEMP_DIR/${PROJECT}_$RELEASE" -( set -e; cd "$TEMP_DIR/${PROJECT}_$RELEASE/" && git checkout ${CHECKOUT} 2>/dev/null || true ) -( set -e; cd "$TEMP_DIR" && rm -Rf "${PROJECT}_$RELEASE/.git"* ) -( set -e; cd "$TEMP_DIR" && find "${PROJECT}_$RELEASE" -type f | sed 's/^\.*\/*//' | sort > "$MANIFEST" ) -mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/" -tar c -C "$TEMP_DIR" --owner 0 --group 0 --numeric-owner --no-recursion --files-from "$MANIFEST" | gzip -n > "$TARGETDIR/_releases_/source/${PROJECT}/${PROJECT}_$RELEASE.tar.gz" diff --git a/bin/nwt-updatebuildmain b/bin/nwt-updatebuildmain deleted file mode 100755 index f4f4917..0000000 --- a/bin/nwt-updatebuildmain +++ /dev/null @@ -1,34 +0,0 @@ -#!/bin/bash - -# Copyright (C) 2010-2011 by Mike Gabriel -# -# This is free software; you can redistribute it and/or modify -# it under the terms of the GNU General Public License as published by -# the Free Software Foundation; either version 3 of the License, or -# (at your option) any later version. -# -# This is distributed in the hope that it will be useful, -# but WITHOUT ANY WARRANTY; without even the implied warranty of -# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -# GNU General Public License for more details. -# -# You should have received a copy of the GNU General Public License -# along with this program; if not, write to the -# Free Software Foundation, Inc., -# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA - -set -e - -GITPROJECT=$(basename $(pwd)) -REF=$1 - -# we need to be within a working copy (base folder) and we need a !!! -test -z $1 || test -d ./.git || { - echo "usage: $(basename $0) " - echo "Call this command from within the base folder of a Git project's working copy..." - exit -1 -} - -# update the build-main branch with our newest blessed reference -git branch build-main &>/dev/null || true -git push origin $REF:build-main diff --git a/bin/nwt-upload-all-packages b/bin/nwt-upload-all-packages deleted file mode 120000 index 21d6658..0000000 --- a/bin/nwt-upload-all-packages +++ /dev/null @@ -1 +0,0 @@ -nwt-build-all-packages \ No newline at end of file diff --git a/bin/nwt-upload-package b/bin/nwt-upload-package deleted file mode 120000 index ce08442..0000000 --- a/bin/nwt-upload-package +++ /dev/null @@ -1 +0,0 @@ -nwt-build-package \ No newline at end of file diff --git a/bin/pkgneedsbuild b/bin/pkgneedsbuild new file mode 100755 index 0000000..2a192eb --- /dev/null +++ b/bin/pkgneedsbuild @@ -0,0 +1,47 @@ +#!/bin/bash + +# Copyright (C) 2010-2011 by Mike Gabriel +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +set -xe + +CHECKOUT=${1:-master} + +[ -d .git ] && { + + TIMESTAMP=$(date +%s) + CURRENT_BRANCH=$(git branch | grep "*" | awk '{print $2}') + + # switch to branch given as $CHECKOUT, if it does not exist locally, create it... + git checkout $CHECKOUT &>/dev/null || git checkout -b $CHECKOUT >/dev/null + + # switch to a tmp branch... + git checkout -b tmp-$TIMESTAMP &>/dev/null + + # pull $CHECKOUT from origin into the tmp branch + LANG=en_US.UTF-8 git pull origin $CHECKOUT 2>/dev/null | egrep "^Already up-to-date.$" &>/dev/null && { + # drop the tmp branch + git checkout $CURRENT_BRANCH &>/dev/null + git branch -D tmp-$TIMESTAMP >/dev/null + exit 1 + } || { + # drop the tmp branch + git checkout $CURRENT_BRANCH &>/dev/null + git branch -D tmp-$TIMESTAMP >/dev/null + exit 0 + } +} || exit 0 diff --git a/bin/tarballrelease b/bin/tarballrelease new file mode 100755 index 0000000..1b58077 --- /dev/null +++ b/bin/tarballrelease @@ -0,0 +1,43 @@ +#!/bin/sh + +# Copyright (C) 2011 by Mike Gabriel +# +# This is free software; you can redistribute it and/or modify +# it under the tBerms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA. + +# Thanks to Jonas Smedegaard for inspiration... + +set -e + +RELEASE="$1" +test -n "$RELEASE" || { echo "usage: $(basename "$0") []"; exit 1; } + +CHECKOUT="${2:-master}" + +PROJECT="$(basename $PWD)" +TARGETDIR=".." + +MANIFEST="$(mktemp)" +TEMP_DIR="$(mktemp -d)" + +echo $MANIFEST + +trap "rm -f \"${MANIFEST}\"; rm -rf \"${TEMP_DIR}\"" 0 +git clone . "$TEMP_DIR/${PROJECT}_$RELEASE" +( set -e; cd "$TEMP_DIR/${PROJECT}_$RELEASE/" && git checkout ${CHECKOUT} 2>/dev/null || true ) +( set -e; cd "$TEMP_DIR" && rm -Rf "${PROJECT}_$RELEASE/.git"* ) +( set -e; cd "$TEMP_DIR" && find "${PROJECT}_$RELEASE" -type f | sed 's/^\.*\/*//' | sort > "$MANIFEST" ) +mkdir -p "$TARGETDIR/_releases_/source/${PROJECT}/" +tar c -C "$TEMP_DIR" --owner 0 --group 0 --numeric-owner --no-recursion --files-from "$MANIFEST" | gzip -n > "$TARGETDIR/_releases_/source/${PROJECT}/${PROJECT}_$RELEASE.tar.gz" diff --git a/bin/updatebuildmain b/bin/updatebuildmain new file mode 100755 index 0000000..f4f4917 --- /dev/null +++ b/bin/updatebuildmain @@ -0,0 +1,34 @@ +#!/bin/bash + +# Copyright (C) 2010-2011 by Mike Gabriel +# +# This is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 3 of the License, or +# (at your option) any later version. +# +# This is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the +# Free Software Foundation, Inc., +# 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + +set -e + +GITPROJECT=$(basename $(pwd)) +REF=$1 + +# we need to be within a working copy (base folder) and we need a !!! +test -z $1 || test -d ./.git || { + echo "usage: $(basename $0) " + echo "Call this command from within the base folder of a Git project's working copy..." + exit -1 +} + +# update the build-main branch with our newest blessed reference +git branch build-main &>/dev/null || true +git push origin $REF:build-main diff --git a/bin/upload-all-packages b/bin/upload-all-packages new file mode 120000 index 0000000..b8c12b0 --- /dev/null +++ b/bin/upload-all-packages @@ -0,0 +1 @@ +build-all-packages \ No newline at end of file diff --git a/bin/upload-package b/bin/upload-package new file mode 120000 index 0000000..2b48fdc --- /dev/null +++ b/bin/upload-package @@ -0,0 +1 @@ +build-package \ No newline at end of file -- cgit v1.2.3