diff options
author | Oliver Smith <osmith@sysmocom.de> | 2020-05-08 12:41:33 +0200 |
---|---|---|
committer | Oliver Smith <osmith@sysmocom.de> | 2020-05-08 12:55:49 +0200 |
commit | 2466ce57c3e3ed442efd450e7af406f8048edf80 (patch) | |
tree | bda8c9168811d8862eb778bab90d6abe2ec3052b | |
parent | b56f7d834f0fe8f3d884f357c0c49f6833ebe863 (diff) |
rpm-local: download source files from rpm spec
Needed for python-cheetah (dependency of uhd) and uhd.
Change-Id: I5627a52159d6d7a7d7f0432044cfe768a675e210
-rwxr-xr-x | rpm-local/build.sh | 3 | ||||
-rw-r--r-- | rpm-local/images/centos8/Dockerfile | 4 | ||||
-rwxr-xr-x | rpm-local/scripts/build_pkg.sh | 3 | ||||
-rwxr-xr-x | rpm-local/scripts/build_pkg_user.sh | 16 |
4 files changed, 23 insertions, 3 deletions
diff --git a/rpm-local/build.sh b/rpm-local/build.sh index 90ba767..13ed69c 100755 --- a/rpm-local/build.sh +++ b/rpm-local/build.sh @@ -75,13 +75,14 @@ _build_pkg() { done # Install depends and build - mkdir -p "cache/$IMAGE/dnf" + mkdir -p "cache/$IMAGE/dnf" "cache/distfiles" docker run \ -it \ --rm \ -v "$DIR/rpmbuild:/home/user/rpmbuild" \ -v "$DIR/scripts:/scripts" \ -v "$DIR/cache/$IMAGE/dnf:/var/cache/dnf" \ + -v "$DIR/cache/distfiles:/home/user/distfiles" \ "$IMAGE:latest" \ /scripts/build_pkg.sh "$pkgname" diff --git a/rpm-local/images/centos8/Dockerfile b/rpm-local/images/centos8/Dockerfile index c2ea7b2..20968d6 100644 --- a/rpm-local/images/centos8/Dockerfile +++ b/rpm-local/images/centos8/Dockerfile @@ -4,10 +4,12 @@ ARG UID RUN useradd -m --uid=$UID user # dnf-plugins-core: for "dnf builddep" +# rpmdevtools: for "spectool" RUN dnf install -y \ createrepo \ dnf-plugins-core \ - rpm-build + rpm-build \ + rpmdevtools # enable repository with required -devel packages RUN yum config-manager --set-enabled PowerTools diff --git a/rpm-local/scripts/build_pkg.sh b/rpm-local/scripts/build_pkg.sh index a831f19..8354bf4 100755 --- a/rpm-local/scripts/build_pkg.sh +++ b/rpm-local/scripts/build_pkg.sh @@ -34,4 +34,5 @@ dnf \ -y \ builddep $1.spec -su user -c "rpmbuild -bb $1.spec" +# Continue building as user +su user -c "/scripts/build_pkg_user.sh $1" diff --git a/rpm-local/scripts/build_pkg_user.sh b/rpm-local/scripts/build_pkg_user.sh new file mode 100755 index 0000000..e29e700 --- /dev/null +++ b/rpm-local/scripts/build_pkg_user.sh @@ -0,0 +1,16 @@ +#!/bin/sh -ex +distfiles="/home/user/distfiles/$1" + +# Download missing sources +mkdir -p "$distfiles" +spectool -C "$distfiles" -gf $1.spec + +# Copy downloaded/cached source files to SOURCES +for i in "$distfiles/"*; do + [ -e "$i" ] || continue + + cp "$i" "/home/user/rpmbuild/SOURCES/" +done + +# Build the package +rpmbuild -bb $1.spec |