As successfully uploaded to Extras-devel from my N900
[easy-deb-chroot] / fremantle / easy-deb-chroot / build_easydebchroot.py
diff --git a/fremantle/easy-deb-chroot/build_easydebchroot.py b/fremantle/easy-deb-chroot/build_easydebchroot.py
new file mode 100755 (executable)
index 0000000..dbeee90
--- /dev/null
@@ -0,0 +1,63 @@
+ #!/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("easy-deb-chroot")   #This is the package name and MUST be in lowercase! 
+     p.description="Scripts to run Debian applications easily in maemo\n for users not familiar with the command line.\n NB: A large image file must be downloaded\n and installed before this package will work!\n  You will need approx. 1.5 GB free in either\n your MyDocs directory or your MicroSD card.\n Instructions and an automated installer\n are provided in the package.\n (This is the Easy Debian 'Stable Lenny' Fremantle version.)"
+
+     p.author="Alan Bruce (qole)"
+     p.mail="alan@thebruces.ca"
+     p.depends = "easy-chroot"
+     p.section="user/system"
+     p.icon = "deblet-48.png"
+     p.arch="armel"              #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"
+     qolepostinst = open("control/postinst", "r")
+     p.postinstall=qolepostinst.read()
+     qolepostrm = open("control/postrm", "r")
+     p.postremove=qolepostrm.read()
+     qolepreinst = open("control/preinst", "r")
+     p.preinstall=qolepreinst.read()
+     # p.postinstall="postinst"
+     # p.postremove="postrm"
+     # p.preinstall="preinst"
+     # p.preremove=""
+
+     version = "0.9.30"   #Version of your software, e.g. "1.2.0" or "0.8.2"
+     build = "1fremantle3"         #Build number
+                         #Text with changelog information to be displayed in the package "Details" tab of the HAM
+     changeloginformation = "0.9.30 First version for Fremantle. Stripped down, but works." 
+    
+     dir_name = "src"    #Name of the subfolder containing your package source files
+
+     #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)
+