- hosts: all
  tasks:

    - name: Build Centos packages of OpenAFS
      shell: |
          set -eux

          # TODO: fedora
          YUM=${YUM:-yum}

          VERSION=1.6.16
          SRC_VERSION=${VERSION}-1
          SRC_RPM=openafs-${SRC_VERSION}.src.rpm
          SRC_URL=https://www.openafs.org/dl/openafs/${VERSION}/${SRC_RPM}

          UPSTREAM_BASE=https://tarballs.openstack.org/project-config/package-afs-centos7
          UPSTREAM_CHECK=${UPSTREAM_BASE}/openafs-client-${SRC_VERSION}.el7.centos.x86_64.rpm
          if wget -O/dev/null -q $UPSTREAM_CHECK; then
              echo "Found existing upstream RPM build, nothing to do"
              # scp should just publish nothing
              exit 0
          fi

          # some common prereqs
          sudo yum -y groupinstall "Development Tools" "Development Libraries"
          sudo yum -y install rpm-build kernel-devel createrepo

          wget $SRC_URL
          # install the build dependencies for the package
          sudo yum-builddep -y ./${SRC_RPM}

          # install source-rpm
          # (this installs to ~/rpmbuild)
          rpm -i ./${SRC_RPM}

          # build everything
          pushd ~/rpmbuild/SPECS/
          rpmbuild -ba ./openafs.spec
          popd

          # create final repo for copying
          createrepo ~/rpmbuild/RPMS/x86_64
      args:
        executable: /bin/bash

- hosts: all
  tasks:

    - name: Build Centos packages of OpenAFS
      shell: |
          set -eux

          # TODO: fedora
          YUM=${YUM:-yum}

          VERSION=1.6.22.3
          SRC_VERSION=${VERSION}-1
          SRC_RPM=openafs-${SRC_VERSION}.src.rpm
          SRC_URL=https://www.openafs.org/dl/openafs/${VERSION}/${SRC_RPM}

          UPSTREAM_BASE=https://tarballs.openstack.org/project-config/package-afs-centos7
          UPSTREAM_CHECK=${UPSTREAM_BASE}/openafs-client-${SRC_VERSION}.el7.centos.x86_64.rpm
          if wget -O/dev/null -q $UPSTREAM_CHECK; then
              echo "Found existing upstream RPM build, nothing to do"
              # scp should just publish nothing
              exit 0
          fi

          # some common prereqs
          sudo yum -y groupinstall "Development Tools" "Development Libraries"
          sudo yum -y install rpm-build kernel-devel createrepo

          wget $SRC_URL
          # install the build dependencies for the package
          sudo yum-builddep -y ./${SRC_RPM}

          # install source-rpm
          # (this installs to ~/rpmbuild)
          rpm -i ./${SRC_RPM}

          # build everything
          pushd ~/rpmbuild/SPECS/
          rpmbuild -ba ./openafs.spec
          popd

          # create final repo for copying
          createrepo ~/rpmbuild/RPMS/x86_64
      args:
        executable: /bin/bash

Update version of CentOS OpenAFS packages to 1.6.22.3
Update version of CentOS OpenAFS packages to 1.6.22.3

This version is required to support CentOS 7.5, see [1].

[1] - https://www.openafs.org/dl/openafs/1.6.22.3/RELNOTES-1.6.22.3

Change-Id: I983564ee4416e7360f568b40ba2d24696c5925a0
