From 6c7e7294da800febc3266cf37066b2e59917eb67 Mon Sep 17 00:00:00 2001 From: drebs Date: Sat, 4 Feb 2017 08:07:44 -0200 Subject: [pkg] add build-deb.sh script --- scripts/packaging/build-deb.sh | 32 +++++++++++++++++++++++++++++++ scripts/packaging/build_debian_package.sh | 32 ------------------------------- 2 files changed, 32 insertions(+), 32 deletions(-) create mode 100755 scripts/packaging/build-deb.sh delete mode 100755 scripts/packaging/build_debian_package.sh diff --git a/scripts/packaging/build-deb.sh b/scripts/packaging/build-deb.sh new file mode 100755 index 00000000..f7dd22a0 --- /dev/null +++ b/scripts/packaging/build-deb.sh @@ -0,0 +1,32 @@ +#!/bin/sh + +# This script generates a debian package from your current repository tree +# (including modified and unstaged files), using the debian directory from the +# latest debian/platform-X.Y branch. +# +# In order to achieve that, what it does is: +# +# - copy the current repository into a temporary directory. +# - find what is the latest "debian/platform-X.Y" branch. +# - checkout the "debian/" directory from that branch. +# - update the "debian/changelog" file with dummy information. +# - run "debuild -uc -us". + +debemail="Leap Automatic Deb Builder " +scriptdir=$(dirname "${0}") +gitroot=$(git -C "${scriptdir}" rev-parse --show-toplevel) +deb_branch=$(git -C "${gitroot}" branch | grep "debian/platform" | sort | tail -n 1 | xargs) +reponame=$(basename "${gitroot}") +tempdir=$(mktemp -d) +targetdir="${tempdir}/${reponame}" + +cp -r "${gitroot}" "${tempdir}/${reponame}" +git -C "${targetdir}" checkout "${deb_branch}" -- debian + +(cd "${targetdir}" && DEBEMAIL="${debemail}" dch -b "Automatic build.") +(cd "${targetdir}" && debuild -uc -us) + +echo "****************************************" +echo "Packages can be found in: ${tempdir}" +ls "${tempdir}" +echo "****************************************" diff --git a/scripts/packaging/build_debian_package.sh b/scripts/packaging/build_debian_package.sh deleted file mode 100755 index b9fb93a9..00000000 --- a/scripts/packaging/build_debian_package.sh +++ /dev/null @@ -1,32 +0,0 @@ -#!/bin/sh - -# This script generates Soledad Debian packages. -# -# When invoking this script, you should pass a git repository URL and the name -# of the branch that contains the code you wish to build the packages from. -# -# The script will clone the given branch from the given repo, as well as the -# main Soledad repo in github which contains the most up-to-date debian -# branch. It will then merge the desired branch into the debian branch and -# build the packages. - -if [ $# -ne 2 ]; then - echo "Usage: ${0} " - exit 1 -fi - -SOLEDAD_MAIN_REPO=git://github.com/leapcode/soledad.git - -url=$1 -branch=$2 -workdir=`mktemp -d` - -git clone -b ${branch} ${url} ${workdir}/soledad -export GIT_DIR=${workdir}/soledad/.git -export GIT_WORK_TREE=${workdir}/soledad -git remote add leapcode ${SOLEDAD_MAIN_REPO} -git fetch leapcode -git checkout -b debian/experimental leapcode/debian/experimental -git merge --no-edit ${branch} -(cd ${workdir}/soledad && debuild -uc -us) -echo "Packages generated in ${workdir}" -- cgit v1.2.3