Contents |
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.'build' will create a build system to build rpm
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/ /
2.'apt-get update'
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
Way 1:
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
3.install build:
yum install build
Way 2:
Load the package ,run '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.
I think it is so much like to build without OBS,so I add it.
Install 'build' tools like up.
Sure you have a available local OBS,and use commands:
osc -A url meta pkg -e home:yourusername packagename
this means create a new package in obs.url is the address of your obs API.(notice the port). As I seem,we should install 'vi',and remember to type something between <type><>(in fact,maybe any change is ok)
osc -A url co home:yourusername/packagename
You will find a directory like home:yourusername in your current directory include a directory in name of the packagename
osc -A url build --no-verify MeeGo_1.1.80.6.20101116.1_Core_standard i586
Of course,runing this in this directory you downloaded,and put all files include source code package in this directory.'--no-verify' may be not needed,and 'MeeGo_1.1.80.6.20101116.1_Core_standard' stand the <repository> like using the obs with web ui, and i586 stand <target architecture>(maybe select them in the obs web first).I think It is easy after using the obs with web ui.
Because of 'build' tools,it maybe appear the problem like 'local build without obs'
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, you should install qemu-arm-static,use 'apt-get install qemu-arm-static'.