Py2deb

(First draft)
Line 12: Line 12:
== Setup a buildmyapp.py code snippet ==
== Setup a buildmyapp.py code snippet ==
-
 
Using py2deb means building a python-based build code snippet as seen below.
Using py2deb means building a python-based build code snippet as seen below.
Save your file in the SAME folder where put your source files!
Save your file in the SAME folder where put your source files!
Line 59: Line 58:
       r = p.generate("0.5.6","2",changelog="Correctly position sun icon centered on sun position. New build process for Extras repository.",tar=True,dsc=True,changes=True,build=False,src=True)
       r = p.generate("0.5.6","2",changelog="Correctly position sun icon centered on sun position. New build process for Extras repository.",tar=True,dsc=True,changes=True,build=False,src=True)
       print r
       print r
-
 
== Run your buildmyapp.py code ==
== Run your buildmyapp.py code ==
Line 69: Line 67:
== Upload to autobuilder ==
== Upload to autobuilder ==
-
Now you can simply enter xterm and upload your package using scp:
+
Now you can simply enter xterm and upload your package using scp (Secure Copy):
  scp *5.6* youraccountname@garage.maemo.org:/var/www/extras-devel/incoming-builder/diablo
  scp *5.6* youraccountname@garage.maemo.org:/var/www/extras-devel/incoming-builder/diablo
 +
In this example, *5.6* is a wildcard so that all the files mentioned under the "Run your buildmyapp.py code" above get uploaded.
== Track autobuilder ==
== Track autobuilder ==
A few moments/minutes after your upload, autobuilder will try to build your package.
A few moments/minutes after your upload, autobuilder will try to build your package.
-
Once it has finished (or failed :-), you will get an email with the result of the autobuild.
+
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.
-
This includes
+
 
 +
== 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.
 +
 
 +
== 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.

Revision as of 19:57, 7 October 2008

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
  • 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. Py2Deb however is a bit trickier to use - this article explains my experience in repackaging mClock for the autobuilder.

Contents

Prerequisites

  • Properly setup SSH and PGP to upload to extras. Makes sure not to forget your passphrases or you will need to re-create your keys and asks Niels for another autobuilder invitation...
  • All your source files in a FLAT file structure in a folder under your /MyDocs folder, (e.g. "/myflatsource")
  • A plan where these files should end up during the installation process :-)

Setup a buildmyapp.py code snippet

Using py2deb means building a python-based build code snippet as seen below. Save your file in the SAME folder where put your source files!

 #!/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
 
 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" failed miserably...)
     print 'test1'
     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."
     p.author="Tom Waelti"
     p.mail="twaelti@gmail.com"
     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.png"
     p.arch="any" 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"
     p["/usr/lib/mClock"] = ["mClock.py","sun.py",]
     p["/usr/share/applications/hildon"] = ["mClock.desktop",]
     p["/usr/share/dbus-1/services"] = ["mClock.service",]
     p["/usr/share/icons/hicolor/48x48/hildon"] = ["mclock.png",]
     p["/usr/share/mClock/img"] = ["0-Night.jpg","1-Winter-January.jpg","2-Spring-April.jpg","3-Summer-July.jpg","4-Fall-October.jpg","sun.png",]
     p["/usr/share/pixmaps"] = ["mclock.png",]
     p["/usr/bin"] = ["mClock",]
 
     print p
     r = p.generate("0.5.6","2",changelog="Correctly position sun icon centered on sun position. New build process for Extras repository.",tar=True,dsc=True,changes=True,build=False,src=True)
     print r

Run your buildmyapp.py code

Now run your code using the FULL PATH to your buildmyapp.py (e.g. "python /home/user/MyDocs/myflatsource/buildmyapp.py" in Xterm). py2deb will now package your files and in the process also ask you for your PGP/GPG passphrase so that it can sign your source package. Once this is done successfully, your source folder will contain a number of new files:

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

Upload to autobuilder

Now you can simply enter xterm and upload your package using scp (Secure Copy):

scp *5.6* youraccountname@garage.maemo.org:/var/www/extras-devel/incoming-builder/diablo

In this example, *5.6* is a wildcard so that all the files mentioned under the "Run your buildmyapp.py code" above get uploaded.

Track autobuilder

A few moments/minutes after your upload, autobuilder will try to build your package. 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.

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, ITT, IRC) to test your package.

Promote your package

Once testing provided good results, you are ready to promote your package, meaning that it will now become available in the "real" extras repository.