Meego Wiki
Views

Local Build Without OBS Needed

From MeeGo wiki
(Difference between revisions)
Jump to: navigation, search
 
(44 intermediate revisions not shown)
Line 1: Line 1:
-
== Building your package using build ==
+
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]]
 +
 
 +
 
 +
== Building your package using 'build' ==
 +
 
 +
=== Install 'build' ===
A more convenient package build way is to use 'build' which is a project from OpenSUSE, MeeGo build infrastructure used it.
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.
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:
+
* If your host is MeeGo, you need to install one more package 'perl-XML-Parser'
 +
 
 +
  zypper install build perl-XML-Parser
 +
 
 +
 
 +
=== Setup ===
 +
 
 +
After you install it, you can run “build –help” to get help info. You need to run 'build' as root.  
 +
* Proxy
 +
If your network needs proxy, please export proxy environment variables, for example:
<pre>
<pre>
export http_proxy=http://proxy.yourcompany.com:8080/
export http_proxy=http://proxy.yourcompany.com:8080/
Line 15: Line 30:
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
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
-
 
<pre>
<pre>
Defaults    env_keep += "http_proxy no_proxy HTTP_PROXY NO_PROXY"
Defaults    env_keep += "http_proxy no_proxy HTTP_PROXY NO_PROXY"
</pre>
</pre>
 +
* Conf file
 +
You may also need to set correct default distro target, or use the "build --dist=/usr/lib/build/configs/meego-1.1.conf" option:
 +
<pre>
 +
cd /usr/lib/build/configs
 +
# To get the meego-1.2 conf
 +
sudo wget http://stskeeps.subnetmask.net/meego-1.2.conf
 +
sudo ln -sf meego-1.2.conf default.conf
 +
</pre>
 +
 +
* GPG Key
build also will check rpm package signature, so you must import public key of repository you're using, for example:
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/
+
For http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/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
+
You can get its public key for http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm
 +
 
 +
If you are building MeeGo packages on same MeeGo version you may already have the key, in which case importing will fail.
<pre>
<pre>
-
$ wget http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/repodata/repomd.xml.key
+
$ wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm
-
$ sudo rpm --import repomd.xml.key
+
$ rpm2cpio meego-release-1.2.0-2.1.noarch.rpm | cpio -idmv
 +
$ rpm --import ./etc/pki/rpm-gpg/RPM-GPG-KEY-meego02
</pre>
</pre>
-
+
 
 +
=== Build a package ===
 +
 
 +
* Build from src [[rpm]]
This command will build a cpio binary package for MeeGo.
This command will build a cpio binary package for MeeGo.
 
 
<pre>
<pre>
-
build --repository http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/ --arch i686 cpio-2.11-2.6.src.rpm
+
build --repository http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/ --arch i686 cpio-2.11-2.6.src.rpm
</pre>
</pre>
 +
* Build from Spec file
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.
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.
 
 
<pre>
<pre>
-
build --repository http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/ --arch i686 cpio.spec
+
build --repository http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/ --arch i686 cpio.spec
</pre>
</pre>
 +
* Build with multiple repository
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 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:
Line 48: Line 80:
build --repository http://repo.meego.com/MeeGo/builds/trunk/preview/core/repos/ia32/packages/ \
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/ \
     --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
+
     --arch i686 cpio-2.11-2.meego.src.rpm
</pre>
</pre>
 +
* Specify cache dir
The default cache dir is /var/cache/build, you can use option –cachedir to set to other dir.
The default cache dir is /var/cache/build, you can use option –cachedir to set to other dir.
Line 64: Line 97:
Your cpio binary package is /var/tmp/build-root/home/abuild/rpmbuild/RPMS/i586/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
-
==  Troubleshooting (ARM) ==
+
 
 +
 
 +
== Development your package using build ==
 +
 
 +
=== Unpack & make change ===
 +
 
 +
If you want to modify packages, such as add/modify/remove patches, you need unpack src.rpm first. Then development can be based on source code.
 +
 
 +
This command would unpack src.rpm to current directory, and your work can be in this directory.
 +
 
 +
  rpm2cpio XXX.src.rpm | cpio -idmv
 +
 
 +
#If you want to add a patch, you just need copy the patch to current directory and add this patch in spec file.
 +
#If you wan to remove patches, you just need to remove them in spec file.
 +
#If you want to modify exist patch, you can modify the special patch and spec file need not to modify.
 +
 
 +
 
 +
=== Build the package ===
 +
 
 +
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
 +
 
 +
binary RPM package can be found in  /var/tmp/build-root/home/abuild/rpmbuild/RPMS/.
 +
 
 +
 
 +
==  Troubleshooting ==
 +
 
 +
=== rpm verify failed ===
 +
 
 +
If you meet below error, please import GPG key first, if the issue still exist and you are using Ubuntu10.04, you may have a try to workaround the issue by installing the "rpm" package for 10.10, there seems to be a bug for "rpm" in 10.04 which fails to verify package signature.
 +
<pre>
 +
downloading http://linux-ftp.jf.intel.com/pub/mirrors/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/autoconf-2.68-1.3.noarch.rpm ...
 +
rpm verify failed
 +
</pre>
 +
Steps to fix:
 +
1. add 10.10 repo to /etc/apt/sources.list
 +
<pre>
 +
deb http://cn.archive.ubuntu.com/ubuntu/ maverick  main restricted
 +
