Difference between revisions of "Setting up RPM Building for SME Server"
(Remove →Setting up building enviroment: as it comes in the provided config files) |
|||
Line 33: | Line 33: | ||
You can then run a test by doing: | You can then run a test by doing: | ||
− | # e.g. initialise a | + | # e.g. initialise a smeserver-8-x86_64-base chroot environment |
− | $ CONFIG= | + | $ CONFIG=smeserver-8-x86_64-base |
$ mock -r $CONFIG --init | $ mock -r $CONFIG --init | ||
which will setup an initial chroot environment using the given config. If that seemed to work (you weren't inundated with error messages), you can try a build: | which will setup an initial chroot environment using the given config. If that seemed to work (you weren't inundated with error messages), you can try a build: | ||
Line 53: | Line 53: | ||
Notes: | Notes: | ||
+ | * Using the provided .cfg files I have verified smeserver-8-x86_64-base.cfg & smeserver-9-x86_64-base.cfg and managed to build e-smith-runit for SME 9 | ||
* the chroot environments are cached, but rebuilding them and checking for updates can be pretty network intensive, so you might want to consider setting up a local repository to pull from. mrepo (available from rpmforge) is pretty good for that. | * the chroot environments are cached, but rebuilding them and checking for updates can be pretty network intensive, so you might want to consider setting up a local repository to pull from. mrepo (available from rpmforge) is pretty good for that. | ||
*there don't seem to be any hooks in mock to allow you to sign packages you've built, so if you do want signed packages you need to sign them afterwards via a rpm --resign $RPMS. | *there don't seem to be any hooks in mock to allow you to sign packages you've built, so if you do want signed packages you need to sign them afterwards via a rpm --resign $RPMS. |
Revision as of 18:16, 27 January 2013
Setting up RPM Building for SME Server
http://www.openfusion.net/linux/mocking_rpms
Mock is a Fedora project that allows you to build RPM packages within a chroot environment, allowing you to build packages for other systems than the one you're running on (e.g. building CentOS 4 32-bit RPMs on a CentOS 5 64-bit host), and ensuring that all the required build dependencies are specified correctly in the RPM spec file.
It is recommended that you use the latest CentOS 6 (64bit) version as a base http://mirror.centos.org/centos/6/isos/x86_64/ I have verified this with CentOS-6.3-x86_64-bin-DVD1.iso
You need to have EPEL repository configured as EPELs version of mock will be used
# Enable EPEL for Centos 6
rpm -Uvh http://fr2.rpmfind.net/linux/epel/6/i386/epel-release-6-8.noarch.rpm
So then the installation of mock is just:
Installing Mock
# Install mock and python-ctypes packages (the latter for better setarch support) $ sudo yum --enablerepo=epel install mock python-ctypes
# Add yourself to the 'mock' group that will have now been created $ sudo usermod -G mock [youraccount]
The mock package creates an /etc/mock directory with configs for various OS versions (mostly Fedoras). Shad has provided working configurations for SME Server here http://mirror.canada.pialasse.com/contribs/slords/mock/
Copy all the .cfg files into /etc/mock including overwriting the site-defaults.cfg
Testing building environment
You can then run a test by doing:
# e.g. initialise a smeserver-8-x86_64-base chroot environment $ CONFIG=smeserver-8-x86_64-base $ mock -r $CONFIG --init
which will setup an initial chroot environment using the given config. If that seemed to work (you weren't inundated with error messages), you can try a build:
# Rebuild the given source RPM within the chroot environment # usage: mock -r <mock_config> --rebuild /path/to/SRPM e.g. $ mock -r $CONFIG --rebuild ~/rpmbuild/SRPMS/clix-0.3.4-1.of.src.rpm If the build succeeds, it drops your packages into the /var/lib/mock/$CONFIG/result directory:
$ ls -1 /var/lib/mock/$CONFIG/result build.log clix-0.3.4-1.of.noarch.rpm clix-0.3.4-1.of.src.rpm root.log state.log
If it fails, you can check mock output, the *.log files above for more info, and/or rerun mock with the -v flag for more verbose messaging.
Notes:
- Using the provided .cfg files I have verified smeserver-8-x86_64-base.cfg & smeserver-9-x86_64-base.cfg and managed to build e-smith-runit for SME 9
- the chroot environments are cached, but rebuilding them and checking for updates can be pretty network intensive, so you might want to consider setting up a local repository to pull from. mrepo (available from rpmforge) is pretty good for that.
- there don't seem to be any hooks in mock to allow you to sign packages you've built, so if you do want signed packages you need to sign them afterwards via a rpm --resign $RPMS.