mockbuild: use mock to build source rpm
Running `make srpm` on the host can have different results from building the SRPM in mock. Stop using the Makefile altogether for this, which is meant for developer convenience only. The interface is clear: a tarball generated from `git archive` and defining the `commit` variable. Less stuff to install on the host, too.
This commit is contained in:
parent
b7367e2519
commit
48ee71b9af
1 changed files with 14 additions and 8 deletions
|
|
@ -55,7 +55,7 @@ fi
|
|||
|
||||
# Install requirements for building RPMs in mock.
|
||||
greenprint "📦 Installing mock requirements"
|
||||
sudo dnf -y install createrepo_c make mock rpm-build s3cmd
|
||||
sudo dnf -y install createrepo_c mock s3cmd
|
||||
|
||||
|
||||
# Print some data.
|
||||
|
|
@ -63,14 +63,20 @@ greenprint "🧬 Using mock config: ${MOCK_CONFIG}"
|
|||
greenprint "📦 SHA: ${COMMIT}"
|
||||
greenprint "📤 RPMS will be uploaded to: ${REPO_URL}"
|
||||
|
||||
# Build source RPMs.
|
||||
greenprint "🔧 Building source RPMs."
|
||||
make srpm
|
||||
greenprint "🔧 Building source RPM"
|
||||
git archive --prefix "osbuild-composer-${COMMIT}/" --output "osbuild-composer-${COMMIT}.tar.gz" HEAD
|
||||
sudo mock -r "$MOCK_CONFIG" --buildsrpm \
|
||||
--define "commit ${COMMIT}" \
|
||||
--spec ./osbuild-composer.spec \
|
||||
--sources "./osbuild-composer-${COMMIT}.tar.gz" \
|
||||
--resultdir ./srpm
|
||||
|
||||
# Compile RPMs in a mock chroot
|
||||
greenprint "🎁 Building RPMs with mock"
|
||||
sudo mock -r "$MOCK_CONFIG" --resultdir "$REPO_DIR" --with=tests \
|
||||
rpmbuild/SRPMS/*.src.rpm
|
||||
greenprint "🎁 Building RPMs"
|
||||
sudo mock -r "$MOCK_CONFIG" \
|
||||
--define "commit ${COMMIT}" \
|
||||
--with=tests \
|
||||
--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%%/*}"
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue