diff options
author | Remi Collet <fedora@famillecollet.com> | 2013-03-20 09:39:06 +0100 |
---|---|---|
committer | Remi Collet <fedora@famillecollet.com> | 2013-03-20 09:39:06 +0100 |
commit | c2213a3c63677926e1564ef3a8ef56d7f9c17bd5 (patch) | |
tree | b02f1628cdee8093a6238b4a2827419b0ff97e06 | |
parent | 9e0cb3911d349bd13d1ea7985e038fa8ce393a0f (diff) |
save remi repo management tools
-rwxr-xr-x | getmock | 158 | ||||
-rwxr-xr-x | mkallrepo | 65 | ||||
-rwxr-xr-x | mkrepo | 65 | ||||
-rwxr-xr-x | pearup | 23 |
4 files changed, 311 insertions, 0 deletions
@@ -0,0 +1,158 @@ +#!/bin/bash + +cd /home/rpmbuild/site/rpms + +function getOneMock() { +case $1 in +*i) dep=${1%i} + ;; +*x) dep=${1%x} + ;; +*) dep=$1 + ;; +esac +case $dep in +el*) dep=${dep#el} + type=enterprise + ;; +fc*) dep=${dep#fc} + type=fedora + ;; +*) echo Connais pas $dep + ;; +esac + + +if [ -d $type/$dep/${2-remi}/x86_64 ] +then + cible=$type/$dep/${2-remi}/ + debug=$type/$dep/debug-${2-remi}/ +else + echo "$1 n'est pas un dépôt" + exit 2 +fi + +if [ -d /var/lib/mock/${1}/repodata ]; then + src=/var/lib/mock/${1} + +elif [ -d /var/lib/mock/${1}i/result ]; then + src=/var/lib/mock/${1}i/result + +elif [ -d /var/lib/mock/$1/result ]; then + src=/var/lib/mock/$1/result +else + echo "$1 n'est pas un dossier mock" + exit 2 +fi + +echo Copie de $src vers $cible +for i in $src/*.rpm +do + j=$(basename $i) + case $j in + *.src.rpm) echo " " $i ignored + ;; + xulrunner-last-debuginfo*) echo " " $i ignored + ;; + firefox-debuginfo*) echo " " $i ignored + ;; + thunderbird-debuginfo*) echo " " $i ignored + ;; + *debuginfo*x86_64.rpm) + if [ -f ${debug}x86_64/$j ]; then + echo " " $i already there + elif [ -d ${debug}x86_64 ]; then + cp $i ${debug}x86_64 && echo + $i copied debuginfo x86_64 + else + echo " " $i ignored + fi + ;; + *debuginfo*86.rpm) + if [ -f ${debug}i386/$j ]; then + echo " " $i already there + elif [ -d ${debug}i386 ]; then + cp $i ${debug}i386 && echo + $i copied debuginfo i386 + else + echo " " $i ignored + fi + ;; + *.noarch.rpm) + if [ -f ${cible}x86_64/$j ]; then + echo " " $i already there + else + cp $i ${cible}x86_64 && echo + $i copied x86_64 + [ -d ${cible}ppc -a ! -f ${cible}ppc/.closed ] \ + && ln ${cible}x86_64/$j ${cible}ppc/$j \ + && echo + $i linked ppc + [ -d ${cible}ppc64 -a ! -f ${cible}ppc64/.closed ] \ + && ln ${cible} /$j ${cible}ppc64/$j \ + && echo + $i linked ppc64 + [ -d ${cible}i386 ] \ + && ln ${cible}x86_64/$j ${cible}i386/$j \ + && echo + $i linked x86_64 + fi + ;; + *.i?86.rpm) + if [ -f ${cible}i386/$j ]; then + echo " " $i already there + else + cp $i ${cible}i386 && echo + $i copied i686 + fi + ;; + *.x86_64.rpm) + if [ -f ${cible}x86_64/$j ]; then + echo " " $i already there + else + cp $i ${cible}x86_64 && echo + $i copied x86_64 + fi + ;; + *) echo Aucun RPM disponible + ;; + esac +done +} + +if [ $# = 0 ]; then + echo usage $0 nomdépôt [ prefix ] + exit 1 +fi + +opt=remi +if [ $1 = test ]; then + opt=test + shift +fi +if [ $1 = php53 ]; then + opt=php53 + shift +fi +if [ $1 = devs -o $1 = dev ]; then + opt=devs + shift +fi + +if [ $1 = all ]; then + for i in $(seq 13 18) + do + getOneMock fc${i}i $opt + done + for i in $(seq 5 6) + do + getOneMock el${i}i $opt + done +elif [ $1 = allx ]; then + for i in $(seq 13 18) + do + getOneMock fc${i}x $opt + done + for i in $(seq 5 6) + do + getOneMock el${i}x $opt + done +else + for i in $* + do + getOneMock $i $opt + done +fi + diff --git a/mkallrepo b/mkallrepo new file mode 100755 index 0000000..39d2ae6 --- /dev/null +++ b/mkallrepo @@ -0,0 +1,65 @@ +#!/bin/sh + +TMPSIG=$(mktemp) +TMPLNK=$(mktemp) + +cd /home/rpmbuild/site/rpms + +#for dep in *.{i386,ppc,ppc64,x86_64} fedora/*/*/{i386,ppc,ppc64,x86_64} +for dep in fedora/{12,13,14,15,16,17,18}/*/{i386,x86_64} enterprise/{5,6}/*/{i386,x86_64} +do + arch=${dep##*/} + + LST="" + if [ -d $dep/repodata -a $dep -nt $dep/repodata -a ! -f $dep/.closed ] + then echo "== Nouveaux RPM dans $dep ==" + if [ $arch = x86_64 ] + then + find $dep -name \*.rpm -a -newer $dep/repodata -print >>$TMPSIG + else + find $dep -name \*.noarch.rpm -a -newer $dep/repodata -print >>$TMPLNK + find $dep -name \*.i?86.rpm -a -newer $dep/repodata -print >>$TMPSIG + fi + + fi + +done +find SRPMS -name \*.rpm -a -newer SRPMS/repodata -print >>$TMPSIG + + +if [ -s $TMPSIG ] +then echo "À signer:"; sort < $TMPSIG + echo "== Signature des $(cat $TMPSIG | wc -l) nouveaux RPM ==" + if rpmsign --addsign $(cat $TMPSIG) + then echo done. + else exit 1 + fi +else echo "Rien à signer." +fi + +if [ -s $TMPLNK ] +then echo "== Création des liens (noarch) ==" + cat $TMPLNK | while read dest + do + srce=${dest/\/ppc64/\/x86_64} + srce=${srce/\/ppc/\/x86_64} + srce=${srce/\/i386/\/x86_64} + + ln -f $srce $dest && echo $dest + done +else echo "Rien à lier." +fi + +#for dep in *.{i386,ppc,ppc64,x86_64} fedora/*/*/{i386,ppc,ppc64,x86_64} +for dep in SRPMS fedora/{12,13,14,15,16,17,18}/*/{i386,x86_64} enterprise/{5,6}/*/{i386,x86_64} +do + if [ -d $dep/repodata -a $dep -nt $dep/repodata -a ! -f $dep/.closed ] + then echo "== Actualisation de $dep ==" + pushd $dep + mkrepo nocheck + touch repodata + popd + #else echo "== $dep est à jour ==" + fi +done + @@ -0,0 +1,65 @@ +#!/bin/sh +#set -x +TMP=/tmp/liste.$(basename $PWD) + +if [ ${1:-check} != nocheck ]; then + echo "+ Controle des signatures" + rpm -K *.rpm | grep -v 'gpg OK' | cut -d: -f1 | tee $TMP + if [ -s $TMP ] + then rpmsign --addsign $(cat $TMP) + else echo OK. + fi +fi + +echo "+ Nettoyage des anciens" + +repomanage --old --keep=2 . | tee $TMP +LST=$(cat $TMP) + +if [ -z "$LST" ] +then echo OK. +else mv $LST /data/rpms/old/ +fi + +nom=${PWD#/home/rpmbuild/site/rpms/} +if [ "$nom" = "SRPMS" ] +then + dis=fedora + ver=17 +else + dis=${nom%%/*} + ver=${nom#$dis/} + ver=${ver%%/*} +fi + +cache=/home/rpmbuild/site/rpms/.createrepocache/$nom +mkdir -p $cache +if [ $dis == fedora -a $ver -ge 11 ] +then check=sha256 +elif [ $dis == enterprise -a $ver -ge 6 ] +then check=sha256 +else check=sha +fi +echo "+ Génération des meta + sql ($check)" +createrepo --workers 4 \ + --cachedir $cache \ + --checksum $check \ + --unique-md-filenames \ + --compress-type=bz2 \ + --database . + +if [ -d headers ] +then + echo "+ Génération des headers" + yum-arch . +fi + +echo "+ Génération repoview" +nom=${PWD#/home/rpmbuild/site/rpms/} +echo repoview --url http://rpms.famillecollet.com/$nom \ + --template-dir /home/rpmbuild/site/rpms/repotmpl \ + --title "Les RPM de Remi - ${nom//\// - }" . +LANG=C repoview --url http://rpms.famillecollet.com/$nom \ + --template-dir /home/rpmbuild/site/rpms/repotmpl \ + --title "Les RPM de Remi - ${nom//\// - }" . + @@ -0,0 +1,23 @@ +#!/bin/sh + +vendor="Remi Collet <remi@fedoraproject.org>" +rpmdate=$(LC_ALL="C" date +"%a %b %d %Y") + +if [ $# -lt 2 ]; then + echo "usage $0 old new" + exit 1 +fi + +sed -e "/^Version:/s/$1/$2/" \ + -e '/^Release:/s/[0-9].*$/1%{?dist}/' \ + -e "s/%changelog/%changelog\n* $rpmdate $vendor - $2-1\n- Update to $2\n/" \ + -e 's/\$RPM_BUILD_ROOT/%{buildroot}/' \ + -i *spec + +spectool -g -S *spec + +tar xf *-$1.tgz package.xml && mv package.xml package-$1.xml +tar xf *-$2.tgz package.xml && mv package.xml package-$2.xml + +colordiff package-$1.xml package-$2.xml + |