
We bump the Ansible version to the version that Zuul runs. We then set ansible-lint to the current latest version. This results in a number of new linter violations which we fix. These violations include: * Needing to name plays * Needing to start names with a capital letter * Using fully qualified names for action modules * Quoting permissions strings to avoid octal conversion errors * Using explicit yaml structures for tasks We also tell ansible-lint to mock zuul_return so that we don't get errors from it complaining that this module is not defined. Change-Id: Ic881313fea58f4482f70e493f3d256541d31860a
107 lines
2.9 KiB
YAML
107 lines
2.9 KiB
YAML
- name: Install prereqs
|
|
package:
|
|
name:
|
|
- rpm-build
|
|
- kernel-devel
|
|
- createrepo
|
|
become: yes
|
|
|
|
- name: Install centos 8/9 common packages
|
|
package:
|
|
name:
|
|
- elfutils-devel
|
|
become: yes
|
|
when: ansible_distribution_major_version is version('8', '>=')
|
|
|
|
- name: Install centos9 packages
|
|
package:
|
|
name:
|
|
- perl-File-Copy
|
|
become: yes
|
|
when: ansible_distribution_major_version is version('9', '>=')
|
|
|
|
# https://wiki.openafs.org/devel/HowToBuildOpenAfsRpmPackages/
|
|
- name: Build and install srpm
|
|
environment:
|
|
PACKAGER: "{{ (ansible_distribution_major_version == '7') | ternary('yum', 'dnf') }}"
|
|
shell: |
|
|
set -eux
|
|
|
|
BASE_VERSION=1.8.12.1
|
|
PRE_VERSION=''
|
|
VERSION=${BASE_VERSION}${PRE_VERSION}
|
|
# If pre-release, this should be "candidate/"; otherwise blank
|
|
CANDIDATE=''
|
|
URL_PATH=${CANDIDATE}${VERSION}
|
|
|
|
# There is a rule somewhere for how this is generated ... this
|
|
# is a best guess
|
|
_PRE_VERSION=""
|
|
# pre-release 0, actual releases 1 (maybe, not sure if its a rule?)
|
|
_SRPM_RELEASE="-1"
|
|
if [[ -n "${PRE_VERSION}" ]]; then
|
|
_SRPM_RELEASE="-0"
|
|
_PRE_VERSION=".${PRE_VERSION}"
|
|
fi
|
|
SRPM=openafs-${BASE_VERSION}${_SRPM_RELEASE}${_PRE_VERSION}.src.rpm
|
|
|
|
mkdir openafs
|
|
wget https://www.openafs.org/dl/openafs/${URL_PATH}/openafs-${VERSION}-src.tar.bz2
|
|
wget https://www.openafs.org/dl/openafs/${URL_PATH}/openafs-${VERSION}-doc.tar.bz2
|
|
wget https://www.openafs.org/dl/openafs/${URL_PATH}/RELNOTES-${VERSION}
|
|
wget https://www.openafs.org/dl/openafs/${URL_PATH}/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 ${SRPM}
|
|
else
|
|
sudo dnf builddep -y ${SRPM}
|
|
fi
|
|
|
|
rpm -i ${SRPM}
|
|
|
|
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
|
|
ansible.posix.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
|