Pages

Saturday 5 May 2012

More hints on publishing PySide QML apps to the Nokia Store for N9

I promised in the comments I would run down exactly what it takes me to publish a PySide application using QML to the Nokia Store for my N9 a couple of weeks ago.

I've got some comments back from Nokia Store QA and I had to make changes so here are the things I've learned so far:




  • Nokia Store is currently using PR1.1 for testing. Make sure your QML does not use later versions of, for example com.nokia.meego, than 1.0. You can test on PR1.1 (as most of us will have already updated to PR1.2) using Remote Device Access on developer.nokia.com.
  • You cannot have a "Debian version" on your version number. This is the number after the "-" in the version number in the package tag. The PySide Assistant via python-stdeb adds this and it currently is unavoidable. After running "psa build-deb" you'll need to modify the contents of the debian/changelog file which will be located in the deb_dist subfolder and manually rebuild the package. See below.
  • You must have an icon embedded in your Debian package. This is automatic for "psa build-deb" but is lost when you manually rebuild the package. PySide Assistant prepares this icon in the file yourpackagename.base64 however this needs some massaging to get it into the right format:
    echo "XB-Maemo-Icon-26:" >> debian/control; tail -n +2 yourpackagename.base64 | sed -e 's/^/ /' >> debian/control
  • Your package must be for the armel architecture, even though by definition PySide and QML are architecture-independent (the runtimes of course are not, but we're not packaging those). This means you must change the architecture from "all" to "armel" in debian/control. Unless you're dealing with compiled Python modules inside your package this shouldn't matter. 
  • Lastly, to recap my last post, Nokia Store requires (almost) all items to be self-contained within a subfolder of /opt. We did this by making a symlink from our desktop's Python root to the desired opt directory and putting this path in setup.py.
So here's the process I've followed so far:

  1. Go through the PySide Assistant process of setting up a package.
    psa init
  2. Make your customisations and put your Python and QML inside the created PySide template.
  3. Make a Nokia Store-compliant /opt symlink for your package.
    sudo ln -s /usr /opt/yourpackagename
  4. Change setup.py to include this path. Add the line near the top:
    sys.prefix = sys.exec_prefix = '/opt/yourpackagename'
  5. Change the version number in setup.py and add any extra files you need installed and their locations. Relative paths should now use /opt/yourpackagename and any other files will need an absolute path (such as your .desktop file).
  6. Build the package as PySide Assistant wants you to:
    psa build-deb
  7. This will generate a yourpackagename.base64 and a deb_dist folder (among others) with the content of the package that we will modify.
  8. Go into the deb_dist/yourpackagename-* folder.
  9. Delete the results of the last package build. (These might conflict and generate errors later on.)
    rm -r debian/yourpackagename
  10. Remove the "-1" Debian version from the first line of the debian/changelog file.
  11. Add the icon and your display name for the Application Manager to the debian/control file. The line for the display name is XB-Maemo-Display-Name. The lines for the icon are generated by the command:
    echo "XB-Maemo-Icon-26:" >> debian/control; tail -n +2 yourpackagename.base64 | sed -e 's/^/ /' >> debian/control
  12. Change the architecture to "armel" in debian/control.

Now that you've made those changes, you just need to rebuild the package (You have, right? If not, let me know where I lost you in the comments). Now we need to do this in a funky way because of the "armel" architecture change:
dpkg-buildpackage -rfakeroot -uc -us -aarmel


You should end up with a yourpackagename_*_armel.deb file in deb_dist. This is what should go to Nokia Store QA. Of course test it first with Remote Device Access to save yourself any surprises.

2 comments:

  1. Thank you so much for these tips - worked great for me, and you've saved me an awful lot of headaches and time! Cheers.

    ReplyDelete
    Replies
    1. Glad I could help a fellow Perth person. ;-P

      Delete