Commit 7559b2c9 authored by Julian Wiesener's avatar Julian Wiesener

make varnish version based on official weekly

parent ff39debb
......@@ -21,23 +21,43 @@ build_dist () {
if [ "${dpkg}" == "__push_repo" ]; then
push_repo || exit 1
else
TERR=0
VERSION="${VERSION}" DEBRELEASE="${DEBRELEASE}" \
ARCH="${ARCH}" builddpkg ${dpkg} || let ERR+=1
ARCH="${ARCH}" builddpkg ${dpkg} >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}.log 2>&1 || let TERR=1
if [ $TERR -ne 0 ]; then
echo "failed: ${dpkg}" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}
fi
let ERR+=$TERR
fi
done
echo "Build for ${DEBRELEASE} done with $ERR failed packages"
if [ $ERR -eq 0 ]; then
echo "buildall: done" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}
else
echo "buildall: $ERR packages failed" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}
fi
echo "Build for ${DEBRELEASE} done with $ERR failed packages" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}.log
return $ERR
}
push_repo () {
aptly repo add ${DEBRELEASE} "${SBUILDDIR}" || return 1
aptly publish update "${DEBRELEASE}" || return 1
aptly repo add ${DEBRELEASE} "${SBUILDDIR}" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}.log 2>&1 || return 1
aptly publish update "${DEBRELEASE}" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}.log 2>&1 || return 1
return 0
}
if [ -z "${VERSION}" ]; then
VERSION=$(date "+%Y%m%d")
fi
if [ -z "${VARNISHABI}" ]; then
VARNISHABI=$(${PREFIX}/bin/getvarnishabi.py)
if [ $? -ne 0 ]; then
exit 1
fi
fi
sed -i '/^GIT_CHEKOUT/d' varnish/overrides || exit 1
echo "GIT_CHEKOUT=${VARNISHABI}" >> varnish/overrides || exit 1
if [ -z "${DEBRELEASE}" ]; then
......
......@@ -84,3 +84,4 @@ fi
cd "${SBUILDDIR}" || exit 1
sbuild -d ${DEBRELEASE} --arch=${ARCH} ${SRCDIR} || exit 1
rm ${BUILDDIR}/${PKGNAME}_${FULL_VERSION}*
echo "success: ${PKGNAME}_${FULL_VERSION}" >> /tmp/pkgbuild_${DEBRELEASE}_${VERSION}
#!/usr/bin/env python
#
# Copyright (c) 2018 UPLEX Nils Goroll Systemoptimierung
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
import sys, re, pycurl, StringIO
class pkg:
name = None
version = None
provides = None
def __init__(self):
self.name = str()
self.version = str()
self.provides = list()
def parse_pkgdata(url):
match_lines = re.compile("^[aA-zZ]*: ")
packages = list()
tpkg = pkg()
res = StringIO.StringIO()
curl = pycurl.Curl()
curl.setopt(curl.FOLLOWLOCATION, True)
curl.setopt(curl.URL, url)
curl.setopt(curl.WRITEFUNCTION, res.write)
curl.perform()
rval = curl.getinfo(curl.HTTP_CODE)
if rval != 200:
sys.stderr.write("Curl error(%i)\n" % rval)
return
pkgdata = res.getvalue().split('\n')
for line in pkgdata:
if not len(line.strip()):
packages.append(tpkg)
tpkg = pkg()
continue
if match_lines.match(line):
k,v = line.split(':', 1)
if k.strip().lower() == "package":
tpkg.name = v.strip()
elif k.strip().lower() == "version":
tpkg.version = v.strip()
if k.strip().lower() == "provides":
for p in v.split(','):
p = p.strip()
if len(p):
tpkg.provides.append(p)
return packages
def newest_pkg(packages, name):
tpkg = None
for pkg in packages:
if pkg.name != name:
continue
if not tpkg:
tpkg = pkg
continue
if pkg.version > tpkg.version:
tpkg = pkg
return tpkg
def get_abi(provides):
for pv in provides:
try:
k,v = pv.rsplit('-', 1)
if k == "varnishd-abi":
return v
except (ValueError):
pass
def main():
packages = parse_pkgdata("https://packagecloud.io/varnishcache/varnish-weekly/debian/dists/stretch/main/binary-amd64/Packages")
if not packages:
sys.stderr.write("No package data found\n")
sys.exit(1)
pkg = newest_pkg(packages, "varnish")
if not pkg:
sys.stderr.write("No varnish package found\n")
sys.exit(1)
abi = get_abi(pkg.provides)
if not abi:
sys.stderr.write("No abi found in package data\n")
sys.exit(1)
print abi
if __name__ == "__main__":
main()
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment