| 1 | = Setting up a buildhost for Redhat-based distros = |
| 2 | |
| 3 | == General directions == |
| 4 | |
| 5 | 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 |
| 6 | |
| 7 | * git, of course |
| 8 | * recent mock (we're running git snapshot) |
| 9 | * recent autoconf (> 2.60) |
| 10 | * createrepo to make nice repos for yum |
| 11 | * weex or lftp to sync your package tree |
| 12 | |
| 13 | If you consider to run this on a RHEL5 host, you would also need |
| 14 | |
| 15 | * up-to-date RPM with SHA1 patches |
| 16 | * patched nss & co for EL5 i386 targets |
| 17 | * bleeding edge mock |
| 18 | * dynamically patch the SPEC to use PCRE for EL targets |
| 19 | |
| 20 | Most of this stuff is readily available for you at the [http://infrastructure.fedoraproject.org/ 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. |
| 21 | |
| 22 | 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. |
| 23 | |
| 24 | == mc-build.sh == |
| 25 | {{{ |
| 26 | #!/bin/bash |
| 27 | |
| 28 | PATH_BASE=/home/buildbot |
| 29 | PATH_UPLOAD=$PATH_BASE/mc-upload |
| 30 | PATH_SOURCE=$PATH_BASE/mc-git |
| 31 | PATH_TEMP=$PATH_BASE/mc-temp |
| 32 | PATH_RPM=/home/buildbot/src/rpm |
| 33 | PATH_MOCK=/var/lib/mock |
| 34 | |
| 35 | BUILD_ARCH="epel-5-i386 epel-5-x86_64 fedora-11-i386 fedora-11-x86_64 fedora-10-i386 fedora-10-x86_64" |
| 36 | |
| 37 | echo Suck git updates... |
| 38 | cd $PATH_SOURCE |
| 39 | git fetch |
| 40 | git reset --hard origin/master |
| 41 | echo Done! |
| 42 | |
| 43 | rm -rf $PATH_UPLOAD |
| 44 | mkdir $PATH_UPLOAD |
| 45 | |
| 46 | for i in $BUILD_ARCH; |
| 47 | do |
| 48 | |
| 49 | echo Clone source tree... |
| 50 | rm -rf $PATH_TEMP |
| 51 | cp -r $PATH_SOURCE $PATH_TEMP |
| 52 | echo Done! |
| 53 | |
| 54 | echo Patching SPEC... |
| 55 | cd $PATH_BASE |
| 56 | if [[ "$i" =~ "epel" ]] |
| 57 | then |
| 58 | patch -p0 < mc-zyv-spec.patch |
| 59 | fi |
| 60 | echo Done! |
| 61 | |
| 62 | echo Make dist |
| 63 | cd $PATH_TEMP |
| 64 | ./autogen.sh |
| 65 | ./configure |
| 66 | make -j 2 dist |
| 67 | echo Done! |
| 68 | |
| 69 | echo Removing old stuff |
| 70 | rm -f $PATH_RPM/SPECS/mc.spec |
| 71 | rm -f $PATH_RPM/SOURCES/mc-*.tar.gz |
| 72 | rm -f $PATH_RPM/SRPMS/mc-*.src.rpm |
| 73 | echo Done! |
| 74 | |
| 75 | echo Building SRPM... |
| 76 | cp mc-*.tar.gz $PATH_RPM/SOURCES |
| 77 | cp ./contrib/dist/redhat/mc.spec $PATH_RPM/SPECS |
| 78 | rpmbuild -bs $PATH_RPM/SPECS/mc.spec |
| 79 | echo Done! |
| 80 | |
| 81 | MC_RPM="`ls $PATH_RPM/SRPMS/mc-*.src.rpm`" |
| 82 | |
| 83 | echo Building $i... |
| 84 | mkdir $PATH_UPLOAD/$i |
| 85 | mock $MC_RPM -r $i |
| 86 | cp $PATH_MOCK/$i/result/*.rpm $PATH_UPLOAD/$i |
| 87 | cp $PATH_MOCK/$i/result/build.log $PATH_UPLOAD/$i |
| 88 | createrepo $PATH_UPLOAD/$i |
| 89 | echo Done! |
| 90 | |
| 91 | done |
| 92 | |
| 93 | HOME=$PATH_BASE weex mc |
| 94 | |
| 95 | }}} |
| 96 | |
| 97 | == mc-zyv-spec.patch == |
| 98 | {{{ |
| 99 | --- mc-temp/contrib/dist/redhat/mc.spec.in 2009-07-04 00:57:19.000000000 +0400 |
| 100 | +++ mc-temp/contrib/dist/redhat/mc.spec.in 2009-07-04 00:53:46.000000000 +0400 |
| 101 | @@ -22,7 +22,7 @@ |
| 102 | Source0: mc-%{ver}.tar.gz |
| 103 | URL: http://www.midnight-commander.org/ |
| 104 | BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) |
| 105 | -BuildRequires: glib2-devel e2fsprogs-devel slang-devel |
| 106 | +BuildRequires: glib2-devel e2fsprogs-devel slang-devel pcre-devel |
| 107 | |
| 108 | %description |
| 109 | GNU Midnight Commander is a visual file manager. It's a feature rich |
| 110 | }}} |