]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-build.git/commitdiff
ceph-*-build,ceph-release-rpm: extract build_ceph_release_rpm 1612/head
authorKefu Chai <kchai@redhat.com>
Wed, 15 Jul 2020 02:53:17 +0000 (10:53 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 15 Jul 2020 03:03:50 +0000 (11:03 +0800)
for less repeating

Signed-off-by: Kefu Chai <kchai@redhat.com>
ceph-dev-build/build/build_rpm
ceph-dev-new-build/build/build_rpm
ceph-release-rpm/build/build
scripts/build_utils.sh

index f95c1ed63011b477b28a3fa0af03a7db14abdabd..17b0381cdc16f648e773d0ce158bcb2993d4473e 100644 (file)
@@ -43,110 +43,7 @@ PACKAGE_MANAGER_VERSION="$RPM_VERSION-$RPM_RELEASE"
 
 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"
index 97fe6004d61c3e2f5382bee2a4dc2740f37e5640..2c95e1f2e596d249792ad27ad441b2a09e45265a 100644 (file)
@@ -44,110 +44,7 @@ PACKAGE_MANAGER_VERSION="$RPM_VERSION-$RPM_RELEASE"
 
 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"
index 6f672000bb479701c8c6a7079392b2dbdd979be0..ec8b5ab8c40c908228b2cf29455e14cc09bf0f7f 100644 (file)
@@ -43,118 +43,10 @@ check_binary_existence $chacra_baseurl/noarch
 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
index 4466d407871f7481c6138d92497e51dd44cd84bf..882ec6b59f3f890ba07c669e4d10ef9664011ee4 100644 (file)
@@ -1111,3 +1111,145 @@ build_rpms() {
     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
+}