]> granicus.if.org Git - pdns/commitdiff
pdns-builder: add auth sdist support
authorPieter Lexis <pieter.lexis@powerdns.com>
Thu, 14 Dec 2017 00:34:24 +0000 (01:34 +0100)
committerPieter Lexis <pieter.lexis@powerdns.com>
Thu, 27 Sep 2018 11:59:25 +0000 (13:59 +0200)
builder-support/dockerfiles/Dockerfile.authoritative [new file with mode: 0644]
builder-support/dockerfiles/Dockerfile.target.sdist [new file with mode: 0644]
builder-support/gen-version [new file with mode: 0755]

diff --git a/builder-support/dockerfiles/Dockerfile.authoritative b/builder-support/dockerfiles/Dockerfile.authoritative
new file mode 100644 (file)
index 0000000..a3920f2
--- /dev/null
@@ -0,0 +1,19 @@
+FROM alpine:3.6 as pdns-authoritative
+
+RUN apk add --no-cache gcc g++ make tar autoconf automake protobuf-dev lua-dev \
+                       libtool file boost-dev curl openssl-dev ragel py-virtualenv
+
+
+# the pdns/ dir is a bit broad, but who cares :)
+ADD configure.ac Makefile.am INSTALL NOTICE README /pdns-authoritative/
+@EXEC sdist_dirs=(build-aux m4 pdns ext docs modules codedocs contrib regression-tests)
+@EXEC for d in ${sdist_dirs[@]} ; do echo "COPY $d/ /pdns-authoritative/$d/" ; done
+WORKDIR /pdns-authoritative/
+
+RUN mkdir /sdist
+
+ARG BUILDER_VERSION
+RUN BUILDER_VERSION=${BUILDER_VERSION} autoreconf -v -i --force && \
+    ./configure --without-modules --without-dynmodules --disable-dependency-tracking && \
+    make dist
+RUN cp pdns-${BUILDER_VERSION}.tar.bz2 /sdist/
diff --git a/builder-support/dockerfiles/Dockerfile.target.sdist b/builder-support/dockerfiles/Dockerfile.target.sdist
new file mode 100644 (file)
index 0000000..bd98dd4
--- /dev/null
@@ -0,0 +1,25 @@
+@IF [ ! -z "$M_all$M_authoritative" ]
+@INCLUDE Dockerfile.authoritative
+@ENDIF
+
+@IF [ ! -z "$M_all$M_recursor" ]
+@INCLUDE Dockerfile.recursor
+@ENDIF
+
+@IF [ ! -z "$M_all$M_dnsdist" ]
+@INCLUDE Dockerfile.dnsdist
+@ENDIF
+
+FROM alpine:3.6 as sdist
+
+@IF [ ! -z "$M_all$M_authoritative" ]
+COPY --from=pdns-authoritative /sdist/ /sdist/
+@ENDIF
+
+@IF [ ! -z "$M_all$M_recursor" ]
+COPY --from=recursor /sdist/ /sdist/
+@ENDIF
+
+@IF [ ! -z "$M_all$M_dnsdist" ]
+COPY --from=dnsdist /sdist/ /sdist/
+@ENDIF
diff --git a/builder-support/gen-version b/builder-support/gen-version
new file mode 100755 (executable)
index 0000000..a2ff215
--- /dev/null
@@ -0,0 +1,46 @@
+#!/bin/sh
+
+if [ ! -z "$BUILDER_VERSION" ]; then
+  printf $BUILDER_VERSION
+  echo $BUILDER_VERSION > .version
+  exit 0
+fi
+
+VERSION="unknown"
+
+DIRTY=""
+git status | grep -q clean || DIRTY='.dirty'
+
+# Special environment variable to signal that we are building a release, as this
+# has consequences for the version number.
+if [ "${IS_RELEASE}" = "YES" ]; then
+  TAG="$(git describe --tags --exact-match 2> /dev/null | cut -d- -f 2-)"
+  if [ -n "${TAG}" ]; then
+    # We're on a tag
+    echo "${TAG}${DIRTY}" > .version
+    printf "${TAG}${DIRTY}"
+    exit 0
+  fi
+  echo 'This is not a tag, either tag this commit or do not set $IS_RELEASE' >&2
+  exit 1
+fi
+
+#
+# Generate the version number based on the branch
+#
+if [ ! -z "$(git rev-parse --abbrev-ref HEAD 2> /dev/null)" ]; then
+  if $(git rev-parse --abbrev-ref HEAD | grep -q 'rel/'); then
+    REL_TYPE="$(git rev-parse --abbrev-ref HEAD | cut -d/ -f 2 | cut -d- -f 1)"
+    VERSION="$(git describe --match=${REL_TYPE}-* --tags --dirty=.dirty | cut -d- -f 2-)"
+  else
+    GIT_VERSION=$(git show --no-patch --format=format:%h HEAD)
+    BRANCH=".$(git rev-parse --abbrev-ref HEAD | perl -p -e 's/[^[:alnum:]]//g;')"
+    [ "${BRANCH}" = ".master" ] && BRANCH=''
+    VERSION="0.0${BRANCH}.${PDNS_BUILD_NUMBER}g${GIT_VERSION}${DIRTY}"
+  fi
+  echo "$VERSION" > .version
+elif [ -f .version ]; then
+  VERSION="$(cat .version)"
+fi
+
+printf $VERSION