| 1 | #!/bin/bash |
|---|
| 2 | XORGMACROS_VERSION=1.0.2-4 |
|---|
| 3 | XORGMACROS_MAJOR_VERSION=$(echo $XORGMACROS_VERSION | cut -d "-" -f 1) |
|---|
| 4 | mkdir -p logs rpms srpms |
|---|
| 5 | rpm_arch=`rpmbuild -E %{_arch} 2>/dev/null` |
|---|
| 6 | if [ -f rpms/xorg-x11-util-macros-$XORGMACROS_VERSION.${rpm_arch}.rpm ] |
|---|
| 7 | then |
|---|
| 8 | echo "Not building xorg-x11-util-macros as rpms/xorg-x11-util-macros-$XORGMACROS_VERSION.${rpm_arch}.rpm already exists" |
|---|
| 9 | exit |
|---|
| 10 | fi |
|---|
| 11 | if [ -f /etc/fedora-release ] |
|---|
| 12 | then |
|---|
| 13 | sudo yum -y install rpmdevtools || exit |
|---|
| 14 | SETUPTREE=rpmdev-setuptree |
|---|
| 15 | elif [ -f /etc/redhat-release ] |
|---|
| 16 | then |
|---|
| 17 | sudo yum -y install fedora-rpmdevtools || exit |
|---|
| 18 | SETUPTREE=fedora-buildrpmtree |
|---|
| 19 | REDHAT_VERSION=`cat /etc/redhat-release | cut -d " " -f 3 | cut -d "." -f 1` |
|---|
| 20 | fi |
|---|
| 21 | $SETUPTREE || exit |
|---|
| 22 | ( |
|---|
| 23 | cd srpms |
|---|
| 24 | wget -c http://mirror.centos.org/centos/5/os/SRPMS/xorg-x11-util-macros-$XORGMACROS_VERSION.fc6.src.rpm |
|---|
| 25 | rpm -ivh --nomd5 xorg-x11-util-macros-$XORGMACROS_MAJOR_VERSION*.src.rpm |
|---|
| 26 | ) |
|---|
| 27 | # add to changelog |
|---|
| 28 | src_rpm=`rpmbuild -bs --nodeps $HOME/rpmbuild/SPECS/xorg-x11-util-macros.spec | sed 's/^Wrote: //'` |
|---|
| 29 | sudo cp -pv /etc/yum.conf{,.builddep.orig} |
|---|
| 30 | sudo python -c "import ConfigParser ; cp = ConfigParser.RawConfigParser() ; cp.read('/etc/yum.conf') ; cp.set('main', 'assumeyes', '1') ; cp.write(open('/etc/yum.conf', 'w'))" |
|---|
| 31 | sudo yum-builddep $src_rpm || finished=1 |
|---|
| 32 | sudo cp -pv /etc/yum.conf{.builddep.orig,} |
|---|
| 33 | rm $src_rpm |
|---|
| 34 | [[ "$finished" == 1 ]] && exit |
|---|
| 35 | QA_RPATHS=0x0001 rpmbuild -ba ~/rpmbuild/SPECS/xorg-x11-util-macros.spec >logs/build-xorg-x11-util-macros.log 2>&1 |
|---|
| 36 | result=$? |
|---|
| 37 | tail logs/build-xorg-x11-util-macros.log |
|---|
| 38 | cp -pv ~/rpmbuild/RPMS/noarch/xorg-x11-util-macros-*$XORGMACROS_MAJOR_VERSION*.rpm rpms/ |
|---|
| 39 | cp -pv ~/rpmbuild/SRPMS/xorg-x11-util-macros-$XORGMACROS_MAJOR_VERSION*.rpm rpms/ |
|---|