root/packaging/centuryegg/build-python-rpm

Revision 13519, 6.0 KB (checked in by build, 8 months ago)

Correct name of fakeroot rpms

  • Property svn:eol-style set to native
  • Property svn:executable set to *
  • Property svn:mime-type set to text/bash-source
Line 
1#!/bin/bash
2if [ x"$PYTHON_VERSION" == "x2.5" ]
3then
4    PYTHON_SRPM_URL=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/10/Everything/source/SRPMS/python-2.5.2-1.fc10.src.rpm
5elif [ x"$PYTHON_VERSION" == "x2.6" ]
6then
7    PYTHON_SRPM_URL=http://archives.fedoraproject.org/pub/archive/fedora/linux/releases/11/Everything/source/SRPMS/python-2.6-7.fc11.src.rpm
8else
9    echo "Can't find a source RPM for Python $PYTHON_VERSION"
10    exit 1
11fi
12mkdir -p logs rpms srpms
13rpm_arch=`rpmbuild -E %{_arch} 2>/dev/null`
14if [ $(ls rpms/python$PYTHON_SUFFIX-$PYTHON_VERSION*.rpm | wc -l) -gt 0 ]
15then
16    echo "Not building python as the following packages are already built:"
17    ls rpms/python$PYTHON_SUFFIX-$PYTHON_VERSION*.rpm
18    exit
19fi
20if [ -f /etc/fedora-release ]
21then
22    sudo yum -y install rpmdevtools || exit
23    SETUPTREE=rpmdev-setuptree
24elif [ -f /etc/redhat-release ]
25then
26    REDHAT_VERSION=`cat /etc/redhat-release | cut -d " " -f 3 | cut -d "." -f 1`
27    if [[ $REDHAT_VERSION -lt 5 ]]
28    then
29        sudo yum -y install fedora-rpmdevtools || exit
30    elif [[ $REDHAT_VERSION == 5 ]]
31    then
32        cd rpms
33        wget -c ftp://mirror.switch.ch/pool/1/mirror/epel/5/${rpm_arch}/fakeroot-libs-1.12.2-21.el5.2.${rpm_arch}.rpm
34        wget -c ftp://mirror.switch.ch/pool/1/mirror/epel/5/${rpm_arch}/fakeroot-1.12.2-21.el5.2.${rpm_arch}.rpm
35        wget -c ftp://mirror.switch.ch/pool/1/mirror/epel/5/${rpm_arch}/rpmdevtools-6.8-1.el5.noarch.rpm
36        if [ "x`rpm -qa redhat-rpm-config`" == "x" ]
37        then
38            sudo yum install -y redhat-rpm-config
39        fi
40        if [ "x`rpm -qa gcc-c++`" == "x" ]
41        then
42            sudo yum install -y gcc-c++
43        fi
44        if [ "x`rpm -qa rpmdevtools`" == "x" ]
45        then
46            sudo rpm -Uvh fakeroot-{,libs-}1.12.2-21.el5.2.${rpm_arch}.rpm rpmdevtools-6.8-1.el5.noarch.rpm || exit 1
47        fi
48        cd ..
49    else
50        echo I don\'t know how to install rpmdevtools on RedHat $REDHAT_VERSION
51        exit 1
52    fi
53    SETUPTREE=fedora-buildrpmtree
54fi
55$SETUPTREE || exit
56# Check official distro version
57EXPAT_VERSION=`yum info expat | grep Version | head -n 1 | sed -e "s/[ \t]\+/ /g" | cut -d ":" -f 2 | cut -d " " -f 2 | sort | tail -n 1`
58if [ `echo $EXPAT_VERSION | cut -d "." -f 1` == "1" ] && [ `echo $EXPAT_VERSION | cut -d "." -f 2` == "95" ] && [ `echo $EXPAT_VERSION | cut -d "." -f 3` -lt 8 ]
59then
60    (
61    echo Building expat...
62    ./build-expat-rpm
63    ./install-expat-rpm
64    )
65fi
66LIBXML_VERSION=`yum info libxml2 | grep Version | head -n 1 | sed -e "s/[ \t]\+/ /g" | cut -d ":" -f 2 | cut -d " " -f 2 | sort | tail -n 1`
67if [ "`echo $LIBXML_VERSION | cut -d "." -f 1`" == "2" ] && [ `echo $LIBXML_VERSION | cut -d "." -f 2` == "6" ] && [ `echo $LIBXML_VERSION | cut -d "." -f 3` -lt 20 ]
68then
69    (
70    echo Building LibXML...
71    ./build-libxml-rpm
72    ./install-libxml-rpm
73    )
74fi
75LIBFFI_VERSION=`yum info libffi | grep Version | head -n 1 | sed -e "s/[ \t]\+/ /g" | cut -d ":" -f 2 | cut -d " " -f 2 | sort | tail -n 1`
76if [ "x$LIBFFI_VERSION" == "x" ]
77then
78    (
79    echo Building LibFFI...
80    ./build-libffi-rpm
81    ./install-libffi-rpm
82    )
83elif [ "x`rpm -q libffi-devel`" == "x" ]
84then
85    sudo yum install libffi-devel
86fi
87AUTOCONF_VERSION=`yum info autoconf | grep Version | head -n 1 | sed -e "s/[ \t]\+/ /g" | cut -d ":" -f 2 | cut -d " " -f 2 | sort | tail -n 1`
88if [ "`echo $AUTOCONF_VERSION | cut -d "." -f 1`" == "2" ] && [ `echo $AUTOCONF_VERSION | cut -d "." -f 2` -lt "61" ]
89then
90    (
91    echo Building Autoconf 2.61...
92    ./build-autoconf-rpm
93    ./install-autoconf-rpm
94    )
95fi
96SQLITE_VERSION=`yum info sqlite | grep Version | head -n 1 | sed -e "s/[ \t]\+/ /g" | cut -d ":" -f 2 | cut -d " " -f 2 | sort | tail -n 1`
97if [ "`echo $SQLITE_VERSION | cut -d "." -f 1`" == "3" ] && [ `echo $SQLITE_VERSION | cut -d "." -f 2` -lt "4" ]
98then
99    (
100    echo Building SQLite...
101    ./build-sqlite-rpm
102    ./install-sqlite-rpm
103    )
104fi
105(
106cd srpms
107wget -c $PYTHON_SRPM_URL
108rpm -ivh --nomd5 python-$PYTHON_VERSION*.src.rpm
109)
110DB_VERSION=`yum info db4-devel | grep Version | head -n 1 | sed -e "s/[ \t]\+/ /g" | cut -d ":" -f 2 | cut -d " " -f 2 | sed -e "s/\([0-9]\+\.[0-9]\+\)\..*/\1/"`
111[ -f ~/rpmbuild/SOURCES/python-$PYTHON_VERSION-config.patch ] && sed -ie "s/DBLIBVER=4.[4-9]/DBLIBVER=$DB_VERSION/" ~/rpmbuild/SOURCES/python-$PYTHON_VERSION-config.patch
112sed -ie "s/db4-devel >= 4.[4-9]/db4-devel >= $DB_VERSION/" $HOME/rpmbuild/SPECS/python.spec
113# Name of libX11-devel on old systems is xorg-x11-devel
114if [ 'x$REDHAT_VERSION' != 'x' ]
115then
116    if [[ $REDHAT_VERSION -lt 5 ]]
117    then
118        [ -f ~/rpmbuild/SOURCES/python-$PYTHON_VERSION-config.patch ] && sed -ie 's/\+.*-lX11/\+ -L\/usr\/X11R6\/lib -lX11/' ~/rpmbuild/SOURCES/python-$PYTHON_VERSION-config.patch
119        sed -ie 's/libX11-devel/xorg-x11-devel/' $HOME/rpmbuild/SPECS/python.spec
120    fi
121fi
122# We've made sure libffi-devel  is installed, and yum-builddep doesn't detect it
123sed -ie "/libffi-devel/ s/^/#/" $HOME/rpmbuild/SPECS/python.spec
124# add to changelog
125src_rpm=`rpmbuild -bs --nodeps $HOME/rpmbuild/SPECS/python.spec | sed 's/^Wrote: //'`
126sudo cp -pv /etc/yum.conf{,.builddep.orig}
127sudo python -c "import ConfigParser ; cp = ConfigParser.RawConfigParser() ; cp.read('/etc/yum.conf') ; cp.set('main', 'assumeyes', '1') ; cp.write(open('/etc/yum.conf', 'w'))"
128sudo yum-builddep $src_rpm || finished=1
129sudo cp -pv /etc/yum.conf{.builddep.orig,}
130rm $src_rpm
131[[ "$finished" == 1 ]] && exit 1
132# for fedora 6
133# QA_RPATHS to prevent /usr/lib64... sqlite error
134# --define __python_ver to include the python version in the bin filenames etc
135QA_RPATHS=0x0001 rpmbuild  --define "__python_ver $PYTHON_SUFFIX" -ba ~/rpmbuild/SPECS/python.spec >logs/build-python$PYTHON_SUFFIX.log 2>&1
136result=$?
137tail logs/build-python$PYTHON_SUFFIX.log
138cp -pv ~/rpmbuild/RPMS/$rpm_arch/python$PYTHON_SUFFIX{,-debuginfo,-devel,-libs,-test,-tools}-$PYTHON_VERSION*.rpm rpms/
139cp -pv ~/rpmbuild/RPMS/$rpm_arch/tkinter$PYTHON_SUFFIX-$PYTHON_VERSION*.rpm rpms/
140cp -pv ~/rpmbuild/SRPMS/python$PYTHON_SUFFIX-$PYTHON_VERSION*.rpm rpms/
141
Note: See TracBrowser for help on using the browser.