From 7e15b85424f612f78917396adb7a7eb36d844ff0 Mon Sep 17 00:00:00 2001 From: Alexandre Aubin Date: Mon, 4 Sep 2017 19:13:28 +0200 Subject: [PATCH] Trying to handle that hook thing --- README.md | 4 ++ config/config | 2 +- config/pbuilder/nodejs.conf | 9 ++++ config/pbuilder/pbuilder.conf | 2 +- scripts/pbuilder/hooks/B90lintian | 18 ++++++++ scripts/pbuilder/hooks/D70apt-update | 2 + scripts/pbuilder/hooks/E01apt-preferences | 16 +++++++ scripts/pbuilder/keyrings/nodesource.gpg | 52 +++++++++++++++++++++++ scripts/rebuildd/build-binaries | 42 +++++++++--------- 9 files changed, 123 insertions(+), 24 deletions(-) create mode 100644 config/pbuilder/nodejs.conf create mode 100644 scripts/pbuilder/hooks/B90lintian create mode 100644 scripts/pbuilder/hooks/D70apt-update create mode 100644 scripts/pbuilder/hooks/E01apt-preferences create mode 100644 scripts/pbuilder/keyrings/nodesource.gpg diff --git a/README.md b/README.md index 0dfc3c5..2c27304 100644 --- a/README.md +++ b/README.md @@ -59,6 +59,10 @@ How this shit works Misc notes ---------- +#### Hooks thingy + +At the start of the build, pbuilder will call the hooks in scripts/pbuilder/hooks + #### If you need to rebuild custom packages (for instance, metronome ?) - Go to a git clone of https://github.com/yunohost/metronome/ diff --git a/config/config b/config/config index 484cf93..e390dab 100644 --- a/config/config +++ b/config/config @@ -28,7 +28,7 @@ PBUILDER_HOME="$HOME_VINAIGRETTE/scripts/pbuilder/" PBUILDER_IMAGES="$HOME_VINAIGRETTE/images/" PBUILDER_RESULTS="$PBUILDER_HOME/result" DAILY_PACKAGES="$PBUILDER_HOME/packages/" -PBUILDER_CONF="$PBUILDER_HOME/config/pbuilder/" +PBUILDER_CONF="$HOME_VINAIGRETTE/config/pbuilder/" # Scripts diff --git a/config/pbuilder/nodejs.conf b/config/pbuilder/nodejs.conf new file mode 100644 index 0000000..1b1cc46 --- /dev/null +++ b/config/pbuilder/nodejs.conf @@ -0,0 +1,9 @@ +# NodeJS-specific configuration + +[[ -n ${OTHERMIRROR} ]] && OTHERMIRROR+=" | " +OTHERMIRROR+="deb https://deb.nodesource.com/node_4.x ${DISTRIBUTION} main" + +[[ -n ${EXTRAPACKAGES} ]] && EXTRAPACKAGES+=" " +EXTRAPACKAGES+="apt-transport-https ca-certificates" + +APTKEYRINGS=("${APTKEYRINGS[@]}" "/etc/pbuilder/keyrings/nodesource.gpg") diff --git a/config/pbuilder/pbuilder.conf b/config/pbuilder/pbuilder.conf index 68a6cf7..3d0ec96 100644 --- a/config/pbuilder/pbuilder.conf +++ b/config/pbuilder/pbuilder.conf @@ -9,7 +9,7 @@ DISTRIBUTION="jessie" # default location for the user hooks directory -HOOKDIR="/etc/pbuilder/hooks" +HOOKDIR="/home/vinaigrette/scripts/pbuilder/hooks/" # main mirror site for Debian MIRRORSITE="http://cdn.debian.net/debian" diff --git a/scripts/pbuilder/hooks/B90lintian b/scripts/pbuilder/hooks/B90lintian new file mode 100644 index 0000000..fb10742 --- /dev/null +++ b/scripts/pbuilder/hooks/B90lintian @@ -0,0 +1,18 @@ +#!/bin/bash + +set -e + +#install_packages() { +# apt-get -y "${APTGETOPT[@]}" install "$@" +#} +# +#install_packages lintian + +echo "+++ lintian output +++" + +#su -c "lintian -I --show-overrides /tmp/buildd/*.changes" - pbuilder +# use this version if you don't want lintian to fail the build +su -c "lintian -i -I --show-overrides /tmp/buildd/*.changes; :" - pbuilder + +echo "+++ end of lintian output +++" + diff --git a/scripts/pbuilder/hooks/D70apt-update b/scripts/pbuilder/hooks/D70apt-update new file mode 100644 index 0000000..0226518 --- /dev/null +++ b/scripts/pbuilder/hooks/D70apt-update @@ -0,0 +1,2 @@ +#!/bin/sh +/usr/bin/apt-get update diff --git a/scripts/pbuilder/hooks/E01apt-preferences b/scripts/pbuilder/hooks/E01apt-preferences new file mode 100644 index 0000000..cf74d9e --- /dev/null +++ b/scripts/pbuilder/hooks/E01apt-preferences @@ -0,0 +1,16 @@ +#!/bin/sh + +set -e + +if $(cat "/etc/apt/sources.list" | grep -q "wheezy-backports"); then + echo "Adding pin preferences for wheezy-backports" + cat > "/etc/apt/preferences.d/wheezy-backports" << EOF +Package: dh-python dh-systemd devscripts +Pin: release a=wheezy-backports +Pin-Priority: 999 +EOF +else + if [ -f /etc/apt/preferences.d/wheezy-backports ]; then + rm -vf /etc/apt/preferences.d/wheezy-backports + fi +fi diff --git a/scripts/pbuilder/keyrings/nodesource.gpg b/scripts/pbuilder/keyrings/nodesource.gpg new file mode 100644 index 0000000..1dc1d10 --- /dev/null +++ b/scripts/pbuilder/keyrings/nodesource.gpg @@ -0,0 +1,52 @@ +-----BEGIN PGP PUBLIC KEY BLOCK----- +Version: GnuPG v1 +Comment: GPGTools - https://gpgtools.org + +mQINBFObJLYBEADkFW8HMjsoYRJQ4nCYC/6Eh0yLWHWfCh+/9ZSIj4w/pOe2V6V+ +W6DHY3kK3a+2bxrax9EqKe7uxkSKf95gfns+I9+R+RJfRpb1qvljURr54y35IZgs +fMG22Np+TmM2RLgdFCZa18h0+RbH9i0b+ZrB9XPZmLb/h9ou7SowGqQ3wwOtT3Vy +qmif0A2GCcjFTqWW6TXaY8eZJ9BCEqW3k/0Cjw7K/mSy/utxYiUIvZNKgaG/P8U7 +89QyvxeRxAf93YFAVzMXhoKxu12IuH4VnSwAfb8gQyxKRyiGOUwk0YoBPpqRnMmD +Dl7SdmY3oQHEJzBelTMjTM8AjbB9mWoPBX5G8t4u47/FZ6PgdfmRg9hsKXhkLJc7 +C1btblOHNgDx19fzASWX+xOjZiKpP6MkEEzq1bilUFul6RDtxkTWsTa5TGixgCB/ +G2fK8I9JL/yQhDc6OGY9mjPOxMb5PgUlT8ox3v8wt25erWj9z30QoEBwfSg4tzLc +Jq6N/iepQemNfo6Is+TG+JzI6vhXjlsBm/Xmz0ZiFPPObAH/vGCY5I6886vXQ7ft +qWHYHT8jz/R4tigMGC+tvZ/kcmYBsLCCI5uSEP6JJRQQhHrCvOX0UaytItfsQfLm +EYRd2F72o1yGh3yvWW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QBWhrqfu +G3KaePvbnObKHXpfIKoAM7X2qfO+IFnLGTPyhFTcrl6vZBTMZTfZiC1XDQLuGUnd +sckuXINIU3DFWzZGr0QrqkuE/jyr7FXeUJj9B7cLo+s/TXo+RaVfi3kOc9BoxIvy +/qiNGs/TKy2/Ujqp/affmIMoMXSozKmga81JSwkADO1JMgUy6dApXz9kP4EE3g== +=CLGF +-----END PGP PUBLIC KEY BLOCK----- diff --git a/scripts/rebuildd/build-binaries b/scripts/rebuildd/build-binaries index c32e486..1f0cf69 100755 --- a/scripts/rebuildd/build-binaries +++ b/scripts/rebuildd/build-binaries @@ -27,38 +27,36 @@ else JOBS=1 fi -echo \ -"******************************************************************************" -echo "Starting building..." +echo "######################" +echo " Starting build ... " +echo "######################" # Format needed pbuilder arguments DEBBUILDOPTS="$DEBBUILDOPTS -j$JOBS" DSC_FILE="${package}_${version}.dsc" BASE_TGZ="${PBUILDER_IMAGES}/${arch}/${codename}.tgz" EXTRA_OPTS=() +CONFIGFILE="" # Use specific conf for nodejs builds -if [[ $package =~ ^yunohost-admin$ ]]; then - base_tgz="${PBUILDER_IMAGES}/${arch}/${codename}-nodejs.tgz" - if [[ -f ${base_tgz} ]]; then - echo "+ using nodejs environment..." - BASE_TGZ=${base_tgz} - fi +if [[ $package == "yunohost-admin" ]]; +then + BASE_TGZ="${PBUILDER_IMAGES}/${arch}/${codename}-nodejs.tgz" + CONFIGFILE="--configfile $PBUILDER_CONF/nodejs.conf" +fi + +if [[ $arch == "armhf" ]]; +then + CONFIGFILE="--configfile $PBUILDER_CONF/armhf.conf" fi -case $arch in - armhf) - pbuilder build --debbuildopts "${DEBBUILDOPTS}" \ - --configfile $PBUILDER_CONF/armhf.conf \ - --basetgz $BASE_TGZ "${EXTRA_OPTS[@]}" $DSC_FILE - exit_code=$? - ;; +pbuilder build \ + --basetgz "${BASE_TGZ}" \ + --debbuildopts "${DEBBUILDOPTS}" \ + ${CONFIGFILE} \ + "${EXTRA_OPTS[@]}" \ + $DSC_FILE - amd64|i386) - pbuilder build --debbuildopts "${DEBBUILDOPTS}" \ - --basetgz $BASE_TGZ "${EXTRA_OPTS[@]}" $DSC_FILE - exit_code=$? - ;; -esac +exit_code=$? exit $exit_code