A task of mine is to build rpm packages without OBS,and it cost me a week to do it, and I record the process of it and some questions.
MeeGo use 'build' to work for this,We can get build package from http://repo.meego.com/MeeGo/tools/repos/ according to kind of your host,and another way to get build source package from http://www.gitorious.org/opensuse/build.
1.add the below line to /etc/apt/sources.list
deb http://repo.meego.com/MeeGo/tools/repos/ubuntu/10.04/ /
You should see the following error: W: GPG error: http://repo.meego.com Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY 0BC7BEC479FC1F8A
To add the repository public key use the following command:
gpg --keyserver subkeys.pgp.net --recv 0BC7BEC479FC1F8A gpg --export --armor 0BC7BEC479FC1F8A | sudo apt-key add -
Now redo 'apt-get update' (I met the problem up,and it seems I failed to add the key .though it could work normally,it maybe is the reason of the questions I want to know at the end of this page )
3.apt-get install build
1.run the lines of commands below as root"
cat <<REPO > /etc/yum.repos.d/meego-tools.repo [meego-tools] name=MeeGo Tools for Fedora baseurl=http://repo.meego.com/MeeGo/tools/repos/fedora/\$releasever enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-meego REPO
2.add gpg key
gpg2 --keyserver subkeys.pgp.net --recv 0BC7BEC479FC1F8A gpg2 --export --armor 0BC7BEC479FC1F8A > /etc/pki/rpm-gpg/RPM-GPG-KEY-meego <\pre> 3.install build: <pre> yum install build <\pre> (It seems I also failed to get the key ,but everything seem to be work well.I am very curious to it ) Way 2: Load the package build-2010.08.04-1.5.src.rpm from http://repo.meego.com/MeeGo/tools/repos/fedora/13/src/ ,and run comand: <pre> rpm -ivh build-2010.08.04-1.5.src.rpm
after that you can find them in /root/rpmbuild/ if you run as root.and you can use commands:'rpmbuild -ba <spec file>' to build a rpm,and install it by use 'rpm -ivh <rpm package>'
In fact,we build the rpm package with spec file or src.rpm package.
If you already installed 'build' tools,you could find /usr/lib/build/configs/meego-1.0.conf.This file seems like for meego1.0,and in fact when we use it build a rpm of version 1.0 ,it will work directly
Before building ,you should have a spec file or src.rpm package,and also you must run commands below as root because of loading the dependency packages automatic in the process:
wget http://repo.meego.com/MeeGo/releases/1.0/core/repos/armv7l/packages/repodata/repomd.xml.key rpm --import repomd.xml.key
(I think the same importing once will be ok,and running the same importing will be failed)
then you can start building:
build --repository http://repo.meego.com/MeeGo/releases/1.0/core/repos/armv7l/packages/ --arch armv7l cpio-2.11-1.2.src.rpm
Complete this ,you will find the rpm package in /var/tmp/build-root/home/abuild/rpmbuild/RPMS/. because 'build' will create a build system and initialize it every time by default, so you need move the result if you want to keep it.
If you want to build the rpm of version 1.1,you should change 'lua' to 'liblua' in Preinstall of meego-1.0.conf. (for me ,it worked on fedora13,and failed on ubuntu10.04,if someone know that,please tell me)
If you want to build a armv7l rpm package,please sure the 'armv7l' or 'armv7el' in meego-1.0.conf
, '/usr/lib/build/build' and '/usr/lib/build/Build.pm'.
If get the error: 'chroot: failed to run command `rpm': exec format error' or 'chroot: failed to run command `rpm': No such file or directory',you should be sure your qemu-arm set right:
On fedora13,you can run 'file /usr/bin/qemu-arm', and if it show 'dynamically linked', you should reset it.you can run 'rpm -i http://download.opensuse.org/repositories/home:/dl9pf:/qemu/Fedora_12/i386/qemu-devel-0.13git2010.06.24.1826-8.1.i386.rpm',and sure it running well(uninstall all blocking packages),and run command again,and you will see the result of 'statically linked'.
On unbuntu10.04,I find 'qemu-arm' in /usr/local/bin,and run 'file /usr/local/bin' ,and it show 'dynamically linked',but it worked normal,and I was puzzled to this.