BUILDAREA=$(setup_rpm_build_area ./rpm/$dist)
build_rpms $BUILDAREA ${CEPH_EXTRA_RPMBUILD_ARGS}
-
-# The following was copied from autobuild-ceph/build-ceph-rpm.sh
-# which creates the ceph-release rpm meant to create the repository file for the repo
-# that will be built and served later.
-# Create and build an RPM for the repository
-
-cat <<EOF > ${BUILDAREA}/SPECS/ceph-release.spec
-Name: ceph-release
-Version: 1
-Release: 0%{?dist}
-Summary: Ceph Development repository configuration
-Group: System Environment/Base
-License: GPLv2
-URL: ${chacra_url}r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/$FLAVOR/
-Source0: ceph.repo
-#Source0: RPM-GPG-KEY-CEPH
-#Source1: ceph.repo
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-
-%description
-This package contains the Ceph repository GPG key as well as configuration
-for yum and up2date.
-
-%prep
-
-%setup -q -c -T
-install -pm 644 %{SOURCE0} .
-#install -pm 644 %{SOURCE1} .
-
-%build
-
-%install
-rm -rf %{buildroot}
-#install -Dpm 644 %{SOURCE0} \
-# %{buildroot}/%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-CEPH
-%if 0%{defined suse_version}
-install -dm 755 %{buildroot}/%{_sysconfdir}/zypp
-install -dm 755 %{buildroot}/%{_sysconfdir}/zypp/repos.d
-install -pm 644 %{SOURCE0} \
- %{buildroot}/%{_sysconfdir}/zypp/repos.d
-%else
-install -dm 755 %{buildroot}/%{_sysconfdir}/yum.repos.d
-install -pm 644 %{SOURCE0} \
- %{buildroot}/%{_sysconfdir}/yum.repos.d
-%endif
-
-%clean
-#rm -rf %{buildroot}
-
-%post
-
-%postun
-
-%files
-%defattr(-,root,root,-)
-#%doc GPL
-%if 0%{defined suse_version}
-/etc/zypp/repos.d/*
-%else
-/etc/yum.repos.d/*
-%endif
-#/etc/pki/rpm-gpg/*
-
-%changelog
-* Fri Aug 12 2016 Alfredo Deza <adeza@redhat.com> 1-1
-- Initial Package
-EOF
-# End of ceph-release.spec file.
-
-# GPG Key
-#gpg --export --armor $keyid > ${BUILDAREA}/SOURCES/RPM-GPG-KEY-CEPH
-#chmod 644 ${BUILDAREA}/SOURCES/RPM-GPG-KEY-CEPH
-
-# Install ceph.repo file
-cat <<EOF > $BUILDAREA/SOURCES/ceph.repo
-[Ceph]
-name=Ceph packages for \$basearch
-baseurl=${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}/\$basearch
-enabled=1
-gpgcheck=0
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/autobuild.asc
-
-[Ceph-noarch]
-name=Ceph noarch packages
-baseurl=${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}/noarch
-enabled=1
-gpgcheck=0
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/autobuild.asc
-
-[ceph-source]
-name=Ceph source packages
-baseurl=${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}/SRPMS
-enabled=1
-gpgcheck=0
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/autobuild.asc
-EOF
-# End of ceph.repo file
-
-rpmbuild -bb --define "_topdir ${BUILDAREA}" ${BUILDAREA}/SPECS/ceph-release.spec
-
+build_ceph_release_rpm $BUILDAREA true
# Make sure we execute at the top level directory
cd "$WORKSPACE"
BUILDAREA=$(setup_rpm_build_area ./rpm/$dist)
build_rpms ${BUILDAREA} ${CEPH_EXTRA_RPMBUILD_ARGS}
-
-# The following was copied from autobuild-ceph/build-ceph-rpm.sh
-# which creates the ceph-release rpm meant to create the repository file for the repo
-# that will be built and served later.
-# Create and build an RPM for the repository
-
-cat <<EOF > ${BUILDAREA}/SPECS/ceph-release.spec
-Name: ceph-release
-Version: 1
-Release: 0%{?dist}
-Summary: Ceph Development repository configuration
-Group: System Environment/Base
-License: GPLv2
-URL: ${chacra_url}r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/$FLAVOR/
-Source0: ceph.repo
-#Source0: RPM-GPG-KEY-CEPH
-#Source1: ceph.repo
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-
-%description
-This package contains the Ceph repository GPG key as well as configuration
-for yum and up2date.
-
-%prep
-
-%setup -q -c -T
-install -pm 644 %{SOURCE0} .
-#install -pm 644 %{SOURCE1} .
-
-%build
-
-%install
-rm -rf %{buildroot}
-#install -Dpm 644 %{SOURCE0} \
-# %{buildroot}/%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-CEPH
-%if 0%{defined suse_version}
-install -dm 755 %{buildroot}/%{_sysconfdir}/zypp
-install -dm 755 %{buildroot}/%{_sysconfdir}/zypp/repos.d
-install -pm 644 %{SOURCE0} \
- %{buildroot}/%{_sysconfdir}/zypp/repos.d
-%else
-install -dm 755 %{buildroot}/%{_sysconfdir}/yum.repos.d
-install -pm 644 %{SOURCE0} \
- %{buildroot}/%{_sysconfdir}/yum.repos.d
-%endif
-
-%clean
-#rm -rf %{buildroot}
-
-%post
-
-%postun
-
-%files
-%defattr(-,root,root,-)
-#%doc GPL
-%if 0%{defined suse_version}
-/etc/zypp/repos.d/*
-%else
-/etc/yum.repos.d/*
-%endif
-#/etc/pki/rpm-gpg/*
-
-%changelog
-* Fri Aug 12 2016 Alfredo Deza <adeza@redhat.com> 1-1
-- Initial Package
-EOF
-# End of ceph-release.spec file.
-
-# GPG Key
-#gpg --export --armor $keyid > ${BUILDAREA}/SOURCES/RPM-GPG-KEY-CEPH
-#chmod 644 ${BUILDAREA}/SOURCES/RPM-GPG-KEY-CEPH
-
-# Install ceph.repo file
-cat <<EOF > $BUILDAREA/SOURCES/ceph.repo
-[Ceph]
-name=Ceph packages for \$basearch
-baseurl=${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}/\$basearch
-enabled=1
-gpgcheck=0
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/autobuild.asc
-
-[Ceph-noarch]
-name=Ceph noarch packages
-baseurl=${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}/noarch
-enabled=1
-gpgcheck=0
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/autobuild.asc
-
-[ceph-source]
-name=Ceph source packages
-baseurl=${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}/SRPMS
-enabled=1
-gpgcheck=0
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/autobuild.asc
-EOF
-# End of ceph.repo file
-
-rpmbuild -bb --define "_topdir ${BUILDAREA}" ${BUILDAREA}/SPECS/ceph-release.spec
-
+build_ceph_release_rpm ${BUILDAREA} true
# Make sure we execute at the top level directory
cd "$WORKSPACE"
mkdir -p RPMBUILD/{BUILD,RPMS,SOURCES,SPECS,SRPMS}
BUILDAREA=$WORKSPACE/RPMBUILD
-# Create and build an RPM for the repository
-cat <<EOF > ${BUILDAREA}/SPECS/ceph-release.spec
-%if 0%{?centos} == 7
-%define dist .el7
-%endif
-%if 0%{?centos} == 8
-%define dist .el8
-%endif
-
-
-Name: ceph-release
-Version: 1
-Release: 1%{?dist}
-Summary: Ceph repository configuration
-Group: System Environment/Base
-License: GPLv2
-URL: http://download.ceph.com/
-Source0: ceph.repo
-#Source0: RPM-GPG-KEY-CEPH
-#Source1: ceph.repo
-BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildArch: noarch
-
-%description
-This package contains the Ceph repository GPG key as well as configuration
-for yum and up2date.
-
-%prep
-
-%setup -q -c -T
-install -pm 644 %{SOURCE0} .
-#install -pm 644 %{SOURCE1} .
-
-%build
-
-%install
-rm -rf %{buildroot}
-#install -Dpm 644 %{SOURCE0} \
-# %{buildroot}/%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-CEPH
-%if 0%{defined suse_version}
-install -dm 755 %{buildroot}/%{_sysconfdir}/zypp
-install -dm 755 %{buildroot}/%{_sysconfdir}/zypp/repos.d
-install -pm 644 %{SOURCE0} \
- %{buildroot}/%{_sysconfdir}/zypp/repos.d
-%else
-install -dm 755 %{buildroot}/%{_sysconfdir}/yum.repos.d
-install -pm 644 %{SOURCE0} \
- %{buildroot}/%{_sysconfdir}/yum.repos.d
-%endif
-
-%clean
-#rm -rf %{buildroot}
-
-%post
-
-%postun
-
-%files
-%defattr(-,root,root,-)
-#%doc GPL
-%if 0%{defined suse_version}
-%config(noreplace) /etc/zypp/repos.d/*
-%else
-%config(noreplace) /etc/yum.repos.d/*
-%endif
-#/etc/pki/rpm-gpg/*
-
-%changelog
-* Mon Jan 12 2015 Travis Rhoden <trhoden@redhat.com> 1-1
-- Make .repo files be %config(noreplace)
-* Tue Mar 10 2013 Gary Lowell <glowell@inktank.com> - 1-0
-- Handle both yum and zypper
-- Use URL to ceph git repo for key
-- remove config attribute from repo file
-* Tue Aug 27 2012 Gary Lowell <glowell@inktank.com> - 1-0
-- Initial Package
-EOF
-# End of ceph-release.spec file.
-# Install ceph.repo file
-
ceph_release="$RELEASE"
-
-cat <<EOF > $BUILDAREA/SOURCES/ceph.repo
-[Ceph]
-name=Ceph packages for \$basearch
-baseurl=http://download.ceph.com/rpm-${ceph_release}/${target}/\$basearch
-enabled=1
-gpgcheck=1
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/release.asc
-
-[Ceph-noarch]
-name=Ceph noarch packages
-baseurl=http://download.ceph.com/rpm-${ceph_release}/${target}/noarch
-enabled=1
-gpgcheck=1
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/release.asc
-
-[ceph-source]
-name=Ceph source packages
-baseurl=http://download.ceph.com/rpm-${ceph_release}/${target}/SRPMS
-enabled=1
-gpgcheck=1
-type=rpm-md
-gpgkey=https://download.ceph.com/keys/release.asc
-EOF
-# End of ceph.repo file
+build_ceph_release_rpm ${BUILDAREA} false
[ "$FORCE" = true ] && chacra_flags="--force" || chacra_flags=""
-
-rpmbuild -ba --define "_topdir ${BUILDAREA}" --define "_unpackaged_files_terminate_build 0" ${BUILDAREA}/SPECS/ceph-release.spec
if [ $? -eq 0 ] ; then
# we actually do noarch stuff here
find $BUILDAREA/RPMS/* | grep noarch | grep rpm | $VENV/chacractl binary ${chacra_flags} create ${chacra_baseurl}/noarch
rpmbuild -ba --define "_topdir ${build_area}" ${extra_rpm_build_args} ceph.spec
echo done
}
+
+build_ceph_release_rpm() {
+ local build_area=$1
+ shift
+ local is_dev_release=$1
+ shift
+
+ # The following was copied from autobuild-ceph/build-ceph-rpm.sh
+ # which creates the ceph-release rpm meant to create the repository file for the repo
+ # that will be built and served later.
+ # Create and build an RPM for the repository
+
+ if $is_dev_release; then
+ summary="Ceph Development repository configuration"
+ project_url=${chacra_url}r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/$FLAVOR/
+ epoch=0
+ repo_base_url="${chacra_url}/r/ceph/${chacra_ref}/${SHA1}/${DISTRO}/${RELEASE}/flavors/${FLAVOR}"
+ gpgcheck=0
+ gpgkey=autobuild.asc
+ else
+ summary="Ceph repository configuration"
+ project_url=http://download.ceph.com/
+ epoch=1
+ repo_base_url="http://download.ceph.com/rpm-${ceph_release}/${target}"
+ gpgcheck=1
+ gpgkey=release.asc
+ fi
+ cat <<EOF > ${build_area}/SPECS/ceph-release.spec
+Name: ceph-release
+Version: 1
+Release: ${epoch}%{?dist}
+Summary: Ceph Development repository configuration
+Group: System Environment/Base
+License: GPLv2
+URL: ${project_url}
+Source0: ceph.repo
+#Source0: RPM-GPG-KEY-CEPH
+#Source1: ceph.repo
+BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
+BuildArch: noarch
+
+%description
+This package contains the Ceph repository GPG key as well as configuration
+for yum and up2date.
+
+%prep
+
+%setup -q -c -T
+install -pm 644 %{SOURCE0} .
+#install -pm 644 %{SOURCE1} .
+
+%build
+
+%install
+rm -rf %{buildroot}
+#install -Dpm 644 %{SOURCE0} \
+# %{buildroot}/%{_sysconfdir}/pki/rpm-gpg/RPM-GPG-KEY-CEPH
+%if 0%{defined suse_version}
+install -dm 755 %{buildroot}/%{_sysconfdir}/zypp
+install -dm 755 %{buildroot}/%{_sysconfdir}/zypp/repos.d
+install -pm 644 %{SOURCE0} \
+ %{buildroot}/%{_sysconfdir}/zypp/repos.d
+%else
+install -dm 755 %{buildroot}/%{_sysconfdir}/yum.repos.d
+install -pm 644 %{SOURCE0} \
+ %{buildroot}/%{_sysconfdir}/yum.repos.d
+%endif
+
+%clean
+#rm -rf %{buildroot}
+
+%post
+
+%postun
+
+%files
+%defattr(-,root,root,-)
+#%doc GPL
+%if 0%{defined suse_version}
+/etc/zypp/repos.d/*
+%else
+/etc/yum.repos.d/*
+%endif
+#/etc/pki/rpm-gpg/*
+
+%changelog
+* Fri Aug 12 2016 Alfredo Deza <adeza@redhat.com> 1-1
+* Mon Jan 12 2015 Travis Rhoden <trhoden@redhat.com> 1-1
+- Make .repo files be %config(noreplace)
+* Tue Mar 10 2013 Gary Lowell <glowell@inktank.com> - 1-0
+- Handle both yum and zypper
+- Use URL to ceph git repo for key
+- remove config attribute from repo file
+* Tue Aug 27 2012 Gary Lowell <glowell@inktank.com> - 1-0
+- Initial Package
+EOF
+ # End of ceph-release.spec file.
+
+ # GPG Key
+ #gpg --export --armor $keyid > ${build_area}/SOURCES/RPM-GPG-KEY-CEPH
+ #chmod 644 ${build_area}/SOURCES/RPM-GPG-KEY-CEPH
+
+ # Install ceph.repo file
+ cat <<EOF > $build_area/SOURCES/ceph.repo
+[Ceph]
+name=Ceph packages for \$basearch
+baseurl=${repo_base_url}/\$basearch
+enabled=1
+gpgcheck=${gpgcheck}
+type=rpm-md
+gpgkey=https://download.ceph.com/keys/${gpgkey}
+
+[Ceph-noarch]
+name=Ceph noarch packages
+baseurl=${repo_base_url/noarch
+enabled=1
+gpgcheck=${gpgcheck}
+type=rpm-md
+gpgkey=https://download.ceph.com/keys/${gpgkey}
+
+[ceph-source]
+name=Ceph source packages
+baseurl=${repo_base_url}/SRPMS
+enabled=1
+gpgcheck=${gpgcheck}
+type=rpm-md
+gpgkey=https://download.ceph.com/keys/${gpgkey}
+EOF
+# End of ceph.repo file
+
+ if $is_dev_release; then
+ rpmbuild -bb \
+ --define "_topdir ${build_area}" \
+ ${build_area}/SPECS/ceph-release.spec
+ else
+ # build source packages for official releases
+ rpmbuild -ba \
+ --define "_topdir ${build_area}" \
+ --define "_unpackaged_files_terminate_build 0" \
+ ${build_area}/SPECS/ceph-release.spec
+ fi
+}