Py2deb

(Upload to autobuilder)
(bugtrackerstr is fixed)
 
(34 intermediate revisions not shown)
Line 1: Line 1:
-
On the maemo platform, software is distributed using the Debian package system. If you don't develop in Scratchbox, but directly on the device, you need a tool to properly put together your software for distribution as such a .deb package.
+
On the Maemo platform, software is distributed using the Debian package system. If you don't develop in Scratchbox, but directly on the device, you need a tool to properly put together your software for distribution as such a .deb package.
-
For this, you can either use [[PyPackager]] or py2deb, both developed by [http://wiki.maemo.org/User:Khertan Khertan]:
+
For this, you can either use [[PyPackager]] or py2deb, both developed by [[User:Khertan|Khertan]]:
-
* Use PyPackager to build a .deb package for redistribution in maemo.org/downloads, on your private homepage or wherever
+
* Use PyPackager to build a .deb package for redistribution in maemo.org/downloads, on your private homepage or wherever. There's no PyPackager for Fremantle yet.
-
* Use Py2Deb to prepare a package structure suitable for autobuilder, so that users can later download it directly from the Extras repository using the Application Manager of the tablets.
+
* Use Py2Deb to prepare a package structure suitable for autobuilder, so that users can later download it directly from the [[Extras]] repository using the Application Manager of the tablets.
-
 
+
-
Using PyPackager is quite easy and is covered in the linked article. The maemo fork of Py2Deb however is a bit trickier to use - this article explains my experience in repackaging mClock for the autobuilder.
+
== Install py2deb ==
== Install py2deb ==
-
Install python2.5-py2deb (it can be found in the extras-devel repository)
+
Install '''python2.5-py2deb''' (it can be found in the [[extras-devel]] repository)
 +
 
 +
Note: Since 2010-03-01 and up to at most version 0.5.4-1 Py2deb was broken.
 +
It was creating an incorrect bug tracker link for your package in extras. If you still have an affected version you can solve the issue easily by editing <code>/usr/lib/python2.5/site-packages/py2deb.py</code> line 382 changing it from:
 +
bugtrackerstr = "XSBC-Bugtracker: %s" % ( self.xsbc_bugtracker )
 +
into
 +
bugtrackerstr = self.xsbc_bugtracker
== Prerequisites ==
== Prerequisites ==
-
Create a folder /myapp under your /MyDocs folder (e.g. "/home/user/MyDocs/mclock"). Then add the following files and folders:
+
 
-
* A subfolder /src that contains all your source files in a folder structure which represents the way your app files will install on the device (See mClock example in next section of this article) - and with the correct permissions set!
+
Create a folder <code>/myapp</code> under your <code>/MyDocs</code> folder (for example,  <code>/home/user/MyDocs/mclock</code>). Then add the following files and folders:
-
* The icon for your software package (e.g. mclock.png, 26x26 pixels), the one that will be visible for your package in the application manager.
+
* A subfolder <code>/src</code> that contains all your source files in a folder structure which represents the way your app files will install on the device (See mClock example in next section of this article) - and with the correct permissions set!
-
* A copy of the "build_myapp.py" file, named and edited to your needs (e.g. build_mclock.py) as seen below
+
* The icon for your software package (for example, mclock.png, 48x48 pixels), the one that will be visible for your package in the application manager.
 +
* A copy of the <code>build_myapp.py</code> file, named and edited to your needs (for example, <code>build_mclock.py</code>) as seen below
 +
 
 +
=== programs and libraries with distutils ===
 +
 
 +
If you want to package a Python program or library that is set up correctly with distutils, you can use
 +
 
 +
  $ python setup.py bdist_dumb
 +
 
 +
to compile and generate a .tar.gz package in <code>dist/</code> subdirectory. Just unpack that package in the src/ folder and add the hildon desktop integration files (see below) there.
== Example /src folder structure ==
== Example /src folder structure ==
Files needed for the Hildon desktop integration:
Files needed for the Hildon desktop integration:
-
   /usr/share/applications/hildon/mClock.desktop
+
   /src/usr/share/applications/hildon/mClock.desktop
-
   /usr/share/dbus-1/services/mClock.service
+
   /src/usr/share/dbus-1/services/mClock.service
-
   /usr/share/icons/hicolor/48x48/hildon/mclock.png
+
   /src/usr/share/icons/hicolor/48x48/hildon/mclock.png
-
   /usr/share/icons/hicolor/scalable/hildon/mclock.png
+
   /src/usr/share/icons/hicolor/scalable/hildon/mclock.png (64x64 pixel)
-
Files of the application itself:
+
== mClock.desktop file ==
-
  /usr/bin/mClock
+
-
  /usr/lib/mClock/mClock.py
+
-
  /usr/lib/mClock/sun.py
+
-
  /usr/share/mClock/img/0-Night.jpg
+
-
  /usr/share/mClock/img/1-Winter-January.jpg
+
-
  /usr/share/mClock/img/2-Spring-April.jpg
+
-
  /usr/share/mClock/img/3-Summer-July.jpg
+
-
  /usr/share/mClock/img/4-Fall-October.jpg
+
-
  /usr/share/mClock/img/sun.png
+
-
== Setup the build_myapp.py code ==
+
  [Desktop Entry]
-
Copy the following code to create your own build_myapp.py, then edit according to your needs:
+
  Version=1.0.0 Version of this file, NOT of the app. Keep it at 1.0.0
-
  #!/usr/bin/python2.5
+
   Encoding=UTF-8
-
   # -*- coding: utf-8 -*-
+
   Name=mClock Name of the app as seen in Menu
-
   ## This program is free software; you can redistribute it and/or modify
+
   Comment=Clock & day/night map Description of the app as seen as subtitle in Menu in Finger mode
-
   ## it under the terms of the GNU General Public License as published
+
   Exec=/opt/mClock/mClock.py Link to the app
-
   ## by the Free Software Foundation; version 2 only.
+
   Icon=mclock Name of our icon file, without the trailing .png part
-
   ##
+
   X-Icon-path=/usr/share/icons Path to the icon
-
   ## This program is distributed in the hope that it will be useful,
+
   X-Window-Icon=mclock Name of our icon file, without the trailing .png part (again?!)
-
   ## but WITHOUT ANY WARRANTY; without even the implied warranty of
+
   Type=Application
-
   ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+
   X-Osso-Service=com.nokia.mclock
-
   ## GNU General Public License for more details.
+
   X-Osso-Type=application/x-executable
-
   ##
+
   StartupWMClass=mClock Only needed because it's a PyGame app (would be automatic with GTK)
-
   import py2deb
+
-
  import os
+
-
  if __name__ == "__main__":
+
Note that you need the X-Osso-Service line only if you actually use osso services. Including that line in the .desktop file without proper handling of osso events in the application will result in the application being terminated shortly after startup.
-
      try:
+
-
          os.chdir(os.path.dirname(sys.argv[0]))
+
-
      except:
+
-
          pass
+
-
      print
+
-
      p=py2deb.Py2deb("mclock")  #This is the package name and MUST be in lowercase! (using e.g. "mClock" fails miserably...)
+
== mclock.service ==
-
      p.description="A simple clock for maemo, incl. a day/night world map.\nPress D-Pad or bottom left to switch view mode.\nESC to exit.\nLeft/right D-Pad (or touching l/r border of screen)\nto change season."
+
  [D-BUS Service]
-
      p.author="Tom Waelti"
+
  Name=com.nokia.mclock MUST begin with com.nokia. due to a bug, anything else WONT work
-
      p.mail="twaelti@gmail.com"
+
  Exec=/opt/mClock/mClock.py Link to the app
-
      p.depends = "python2.5 (>= 2.5.1-1osso5), python2.5-osso, python2.5-gnome (>= 2.18.0-1osso3), python2.5-pygame"
+
-
      p.section="user/other"
+
-
      p.icon = "/home/user/MyDocs/mclock/mClock.png"
+
-
      p.arch="all"                #should be all for python, any for all arch
+
-
      p.urgency="low"            #not used in maemo onl for deb os
+
-
      p.distribution="diablo"
+
-
      p.repository="extras-devel"
+
-
      version = "0.5.7"          #Version of your software, e.g. "1.2.0" or "0.8.2"
+
-
      build = "2"                #Build number, e.g. "1" for the first build of this version of your software. Increment for later re-builds of the same version of your software.
+
-
                                  #Text with changelog information to be displayed in the package "Details" tab of the Maemo Application Manager
+
-
      changeloginformation = "Fixed (large) icon."
+
-
   
+
-
      dir_name = "src"            #Name of the subfolder containing your package source files (e.g. usr\share\icons\hicolor\scalable\myappicon.svg, usr\lib\myapp\somelib.py). We suggest to leave it named src in all projects and will refer to that in the wiki article on maemo.org
+
-
      #Thanks to DareTheHair from ITT for this snippet that recursively builds the file list
+
== Files of the application itself ==
-
      for root, dirs, files in os.walk(dir_name):
+
  /src/opt/mClock
-
          real_dir = root[len(dir_name):]
+
  /src/opt/mClock/mClock.py
-
          fake_file = []
+
  /src/opt/mClock/sun.py
-
          for f in files:
+
  /src/opt/mClock/img/0-Night.jpg
-
              fake_file.append(root + os.sep + f + "|" + f)
+
  /src/opt/mClock/img/1-Winter-January.jpg
-
          if len(fake_file) > 0:
+
  /src/opt/mClock/img/2-Spring-April.jpg
-
              p[real_dir] = fake_file
+
  /src/opt/mClock/img/3-Summer-July.jpg
 +
  /src/opt/mClock/img/4-Fall-October.jpg
 +
  /src/opt/mClock/img/sun.png
-
      print p
+
mClock.py should begin with:
-
      r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)
