Skip to content

Commit

Permalink
mockbuild: use mock to build source rpm
Browse files Browse the repository at this point in the history
Running `meson build` on the host can have different results from
building the SRPM in mock.
  • Loading branch information
larskarlitski committed Nov 20, 2020
1 parent ed424cd commit 943c97b
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions schutzbot/mockbuild.sh
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ fi

# Install requirements for building RPMs in mock.
greenprint "πŸ“¦ Installing mock requirements"
sudo dnf -y install createrepo_c meson mock ninja-build python3-pip rpm-build
sudo dnf -y install createrepo_c mock python3-pip rpm-build

# Install s3cmd if it is not present.
if ! s3cmd --version > /dev/null 2>&1; then
Expand All @@ -68,15 +68,19 @@ greenprint "🧬 Using mock config: ${MOCK_CONFIG}"
greenprint "πŸ“¦ Git SHA: ${GIT_SHA}"
greenprint "πŸ“€ RPMS will be uploaded to: ${REPO_URL}"

# Build source RPMs.
greenprint "πŸ”§ Building source RPMs."
meson build
ninja -C build srpms

# Compile RPMs in a mock chroot
greenprint "🎁 Building RPMs with mock"
sudo mock -v -r $MOCK_CONFIG --resultdir $REPO_DIR --with=tests \
build/rpmbuild/SRPMS/*.src.rpm
greenprint "πŸ”§ Building source RPM"
git archive --prefix "koji-osbuild-$COMMIT/" --output "koji-osbuild-$COMMIT.tar.gz" HEAD
sudo mock -v -r "$MOCK_CONFIG" --buildsrpm \
--define "commit ${COMMIT}" \
--spec ./koji-osbuild.spec \
--sources "./koji-osbuild-${COMMIT}.tar.gz" \
--resultdir ./srpm

greenprint "🎁 Building RPMs"
sudo mock -v -r $MOCK_CONFIG \
--define "commit ${COMMIT}" \
--resultdir $REPO_DIR \
srpm/*.src.rpm

# Change the ownership of all of our repo files from root to our CI user.
sudo chown -R $USER ${REPO_DIR%%/*}
Expand Down

0 comments on commit 943c97b

Please sign in to comment.