diff options
author | Oliver Smith <osmith@sysmocom.de> | 2022-08-19 15:22:57 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2022-10-06 09:45:02 +0200 |
commit | 449dae8c13aa6ae6b76ca34fe577d5a73b6ec98a (patch) | |
tree | ae1122a4b7fe6dc246bec390f3d5450d4ed62eda /scripts/obs/data/build_binpkg.Dockerfile | |
parent | d423d17e0716c1ab4c99fecd03ce16877897137f (diff) |
obs: add build_binpkg.py
Add a script to build deb/rpm packages, as it would be done on
obs.osmocom.org. This will be used by jenkins to verify deb and rpm
builds for each submitted gerrit patch.
I have attempted to use 'osc build' instead of directly calling
apt-get build-dep and dpkg-buildpackage (and rpm equivalents). Using
'osc build' would have the advantage that the build works as close to
the OBS build as possible. However it would try to install dependencies
with sudo, so we would need to have sudo available in the docker
container that builds the untrusted code from gerrit. Let's not do that.
Related: OS#2385
Change-Id: I4c6b5d61af35df98cbc70d9ddc8ad36d38a9ce18
Diffstat (limited to 'scripts/obs/data/build_binpkg.Dockerfile')
-rw-r--r-- | scripts/obs/data/build_binpkg.Dockerfile | 72 |
1 files changed, 72 insertions, 0 deletions
diff --git a/scripts/obs/data/build_binpkg.Dockerfile b/scripts/obs/data/build_binpkg.Dockerfile new file mode 100644 index 0000000..feacbc9 --- /dev/null +++ b/scripts/obs/data/build_binpkg.Dockerfile @@ -0,0 +1,72 @@ +ARG DISTRO_FROM +FROM ${DISTRO_FROM} +ARG DISTRO +ARG UID + +COPY Release.key /tmp/Release.key + +RUN useradd --uid=${UID} -m user + +# Only install build-essential here, and what's needed to add the Osmocom +# repository. Everything else must be defined as dependency in the package +# build recipe. For rpm-based distributions, there is no build-essential or +# similar package. Instead add relevant packages from prjconf, e.g.: +# https://build.opensuse.org/projects/CentOS:CentOS-8/prjconf +RUN case "$DISTRO" in \ + debian*) \ + apt-get update && \ + apt-get install -y --no-install-recommends \ + build-essential \ + ca-certificates \ + fakeroot \ + git \ + gnupg2 \ + && \ + apt-get clean \ + ;; \ + centos*) \ + dnf -y install \ + autoconf \ + automake \ + binutils \ + dnf-utils \ + gcc \ + gcc-c++ \ + glibc-devel \ + libtool \ + make \ + redhat-rpm-config \ + rpm-build \ + rpmdevtools \ + wget && \ + yum config-manager --set-enabled powertools && \ + su user -c rpmdev-setuptree \ + ;; \ + esac + +# Add master repository, where packages immediately get updated after merging +# patches to master. +RUN case "$DISTRO" in \ + debian:11) \ + apt-key add /tmp/Release.key && \ + rm /tmp/Release.key && \ + echo "deb https://downloads.osmocom.org/packages/osmocom:/master/Debian_11/ ./" \ + > /etc/apt/sources.list.d/osmocom-master.list \ + ;; \ + centos:8) \ + { echo "[network_osmocom_master]"; \ + echo "name=Nightly packages of the Osmocom project (CentOS_8)"; \ + echo "type=rpm-md"; \ + echo "baseurl=https://downloads.osmocom.org/packages/osmocom:/master/CentOS_8/"; \ + echo "gpgcheck=1"; \ + echo "gpgkey=https://downloads.osmocom.org/packages/osmocom:/master/CentOS_8/repodata/repomd.xml.key"; \ + echo "enabled=1"; \ + } > /etc/yum.repos.d/network:osmocom:master.repo \ + ;; \ + *) \ + echo "can't install repo for $DISTRO" && \ + exit 1 \ + ;; \ + esac + +WORKDIR /obs/ |