Editing PyMaemo/How to build
Warning: You are not logged in.
Your IP address will be recorded in this page's edit history.
The edit can be undone.
Please check the comparison below to verify that this is what you want to do, and then save the changes below to finish undoing the edit.
Latest revision | Your text | ||
Line 1: | Line 1: | ||
+ | <b style="color: red">DRAFT</b> | ||
+ | |||
+ | = How to build PyMaemo packages= | ||
+ | |||
+ | == Introduction == | ||
+ | |||
To build PyMaemo packages from the source, you'll need: | To build PyMaemo packages from the source, you'll need: | ||
* Maemo 5 SDK | * Maemo 5 SDK | ||
* Rootstraps for X86 and ARMEL targets | * Rootstraps for X86 and ARMEL targets | ||
- | * pymaemo-tools | + | * grep-dctrl |
+ | * pymaemo-tools | ||
The scripts from pymaemo-tools are used to download packages' sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-tools uses a slightly modified of sbdmock - see pymaemo-tools README if you want to know which modifications were made. | The scripts from pymaemo-tools are used to download packages' sources and build them using sbdmock, one at a time. sbdmock, in turn, uses the SDK and the rootstraps to create a clean environment for building every package. More information about sbdmock can be obtained [[Building_packages_with_sbdmock|here]], although pymaemo-tools uses a slightly modified of sbdmock - see pymaemo-tools README if you want to know which modifications were made. | ||
Line 37: | Line 44: | ||
Clone the pymaemo-tools project inside $BASE: | Clone the pymaemo-tools project inside $BASE: | ||
- | $ git clone git | + | $ git clone [git repo] |
This will create the directory pymaemo-tools under $BASE. | This will create the directory pymaemo-tools under $BASE. | ||
- | Edit the | + | Edit the fremantle_i386.cfg and fremantle_armel.cfg under $BASE/pymaemo-tools/sbdmock, |
+ | putting the rootstrap path correspondent to each in the following key: | ||
* i386: config_opts['rootstrap'] = "$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz" | * i386: config_opts['rootstrap'] = "$BASE/rootstraps/maemo-sdk-rootstrap_5.0_i386.tgz" | ||
* armel: config_opts['rootstrap'] = "$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz" | * armel: config_opts['rootstrap'] = "$BASE/rootstraps/maemo-sdk-rootstrap_5.0_armel.tgz" | ||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
- | |||
== Building == | == Building == | ||
Line 57: | Line 57: | ||
For building all the packages for the X86 target, enter $BASE/pymaemo-tools and run: | For building all the packages for the X86 target, enter $BASE/pymaemo-tools and run: | ||
- | $ ./build_packages.sh sbdmock: | + | $ ./build_packages.sh sbdmock:fremantle_i386 packages_fremantle.ini |
- | The same can be done to ARMEL target, just replacing "i386" with " | + | The same can be done to ARMEL target, just replacing "i386" with "armel". The file packages_fremantle.ini contains all data necessary for obtaining the sources. |
You can build individual packages too, specifying them as parameters. If you want to build only, let's say, pyopenssl and pycurl for the ARMEL target, run: | You can build individual packages too, specifying them as parameters. If you want to build only, let's say, pyopenssl and pycurl for the ARMEL target, run: | ||
- | $ ./build_packages.sh sbdmock: | + | $ ./build_packages.sh sbdmock:fremantle_armel packages_fremantle.ini pyopenssl,pycurl |
Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line. | Be advised that any PyMaemo dependency for these packages must be built first, as build_packages.sh will attempt to build only the packages provided at the command line. | ||
- | There are other options for the build; for more information, run build_packages.sh with no parameters or refer to the README file inside pymaemo-tools. | + | There are other options for the build; for more information, run build_packages.sh |
+ | with no parameters or refer to the README file inside pymaemo-tools. | ||
- | When the build finishes the resultant Debian packages will be placed at $BASE/pymaemo-tools/workdir/fremantle_<target>/repo, where <target> is i386 or armel,and the build logs placed in $BASE/pymaemo-tools/workdir/fremantle_<target>/logs. From that point on, they can be installed on the targets and the ARMEL ones can be copied to the device to be installed there. | + | When the build finishes the resultant Debian packages will be placed at |
+ | $BASE/pymaemo-tools/workdir/fremantle_<target>/repo, where <target> is i386 or armel,and the build logs placed in $BASE/pymaemo-tools/workdir/fremantle_<target>/logs. | ||
+ | From that point on, they can be installed on the targets and the ARMEL ones | ||
+ | can be copied to the device to be installed there. | ||
=== Directories created === | === Directories created === | ||
- | * $BASE/pymaemo-tools/download_cache: all downloaded files are placed here, one directory by package, so you don't have to download everything again | + | * $BASE/pymaemo-tools/download_cache: all downloaded files are placed here, one directory by package, so you don't have to download everything again in every build. If the sources are updated, though, you will have to erase the corresponding entries on download_cache for allow them to be downloaded again. |
* $BASE/pymaemo-tools/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages. | * $BASE/pymaemo-tools/workdir: the generated files (prepared sources, logs, built packages) are placed under this directory, grouped by the name of the sbdmock config file used to build them. Inside each group, the logs and repo directories will contain, respectively, the build logs and the built packages. | ||
- | == | + | == Customization == |
- | If you want to | + | If you want to roll out your own packages or modify the existing ones, the sections below will provide some directions. |
- | + | === Adding your own packages to the build === | |
- | + | ||
- | + | ||
- | + | ||
- | If you | + | If you want to add your own package to the build process, you just have to edit one simple file, packages-fremantle.ini. Just add an entry at the end of the file depending on how your package is organized. |
- | * If your package | + | * If all the contents of your package are contained in a single SVN or GIT repository, you have a "native" package. If you're using SVN, the lines below are enough: |
- | + | ||
- | + | ||
- | + | ||
- | + | ||
- | + | [new-package] | |
+ | svn_url=http://packagerepository/new-package/trunk | ||
+ | native=yes | ||
- | + | If you're using git, just change "svn_url" to "git_url" and use the appropriate repository address (git://...). Note also that the flag "native=yes" must be present. Just change "new-package" to a string identifying your package and you're set. | |
- | + | * If your package has Debian or Ubuntu as upstream and only the packaging is specific for Maemo, you'll have to specify the location of all the files needed in addition to the repository where the packaging is located. See below an example for pyclutter: | |
- | + | ||
- | + | ||
- | + | ||
- | == Modifying PyMaemo packages == | + | [pyclutter] |
+ | source_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0.orig.tar.gz | ||
+ | diff_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0-1.diff.gz | ||
+ | dsc_url=http://ftp.de.debian.org/debian/pool/main/p/pyclutter/pyclutter_0.8.0-1.dsc | ||
+ | svn_url=https://garage.maemo.org/svn/pymaemo/packages/pyclutter/trunk/debian | ||
+ | |||
+ | In this example the source, .diff.gz and .dsc files are taken from Debian, and the Maemo-specific packaging is taken from the (former) PyMaemo repository. pymaemo-tools will assemble the package prior to build, as explained in the Overview section. | ||
+ | |||
+ | === Modifying PyMaemo packages === | ||
The PyMaemo packages are in Gitorious now, allowing the submission of modifications for any of them via merge requests. An overview of the entire process is listed below: | The PyMaemo packages are in Gitorious now, allowing the submission of modifications for any of them via merge requests. An overview of the entire process is listed below: | ||
# Create a clone of the repository at Gitorious for the package you want to modify, and git-clone it; | # Create a clone of the repository at Gitorious for the package you want to modify, and git-clone it; | ||
- | # Modify the | + | # Modify the packages-fremantle.ini entry of the package to point to the full path of the repository directory; |
- | # | + | # Erase your package files from $BASE/download_cache, $BASE/workdir and $BASE/workdir/fremantle_<target>/repo before the build; |
- | + | # Modify the package and run build_packages.sh to build it; | |
- | # Install on Scratchbox and on the device, if possible, and run all available unit tests for the package - needless to say, your modifications | + | # Install on Scratchbox and on the device, if possible, and run all available unit tests for the package - needless to say, your modifications should not introduce regressions of any type; |
# Add unit tests to assert the funcionality of the new features added, whenever possible; | # Add unit tests to assert the funcionality of the new features added, whenever possible; | ||
# When you are satisfied with the results, push your local changes to your Gitorious clone and file a merge request. | # When you are satisfied with the results, push your local changes to your Gitorious clone and file a merge request. | ||
- | If you want to modify a package | + | |
+ | As said before, there are two types of packages: native and taken from upstream. If you want to modify a native package, you can do anything you want, as the entire package is contained in the repository. However, if the package is taken from upstream, the only changes you can make will be located in the packaging - you'll have to use patches to actually modify any upstream file in build time. | ||
== Tips == | == Tips == | ||
- | === Create | + | === Create Debian repository with one line === |
- | If you want to quickly make a Debian repository for easy installation, run the following command at $BASE/pymaemo-tools/workdir/fremantle_<target>/repo: | + | If you want to quickly make a Debian repository for easy installation, |
+ | run the following command at $BASE/pymaemo-tools/workdir/fremantle_<target>/repo: | ||
$ apt-ftparchive packages . | gzip -9c > Packages.gz | $ apt-ftparchive packages . | gzip -9c > Packages.gz | ||
- | Now you have to expose the packages' path to the Web server and add the repository in the target machine accordingly. | + | Now you have to expose the packages' path to the Web server and add the repository |
+ | in the target machine accordingly. | ||
=== Tracking build in real time === | === Tracking build in real time === | ||
Line 134: | Line 141: | ||
* Build: | * Build: | ||
$ tail -F $BASE/workdir/fremantle_<target>/repo/build.log | $ tail -F $BASE/workdir/fremantle_<target>/repo/build.log | ||
- | |||
- |
Learn more about Contributing to the wiki.