Meego Wiki
Views

Local Build Without OBS Needed

From MeeGo wiki
Revision as of 06:16, 29 June 2011 by Xiaoqiang0 (Talk | contribs)
Jump to: navigation, search

This page is for people who want to avoid any connection with any OBS backend - ie "as raw as possible".

If you simply want to do a local build then you probably want "osc build" which does almost everything for you. see Build_Infrastructure/Packagers_Developers

Contents

Building your package using build

A more convenient package build way is to use 'build' which is a project from OpenSUSE, MeeGo build infrastructure used it.

You can get build binary package from http://repo.meego.com/MeeGo/tools/repos/ per your Linux distribution, if your Linux distribution isn't there, you can get build source package from http://www.gitorious.org/opensuse/build to build it yourself manually.

After you install it ( I suppose you know how to install a package on your Linux), you can run “build –help” to get help info.

You must run build as root. If your network needs proxy, please export proxy environment variables, for example:

export http_proxy=http://proxy.yourcompany.com:8080/
export no_proxy=localhost,127.0.0.0/8,.yourcompany.com, 172.16.0.0/16

If you used to run “sudo build …” and your network needs proxy, please ensure sudo to inherit proxy environment variables, you can do this by adding the below line to /etc/sudoers

Defaults    env_keep += "http_proxy no_proxy HTTP_PROXY NO_PROXY"

build also will check rpm package signature, so you must import public key of repository you're using, for example:

For http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/

You can get its public key for http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/repodata/repomd.xml.key

$ wget http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/repodata/repomd.xml.key
$ sudo rpm --import repomd.xml.key

This command will build a cpio binary package for MeeGo.

build --repository http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/ --arch i686 cpio-2.11-2.6.src.rpm

Optionally, you also can use spec file to build it, for this case, build will find your source tar ball and patches under current work dir.

build --repository http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/ --arch i686 cpio.spec

build will base your repo URL to cache your repo, so please use the same URL string for the same repo every time (URL with / at the end of it and the same URL without / at the end of it will result in different cache dirs), you can use multiple --repository options to specify multiple repos, for example:

build --repository http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/ \
    --repository http://repo.meego.com/MeeGo/builds/trunk/preview/netbook/repos/ia32/packages/ \
    --arch i686 meego-panel-applications-0.2.3-1.10.src.rpm

The default cache dir is /var/cache/build, you can use option –cachedir to set to other dir.

The default BUILDROOT dir is /var/tmp/build-root, you can use --root option to specify one more dir, once build is done, you can get your binary package in BUILDROOT, for example:

...
Wrote: /home/abuild/rpmbuild/SRPMS/cpio-2.11-2.meego.src.rpm
Wrote: /home/abuild/rpmbuild/RPMS/i586/cpio-2.11-2.meego.i586.rpm
Wrote: /home/abuild/rpmbuild/RPMS/i586/cpio-debuginfo-2.11-2.meego.i586.rpm
...

Your cpio binary package is /var/tmp/build-root/home/abuild/rpmbuild/RPMS/i586/2.11-2.meego.i586.rpm

Development your package using build

If you want to modify packages, such as add/modify/remove patches, you need unpack src.rpm first. Then develop based on source code.

This command would unpack src.rpm to current directory, and your work can be in this directly.

 rpm2cpio XXX.src.rpm | cpio -idmv
  1. If you want to add a patch, you just need copy the patch to current directory and add this patch in spec file.
  2. If you wan to remove patches, you just need to remove them in spec file.
  3. If you want to modify exist patch, you can modify the special patch and spec file need not to modify.

Once you development work is done, you can use ‘build’ command to generate new RPM based on you changes. Command as follows:

 build --repository http://YYY/repos/oss/ia32/packages/ --arch i686 XXX.spec

Troubleshooting (ARM)

Exec format error

Meet this problem :

on fedora13 when using 'build' to create a armv7l rpm package. one of reasons: maybe 'qemu-arm' is not right set. Try command:'file /usr/bin/qemu-arm' ,and if its output show 'dynamically linked',and the problem maye is here,and it should be 'statically linked'.you can use commands 'rpm -i http://download.opensuse.org/repositories/home:/dl9pf:/qemu/Fedora_12/i386/qemu-devel-0.13git2010.06.24.1826-8.1.i386.rpm' (the package maybe changes,so you can go the web address to get it ,then install it )to reinstall this part, and maybe you will meet some problem because of its dependencies ,and you can uninstall all of them first.

on ubuntu10.04,you should install 'qemu-arm-static',use command:apt-get install qemu-arm-static

On Debian, you should install 'qemu-user-static' from Squeeze (Debian 6.0) and later.

rpm error

This problem on ubuntu 10.04 when using 'build' to create a i686 rpm package. Error:rpm: error while loading shared libraries: liblua-5.1.so: cannot open shared object file: No such file or directory Please modify the /usr/lib/build/configs/default.conf in preinstall section add liblua.--Kismeter 15:02, 2 December 2010 (UTC)

Nothing Provides

This problem on Ubuntu 10.04 when using 'build' to create a i586 package. Please Use build --repository http://repo.meego.com/MeeGo/builds/xxx/core/repos/ia32/packages/ --arch i686 xxxx.src.rpm The arch must be i686.

chroot: cannot run command `rpm'

when build a armv7l rpm,modify /usr/lib/build/build and /usr/lib/build/configs/meego-1.0.conf ,change armv7el to armv7l in these files,maybe /usr/lib/build/Build.pm also need change. If problem persist, see bug 18905

Another language version of this page

Personal tools