wiki:NightlyBuildBot

Version 1 (modified by zaytsev, 15 years ago) (diff)

Posted the build script

Setting up a buildhost for Redhat-based distros

General directions

The idea behind the buildhost is pretty simple. All you need is a clone of our git repository and a helper script that you might cron for execution at a certain time. The script would periodically fetch the changes from the repo to keep the local copy of the sources up to date, run mock to build the RPMs in a chroot'ed environment, corresponding to the target operating systems and finally automatically sync the folder with your public webhost. For this you need

  • git, of course
  • recent mock (we're running git snapshot)
  • recent autoconf (> 2.60)
  • createrepo to make nice repos for yum
  • weex or lftp to sync your package tree

If you consider to run this on a RHEL5 host, you would also need

  • up-to-date RPM with SHA1 patches
  • patched nss & co for EL5 i386 targets
  • bleeding edge mock
  • dynamically patch the SPEC to use PCRE for EL targets

Most of this stuff is readily available for you at the Fedora Infrastructure repos, because they still use a certain amount of EL5 builders. Be warned, however, that you need a certain amount of knowledge to go this route, so if you don't mind accidentally blowing up your machine, just go ahead.

The script we use is given below for your convenience (public domain). Feel free to adjust it to suit your system. If you find a potential flaw or want to contribute an enhancement feel free to get in touch with the buildhost maintainer.

mc-build.sh

#!/bin/bash

PATH_BASE=/home/buildbot
PATH_UPLOAD=$PATH_BASE/mc-upload
PATH_SOURCE=$PATH_BASE/mc-git
PATH_TEMP=$PATH_BASE/mc-temp
PATH_RPM=/home/buildbot/src/rpm
PATH_MOCK=/var/lib/mock

BUILD_ARCH="epel-5-i386 epel-5-x86_64 fedora-11-i386 fedora-11-x86_64 fedora-10-i386 fedora-10-x86_64"

echo Suck git updates...
cd $PATH_SOURCE
git fetch
git reset --hard origin/master
echo Done!

rm -rf $PATH_UPLOAD
mkdir $PATH_UPLOAD

for i in $BUILD_ARCH;
do

    echo Clone source tree...
    rm -rf $PATH_TEMP
    cp -r $PATH_SOURCE $PATH_TEMP
    echo Done!

    echo Patching SPEC...
    cd $PATH_BASE
    if [[ "$i" =~ "epel" ]]
    then
        patch -p0 < mc-zyv-spec.patch
    fi
    echo Done!

    echo Make dist
    cd $PATH_TEMP
    ./autogen.sh
    ./configure
    make -j 2 dist
    echo Done!
    
    echo Removing old stuff
    rm -f $PATH_RPM/SPECS/mc.spec
    rm -f $PATH_RPM/SOURCES/mc-*.tar.gz
    rm -f $PATH_RPM/SRPMS/mc-*.src.rpm
    echo Done!

    echo Building SRPM...
    cp mc-*.tar.gz $PATH_RPM/SOURCES
    cp ./contrib/dist/redhat/mc.spec $PATH_RPM/SPECS    
    rpmbuild -bs $PATH_RPM/SPECS/mc.spec
    echo Done!

    MC_RPM="`ls $PATH_RPM/SRPMS/mc-*.src.rpm`"

    echo Building $i...
    mkdir $PATH_UPLOAD/$i
    mock $MC_RPM -r $i
    cp $PATH_MOCK/$i/result/*.rpm $PATH_UPLOAD/$i
    cp $PATH_MOCK/$i/result/build.log $PATH_UPLOAD/$i
    createrepo $PATH_UPLOAD/$i
    echo Done!

done

HOME=$PATH_BASE weex mc

mc-zyv-spec.patch

--- mc-temp/contrib/dist/redhat/mc.spec.in        2009-07-04 00:57:19.000000000 +0400
+++ mc-temp/contrib/dist/redhat/mc.spec.in        2009-07-04 00:53:46.000000000 +0400
@@ -22,7 +22,7 @@
 Source0:   mc-%{ver}.tar.gz
 URL:       http://www.midnight-commander.org/
 BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n)
-BuildRequires: glib2-devel e2fsprogs-devel slang-devel
+BuildRequires: glib2-devel e2fsprogs-devel slang-devel pcre-devel
 
 %description
 GNU Midnight Commander is a visual file manager.  It's a feature rich