aboutsummaryrefslogtreecommitdiffstats
path: root/rebuild_perl_iurt
blob: 87cb3d1bfce758fe36f464a640be96114f534166 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/bin/sh

set -e

distro=$1
arch=$2
perlchroot=$3
if [ -z "$distro" ] || [ -z "$arch" ]; then
    echo "usage: $0 <distro> <arch> [<iurt chroot>]"
    exit 1
fi

# To be used when bootstrap need updates_testing stuffs ( like new rpm ): media="core/release core/updates_testing"
media=core/release
repository=http://repository.mageia.org/distrib/

if [ -z "$perlchroot" ]; then
    perlchroot=$(echo | iurt --repository $repository --shell -r $distro $arch 2>&1 | perl -lne '/dumping to a chrooted shell into (.*)/ and print $1')
fi

if [ -z "$perlchroot" ]; then
    echo "No chroot given to reuse and failed to create a new one"
    exit 1
fi

iurt --repository $repository --shell -r $distro $arch --use-old-chroot $perlchroot --chrooted-urpmi -m $media -- $repository <<"EOF"
set -x
set -e
skip() { echo $*; }
sudo urpmi.update -a
sudo urpmi --auto mgarepo
mkdir -p ~/.mgarepo
perl -pe 's/svn\+ssh:/svn:/' /etc/mgarepo.conf > ~/.mgarepo/config
perlapis_path=$HOME/perlapis.txt
[ -e $perlapis_path ] || rpm -q --provides perl-base | grep ^libperl.so. > $perlapis_path
for p in perl perl-Test-LeakTrace perl-List-MoreUtils-XS perl-List-MoreUtils perl-Math-Int64 perl-URPM perl-Locale-gettext; do mgarepo getsrpm -n $p; done
rpm -ivh --nodeps *.src.rpm
sudo urpmi --auto --no-verify-rpm rpmbuild/SPECS/*.spec
rpmbuild -ba rpmbuild/SPECS/perl.spec
sudo rpm -Uvh --nodeps --force $(ls rpmbuild/RPMS/*/perl-*.rpm | grep -v debuginfo)
rpmbuild -ba rpmbuild/SPECS/perl-Test-LeakTrace.spec
sudo rpm -Uvh --force rpmbuild/RPMS/*/perl-Test-LeakTrace*.rpm
rpmbuild -ba rpmbuild/SPECS/perl-List-MoreUtils-XS.spec
sudo rpm -Uvh --force rpmbuild/RPMS/*/perl-List-MoreUtils-XS*.rpm
PERL5LIB=$(rpm -ql perl-List-MoreUtils-XS perl-List-MoreUtils | perl -ne 's!/List/MoreUtils.pm!! && print') LIST_MOREUTILS_PP=1 rpmbuild -ba rpmbuild/SPECS/perl-List-MoreUtils.spec
sudo rpm -Uvh --force rpmbuild/RPMS/*/perl-List-MoreUtils-*.rpm
rpmbuild -ba rpmbuild/SPECS/perl-Math-Int64.spec
sudo rpm -Uvh --force rpmbuild/RPMS/*/perl-Math-Int64*.rpm
rpmbuild -ba rpmbuild/SPECS/perl-URPM.spec
rpmbuild -ba rpmbuild/SPECS/perl-Locale-gettext.spec
sudo rpm -Uvh --force rpmbuild/RPMS/*/perl-URPM-*.rpm rpmbuild/RPMS/*/perl-Locale-gettext-*.rpm
updatepkgs() { spec=$1; toupdate=; while read line; do set -- $line; name=$1; path=$2; rpm -q $name --quiet && toupdate="$toupdate $path"; done < <(rpm -q --specfile $spec --qf '%{name} rpmbuild/RPMS/%{arch}/%{name}-%{version}-%{release}.%{arch}.rpm\n' | egrep -v -- '-(debuginfo|__restore__)-'); [ -n "$toupdate" ] && sudo rpm -Uvh --force $toupdate; }
rebuild() { p=$1; mgarepo getsrpm -n $p; rpm -ivh @*:$p-*.src.rpm; spec=rpmbuild/SPECS/$p.spec; sudo urpmi --auto --no-verify-rpm $spec; rpmbuild -ba $spec; updatepkgs $spec; }
pkgs=$(LC_ALL=C rpm -q --qf '%{SOURCERPM}\n' --whatrequires $(cat $perlapis_path) | perl -lne '/^(\S+)-[^-]+-[^-]+$/ and print $1' | uniq); for p in $pkgs; do rebuild $p; done
EOF

echo $perlchroot