deb http://cn.archive.ubuntu.com/ubuntu/ maverick-updates  main restricted
 +
</pre>
 +
 
 +
2. remove old rpm and install new one
 +
<pre>
 +
$ sudo apt-get update
 +
$ sudo apt-get remove rpm
 +
$ sudo apt-get install rpm
 +
</pre>
 +
 
 +
3. comment out 10.10 repo to avoid upgrade other packages
=== Exec format error ===
=== 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
+
You may have such issue when using 'build' to create a armv7l rpm package, please see detailed solution for the distro
-
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' to reinstall this part, and maybe you will meet some problem because of its dependencies ,and  you can uninstall all of them first.
+
 
-
the other commands maybe useful:
+
* Fedora13
 +
Try command:'file /usr/bin/qemu-arm', and its output should show "statically linked", if not, you can re-install the qemu package(the package maybe changes, you can go the web address to get it, then install it).
 +
$file /usr/bin/qemu-arm
 +
$sudo rpm -i http://download.opensuse.org/repositories/home:/dl9pf:/qemu/Fedora_12/i386/qemu-devel-0.13git2010.06.24.1826-8.1.i386.rpm
 +
 
 +
* Ubuntu10.04
 +
Please install 'qemu-arm-static'
 +
$sudo apt-get install qemu-arm-static
 +
 
 +
* Debian
 +
Please 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.--[[User:Kismeter|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 [https://bugs.meego.com/show_bug.cgi?id=18905 bug 18905]
 +
 
 +
===RPM key import failed===
 +
 
 +
If you are running the instructions on same version of MeeGo as the repository you are trying to build from, you probably already have the GPG key. In this case trying to import it again will fail but won't say why.
 +
 
 +
== Another language version of this page ==
 +
 
 +
* [[不需要obs的本地build-_简体中文]]

Latest revision as of 17:39, 5 September 2011

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'

Install '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.

  • If your host is MeeGo, you need to install one more package 'perl-XML-Parser'
 zypper install build perl-XML-Parser


Setup

After you install it, you can run “build –help” to get help info. You need to run 'build' as root.

  • Proxy

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"
  • Conf file

You may also need to set correct default distro target, or use the "build --dist=/usr/lib/build/configs/meego-1.1.conf" option:

cd /usr/lib/build/configs
# To get the meego-1.2 conf
sudo wget http://stskeeps.subnetmask.net/meego-1.2.conf
sudo ln -sf meego-1.2.conf default.conf
  • GPG Key

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/releases/1.2.0/repos/oss/ia32/packages

You can get its public key for http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm

If you are building MeeGo packages on same MeeGo version you may already have the key, in which case importing will fail.

$ wget http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/meego-release-1.2.0-2.1.noarch.rpm
$ rpm2cpio meego-release-1.2.0-2.1.noarch.rpm | cpio -idmv
$ rpm --import ./etc/pki/rpm-gpg/RPM-GPG-KEY-meego02

Build a package

  • Build from src rpm

This command will build a cpio binary package for MeeGo.

build --repository http://repo.meego.com/MeeGo/releases/1.2.0/repos/oss/ia32/packages/ --arch i686 cpio-2.11-2.6.src.rpm
  • Build from Spec file

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/releases/1.2.0/repos/oss/ia32/packages/ --arch i686 cpio.spec
  • Build with multiple repository

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 cpio-2.11-2.meego.src.rpm
  • Specify cache dir

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

Unpack & make change

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

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

 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.


Build the package

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

binary RPM package can be found in /var/tmp/build-root/home/abuild/rpmbuild/RPMS/.


Troubleshooting

rpm verify failed

If you meet below error, please import GPG key first, if the issue still exist and you are using Ubuntu10.04, you may have a try to workaround the issue by installing the "rpm" package for 10.10, there seems to be a bug for "rpm" in 10.04 which fails to verify package signature.

downloading http://linux-ftp.jf.intel.com/pub/mirrors/MeeGo/releases/1.2.0/repos/oss/ia32/packages/noarch/autoconf-2.68-1.3.noarch.rpm ... 
rpm verify failed

Steps to fix: 1. add 10.10 repo to /etc/apt/sources.list

deb http://cn.archive.ubuntu.com/ubuntu/ maverick  main restricted
deb http://cn.archive.ubuntu.com/ubuntu/ maverick-updates  main restricted 

2. remove old rpm and install new one

$ sudo apt-get update
$ sudo apt-get remove rpm
$ sudo apt-get install rpm

3. comment out 10.10 repo to avoid upgrade other packages

Exec format error

You may have such issue when using 'build' to create a armv7l rpm package, please see detailed solution for the distro

  • Fedora13

Try command:'file /usr/bin/qemu-arm', and its output should show "statically linked", if not, you can re-install the qemu package(the package maybe changes, you can go the web address to get it, then install it).

$file /usr/bin/qemu-arm
$sudo rpm -i http://download.opensuse.org/repositories/home:/dl9pf:/qemu/Fedora_12/i386/qemu-devel-0.13git2010.06.24.1826-8.1.i386.rpm  
  • Ubuntu10.04

Please install 'qemu-arm-static'

$sudo apt-get install qemu-arm-static
  • Debian

Please 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

RPM key import failed

If you are running the instructions on same version of MeeGo as the repository you are trying to build from, you probably already have the GPG key. In this case trying to import it again will fail but won't say why.

Another language version of this page

Personal tools