m (→Pre-requisites: Formatting) |
(→Set up QtCreator to produce files: add an other workarround) |
||
| (44 intermediate revisions not shown) | |||
| Line 1: | Line 1: | ||
| - | The | + | The MeeGo Open Build System (OBS) seems rather complicated, this page will attempt to make it nice and easy to get started. See also the Mer project's documentation on [http://wiki.maemo.org/Mer/Build/Application_Building application building] with OBS. |
It's a work in progress, feel free to add and modify! | It's a work in progress, feel free to add and modify! | ||
| - | = | + | =Prerequisites= |
* You need a meego.com login to be able to access the OBS | * You need a meego.com login to be able to access the OBS | ||
| - | |||
* Install osc (for example, <code>apt-get install osc</code> may work out-of-the-box on recent versions of Ubuntu & Debian, other repositories are available on [http://download.opensuse.org/repositories/openSUSE:/Tools/ openSUSE tools]) | * Install osc (for example, <code>apt-get install osc</code> may work out-of-the-box on recent versions of Ubuntu & Debian, other repositories are available on [http://download.opensuse.org/repositories/openSUSE:/Tools/ openSUSE tools]) | ||
| + | * As an alternative to osc you may use the web interface to upload your files | ||
| - | =Setting up your home project= | + | =Preparations= |
| + | |||
| + | OBS is based around ''projects'', ''packages'' and ''repositories''. '''Packages''' have a set of files (source code, packaging meta-data, etc.) which are compiled by build servers against particular distributions. Each distribution results in your code being available in a '''repository'''. | ||
| + | |||
| + | ==Setting up your home project== | ||
Your home project is like a home directory in which you can create sub-projects, repositories, etc. | Your home project is like a home directory in which you can create sub-projects, repositories, etc. | ||
| - | * Visit the OBS page | + | * Visit the [https://build.pub.meego.com/ OBS page] |
| + | * Follow the extra [https://build.pub.meego.com/user/register_user registration instructions] | ||
* Log in and click on 'create home project' (down at the bottom of the page iirc) | * Log in and click on 'create home project' (down at the bottom of the page iirc) | ||
| + | ==Creating a project== | ||
| + | A project is required before anything can be built. | ||
| - | + | * Go to the "Projects" tab for the project in which you wish to create it | |
| + | * Select "Add a new package" | ||
| + | * Enter a UNIX-style (all lower case) "Name" | ||
| + | * Enter a title-case, with appropriate spacing, "Title" | ||
| + | * Enter a brief "Description" | ||
| + | * Click "Save Changes" | ||
| - | + | ==Setting up a sub-project (optional)== | |
| + | A sub-project allows you to group related activities together. | ||
| - | + | * In the "Overview" tab for your home project, select "Actions > Create subproject". | |
| - | From the terminal | + | ==Adding repositories== |
| - | * Checkout | + | |
| + | * Go to the "Repositories" tab for the project in question | ||
| + | * Click "Add Repository" | ||
| + | |||
| + | As Harmattan OBS support is still in development, you can [http://forum.meego.com/showpost.php?p=25005&postcount=29 add it through the advanced interface]. | ||
| + | |||
| + | Before trying to issue submit requests to projects that are under automated integration (ex. CE:* projects on community OBS), make sure you have created the correct set of repositories needed. | ||
| + | |||
| + | For each repository in target project, there should be a repository in source project which builds only against the target repository and have at least the same architectures as the target repository they build against. | ||
| + | |||
| + | This can be done easily using [https://github.com/MeeGoIntegration/mint-utils/blob/master/addrepos.py the addrepos osc plugin ], drop it in your ~/.osc-plugins and run the command : | ||
| + | |||
| + | osc -A https://api.pub.meego.com addrepos MYPROJECT TARGETPROJECT | ||
| + | |||
| + | It will open an editor with the repositories appended to the bottom of your prj meta. | ||
| + | |||
| + | =Adding files to a package and building them= | ||
| + | |||
| + | ==Needed files== | ||
| + | |||
| + | ===MeeGo=== | ||
| + | For MeeGo you need a .spec file and a tarball containing your source code, etc. | ||
| + | |||
| + | ===Harmattan=== | ||
| + | For Harmattan you need a <code>.dsc</code> file, source tarball and <code>.debian.tar.gz</code> (this allows one to keep the debian directory out of the source). The source is extracted using <code>dpkg-source -x ....dsc</code>, so restrictions on file formats apply (e.g. <code>mypkg_1.0.0.tar.gz</code>, <code>mypkg_1.0.0.dsc</code>, <code>mypkg_1.0.0.debian.tar.gz</code>) | ||
| + | |||
| + | Alternatively, you may just use the <code>.dsc</code> together with a <code>.tar.gz</code> file containing both, the sources and the debian directory. | ||
| + | |||
| + | ====Use an additional tool==== | ||
| + | The steps below are encapsulated in a follow-up to [http://mud-builder.garage.maemo.org/ mud-builder], called <code>mud2</code>. The [http://forum.meego.com/showpost.php?p=24047&postcount=15 tool only has a dependency on Perl] and performs all the steps below, hoping to streamline the process of taking Qt Creator projects and producing MeeGo, Harmattan and Fremantle OBS-compatible files. | ||
| + | |||
| + | ====Set up QtCreator to produce files==== | ||
| + | '''First''', you need to modify the rules file (<code>qtc_packaging/debian_harmattan/rules</code>, which is then copied to <code>debian/rules</code>): | ||
| + | * Uncomment the lines marked with <code># Uncomment this line for use without Qt Creator</code>. | ||
| + | * In the <code>clean</code> section, comment the line <code>$(MAKE) clean</code> | ||
| + | |||
| + | '''Second''', to get the files needed for building you may add a custom build step: | ||
| + | * Projects -> Harmattan -> Build -> Build Steps -> Add Build Step | ||
| + | * Enter Command: <code>C:\QtSDK\Madde\wbin\mad.cmd</code> or in Linux use <code>/opt/QtSDK/Madde/bin/mad</code> | ||
| + | * Leave Working directory unchanged: <code>%{buildDir}</code> | ||
| + | * Enter Command arguments: <code>-t harmattan-platform-api dpkg-buildpackage -sa -S -uc -us -Imoc -Iobj -Ircc -Iui -I.svn -I*.deb -I*.changes -Iqtc_packaging -IMakefile -I*.pro.user -I<packagename></code> | ||
| + | Notice that most of the command arguments remove unneccessary files from the tar package. They are not mandatory but reduce file size. | ||
| + | * Build it | ||
| + | You will get the resulting <code><packagename>-<version>.tar.gz</code> and <code><packagename>-<version>.dsc</code> (together with a non-needed <code><packagename>-<version>.source.changes</code>) in the directory above the source directory. | ||
| + | |||
| + | '''Take care''': | ||
| + | QtCreator uses the <code>debian</code> directory for packaging. However, it only copies the content of <code>qtc_packaging/debian_harmattan</code> into <code>debian</code> when you deploy the package (thus press run or debug). If you change something in <code>qtc_packaging/debian_harmattan</code> and only run a build without run/debug, you must manually copy the changes to <code>debian</code> before. | ||
| + | |||
| + | '''Security framework relevant applications''': | ||
| + | The <code>rules</code> file must include a step to add the <code><package name>.aegis</code> manifest into the built debian archive. For this, add <code>aegis-deb-add -control debian/<package name>/DEBIAN/control .. debian/<package name>.aegis=_aegis</code> at the end (after <code>dh_builddeb</code>). Needed build dependency in the <code>control</code> file is <code>aegis-builder (>= 1.6)</code>. | ||
| + | |||
| + | '''If you are using Windows or having build problems with changelog or rules file:''' | ||
| + | It seams that QTCreator for Windows sometimes creates the changelog and rules file with windows lineendings. | ||
| + | Which causes the OBS to fail. (a <code>rules</code> file with wrong lineendings causes the <code>clean</code> step to fail. | ||
| + | |||
| + | '''If you got an error code -2 while compiling''': | ||
| + | It seams that QtCreator didn't replace the var <packagename> by the real package name in the argument list, so enter the package directly instead. | ||
| + | |||
| + | '''If you get the error : 'harmattan-platform-api': no such target''': | ||
| + | It seams that the target didn't exists in your SDK, to get the list of target available run Command: <code>C:\QtSDK\Madde\wbin\mad.cmd list</code> or in Linux run <code>/opt/QtSDK/Madde/bin/mad list</code> | ||
| + | Example : harmattan_10.2011.34-1 | ||
| + | |||
| + | '''If you get an error about MDeclarativeCache unknow while compiling the qmlapplicationviewer''' : | ||
| + | It seams that some builds depends are missing, add applauncherd-dev and pkg-config to build depends in the debian/control file. | ||
| + | |||
| + | ==Start building== | ||
| + | |||
| + | ===From the terminal=== | ||
| + | * Checkout (like SVN) your home project, which will contain all your sub-projects and packages | ||
osc -A https://api.pub.meego.com co home:[username] | osc -A https://api.pub.meego.com co home:[username] | ||
* Add files to your local copy | * Add files to your local copy | ||
| - | + | osc add [filename] | |
| - | + | ||
| - | osc | + | |
* Commit the files | * Commit the files | ||
| - | osc | + | osc commit |
At this point the OBS will try to build your project remotely. You can also build locally by doing <code>osc build</code> | At this point the OBS will try to build your project remotely. You can also build locally by doing <code>osc build</code> | ||
| - | Using the webinterface | + | If you add new packages later on or commit changes from another computer you can update your local copy by doing |
| + | osc update | ||
| + | |||
| + | ===Using the webinterface=== | ||
* Add the correct files as listed above and they will be automatically built for you | * Add the correct files as listed above and they will be automatically built for you | ||
| + | |||
| + | ==Debugging== | ||
| + | What to do if packages don't build in OBS. | ||
| + | |||
| + | ===Harmattan=== | ||
| + | It is advised to first try if a package builds in the Scratchbox based SDK before submitting it to OBS. The Scratchbox environment should be reasonably similar to OBS and lower rebuild time enables faster debugging of packaging issues. | ||
| + | |||
| + | Also, some packages from recent distributions might complain about out of date build dependencies, mostly concerning debhelper and cdbs. As debhelper and cdb are generally not easy to replace with newer versions, it is possible to either use older packages or edit the '''debian/control''' and '''debian/control.in''' and downgrade the dependencies. | ||
| + | |||
| + | ===OBS local build=== | ||
| + | It is possible to build packages locally, using the osc tool. Also unlike during the online build, it is possible to enter the build chroot and inspect its state. Also, local builds do not need to wait in the online build queue and may be faster (depending on local hardware). | ||
| + | |||
| + | * install osc | ||
| + | * install [http://download.opensuse.org/repositories/openSUSE:/Tools/ OBS build tools] | ||
| + | * install quemu | ||
| + | * check out a project with some packages | ||
| + | <pre> | ||
| + | osc co home:name:project | ||
| + | </pre> | ||
| + | * enter a package folder folder | ||
| + | <pre> | ||
| + | cd home:name:project/package | ||
| + | </pre> | ||
| + | * initiate local build | ||
| + | <pre> | ||
| + | osc build | ||
| + | </pre> | ||
| + | ====COBS+Harmattan==== | ||
| + | * to do a local build with the Harmattan target from COBS: | ||
| + | <pre> | ||
| + | osc build MeeGo_1.2_Harmattan_Maemo.org_MeeGo_1.2_Harmattan_standard armv7el | ||
| + | </pre> | ||
| + | |||
| + | ====Possible pitfalls==== | ||
| + | |||
| + | '''Problem:''' | ||
| + | Harmattan packages might fail to download (404) during a local build. | ||
| + | |||
| + | '''Solution:''' | ||
| + | Just wait, after all of the packages have failed it will use an alternate download method that will work. | ||
| + | |||
| + | '''Problem:''' | ||
| + | <pre> | ||
| + | failed to run command `/sbin/ldconfig': No such file or directory | ||
| + | </pre> | ||
| + | and | ||
| + | <pre> | ||
| + | chroot: failed to run command `dpkg': No such file or directory | ||
| + | </pre> | ||
| + | '''Solution:'''There are some Qemu packages missing in you system (most probably qemu-user-static or an equivalent). | ||
| + | |||
| + | On Ubuntu 11.04, these packages should be installed: | ||
| + | <pre> | ||
| + | qemu-user-static qemu-common qemu-kvm qemu | ||
| + | </pre> | ||
| + | |||
| + | '''NOTE:''' Looks like even just ''qemu-user-static'' package suffices for builds to run to completion. | ||
| + | |||
| + | =Installing packages= | ||
| + | == Into your MeeGo system == | ||
| + | {{main|Zypper#Adding_a_repository}} | ||
| + | * Once packages are built, you can include them in your MeeGo installation. | ||
| + | * The general method is: | ||
| + | zypper ar -f <nowiki>http://repo.pub.meego.com/home:/username/repository/</nowiki> title | ||
| + | zypper in <package> | ||
| + | ** Where: | ||
| + | ** ''username'' is your user | ||
| + | ** ''repository'' is the repository branch name | ||
| + | ** ''title'' is the name zypper will use for the repository | ||
| + | |||
| + | == Into Harmattan == | ||
| + | # Find the repository address: | ||
| + | ## Go to the appropriate project's ''Overview'' page (e.g. your home project, or sub-project) | ||
| + | ## Click on the MeeGo 1.2 Harmattan repository on the ''Build Status'' | ||
| + | ## Copy the link for the ''Download Repository'' | ||
| + | * Create <code>/etc/apt/sources.list.d/project.list</code> (where ''project'' is a memorable name, e.g. your username for your home project), containing the download link, prefixed with '''<code>deb</code>''' and suffixed by '''<code>./</code>'''. For example: | ||
| + | deb <nowiki>http://repo.pub.meego.com/home:/jaffa/Harmattan/</nowiki> ./ | ||
| + | * Run: | ||
| + | apt-get update | ||
| + | apt-get install package | ||
| + | :...where ''package'' is, of course, your package name. | ||
| + | |||
| + | Updates to the installed applications will appear at ''Settings > Applications > Manage Applications > Updates'' | ||
| + | |||
| + | == Into Maemo 5 == | ||
| + | Enable Extras-devel. | ||
The MeeGo Open Build System (OBS) seems rather complicated, this page will attempt to make it nice and easy to get started. See also the Mer project's documentation on application building with OBS.
It's a work in progress, feel free to add and modify!
Contents |
apt-get install osc may work out-of-the-box on recent versions of Ubuntu & Debian, other repositories are available on openSUSE tools)
OBS is based around projects, packages and repositories. Packages have a set of files (source code, packaging meta-data, etc.) which are compiled by build servers against particular distributions. Each distribution results in your code being available in a repository.
Your home project is like a home directory in which you can create sub-projects, repositories, etc.
A project is required before anything can be built.
A sub-project allows you to group related activities together.
As Harmattan OBS support is still in development, you can add it through the advanced interface.
Before trying to issue submit requests to projects that are under automated integration (ex. CE:* projects on community OBS), make sure you have created the correct set of repositories needed.
For each repository in target project, there should be a repository in source project which builds only against the target repository and have at least the same architectures as the target repository they build against.
This can be done easily using the addrepos osc plugin , drop it in your ~/.osc-plugins and run the command :
osc -A https://api.pub.meego.com addrepos MYPROJECT TARGETPROJECT
It will open an editor with the repositories appended to the bottom of your prj meta.
For MeeGo you need a .spec file and a tarball containing your source code, etc.
For Harmattan you need a .dsc file, source tarball and .debian.tar.gz (this allows one to keep the debian directory out of the source). The source is extracted using dpkg-source -x ....dsc, so restrictions on file formats apply (e.g. mypkg_1.0.0.tar.gz, mypkg_1.0.0.dsc, mypkg_1.0.0.debian.tar.gz)
Alternatively, you may just use the .dsc together with a .tar.gz file containing both, the sources and the debian directory.
The steps below are encapsulated in a follow-up to mud-builder, called mud2. The tool only has a dependency on Perl and performs all the steps below, hoping to streamline the process of taking Qt Creator projects and producing MeeGo, Harmattan and Fremantle OBS-compatible files.
First, you need to modify the rules file (qtc_packaging/debian_harmattan/rules, which is then copied to debian/rules):
# Uncomment this line for use without Qt Creator.
clean section, comment the line $(MAKE) clean
Second, to get the files needed for building you may add a custom build step:
C:\QtSDK\Madde\wbin\mad.cmd or in Linux use /opt/QtSDK/Madde/bin/mad
%{buildDir}
-t harmattan-platform-api dpkg-buildpackage -sa -S -uc -us -Imoc -Iobj -Ircc -Iui -I.svn -I*.deb -I*.changes -Iqtc_packaging -IMakefile -I*.pro.user -I<packagename>
Notice that most of the command arguments remove unneccessary files from the tar package. They are not mandatory but reduce file size.
You will get the resulting <packagename>-<version>.tar.gz and <packagename>-<version>.dsc (together with a non-needed <packagename>-<version>.source.changes) in the directory above the source directory.
Take care:
QtCreator uses the debian directory for packaging. However, it only copies the content of qtc_packaging/debian_harmattan into debian when you deploy the package (thus press run or debug). If you change something in qtc_packaging/debian_harmattan and only run a build without run/debug, you must manually copy the changes to debian before.
Security framework relevant applications:
The rules file must include a step to add the <package name>.aegis manifest into the built debian archive. For this, add aegis-deb-add -control debian/<package name>/DEBIAN/control .. debian/<package name>.aegis=_aegis at the end (after dh_builddeb). Needed build dependency in the control file is aegis-builder (>= 1.6).
If you are using Windows or having build problems with changelog or rules file:
It seams that QTCreator for Windows sometimes creates the changelog and rules file with windows lineendings.
Which causes the OBS to fail. (a rules file with wrong lineendings causes the clean step to fail.
If you got an error code -2 while compiling: It seams that QtCreator didn't replace the var <packagename> by the real package name in the argument list, so enter the package directly instead.
If you get the error : 'harmattan-platform-api': no such target:
It seams that the target didn't exists in your SDK, to get the list of target available run Command: C:\QtSDK\Madde\wbin\mad.cmd list or in Linux run /opt/QtSDK/Madde/bin/mad list
Example : harmattan_10.2011.34-1
If you get an error about MDeclarativeCache unknow while compiling the qmlapplicationviewer : It seams that some builds depends are missing, add applauncherd-dev and pkg-config to build depends in the debian/control file.
osc -A https://api.pub.meego.com co home:[username]
osc add [filename]
osc commit
At this point the OBS will try to build your project remotely. You can also build locally by doing osc build
If you add new packages later on or commit changes from another computer you can update your local copy by doing
osc update
What to do if packages don't build in OBS.
It is advised to first try if a package builds in the Scratchbox based SDK before submitting it to OBS. The Scratchbox environment should be reasonably similar to OBS and lower rebuild time enables faster debugging of packaging issues.
Also, some packages from recent distributions might complain about out of date build dependencies, mostly concerning debhelper and cdbs. As debhelper and cdb are generally not easy to replace with newer versions, it is possible to either use older packages or edit the debian/control and debian/control.in and downgrade the dependencies.
It is possible to build packages locally, using the osc tool. Also unlike during the online build, it is possible to enter the build chroot and inspect its state. Also, local builds do not need to wait in the online build queue and may be faster (depending on local hardware).
osc co home:name:project
cd home:name:project/package
osc build
osc build MeeGo_1.2_Harmattan_Maemo.org_MeeGo_1.2_Harmattan_standard armv7el
Problem: Harmattan packages might fail to download (404) during a local build.
Solution: Just wait, after all of the packages have failed it will use an alternate download method that will work.
Problem:
failed to run command `/sbin/ldconfig': No such file or directory
and
chroot: failed to run command `dpkg': No such file or directory
Solution:There are some Qemu packages missing in you system (most probably qemu-user-static or an equivalent).
On Ubuntu 11.04, these packages should be installed:
qemu-user-static qemu-common qemu-kvm qemu
NOTE: Looks like even just qemu-user-static package suffices for builds to run to completion.
Main article: Zypper#Adding_a_repository
zypper ar -f http://repo.pub.meego.com/home:/username/repository/ title zypper in <package>
/etc/apt/sources.list.d/project.list (where project is a memorable name, e.g. your username for your home project), containing the download link, prefixed with deb and suffixed by ./. For example:
deb http://repo.pub.meego.com/home:/jaffa/Harmattan/ ./
apt-get update apt-get install package
Updates to the installed applications will appear at Settings > Applications > Manage Applications > Updates
Enable Extras-devel.