Updating packaging for Maemo 4.1
[watersofshiloah] / support / builddeb.py
index 203beaf..6830a89 100755 (executable)
@@ -12,31 +12,44 @@ import constants
 
 
 __appname__ = constants.__app_name__
-__description__ = """
+__description__ = """Media player for inspirational streaming radio and audiobooks including the KJV Bible
+Supports streaming:
+* "Mormon Channel" inspirational radio station
+* Conference precedings and magazines from The Church of Jesus Christ of Latter-day Saints
+* Scriptures, including King James Version of the Bible and the Book of Mormon
 .
-Homepage:
+This application is not endorsed by The Church of Jesus Christ of Latter-day Saints
+.
+Homepage: http://watersofshiloah.garage.maemo.org
 """
 __author__ = "Ed Page"
 __email__ = "eopage@byu.net"
 __version__ = constants.__version__
 __build__ = constants.__build__
 __changelog__ = """
+* Cut down on size of media
+* Attempting to get Maemo 4.1 working
+* Fixing a couple of issues for launching on Maemo 5
 """
 
 
 __postinstall__ = """#!/bin/sh -e
 
 gtk-update-icon-cache -f /usr/share/icons/hicolor
+rm -f ~/.%(name)s/%(name)s.log
+""" % {"name": constants.__app_name__}
+
+__preremove__ = """#!/bin/sh -e
 """
 
 
-def find_files(path):
+def find_files(prefix, path):
        for root, dirs, files in os.walk(path):
                for file in files:
-                       if file.startswith("src-"):
+                       if file.startswith(prefix+"-"):
                                fileParts = file.split("-")
                                unused, relPathParts, newName = fileParts[0], fileParts[1:-1], fileParts[-1]
-                               assert unused == "src"
+                               assert unused == prefix
                                relPath = os.sep.join(relPathParts)
                                yield relPath, file, newName
 
@@ -60,8 +73,7 @@ def build_package(distribution):
        p = py2deb.Py2deb(__appname__)
        p.prettyName = constants.__pretty_app_name__
        p.description = __description__
-       p.bugTracker = ""
-       p.upgradeDescription = __changelog__.split("\n\n", 1)[0]
+       p.bugTracker = "https://bugs.maemo.org/enter_bug.cgi?product=Waters%%20of%%20Shiloah"
        p.author = __author__
        p.mail = __email__
        p.license = "lgpl"
@@ -70,19 +82,20 @@ def build_package(distribution):
                "python-gtk2 | python2.5-gtk2",
                "python-xml | python2.5-xml",
                "python-dbus | python2.5-dbus",
+               "python-telepathy | python2.5-telepathy",
        ])
        maemoSpecificDepends = ", python-osso | python2.5-osso, python-hildon | python2.5-hildon"
        p.depends += {
-               "debian": ", python-glade2",
-               "diablo": maemoSpecificDepends + ", python2.5-conic",
-               "fremantle": maemoSpecificDepends + ", python-glade2, python-alarm",
+               "debian": ", python-gst0.10",
+               "diablo": maemoSpecificDepends,
+               "fremantle": maemoSpecificDepends + ", python-gst0.10",
        }[distribution]
        p.recommends = ", ".join([
        ])
        p.section = {
-               "debian": "",
-               "diablo": "",
-               "fremantle": "",
+               "debian": "sound",
+               "diablo": "user/multimedia",
+               "fremantle": "user/multimedia",
        }[distribution]
        p.arch = "all"
        p.urgency = "low"
@@ -90,24 +103,33 @@ def build_package(distribution):
        p.repository = "extras"
        p.changelog = __changelog__
        p.postinstall = __postinstall__
-       p.icon = {
-               "debian": "",
-               "diablo": "",
-               "fremantle": "", # Fremantle natively uses 48x48
-       }[distribution]
-       p["/usr/bin"] = [ "" ]
-       for relPath, files in unflatten_files(find_files(".")).iteritems():
-               fullPath = ""
+       p.icon = "48x48-WatersOfShiloah.png"
+       p["/opt/WatersOfShiloah/bin"] = ["WatersOfShiloah.py"]
+       for relPath, files in unflatten_files(find_files("src", ".")).iteritems():
+               fullPath = "/opt/WatersOfShiloah/lib"
+               if relPath:
+                       fullPath += os.sep+relPath
+               fileLocationTransforms = list(
+                       "|".join((oldName, newName))
+                       for (oldName, newName) in files
+               )
+               if not relPath:
+                       fileLocationTransforms.append({
+                               "debian": "src-stream_gst.py|stream.py",
+                               "diablo": "src-stream_osso.py|stream.py",
+                               "fremantle": "src-stream_gst.py|stream.py",
+                       }[distribution])
+               p[fullPath] = fileLocationTransforms
+       for relPath, files in unflatten_files(find_files("data", ".")).iteritems():
+               fullPath = "/opt/WatersOfShiloah/share"
                if relPath:
                        fullPath += os.sep+relPath
                p[fullPath] = list(
                        "|".join((oldName, newName))
                        for (oldName, newName) in files
                )
-       p["/usr/share/applications/hildon"] = [""]
-       p["/usr/share/icons/hicolor/26x26/hildon"] = [""]
-       p["/usr/share/icons/hicolor/64x64/hildon"] = [""]
-       p["/usr/share/icons/hicolor/scalable/hildon"] = [""]
+       p["/usr/share/applications/hildon"] = ["WatersOfShiloah.desktop"]
+       p["/usr/share/icons/hicolor/48x48/hildon"] = ["48x48-WatersOfShiloah.png|WatersOfShiloah.png"]
 
        if distribution == "debian":
                print p