nextcloud-desktop/admin/linux/debian/drone-build.sh

125 lines
3.5 KiB
Bash
Raw Normal View History

2018-01-06 19:03:10 +03:00
#!/bin/bash
set -xe
shopt -s extglob
2018-07-15 14:20:00 +03:00
PPA=ppa:nextcloud-devs/client-beta
PPA_BETA=ppa:nextcloud-devs/client-alpha
2018-01-06 19:03:10 +03:00
2018-07-15 14:20:00 +03:00
OBS_PROJECT=home:ivaradi:beta
OBS_PROJECT_BETA=home:ivaradi:alpha
2018-01-06 19:03:10 +03:00
OBS_PACKAGE=nextcloud-client
pull_request=${DRONE_PULL_REQUEST:=master}
if test -z "${DRONE_WORKSPACE}"; then
DRONE_WORKSPACE=`pwd`
fi
if test -z "${DRONE_DIR}"; then
DRONE_DIR=`dirname ${DRONE_WORKSPACE}`
fi
2018-01-06 19:03:10 +03:00
2018-01-30 21:22:26 +03:00
set +x
2018-01-06 19:03:10 +03:00
if test "$DEBIAN_SECRET_KEY" -a "$DEBIAN_SECRET_IV"; then
openssl aes-256-cbc -K $DEBIAN_SECRET_KEY -iv $DEBIAN_SECRET_IV -in admin/linux/debian/signing-key.txt.enc -d | gpg --import
openssl aes-256-cbc -K $DEBIAN_SECRET_KEY -iv $DEBIAN_SECRET_IV -in admin/linux/debian/oscrc.enc -out ~/.oscrc -d
touch ~/.has_ppa_keys
fi
2018-01-30 21:22:26 +03:00
set -x
2018-01-06 19:03:10 +03:00
cd "${DRONE_WORKSPACE}"
2018-01-06 19:03:10 +03:00
read basever kind <<<$(admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog stable)
cd "${DRONE_DIR}"
2018-01-06 19:03:10 +03:00
echo "$kind" > kind
kind="release"
if test "$kind" = "beta"; then
repo=nextcloud-devs/client-alpha
2018-07-15 14:20:00 +03:00
else
repo=nextcloud-devs/client-beta
2018-01-06 19:03:10 +03:00
fi
origsourceopt=""
if ! wget http://ppa.launchpad.net/${repo}/ubuntu/pool/main/n/nextcloud-client/nextcloud-client_${basever}.orig.tar.bz2; then
cp -a ${DRONE_WORKSPACE} nextcloud-client_${basever}
2018-01-06 19:03:10 +03:00
tar cjf nextcloud-client_${basever}.orig.tar.bz2 --exclude .git nextcloud-client_${basever}
origsourceopt="-sa"
fi
2018-07-26 21:08:48 +03:00
for distribution in xenial bionic cosmic stable; do
2018-01-06 19:03:10 +03:00
rm -rf nextcloud-client_${basever}
cp -a ${DRONE_WORKSPACE} nextcloud-client_${basever}
2018-01-06 19:03:10 +03:00
cd nextcloud-client_${basever}
cp -a admin/linux/debian/debian .
if test -d admin/linux/debian/debian.${distribution}; then
tar cf - -C admin/linux/debian/debian.${distribution} . | tar xf - -C debian
fi
admin/linux/debian/scripts/git2changelog.py /tmp/tmpchangelog ${distribution}
cp /tmp/tmpchangelog debian/changelog
if test -f admin/linux/debian/debian.${distribution}/changelog; then
cat admin/linux/debian/debian.${distribution}/changelog >> debian/changelog
else
cat admin/linux/debian/debian/changelog >> debian/changelog
fi
2018-02-01 21:22:46 +03:00
for p in debian/post-patches/*.patch; do
if test -f "${p}"; then
echo "Applying ${p}"
patch -p1 < "${p}"
fi
done
2018-01-06 19:03:10 +03:00
fullver=`head -1 debian/changelog | sed "s:nextcloud-client (\([^)]*\)).*:\1:"`
EDITOR=true dpkg-source --commit . local-changes
dpkg-source --build .
dpkg-genchanges -S ${origsourceopt} > "../nextcloud-client_${fullver}_source.changes"
if test -f ~/.has_ppa_keys; then
debsign -k7D14AA7B -S
fi
2018-01-06 19:03:10 +03:00
cd ..
done
if test "${pull_request}" = "master"; then
2018-01-06 19:03:10 +03:00
kind=`cat kind`
if test "$kind" = "beta"; then
PPA=$PPA_BETA
OBS_PROJECT=$OBS_PROJECT_BETA
fi
OBS_SUBDIR="${OBS_PROJECT}/${OBS_PACKAGE}"
if test -f ~/.has_ppa_keys; then
for changes in nextcloud-client_*~+([a-z])1_source.changes; do
dput $PPA $changes > /dev/null
done
mkdir osc
cd osc
osc co ${OBS_PROJECT} ${OBS_PACKAGE}
if test "$(ls ${OBS_SUBDIR})"; then
osc delete ${OBS_SUBDIR}/*
fi
cp ../nextcloud-client*.orig.tar.* ${OBS_SUBDIR}/
cp ../nextcloud-client_*[0-9.][0-9].dsc ${OBS_SUBDIR}/
cp ../nextcloud-client_*[0-9.][0-9].debian.tar* ${OBS_SUBDIR}/
cp ../nextcloud-client_*[0-9.][0-9]_source.changes ${OBS_SUBDIR}/
osc add ${OBS_SUBDIR}/*
cd ${OBS_SUBDIR}
osc commit -m "Travis update"
fi
fi