8f797cf66fc1b8254c695ef115d1f2df864a565c
[easy-deb-chroot] / fremantle / easy-chroot / build_easychroot.py
1  #!/usr/bin/python2.5
2  # -*- coding: utf-8 -*-
3  ## This program is free software; you can redistribute it and/or modify
4  ## it under the terms of the GNU General Public License as published
5  ## by the Free Software Foundation; version 2 only.
6  ##
7  ## This program is distributed in the hope that it will be useful,
8  ## but WITHOUT ANY WARRANTY; without even the implied warranty of
9  ## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10  ## GNU General Public License for more details.
11  ##
12
13 import py2deb
14 import os
15
16 if __name__ == "__main__":
17      try:
18          os.chdir(os.path.dirname(sys.argv[0]))
19      except:
20          pass
21      print
22      p=py2deb.Py2deb("easy-chroot")   #This is the package name and MUST be in lowercase! 
23      p.description="Scripts to mount and chroot into images/partitions\nFremantle version;\n(This does NOT use the 'turbo-charged' dm-loop for mounting image files.)"
24      p.author="Alan Bruce (qole)"
25      p.mail="alan@thebruces.ca"
26      # p.depends = ""
27      p.section="user/system"
28      p.icon = "cigar-48.png"
29      p.arch="armel"              #should be all for python, any for all arch
30      p.urgency="low"             #not used in maemo onl for deb os
31      p.distribution="fremantle"
32      p.repository="extras-devel"
33      qolepostinst = open("control/postinst", "r")
34      p.postinstall=qolepostinst.read()
35      qolepostrm = open("control/postrm", "r")
36      p.postremove=qolepostrm.read()
37      # p.postinstall="control/postinst"
38      # p.postremove="control/postrm"
39      # p.preinstall=""
40      # p.preremove=""
41
42      version = "0.2.2"   #Version of your software, e.g. "1.2.0" or "0.8.2"
43      build = "1fremantle1"         #Build number
44      versionbuild = version + "-" + build
45                          #Text with changelog information to be displayed in the package "Details" tab of the HAM
46      oldchangelog = "0.2.1: First version for Fremantle, fifth package. Trying a new version of py2deb." 
47      newchanges = "0.2.2: Added thp's patches, some other fixes."
48      changeloginformation = oldchangelog + "\n" + newchanges
49      # changelog="control/changelog"
50      dir_name = "src"    #Name of the subfolder containing your package source files
51
52      #Thanks to DareTheHair from talk.maemo.org for this snippet that recursively builds the file list 
53      for root, dirs, files in os.walk(dir_name):
54          real_dir = root[len(dir_name):]
55          fake_file = []
56          for f in files:
57              fake_file.append(root + os.sep + f + "|" + f)
58          if len(fake_file) > 0:
59              p[real_dir] = fake_file
60
61      print p
62      r = p.generate(version,build,changelog=changeloginformation,tar=True,dsc=True,changes=True,build=False,src=True)
63      # r = p.generate(versionbuild,changelog,tar=True,dsc=True,changes=True,build=False,src=True)