]> git.apps.os.sepia.ceph.com Git - autobuild-ceph.git/commitdiff
build-ceph-rpm.sh: Update rpm repo for ceph-deploy wip-rpm
authorGary Lowell <glowell@inktank.com>
Fri, 8 Mar 2013 05:15:11 +0000 (21:15 -0800)
committerGary Lowell <glowell@inktank.com>
Fri, 8 Mar 2013 05:15:11 +0000 (21:15 -0800)
Add an rpm for the repository config.  Config points
to to he repo on gitbuilder-ceph.com for the built
branch.  There is one repository for each of the
binary, noarch, and SRPM directories.  Work related
to Bug #3921.

Signed-off-by: Gary Lowell <gary.lowell@inktank.com>
build-ceph-rpm.sh

index 15acf2ca3fa4b57e2a876624d8e390aa2d349ff8..9768030f760222666ca5cef8580b27c3966df1a0 100755 (executable)
@@ -9,8 +9,25 @@ rm -rf src/libs3
 git submodule update --init
 git clean -fdx
 
-
 DISTS=`cat ../../dists`
+TARGET="$(cat ../../rsync-target)"
+TARGET="$(basename $TARGET)"
+REV="$(git rev-parse HEAD)"
+VER="$(git describe)"
+
+# Try to determine branch name
+BRANCH=$(../branches.sh -v | grep $REV | awk '{print $2}') || BRANCH="unknown"
+BRANCH=$(basename $BRANCH)
+echo "Building branch=$BRANCH, sha1=$REV, version=$VER"
+
+# set up key for signing RPMs
+export GNUPGHOME=/srv/gnupg
+KEYID=03C3951A
+if ! gpg --list-keys 2>&1 | grep $KEYID  > /dev/null
+then
+    echo "Can not find RPM signing key" 1>&2
+    exit 4
+fi
 
 echo --START-IGNORE-WARNINGS
 [ ! -x autogen.sh ] || ./autogen.sh || exit 1
@@ -59,21 +76,114 @@ cp -a ceph-*.tar.bz2 ${BUILDAREA}/SOURCES/.
 BUILDAREA=`readlink -fn ${BUILDAREA}`   ### rpm wants absolute path
 rpmbuild -ba --define "_topdir ${BUILDAREA}" --define "_unpackaged_files_terminate_build 0" ceph.spec
 
+# 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 repository configuration
+Group:          System Environment/Base 
+License:        GPLv2
+URL:            http://gitbuilder.ceph.com/$dist
+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
+install -dm 755 %{buildroot}/%{_sysconfdir}/yum.repos.d
+install -pm 644 %{SOURCE0} \
+    %{buildroot}/%{_sysconfdir}/yum.repos.d
+
+%clean
+#rm -rf %{buildroot}
+
+%post
+
+%postun 
+
+%files
+%defattr(-,root,root,-)
+#%doc GPL
+%config(noreplace) /etc/yum.repos.d/*
+#/etc/pki/rpm-gpg/*
+
+%changelog
+* Tue Aug 27 2011 Gary Lowell <glowell@inktank.com> - 1-0
+- 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=http://gitbuilder.ceph.com/${TARGET}/ref/${BRANCH}/\$basearch
+enabled=1
+gpgcheck=1
+gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc
+
+[Ceph-noarch]
+name=Ceph noarch packages
+baseurl=http://gitbuilder.ceph.com/${TARGET}/ref/${BRANCH}/noarch
+enabled=1
+gpgcheck=1
+gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc
+
+[ceph-source]
+name=Ceph source packages
+baseurl=http://gitbuilder.ceph.com/${TARGET}/ref/${BRANCH}/SRPMS
+enabled=1
+gpgcheck=1
+gpgkey=https://ceph.com/git/?p=ceph.git;a=blob_plain;f=keys/autobuild.asc
+EOF
+# End of ceph.repo file
+
+rpmbuild -bb --define "_topdir ${BUILDAREA}" --define "_unpackaged_files_terminate_build 0" ${BUILDAREA}/SPECS/ceph-release.spec
+
 # Sign RPMS
 export GNUPGHOME=/srv/gnupg
 echo "Signing RPMS ..."
 for file in `find ${BUILDAREA} -name "*.rpm"`
 do
-    /srv/autobuild-ceph/rpm-autosign.exp --define "_gpg_name 03C3951A" $file
+    /srv/autobuild-ceph/rpm-autosign.exp --define "_gpg_name $KEYID" $file
 done
 
-REV="$(git rev-parse HEAD)"
+# Create repo index for yum/zypper
+for dir in ${BUILDAREA}/SRPMS ${BUILDAREA}/RPMS/*
+do
+    createrepo ${dir}
+    gpg --detach-sign --armor -u $KEYID ${dir}/repodata/repomd.xml
+done
+
+#REV="$(git rev-parse HEAD)"
 OUTDIR="../out/output/sha1/$REV"
 OUTDIR_TMP="${OUTDIR}.tmp"
 install -d -m0755 -- "$OUTDIR_TMP"
 printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
-#printf '%s\n' "$VER" >"$OUTDIR_TMP/version"
-#printf '%s\n' "ceph" >"$OUTDIR_TMP/name"
+printf '%s\n' "$VER" >"$OUTDIR_TMP/version"
+printf '%s\n' "ceph" >"$OUTDIR_TMP/name"
 #mkdir -p $OUTDIR_TMP/conf
 
 #MACH="$(uname -m)"
@@ -82,13 +192,13 @@ printf '%s\n' "$REV" >"$OUTDIR_TMP/sha1"
 #../maxtime 1800 ionice -c3 nice -n20 make install DESTDIR="$PWD/$INSTDIR"
 #tar czf "$OUTDIR_TMP/ceph.$MACH.tgz" -C "$INSTDIR" .
 #rm -rf -- "$INSTDIR"
-for dir in $BUILDAREA/RPMS/* 
+
+# Copy RPMS to output repo
+for dir in ${BUILDAREA}/SRPMS ${BUILDAREA}/RPMS/*
 do
-    if [ -d $dir ] ; then
-        createrepo $dir
-    fi
+    cp -a ${dir} $OUTDIR_TMP
 done
-cp -a $BUILDAREA/{RPMS,SRPMS} $OUTDIR_TMP
+
 rm -rf -- "$BUILDAREA"
 
 # put our temp files inside .git/ so ls-files doesn't see them