Mer/Build: Difference between revisions

From Maemo Wiki
Jump to navigationJump to search
imported>epage
m I guess I didn't read the docs closely enough and it took me a sec to realize it was running "su" and not "sudo", so hoping adding the workaround for disabled root accounts can help.
imported>lbt
Broken into managable chunks
Line 1: Line 1:
This page documents how to use the [http://build.opensuse.org openSUSE Build Service] with Mer. More on the openSUSE Buildservice [http://en.opensuse.org/Build_Service here].
=LBT IS RE-WRITING THIS SECTION TODAY (4 June)=
 
This section documents how to use the [http://build.opensuse.org openSUSE Build Service] with Mer. More on the openSUSE Buildservice [http://en.opensuse.org/Build_Service here].


A simple way to think of OBS is as a version control system for source tarballs and .dsc files and whenever you commit a tarball the build farm compiles it for you.
A simple way to think of OBS is as a version control system for source tarballs and .dsc files and whenever you commit a tarball the build farm compiles it for you.
Line 5: Line 7:
Over and above this OBS provides a local tool called osc that lets you do clean builds not only for your own OS and architecture but also for other distros and even other architectures (armel).
Over and above this OBS provides a local tool called osc that lets you do clean builds not only for your own OS and architecture but also for other distros and even other architectures (armel).


== Installing OBS tools locally ==
==Getting Started==
 
You'll need an [https://secure-www.novell.com/selfreg/jsp/createOpenSuseAccount.jsp?target=http://www.opensuse.org account with Novell]
 
=== Debian ===
Assuming a Debian Lenny/5.0 development box locally:
 
To get the OBS tools repository add the following line:
deb <nowiki>http://download.opensuse.org/repositories/openSUSE:/Tools/Debian_5.0/ /</nowiki>
to a new file called:
/etc/apt/sources.list.d/obs.list
 
Then
apt-get update
apt-get install osc build qemu
 
=== Ubuntu ===
Assuming an Ubuntu9.04 development box locally:
 
To get the OBS tools repository add the following line:
deb <nowiki>http://download.opensuse.org/repositories/openSUSE:/Tools/xUbuntu_9.04/ /</nowiki>
to a new file called:
/etc/apt/sources.list.d/obs.list
 
Then
apt-get update
apt-get install osc build
 
Now edit <code>/etc/apt/sources.list.d/obs.list</code> and comment that line out.
 
Note there is a problem in Ubuntu9.04 osc as of 25 May '09... to fix it, do this as root:
  cd /usr/lib/python2.6/dist-packages/
  ln -s ../site-packages/osc* .
 
Ubuntu qemu isn't up to it so we need the Debian one:
 
Add the following lines:
deb <nowiki>http://download.opensuse.org/repositories/openSUSE:/Tools/Debian_5.0/ /</nowiki>
deb <nowiki>http://ftp.debian.org/debian/</nowiki> stable main
to a new file called:
/etc/apt/sources.list.d/debian5_qemu.list
 
Then
apt-get update
apt-get install qemu
 
 
now remove that file:
<code>rm /etc/apt/sources.list.d/debian5_qemu.list</code>
 
and run
apt-get update
 
==== Troubleshooting ====
 
If you get the following error when adding one of these repos
W: GPG error: http://ftp.debian.org stable Release: The following signatures couldn't be verified because the public key is not available: NO_PUBKEY ''SOMEKEY''
Then run the command
gpg --keyserver pgpkeys.mit.edu --recv-key ''SOMEKEY'' && gpg -a --export  ''SOMEKEY'' | sudo apt-key add -
replacing ''SOMEKEY'' with the complained about key
 
=== All OSes ===
Now, as a normal user, run
osc
and enter novell.com username/passwd when prompted (note these are stored in cleartext in the config file). Note this isn't supposed to do anything (it prints out the osc help) but it stores your name/pw for future use.
 
Go and [https://build.opensuse.org login].
 
Make sure you click the "let me build packages" button.
 
There is a link to 'Home Project' on the left, follow this and enter a description.
 
=== Local osc setup ===
Create a local build path.
 
mkdir -p ~/maemo/Mer/obs
 
All references below with (yourusername) should of course be replaced with the login name on your local machine.
 
You can now check some settings in your ~/.oscrc :
 
This is the OBS builder we're using... maybe we'll use a maemo.org instance one day?
apiurl = <nowiki>https://api.opensuse.org</nowiki>
 
This specifies where all the cached binary packages are held to create a chroot build environment. Around 300MB.
packagecachedir = /home/(yourusername)/maemo/Mer/obs/.pkg-cache/
 
This specifies the default location where a complete chroot build will be installed. This will be a minimal OS install - allow 400MB minimum.  Replace (yourusername) with your current login name
build-root = /home/(yourusername)/maemo/Mer/obs/build-%(repo)s-%(arch)s
 
The next section is credentials for access control to the builder.
<nowiki>[https://api.opensuse.org]</nowiki>
user = <username>
pass = <password>
 
== Getting Mer and Packages ==
 
Create and cd to a directory to act as the root for the OBS/Mer repository. You'll need space to have a copy of various Mer source packages - around 650MB
 
cd ~/maemo/Mer/obs
 
Now <code>osc ls Maemo:Mer:Devel</code> will list all the packages.
 
If you want the ''entire'' Mer project then you can run <code>osc co Maemo:Mer:Devel</code> to checkout the entire project as tar.gz and .dsc files, or to get just one package <code>osc co Maemo:Mer:Devel/''<package>''</code>
 
Errors indicating "HTTP Unauthorized" may indicate account or password issues.
 
== Building a package locally ==


(Note: if you have Scratchbox then you may need to see the section below on temporarily disabling it)
The first thing to do is to [[/Install OBS|install OBS]]. This will provide access to the tools and source used to build Mer.


To work on a package go to the right location and get the source.
Then you should become familiar with building an application using OBS but outside the Mer repository. This is explained in detail in [[/Application Building|Application Building]].
osc co Maemo:Mer:Devel/maemopad
cd Maemo:Mer:Devel/maemopad        # ie <osc project dir>
osc up
osc build --clean Ubuntu_9.04    armv5el maemopad*.dsc        # ie <project.dsc>


This will download all the (arm) debs to create a local chroot - it'll take a while the first time but will use a cache after that.
When you are comfortable with that it makes sense to look at the [[/Mer Packages|Mer Packages]].


Eventually it will prompt you for the root passwd in order to chroot etc. After that the builder will su to the "abuild" user (uid:gid 399:399) and build the code.
Finally there are [[/Processes|processes]] used to manage the Mer packages.


Note: On some systems (particularly Ubuntu), the root account is disabled, preventing your ability to su into it.  To workaround this, run the following command
sudo passwd root
If you like you can work inside qemu chroot:
chroot /home/(yourusername)/maemo/Mer/obs/build-standard-armv5el su abuild                # this is the dir you set in .oscrc as the build-root.
cd /usr/src/packages/BUILD
at this point:
./configure
make
etc... all work using the binfmt_misc redirection.
== To create a new package ==
These osc commands are done in your own area - use your username after "home:"
Before you can create projects in your home project, you have to create it using the web interface:
* Click on "Home project" in the left navigation bar in the OBS website
* Click on "Create Project"
Run
osc meta pkg -e home:<username> <package>
This pops up an editor where you can edit the name/description and then save.
This will tell the OBS server about the package.
To get a local (empty) copy run
osc up
You might need to checkout your home project first:
osc co home:<username>
This makes a package directory so now you can:
cp /path/to/<package>.tar.gz /path/to/<package>.dsc home:<username>/<package>
cd home:<username>/<package>
Then add them to version control
osc addremove
and upload them
osc commit
To watch what is going on:
osc buildlog <target>
so
osc buildlog Debian_5.0 i586
This does something like a "tail -f" of the Xen builder.
=== Standalone Project ===
On the web, create the (sub)project maemopad.
In the repository section add a repository and from advanced select the Mer project: Maemo:Mer:Devel
Now we need to pick build targets:
  <nowiki>https://build.opensuse.org/project/add_target_simple?project=home:<username></nowiki>
And pick one or two ( I picked Debian Lenny and Ubuntu 8.10)
This creates a standalone project and builds against another project
Goto your obs base (eg /scratch3/maemo/Mer/obs) and checkout the project:
  osc co home:<username>:maemopad
Now create the package metadata:
  osc meta pkg -e home:<username>:maemopad maemopad
and get a local copy (empty still):
  cd home:<username>:maemopad/
  osc up
the 'osc up' created a directory so go into it and get the source:
  cd maemopad/
  wget <nowiki>http://repository.maemo.org/pool/maemo4.1.2/free/m/maemopad/maemopad_2.4.dsc</nowiki>
  wget <nowiki>http://repository.maemo.org/pool/maemo4.1.2/free/m/maemopad/maemopad_2.4.tar.gz</nowiki>
Use the cheap'n'cheerful 'register all file adds and removes with vc'-command:
  osc addremove
and then commit the source which uploads it to the OBS
  osc commit -m "added source"
This will trigger a rebuild and you can access the logs.
== Co-existing with Scratchbox ==
If you use the OBS local build facility and the scratchbox-1 local builder then you need to know how to teach the two emulators how to co-exist.
Both OBS and Scratchbox use [http://git.kernel.org/gitweb.cgi?p=linux/kernel/git/torvalds/linux-2.6.git;a=blob;f=Documentation/binfmt_misc.txt;hb=HEAD binfmt_misc] to cause the kernel to invoke (in our case) qemu when it comes across an armel binary.
To disable qemu and enable sbox
  echo 0 > /proc/sys/fs/binfmt_misc/arm
  echo 0 > /proc/sys/fs/binfmt_misc/armeb
  echo 1 > /proc/sys/fs/binfmt_misc/sbox-arm
  echo 1 > /proc/sys/fs/binfmt_misc/sbox-armeb
To disable sbox and enable arm
  echo 1 > /proc/sys/fs/binfmt_misc/arm
  echo 1 > /proc/sys/fs/binfmt_misc/armeb
  echo 0 > /proc/sys/fs/binfmt_misc/sbox-arm
  echo 0 > /proc/sys/fs/binfmt_misc/sbox-armeb
Don't do this whilst a build is in progress!
Note that you may need to run :
  qemu-binfmt-conf.sh
to register qemu to handle arm binaries
== Linking ==
To link to a source create a _link file containing:
  <link project="linked project name" package="linked package name">
optionally:
  <patches>
    <apply name="name of the first patch" />
  </patches>
Sadly these patches apply to the files in the source; so this means you need to apply the diff to the maemo-ised diff file.


== OBS Build Farm ==
== OBS Build Farm ==
Line 246: Line 22:
http://wiki.maemo.org/Mer/Documentation/Build/Common_Problems
http://wiki.maemo.org/Mer/Documentation/Build/Common_Problems


== OBS Project structure and promotion ==
The Mer projects on OBS look like this:
Maemo:Mer:Stable
Maemo:Mer:Stable:HW:Beagle
Maemo:Mer:Stable:HW:N8x0
This means all devices will have the main 'Stable' repository and an appropriate HW repository.
The development area is expanded slightly:
Maemo:Mer:Devel:Apps
Maemo:Mer:Devel:Base
Maemo:Mer:Devel:MaemoCommon
Maemo:Mer:Devel:MaemoCommon:L10n
Maemo:Mer:Devel:UI
Maemo:Mer:Devel:HW:Beagle:Devel
Maemo:Mer:Devel:HW:N8x0:Devel
Packages in each of these Devel subproject areas can be hacked on and then, when they're kinda working they are consolidated into the :Devel area (which is used as a build target for the :Devel:* subprojects)
Maemo:Mer:Devel
Maemo:Mer:Devel:HW:N8x0
Maemo:Mer:Devel:HW:Beagle
Packages are placed in :Testing with the intention of including
them in the next release subject to QA and bug fixes
  Maemo:Mer:Testing
  Maemo:Mer:Testing:HW:Beagle
  Maemo:Mer:Testing:HW:N8x0
Once :Testing is ready a release of all packages to a numbered version is made:
  Maemo:Mer:0.13
  Maemo:Mer:0.13:HW:Beagle
  Maemo:Mer:0.13:HW:N8x0
Note that the :HW promotion process is slightly different:
Maemo:Mer:Devel:HW:N8x0:Devel -> Maemo:Mer:Devel:HW:N8x0 -> Maemo:Mer:Testing:HW:N8x0 -> Maemo:Mer:Stable:HW:N8x0
=== Maemo:Mer:Devel:Apps ===
Mer Applications and Applets
Packaged applications included in Mer
* advanced-backlight
* advanced-power
* advanced-power-monitor
* blueman
* extras-repository
* finefm
* galculator
* homeip
* maemopadplus
* midori
* mirage
* mplayer
* osso-xterm
* vte
* personal-launch
* wpeditor
=== Maemo:Mer:Devel:Base ===
Mer system base
Packages which deals with the underlying functionality of Mer
that isn't directly presented to the user, such as booting,
networking, logging, rescue, generic X support
* apt
* alsa-plugins
* circular-syslogd
* core-pattern
* evkey
* base64
* hal
* network-manager
* cnetworkmanager
* pulseaudio
* sudo
* tslib
* upstart
* utelnetd
* waitdbus
* xserver-xorg-input-evdev
* xresponse-visualize
* xkeyboard-config
* xf86-input-tslib
=== Maemo:Mer:Devel:MaemoCommon ===
Maemo and Hildon Packages
These packages should ideally be unmodified from the upstream Maemo and hildon projects
* alarmd
* clinkc
* certman
* clipboard-manager
* dbus-glib
* epeg
* alarmd
* gail
* gconf2
* glib2.0
* gnome-vfs-filechooser-backend
* gstreamer0.10-ffmpeg-osso
* gtk+2.0
* gtkhtml
* hildon-application-manager
* hildon-control-panel
* hildon-input-method
* hildon-input-method-framework
* icd2-osso-ic-dev
* hildon-thumbnail
* hildon-theme-tools
* hildon-theme-cacher
* hildon-games-wrapper
* libconbtui
* libconic
* libdb1
* libhildon
* libhildonfm
* libhildonhelp
* libhildonmime
* libosso
* maemo-launcher
* maemopad
* mce-dev
* osso-af-settings
* osso-af-utils
* osso-gnome-vfs2
* osso-gnomevfs2-extra
* osso-gwconnect
* osso-gwobex
* osso-systemui-dbus-dev
* osso-uri-l10n-public
* sapwood
* screenshot-tool
* tablet-browser-interface
=== Maemo:Mer:Devel:MaemoCommon:L10n ===
L10n shared with Maemo
Packages with translation strings which we share with Maemo
* marketing-release-public
* gtk20-l10n
* hildon-application-manager-l10n-public
* hildon-common-strings-l10n-public
* hildon-control-panel-l10n-public
* hildon-fm-l10n-public
* hildon-libs-l10n-public
* ke-recv-l10n-public
* maemo-af-desktop-l10n-public
* osso-applet-tasknavigator-l10n-public
=== Maemo:Mer:Devel:UI ===
Mer User interface &amp; Behaviour
Packages which deals with presenting the Hildon Desktop and the
Mer UI, and generic functionality across platforms
* zenity
* powerlaunch
* ubuntulooks
* first-boot-wizard
* hildon-desktop
* hildon-desktop-env
* hildon-desktop-layout-alpha
* hildon-home-weather
* hildon-initscripts
* hildon-icons
* hildon-theme-layout-mer
* hildon-theme-liberty-mer
* hildon-theme-selector
* hildon-cpa-dummy
* liberty-sounds-ui
* marquee-plugins
* matchbox-window-manager
* libmatchbox1
* network-manager-applet
* hildon-input-method-plugins-example
* hildon-plugins-settings
* pygtk
* python-conic
* python-hildon
* python-hildondesktop
* python-osso
* load-applet
=== Maemo:Mer:Devel:HW:Beagle:Devel ===
Development area for Beagle specific code
=== Maemo:Mer:Devel:HW:N8x0:Devel ===
Development area for N8x0 specific code
* dsme-tools
* kernel-diablo
* kernel-diablo-modules-fbcon
* cx3110x-module
* cx3110x-module-src
* cx3110x-umac-module
* n810-slideout-kbd-xmodmap
* mer-omapfb-splash
* mer-rescue-menu
* nit-bootmenu-compat
* nit-kernel-compat
* nokia-n8x0-firmware
* nokia-tablets-pointercal
* omap-fb-console
* omap-fb-tools
* x11proto-xsp
* libxsp
* usbnet-emergency-telnetd
=== Promotion Tasks ===
To promote a package:
  osc copypac <SOURCEPRJ> <SOURCEPAC> <DESTPRJ>
eg:
  osc copypac Maemo:Mer:Devel glib2.02 Maemo:Mer:Testing
Ensure that:
  osc meta prjconf <SOURCE>
is copied to the <TARGET> conf. This may contain things like package selection preferences.
Currently the prjconf is:
  Prefer: hildon-fm-l10n-mr0
  Ignore: hildon-fm-l10n-mr
== To Promote :Devel To :Testing ==
First pipe over the project metadata:
  osc meta prjconf Maemo:Mer:Devel  | osc meta prjconf Maemo:Mer:Testing -F -
Then run:
  for i in $(osc ls Maemo:Mer:Devel); do echo $i; osc copypac Maemo:Mer:Devel $i Maemo:Mer:Testing ; done
  for HW in HW:N8x0 HW:SmartQ HW:Freerunner HW:Beagle; do
    for i in $(osc ls Maemo:Mer:Devel:$HW); do echo $i; osc copypac Maemo:Mer:Devel:$HW $i Maemo:Mer:Testing:$HW ; done
  done
== To Promote :Testing to :Stable ==
The process here is to create a versioned repo; eg :0.13
  export STABLE=0.13
First pipe over the project metadata:
  osc meta prjconf Maemo:Mer:Testing  | osc meta prjconf Maemo:Mer:$STABLE -F -
Then run:
  for i in $(osc ls Maemo:Mer:Testing); do echo $i; osc copypac Maemo:Mer:Testing $i Maemo:Mer:$STABLE ; done
  for HW in HW:N8x0 HW:SmartQ HW:Freerunner HW:Beagle; do
  for i in $(osc ls Maemo:Mer:Testing:$HW); do echo $i; osc copypac Maemo:Mer:Testing:$HW $i Maemo:Mer:$STABLE:$HW ; done
  done
Then, once it's built and stable, use _aggregate to link each package to :Stable
First clean out :Stable
  for i in $(osc ls Maemo:Mer:Stable); do osc deletepac Maemo:Mer:Stable $i ; done
  for HW in HW:N8x0 HW:SmartQ HW:Freerunner HW:Beagle; do
    for i in $(osc ls Maemo:Mer:Stable:$HW); do echo $i; osc deletepac Maemo:Mer:Stable:$HW $i; done
  done
  for i in $(osc ls Maemo:Mer:$STABLE); do osc aggregatepac Maemo:Mer:$STABLE $i Maemo:Mer:Stable; done
  for HW in HW:N8x0 HW:SmartQ HW:Freerunner HW:Beagle; do
    for i in $(osc ls Maemo:Mer:$STABLE:$HW); do echo $i; osc aggregatepac Maemo:Mer:$STABLE:$HW $i Maemo:Mer:Stable:$HW; done
  done
Note that :Stable project must be setup to publish and to build


[[Category:Mer|Build]]
[[Category:Mer]]

Revision as of 09:03, 4 June 2009

LBT IS RE-WRITING THIS SECTION TODAY (4 June)

This section documents how to use the openSUSE Build Service with Mer. More on the openSUSE Buildservice here.

A simple way to think of OBS is as a version control system for source tarballs and .dsc files and whenever you commit a tarball the build farm compiles it for you.

Over and above this OBS provides a local tool called osc that lets you do clean builds not only for your own OS and architecture but also for other distros and even other architectures (armel).

Getting Started

The first thing to do is to install OBS. This will provide access to the tools and source used to build Mer.

Then you should become familiar with building an application using OBS but outside the Mer repository. This is explained in detail in Application Building.

When you are comfortable with that it makes sense to look at the Mer Packages.

Finally there are processes used to manage the Mer packages.


OBS Build Farm

http://wiki.maemo.org/Mer/Documentation/Build/Common_Problems