diff options
author | Ruben Rodriguez <ruben@activitycentral.com> | 2012-09-04 15:23:15 (GMT) |
---|---|---|
committer | Ruben Rodriguez <ruben@activitycentral.com> | 2012-09-04 15:23:15 (GMT) |
commit | b9a295182236bff4499ecaf1d2dc21e1e553bb1c (patch) | |
tree | 5d81c80abe8e84dbcb9f544a0441b025088d87fc | |
parent | 8d00346fb4fe5600ac3389bdcaae61cbf86dc799 (diff) |
Added buildall.sh and buildrpm.sh scripts
-rw-r--r-- | rpms/buildall.sh | 48 | ||||
-rw-r--r-- | rpms/buildrpm.sh | 123 |
2 files changed, 171 insertions, 0 deletions
diff --git a/rpms/buildall.sh b/rpms/buildall.sh new file mode 100644 index 0000000..5ae585c --- /dev/null +++ b/rpms/buildall.sh @@ -0,0 +1,48 @@ +#!/bin/bash +# +# Copyright (C) 2012 Ruben Rodriguez <ruben@trisquel.info> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA + +# Builds all Dextrose-patched Sugar RPMs and puts them in ~/repo + +arch |grep -q arm && ARCH=armv5tel || ARCH=i686 + +mkdir ~/repo/specs ~/repo/$ARCH/os ~/repo/$ARCH/debug ~/repo/source ~/repo/buildlogs -p + +makeandpush() { + PACKAGE=$2 + VERSION=$1 + + sh buildrpm.sh $VERSION $PACKAGE 2>&1 | tee ~/repo/buildlogs/$PACKAGE-$VERSION-$(date +%Y%m%d)-$ARCH.rpmbuild.log + + cp -v ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec ~/repo/specs/$PACKAGE-$(date +%Y%m%d)-$ARCH.spec + cp -v ~/rpmbuild/SRPMS/* ~/repo/source + cp -v ~/rpmbuild/RPMS/*/* ~/repo/$ARCH/os + cp -v ~/rpmbuild/RPMS/$PACKAGE-$VERSION.appliedpatches ~/repo/buildlogs/$PACKAGE-$VERSION-$(date +%Y%m%d)-$ARCH.appliedpatches.log + cp -v ~/rpmbuild/RPMS/$PACKAGE-$VERSION.failedpatches ~/repo/buildlogs/$PACKAGE-$VERSION-$(date +%Y%m%d)-$ARCH.failedpatches.log + mv -v ~/repo/$ARCH/os/*debuginfo* ~/repo/$ARCH/debug +} + +makeandpush 0.94.1 sugar +makeandpush 0.94.1 sugar-toolkit +makeandpush 0.94.0 sugar-artwork + +createrepo ~/repo/$ARCH/os +createrepo ~/repo/source +createrepo ~/repo/$ARCH/debug + +[ $ARCH = "i686" ] && rsync -va ~/repo/* quidam@shell.sugarlabs.org:dextrose-repo/v3/ +[ $ARCH = "armv5tel" ] && rsync -va ~/repo/armv5tel repo/buildlogs quidam@shell.sugarlabs.org:dextrose-repo/v3/ diff --git a/rpms/buildrpm.sh b/rpms/buildrpm.sh new file mode 100644 index 0000000..1b935e2 --- /dev/null +++ b/rpms/buildrpm.sh @@ -0,0 +1,123 @@ +#!/bin/bash +# +# Copyright (C) 2012 Ruben Rodriguez <ruben@trisquel.info> +# +# This program is free software; you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation; either version 2 of the License, or +# (at your option) any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program; if not, write to the Free Software +# Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +# + +# This script builds Dextrose patched, Sugar rpms from git repositories +# Requirements: git, yum-utils, rpmbuild, patch, libtool, intltool, createrepo + +set -e + +if [ $# != 2 ] +then + echo Usage: sh $0 version package + echo Example: sh $0 0.94.1 sugar-toolkit + exit 1 +fi + +# Let's make sure we have all we need +yum -y install git yum-utils rpmbuild patch libtool intltool createrepo + +WD=$PWD +VERSION=$1 +PACKAGE=$2 +FUZZ=20 +ARCH=$(rpm -q glibc |sed 's/.*\.//;s/i686/i386/') +TEST=$(mktemp -d) + +rm -rf ~/rpmbuild/SOURCES ~/rpmbuild/SPECS + +mkdir -p ~/rpmbuild/BUILD ~/rpmbuild/BUILDROOT ~/rpmbuild/RPMS ~/rpmbuild/SOURCES ~/rpmbuild/SPECS/$PACKAGE ~/rpmbuild/SRPMS + + +cp $PACKAGE/$PACKAGE.spec ~/rpmbuild/SPECS/$PACKAGE/ +[ -f $PACKAGE/macros.$PACKAGE ] && cp $PACKAGE/macros.$PACKAGE ~/rpmbuild/SOURCES/ + +git clone git://git.sugarlabs.org/$PACKAGE/mainline.git ~/rpmbuild/SOURCES/$PACKAGE-$VERSION +cd ~/rpmbuild/SOURCES/$PACKAGE-$VERSION +git checkout v$VERSION +cd $WD +sed "s/Version:.*/Version: $VERSION/" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +sed "s/Release:.*/Release: $(date +%Y%m%d)dx3/" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +# Since sugar and sugar-artwork DX3 specs *already* have epoch set to the +# date number, we will continue that hack for DX3. BUT THIS IS WRONG!!! +sed '/^Epoch:/d' -i ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec +sed "/^Name:/s/$/\nEpoch: $(date +%Y%m%d)/" -i ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec + +# Let's allow some fuzz +sed "1s/$/\n%define _default_patch_fuzz $FUZZ/" -i ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec + +cd ~/rpmbuild/SOURCES/$PACKAGE-$VERSION +[ $PACKAGE = "sugar-artwork" ] && sed '/GNOME_COMPILE_WARNINGS/d' configure.ac -i +sh autogen.sh +cd .. +tar -jcvf $PACKAGE-$VERSION.tar.bz2 $PACKAGE-$VERSION +cd $WD + +############################################################################ + +# Set tokens for adding patches to the spec file +sed "/^Source0/s/$/\n\#ListPatches/" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +sed "/^%setup/s/$/\n\#MakePatches/" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +sed "/^Patch/d" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +sed "/^%*patch/d" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i + +# number, name, string, strip +addpatch(){ +sed "/ListPatches/s%^%Patch$1: $3\n%" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +sed "/MakePatches/s/^/%patch$1 -p$4 -b $2\n/" ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i +} + +rm -rf ~/rpmbuild/RPMS/$PACKAGE-$VERSION.*patches +cp ~/rpmbuild/SOURCES/$PACKAGE-$VERSION $TEST/src -a +cd $TEST/src +for i in $WD/$PACKAGE/*patch +do + file=${i//*\//} + number=${file//-*/} + log=$(patch -N -t -F$FUZZ --dry-run -p1 < $i 2>&1) + if [ $? = 0 ] + then + echo APPLYED PATCH: $file | tee -a ~/rpmbuild/RPMS/$PACKAGE-$VERSION.appliedpatches + patch -F$FUZZ -p1 < $i + cp $i ~/rpmbuild/SOURCES/ + addpatch $number .$number "$file" 1 + else + if echo $log |grep -q "previously applied" + then + echo ALREADY APPLIED: $file | tee -a ~/rpmbuild/RPMS/$PACKAGE-$VERSION.failedpatches + else + echo FAILED TO APPLY: $file | tee -a ~/rpmbuild/RPMS/$PACKAGE-$VERSION.failedpatches + fi + fi +done +cd $WD +rm -rf $TEST + +# Clean tokens +sed '/ListPatches/d; /MakePatches/d' ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec -i + +############################################################################ + +grep BuildRequires ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec |sed s/.*\ //|xargs yum -y install +rpmbuild --clean ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec +if rpm -q glibc |grep -q armv5 +then + rpmbuild --target armv5tel -ba ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec +else + rpmbuild -ba ~/rpmbuild/SPECS/$PACKAGE/$PACKAGE.spec +fi |