+
  #!/usr/bin/env python
 +
and be executable
 +
== Setup the build_myapp.py code ==
 +
 +
Copy the following code to create your own build_myapp.py, then edit according to your needs:
 +
<source lang="python">
 +
#!/usr/bin/python2.5
 +
# -*- coding: utf-8 -*-
 +
## This program is free software; you can redistribute it and/or modify
 +
## it under the terms of the GNU General Public License as published
 +
## by the Free Software Foundation; version 2 only.
 +
##
 +
## This program is distributed in the hope that it will be useful,
 +
## but WITHOUT ANY WARRANTY; without even the implied warranty of
 +
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 +
## GNU General Public License for more details.
 +
##
 +
import py2deb
 +
import os
 +
if __name__ == "__main__":
 +
    try:
 +
        os.chdir(os.path.dirname(sys.argv[0]))
 +
    except:
 +
        pass
 +
    print
 +
    p=py2deb.Py2deb("mclock")  #This is the package name and MUST be in lowercase! (using  "mClock" fails miserably, for example)
 +
    p.description="A simple clock for Maemo, including a day/night world map.\nPress D-Pad or bottom left to switch view mode.\nESC to exit.\nLeft/right D-Pad (or touching l/r border of screen)\nto change season."
 +
    p.author="Tom Waelti"
 +
    p.mail="twaelti@gmail.com"
 +
    p.depends = "python2.5, python-osso, python-dbus, python2.5-gtk2, python2.5-pygame"
 +
    # Edit this based on your import statements (for example, you probably will not need pygame)
 +
    p.section="user/office"
 +
    # When editing the .section, make sure to use [[Packaging#Sections|an allowed section]] - otherwise the autobuilder will give a warning.
 +
    p.icon = "/home/user/MyDocs/mclock/mClock.png"
 +
    p.arch="all"                #should be all for python, any for all arch
 +
    p.urgency="low"            #not used in maemo onl for deb os
 +
    p.distribution="fremantle"
 +
    p.repository="extras-devel"
 +
    p.xsbc_bugtracker="http://bugs.maemo.org"
 +
    #  p.postinstall="""#!/bin/sh
 +
    #  chmod +x /usr/bin/mclock.py""" #Set here your post install script
 +
    #  p.postremove="""#!/bin/sh
 +
    #  chmod +x /usr/bin/mclock.py""" #Set here your post remove script
 +
    #  p.preinstall="""#!/bin/sh
 +
    #  chmod +x /usr/bin/mclock.py""" #Set here your pre install script
 +
    #  p.preremove="""#!/bin/sh
 +
    #  chmod +x /usr/bin/mclock.py""" #Set here your pre remove script
 +
    version = "0.5.7"          #Version of your software, for example "1.2.0" or "0.8.2"
 +
    build = "1"                #Build number, for example "1" for the first build of this version of your software. Increment for later re-builds of the same version of your software.
 +
                                #Text with changelog information to be displayed in the package "Details" tab of the Maemo Application Manager
 +
    changeloginformation = "Fixed (large) icon."
 +
    dir_name = "src"            #Name of the subfolder containing your package source files (for example, usr\share\icons\hicolor\scalable\myappicon.svg, usr\lib\myapp\somelib.py). We suggest to leave it named src in all projects and will refer to that in the wiki article on maemo.org
 +
    #Thanks to DareTheHair from talk.maemo.org for this snippet that recursively builds the file list.
 +
    for root, dirs, files in os.walk(dir_name):
 +
        real_dir = "/" + root[len(dir_name):]
 +
        fake_file = []
 +
        for f in files:
 +
            fake_file.append(root + os.sep + f + "|" + f)
 +
        if len(fake_file) > 0:
 +
            p[real_dir] = fake_file
 +
    print p
 +
    r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)
 +
