openstack-zuul-jobs/roles/openafs-rpm-package-build/tasks/main.yaml
Ian Wienand 2fcfa7362b openafs-rpm-package-build: tar results
It turns out there are many issues doing a recursive download from our
log servers.  Tar the results so we can pass it through a single file,
and extract that file in the publish jobs.

Change-Id: I2b54c061ae3563a8244a39d08e2fe49c2f885d2e
2020-06-05 12:37:04 +10:00

85 lines
2.2 KiB
YAML

- name: Install prereqs
package:
name:
- rpm-build
- kernel-devel
- createrepo
become: yes
- name: Install centos8 packages
package:
name:
- elfutils-devel
become: yes
when: ansible_distribution_major_version == '8'
# https://wiki.openafs.org/devel/HowToBuildOpenAfsRpmPackages/
- name: Build and install srpm
environment:
PACKAGER: "{{ (ansible_distribution_major_version == '7') | ternary('yum', 'dnf') }}"
shell: |
set -eux
VERSION=1.8.5
mkdir openafs
wget https://www.openafs.org/dl/openafs/${VERSION}/openafs-${VERSION}-src.tar.bz2
wget https://www.openafs.org/dl/openafs/${VERSION}/openafs-${VERSION}-doc.tar.bz2
wget https://www.openafs.org/dl/openafs/${VERSION}/RELNOTES-${VERSION}
wget https://www.openafs.org/dl/openafs/${VERSION}/ChangeLog
# Build the source RPM.
tar xf openafs-${VERSION}-src.tar.bz2 --strip-components=4 '*/makesrpm.pl'
perl makesrpm.pl openafs-${VERSION}-src.tar.bz2 openafs-${VERSION}-doc.tar.bz2 RELNOTES-${VERSION} ChangeLog
if [[ ${PACKAGER} == "yum" ]]; then
sudo yum-builddep -y openafs-${VERSION}-1.src.rpm
else
sudo dnf builddep -y openafs-${VERSION}-1.src.rpm
fi
rpm -i openafs-${VERSION}-1.src.rpm
pushd ~/rpmbuild/SPECS
rpmbuild -ba ./openafs.spec
popd
# create final repo
createrepo ~/rpmbuild/RPMS/{{ ansible_architecture }}
# tar result
pushd ~/rpmbuild
tar cvzf openafs-rpms.tar.gz RPMS
- name: Copy built rpms
synchronize:
src: '{{ ansible_user_dir }}/rpmbuild/'
dest: '{{ zuul.executor.log_root }}'
mode: pull
rsync_opts:
- --include=/RPMS/**
- --include=/SRPMS/**
- --include=openafs-rpms.tar.gz
- --include=*/
- --exclude=*
- --prune-empty-dirs
- name: Return build artifact
zuul_return:
data:
zuul:
artifacts:
- name: rpms
url: RPMS
metadata:
type: rpm
- name: srpms
url: SRPMS
metadata:
type: srpm
- name: rpms-tar
url: openafs-rpms.tar.gz
metadata:
type: rpm.tar.gz