</source>
-
When editing the .section, make sure to use [http://wiki.maemo.org/Task:Package_categories#New_list_for_Diablo an allowed section] - otherwise autobuilder will give a warning.
+
When editing the .section, make sure to use [[Packaging#Sections|an allowed section]] - otherwise autobuilder will give a warning.
== Run your build_myapp.py code ==
== Run your build_myapp.py code ==
-
Open "X Terminal" on your device and change directory into your folder (e.g. "cd /home/user/MyDocs/mclock"). Then run your code using "python ./buildmyapp.py" (e.g. "python /home/user/MyDocs/mclock/build_mclock.py") in Xterm. py2deb will now package your files. In the process, it might also ask about (or complain if its missing) your PGP/GPG passphrase so that it can sign your source package - this can however safely be ignored, as autobuilder doesn't require package signing anymore since late 2008.
+
 
-
Once this is done successfully, your /MyDocs/myapp folder will contain three new files, e.g.
+
Open [[terminal|X Terminal]] on your device and change directory into your folder (for example, <code>cd /home/user/MyDocs/mclock</code>). Then run your code using
-
* mclock_0.5.6-2.changes (the changelog)
+
run-standalone.sh python2.5 ./buildmyapp.py
-
* mclock_0.5.6-2.dsc (the package description)
+
For example,
-
* mclock_0.5.6-2.tar.gz (the packed source files)
+
run-standalone.sh python2.5 /home/user/MyDocs/mclock/build_mclock.py
 +
in Xterm. py2deb will now package your files. In the process, it might also ask about (or complain if its missing) your PGP/GPG passphrase so that it can sign your source package - this can however safely be ignored, as autobuilder doesn't require package signing anymore since late 2008.
 +
 
 +
Be warned that py2deb will run other commands inside xterm.  If you're building by sshing into your N900, it may look as it was stuck.  Turn on the N900's display, and you'll notice an xterm awaiting input.
 +
 
 +
Once this is done successfully, your /MyDocs/myapp folder will contain three new files, for example:
 +
* <code>mclock_0.5.6-1.changes</code> (the changelog)
 +
* <code>mclock_0.5.6-1.dsc</code> (the package description)
 +
* <code>mclock_0.5.6-1.tar.gz</code> (the packed source files)
== Upload to autobuilder ==
== Upload to autobuilder ==
-
The 3 files created can now be "fed" to the Autobuilder who will build the final debian package and then push your app into the Extras Devel repository.<br/>
+
 
-
Check [http://wiki.maemo.org/Uploading_to_Extras#Upload this section] to learn about uploading to autobuilder (Using the [https://garage.maemo.org/extras-assistant/index.php webbased assistant] is probably the easiest way to get started).
+
The 3 files created can now be "fed" to the Autobuilder who will build the final debian package and then push your app into the Extras Devel repository.
 +
 
 +
Check [[Uploading to Extras-devel#Upload|this section]] to learn about uploading to autobuilder (Using the [https://garage.maemo.org/extras-assistant/index.php webbased assistant] is probably the easiest way to get started).
== Track autobuilder ==
== Track autobuilder ==
-
After your upload, autobuilder will try to build your package. This will take about 5-10 minutes.<br/>
+
 
-
Once it has finished (or failed :-), you will get an email with the result of the autobuild as the subject (e.g. "[diablo]: mclock 0.5.6-2 OK") and some log details in the message body. It will also include a link to the detailed logs (e.g. for [ "https://garage.maemo.org/builder/diablo/mclock_0.5.6-2/" mClock]) so that you can learn more about any errors etc.
+
After your upload, autobuilder will try to build your package. This will take a few minutes.<br/>
-
Upon successfull build, it will take another few minutes for the application to show up in the Extras Devel repository.
+
Once it has finished (or failed :-), you will receive an email with the result of the autobuild as the subject (for example, "[fremantle]: mclock 0.5.6-1 OK") and some log details in the message body. It will also include a link to the detailed logs (for example,  [https://garage.maemo.org/builder/diablo/mclock_0.5.6-1/ mClock]) so that you can learn more about any errors etc. The results of your build will also show up in the [https://garage.maemo.org/pipermail/extras-cauldron-builds/ extras-cauldron-builds Archives].
 +
 
 +
Upon successfull build, it will take some more time (normally up to 30 minutes) for the application to show up in the [http://repository.maemo.org/extras-devel/pool/fremantle/free/ Extras Devel repository], for example as [http://repository.maemo.org/extras-devel/pool/fremantle/free/m/mclock/ mclock_0.5.7-1_all.deb].
== Test your package ==
== Test your package ==
-
If your build was OK, you can now refresh your Application Manager (make sure that you did add and enable the [https://wiki.maemo.org/Extras#Extras-devel extras-devel repository]!) and install your application from there. Ask some friends in the maemo community (mailing lists, ITT, IRC) to test your package.
+
 
 +
If your build was OK, you can now refresh your Application Manager (make sure that you did add and enable the [[Extras#Extras-devel|extras-devel repository]]!) and install your application from there. Ask some friends in the Maemo community (mailing lists, talk, IRC) to test your package.
== Promote your package ==
== Promote your package ==
-
Once testing provided good results, you are ready to [http://wiki.maemo.org/Uploading_to_Extras#Promotion promote] your package, meaning that it will now become available in the "real" extras repository.
 
-
== Future ==
+
Once initial testing in extras-devel provided good results, you are ready to [[Uploading to Extras-devel#Promotion|promote]] your package to Extras-Test, meaning that it will now become available to a broader range of testers.
-
IMHO, the following features would be nice for py2deb:
+
And one day, after gettings 10 thumbs up in there (and having the package at least 10 days in extras-testing), you can promote it to the "real" extras repository, making it available to all Maemo owners globally :-)
-
* Support for Pre-/Postinstall scripts (might already be hidden inside, but no info available)
+
[[Category:Development]]
[[Category:Development]]
 +
[[Category:Packaging]]
 +
[[Category:Python]]

Latest revision as of 19:31, 17 September 2013

On the Maemo platform, software is distributed using the Debian package system. If you don't develop in Scratchbox, but directly on the device, you need a tool to properly put together your software for distribution as such a .deb package. For this, you can either use PyPackager or py2deb, both developed by Khertan:

  • Use PyPackager to build a .deb package for redistribution in maemo.org/downloads, on your private homepage or wherever. There's no PyPackager for Fremantle yet.
  • Use Py2Deb to prepare a package structure suitable for autobuilder, so that users can later download it directly from the Extras repository using the Application Manager of the tablets.

Contents

Install py2deb

Install python2.5-py2deb (it can be found in the extras-devel repository)

Note: Since 2010-03-01 and up to at most version 0.5.4-1 Py2deb was broken. It was creating an incorrect bug tracker link for your package in extras. If you still have an affected version you can solve the issue easily by editing /usr/lib/python2.5/site-packages/py2deb.py line 382 changing it from:

bugtrackerstr = "XSBC-Bugtracker: %s" % ( self.xsbc_bugtracker )

into

bugtrackerstr = self.xsbc_bugtracker

Prerequisites

Create a folder /myapp under your /MyDocs folder (for example, /home/user/MyDocs/mclock). Then add the following files and folders:

  • A subfolder /src that contains all your source files in a folder structure which represents the way your app files will install on the device (See mClock example in next section of this article) - and with the correct permissions set!
  • The icon for your software package (for example, mclock.png, 48x48 pixels), the one that will be visible for your package in the application manager.
  • A copy of the build_myapp.py file, named and edited to your needs (for example, build_mclock.py) as seen below

programs and libraries with distutils

If you want to package a Python program or library that is set up correctly with distutils, you can use

 $ python setup.py bdist_dumb

to compile and generate a .tar.gz package in dist/ subdirectory. Just unpack that package in the src/ folder and add the hildon desktop integration files (see below) there.

Example /src folder structure

Files needed for the Hildon desktop integration:

 /src/usr/share/applications/hildon/mClock.desktop
 /src/usr/share/dbus-1/services/mClock.service
 /src/usr/share/icons/hicolor/48x48/hildon/mclock.png
 /src/usr/share/icons/hicolor/scalable/hildon/mclock.png  (64x64 pixel)

mClock.desktop file

 [Desktop Entry]
 Version=1.0.0	Version of this file, NOT of the app. Keep it at 1.0.0
 Encoding=UTF-8
 Name=mClock	Name of the app as seen in Menu
 Comment=Clock & day/night map	Description of the app as seen as subtitle in Menu in Finger mode 
 Exec=/opt/mClock/mClock.py	Link to the app
 Icon=mclock	Name of our icon file, without the trailing .png part
 X-Icon-path=/usr/share/icons	Path to the icon
 X-Window-Icon=mclock	Name of our icon file, without the trailing .png part (again?!)
 Type=Application
 X-Osso-Service=com.nokia.mclock	
 X-Osso-Type=application/x-executable
 StartupWMClass=mClock	Only needed because it's a PyGame app (would be automatic with GTK)

Note that you need the X-Osso-Service line only if you actually use osso services. Including that line in the .desktop file without proper handling of osso events in the application will result in the application being terminated shortly after startup.

mclock.service

 [D-BUS Service]
 Name=com.nokia.mclock	MUST begin with com.nokia. due to a bug, anything else WONT work
 Exec=/opt/mClock/mClock.py	Link to the app

Files of the application itself

 /src/opt/mClock
 /src/opt/mClock/mClock.py
 /src/opt/mClock/sun.py
 /src/opt/mClock/img/0-Night.jpg
 /src/opt/mClock/img/1-Winter-January.jpg
 /src/opt/mClock/img/2-Spring-April.jpg
 /src/opt/mClock/img/3-Summer-July.jpg
 /src/opt/mClock/img/4-Fall-October.jpg
 /src/opt/mClock/img/sun.png

mClock.py should begin with:

 #!/usr/bin/env python

and be executable

Setup the build_myapp.py code

Copy the following code to create your own build_myapp.py, then edit according to your needs:

#!/usr/bin/python2.5
# -*- coding: utf-8 -*-
## This program is free software; you can redistribute it and/or modify
## it under the terms of the GNU General Public License as published
## by the Free Software Foundation; version 2 only.
##
## This program is distributed in the hope that it will be useful,
## but WITHOUT ANY WARRANTY; without even the implied warranty of
## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
## GNU General Public License for more details.
##
import py2deb
import os
if __name__ == "__main__":
    try:
        os.chdir(os.path.dirname(sys.argv[0]))
    except:
        pass
    print
    p=py2deb.Py2deb("mclock")   #This is the package name and MUST be in lowercase! (using  "mClock" fails miserably, for example)
    p.description="A simple clock for Maemo, including a day/night world map.\nPress D-Pad or bottom left to switch view mode.\nESC to exit.\nLeft/right D-Pad (or touching l/r border of screen)\nto change season."
    p.author="Tom Waelti"
    p.mail="twaelti@gmail.com"
    p.depends = "python2.5, python-osso, python-dbus, python2.5-gtk2, python2.5-pygame"
    # Edit this based on your import statements (for example, you probably will not need pygame)
    p.section="user/office"
    # When editing the .section, make sure to use [[Packaging#Sections|an allowed section]] - otherwise the autobuilder will give a warning.
    p.icon = "/home/user/MyDocs/mclock/mClock.png"
    p.arch="all"                #should be all for python, any for all arch
    p.urgency="low"             #not used in maemo onl for deb os
    p.distribution="fremantle"
    p.repository="extras-devel"
    p.xsbc_bugtracker="http://bugs.maemo.org"
    #  p.postinstall="""#!/bin/sh
    #  chmod +x /usr/bin/mclock.py""" #Set here your post install script
    #  p.postremove="""#!/bin/sh
    #  chmod +x /usr/bin/mclock.py""" #Set here your post remove script
    #  p.preinstall="""#!/bin/sh
    #  chmod +x /usr/bin/mclock.py""" #Set here your pre install script
    #  p.preremove="""#!/bin/sh
    #  chmod +x /usr/bin/mclock.py""" #Set here your pre remove script
    version = "0.5.7"           #Version of your software, for example "1.2.0" or "0.8.2"
    build = "1"                 #Build number, for example "1" for the first build of this version of your software. Increment for later re-builds of the same version of your software.
                                #Text with changelog information to be displayed in the package "Details" tab of the Maemo Application Manager
    changeloginformation = "Fixed (large) icon." 
    dir_name = "src"            #Name of the subfolder containing your package source files (for example, usr\share\icons\hicolor\scalable\myappicon.svg, usr\lib\myapp\somelib.py). We suggest to leave it named src in all projects and will refer to that in the wiki article on maemo.org
    #Thanks to DareTheHair from talk.maemo.org for this snippet that recursively builds the file list.
    for root, dirs, files in os.walk(dir_name):
        real_dir = "/" + root[len(dir_name):]
        fake_file = []
        for f in files:
            fake_file.append(root + os.sep + f + "|" + f)
        if len(fake_file) > 0:
            p[real_dir] = fake_file
    print p
    r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)

When editing the .section, make sure to use an allowed section - otherwise autobuilder will give a warning.

Run your build_myapp.py code

Open X Terminal on your device and change directory into your folder (for example, cd /home/user/MyDocs/mclock). Then run your code using

run-standalone.sh python2.5 ./buildmyapp.py

For example,

run-standalone.sh python2.5 /home/user/MyDocs/mclock/build_mclock.py

in Xterm. py2deb will now package your files. In the process, it might also ask about (or complain if its missing) your PGP/GPG passphrase so that it can sign your source package - this can however safely be ignored, as autobuilder doesn't require package signing anymore since late 2008.

Be warned that py2deb will run other commands inside xterm. If you're building by sshing into your N900, it may look as it was stuck. Turn on the N900's display, and you'll notice an xterm awaiting input.

Once this is done successfully, your /MyDocs/myapp folder will contain three new files, for example:

  • mclock_0.5.6-1.changes (the changelog)
  • mclock_0.5.6-1.dsc (the package description)
  • mclock_0.5.6-1.tar.gz (the packed source files)

Upload to autobuilder

The 3 files created can now be "fed" to the Autobuilder who will build the final debian package and then push your app into the Extras Devel repository.

Check this section to learn about uploading to autobuilder (Using the webbased assistant is probably the easiest way to get started).

Track autobuilder

After your upload, autobuilder will try to build your package. This will take a few minutes.
Once it has finished (or failed :-), you will receive an email with the result of the autobuild as the subject (for example, "[fremantle]: mclock 0.5.6-1 OK") and some log details in the message body. It will also include a link to the detailed logs (for example, mClock) so that you can learn more about any errors etc. The results of your build will also show up in the extras-cauldron-builds Archives.

Upon successfull build, it will take some more time (normally up to 30 minutes) for the application to show up in the Extras Devel repository, for example as mclock_0.5.7-1_all.deb.

Test your package

If your build was OK, you can now refresh your Application Manager (make sure that you did add and enable the extras-devel repository!) and install your application from there. Ask some friends in the Maemo community (mailing lists, talk, IRC) to test your package.

Promote your package

Once initial testing in extras-devel provided good results, you are ready to promote your package to Extras-Test, meaning that it will now become available to a broader range of testers. And one day, after gettings 10 thumbs up in there (and having the package at least 10 days in extras-testing), you can promote it to the "real" extras repository, making it available to all Maemo owners globally :-)