FFExtensions

Differences between revisions 2 and 3
Revision 2 as of 2008-02-21 19:49:01
Size: 13945
Editor: pool-71-123-18-252
Comment:
Revision 3 as of 2008-08-06 16:37:32
Size: 13945
Editor: localhost
Comment: converted to 1.6 markup
No differences found!

Dev Week -- Firefox 3 Extension Packaging -- Alexander Sack -- Thu, Feb 21

(11:01:09 AM) asac: Welcome to Ubuntu Developer Week and welcome to the firefox extension world ;)
(11:01:52 AM) InsClusoe: asac:  Thank you..
(11:01:59 AM) asac: i will give first some basic background and then will go on to a practicing part
(11:02:18 AM) asac: lets get started
(11:02:35 AM) asac: packaging extensions is a good starter task as the technical side is rather straight-forward.
(11:02:51 AM) asac: However, nothing comes for free :-P and extensions also have a backdraft: the upstream world is quite different compared to other software we distribute.
(11:03:18 AM) asac: One important backdraft is on the communication part with upstream
(11:03:30 AM) asac: ffox extension upstreams usually don't care about properly releasing sources that include license information
(11:03:59 AM) asac: Sometimes they often don't even have a homepage and don't release sources. Further, its sometimes even hard to find an appropriate upstream contact.
(11:04:46 AM) asac: if we cannot find the required information we should not package it. we should rather contact the developers and ask them for clarifying licensing and so on
(11:04:55 AM) asac: Thats why I created https://wiki.ubuntu.com/MozillaTeam/Firefox3Extensions
(11:05:09 AM) asac: At that place we should collect the required information needed to decently maintain a package _before_ we start to package one.
(11:05:44 AM) asac: So if you want an extension packaged (or want to package one), adding the required information on that page is required and comes handy later!
(11:06:37 AM) asac: so much for the basics.
(11:07:08 AM) neversfelde is now known as neversfelde_
(11:07:11 AM) asac: if you have any questions afterthis session, you can always ask on #ubuntu-mozillateam
(11:07:34 AM) asac: ok, lets go for some practice ;)
(11:07:52 AM) asac: please do the "Before you package an extension" section on https://wiki.ubuntu.com/MozillaTeam/Firefox3Extensions/Packaging
(11:08:16 AM) asac: i'll wait a bit for those that have joined late to install the basics
(11:08:41 AM) neversfelde_ is now known as neversfelde
(11:09:14 AM) asac: its important that you need mozilla-devscript package from my ppa (see wiki page) :)
(11:09:28 AM) asac: aeh mozilla-devscripts, sorry
(11:10:46 AM) asac: this practice part will teach two ways of packaging ffox extensions; both using the new xpi.mk feature shipped by the new mozilla-devscripts
(11:11:36 AM) asac: sorry: above should have read "please do the Prerequisites on https://wiki.ubuntu.com/MozillaTeam/Firefox3Extensions/Packaging"
(11:12:31 AM) asac: any questions so far? any problems installing the packages?
(11:12:37 AM) asac: or branching?
(11:12:53 AM) ***jetsaredim updating the sources.list
(11:13:03 AM) asac: ok ... ill wait a few more minutes i guess :)
(11:14:03 AM) jetsaredim: these bzr commands take a while
(11:14:37 AM) asac: yes. thats known :) ... but should be pretty fast if you have bzr 1.0  or higher
(11:14:40 AM) Grazieno: jetsaredim: yes
(11:14:45 AM) barcc: ok
(11:15:23 AM) asac: so ubufox.upstream will be our upstream source code we use to practice
(11:15:47 AM) asac: we will produce a package called "myubufox" based on that :)
(11:16:32 AM) asac: let me know when you are ready ;)
(11:16:47 AM) Grazieno: asac: I'm ready...I think :)
(11:16:56 AM) phoenix24: Ready!
(11:17:03 AM) asac: yeah great.
(11:17:13 AM) asac: so the first approach is to package .xpi files directly
(11:17:37 AM) asac: we usually don't want to package .xpi files, but if upstream doesn't release proper sources, we can still do it
(11:17:55 AM) asac: to produce an ubufox.xpi, please change to the ubufox.upstream directory and run
(11:17:59 AM) asac: "sh build.sh"
(11:18:45 AM) asac: now lets assume that thats the extension you found on the net that you want to package, we first have to create a proper orig.tar.gz out of it
(11:19:15 AM) asac: lets assume that the package has version 0.1 ... then create a directory myubufox-0.1
(11:19:30 AM) asac: and copy the ubufox.xpi into that directory
(11:20:05 AM) asac: the name of the .xpi file doesn't matter much, so you can just keep it
(11:20:53 AM) asac: just to ensure that you have the right directory layout, here its how it looks for me now: http://paste.ubuntu.com/4843/
(11:21:19 AM) asac: if you are not yet there, let me know :)
(11:21:57 AM) asac: ok ... next create an orig.tar.gz out of that
(11:22:01 AM) asac:  tar cvzf myubufox_0.1.orig.tar.gz myubufox-0.1/
(11:22:07 AM) Grazieno: asac: ok
(11:22:44 AM) phoenix24: asac: ok!
(11:22:51 AM) asac: the XPI.TEMPLATE you branched further above is a pretty good template and should work for a lot of extensions
(11:23:08 AM) asac: so just copy the debian directory out of it into your myubufox-0.1 directory
(11:23:26 AM) asac: like: cp -r XPI.TEMPLATE/debian myubufox-0.1/debian
(11:24:21 AM) asac: my ubufox directory looks now like: http://paste.ubuntu.com/4845/
(11:25:30 AM) phoenix24: yes!
(11:25:33 AM) asac: ok lets look at the debian/rules ... at best open it in an editor
(11:26:12 AM) asac: there are a few variables with some documentation on what they do. for basic .xpi based packages you should not need to change anything except the package name
(11:26:17 AM) Grazieno: asac: phoenix24 ok!
(11:26:31 AM) asac: MOZ_EXTENSION_PKG := example-extension => MOZ_EXTENSION_PKG := myubufox
(11:27:36 AM) asac: for the second example later, we make use of MOZ_XPI_BUILD_COMMAND  as well, but for simple .xpi thats not needed
(11:28:08 AM) asac: ok, upon request here the folder structure i pastebined above (for the logs)
(11:28:13 AM) asac: $ find myubufox-0.1/
(11:28:14 AM) asac: myubufox-0.1/
(11:28:14 AM) asac: myubufox-0.1/debian
(11:28:14 AM) asac: myubufox-0.1/debian/compat
(11:28:14 AM) asac: myubufox-0.1/debian/rules
(11:28:16 AM) asac: myubufox-0.1/debian/copyright
(11:28:18 AM) asac: myubufox-0.1/debian/control
(11:28:21 AM) asac: myubufox-0.1/debian/changelog
(11:28:23 AM) asac: myubufox-0.1/ubufox.xpi
(11:28:26 AM) asac: thats how it looked like before we started looking at the debian/rules file
(11:29:02 AM) asac: btw, the magic in the rules file is the include include /usr/share/mozilla-devscripts/xpi.mk which makes everything else pretty trivial
(11:29:39 AM) asac: you can look at that file after the session  if you are interested in makefile/cdbs wizardry ;) ... but it should not be required to understnd that file
(11:29:52 AM) asac: ok, i assume that you have changed the package name in debian/rules?
(11:30:29 AM) Grazieno: asac: yes!
(11:30:48 AM) phoenix24: yes!
(11:31:31 AM) asac: ok good ... then we need to fix debian/control
(11:32:04 AM) asac: its again just the package name. for our case we use myubufox for Source: as well as for Package:
(11:32:38 AM) asac: usually you would fill in a good package description, set a proper maintainer as well, but we don't need this for practice
(11:33:05 AM) asac: further the section might be wrong, as there might be office extensions and so on
(11:35:22 AM) asac: ok after fixing the debian/control file we are pretty much done
(11:35:37 AM) asac: for me it looks like this now:
(11:35:39 AM) asac: Source: myubufox
(11:35:39 AM) asac: Section: web
(11:35:39 AM) asac: Priority: optional
(11:35:39 AM) asac: Maintainer: Yourname <your@email.tld>
(11:35:41 AM) asac: Build-Depends: debhelper (>= 5), cdbs, mozilla-devscripts (>= 0.5~)
(11:35:44 AM) asac: XS-Vcs-Bzr: https://code.launchpad.net/~LPID/firefox-extensions/example-extension.ubuntu/
(11:35:47 AM) asac: Standards-Version: 3.7.3
(11:35:49 AM) asac: Package: myubufox
(11:35:52 AM) asac: Architecture: all
(11:35:54 AM) asac: Depends: firefox | firefox-3.0 | firefox-2
(11:35:57 AM) asac: Description: one line for short description Long descriptions can span multiple lines . and as above empty lines
(11:36:00 AM) asac: well .. some linebreaks removed for the extensions
(11:36:02 AM) asac: but you get the point i guess
(11:36:10 AM) asac: i just changed the Source: and Package: line
(11:37:02 AM) asac: ok last thing: fix the version and the package name in changelog
(11:37:09 AM) asac: .e.g debian/changelog
(11:37:27 AM) tsmithe` is now known as tsmithe
(11:37:28 AM) asac: and of course your name
(11:38:05 AM) asac: are you ready?
(11:38:16 AM) phoenix24: yes!
(11:38:18 AM) asac: then give it a spin and produce your binary test package :)
(11:38:23 AM) asac: just run: debuild -b
(11:38:27 AM) Grazieno: ok
(11:39:36 AM) asac: the output i get during that build is like: http://paste.ubuntu.com/4847/
(11:40:11 AM) asac: at the end of the build i get some lintian warning/errors:
(11:40:16 AM) asac: E: myubufox_0.1-1_i386.changes: bad-distribution-in-changes-file UNRELEASED
(11:40:19 AM) asac: E: myubufox: copyright-should-refer-to-common-license-file-for-lgpl
(11:40:21 AM) asac: W: myubufox: maintainer-not-full-name Yourname
(11:40:24 AM) asac: W: myubufox: new-package-should-close-itp-bug
(11:40:26 AM) asac: W: myubufox: wrong-bug-number-in-closes l3:#XXXXXX
(11:40:28 AM) asac: the first error would be fixed by using hardy instead of UNRELEASED
(11:40:42 AM) asac: and the second one, by filling the debian/copyright file with proper content
(11:41:00 AM) asac: the others should be self-explanatory
(11:41:47 AM) asac: but we don't need to fix them ;)
(11:41:49 AM) asac: now
(11:42:11 AM) asac: ok ... do you all have a myubufox_0.1-1_all.deb now?
(11:42:50 AM) Grazieno: asac: yes
(11:42:57 AM) asac: Grazieno: congrats!!
(11:43:01 AM) asac: you win ;)
(11:43:46 AM) Grazieno: asac: :)
(11:43:50 AM) asac: you could install it now and it should install the extension in your firefox. you don't need to test that now, if it doesn't work then its a bug in mozilla-devscripts that you can always bug me about ;)
(11:44:06 AM) asac: but it should work :)
(11:44:27 AM) asac: (well maybe you need to uninstall the main ubufox package first, because they have the same extension id)
(11:46:23 AM) asac: ok ... lets go on with second approach then (which should be quicker as we know how it works a bit)
(11:46:39 AM) Grazieno: asac: How can I see the extension in firefox? Is it possible?
(11:46:54 AM) asac: Grazieno: well ... you need to uninstall the ubufox package first
(11:47:00 AM) asac: then you should see the new one
(11:47:07 AM) asac: (they conflict and firefox will just display one)
(11:47:53 AM) asac: ok the second approach is to use the realy ubufox sources
(11:48:02 AM) asac: and we will use bzr for real :)
(11:48:21 AM) asac: to start you create a package branch locally thats based on the ubufox.upstream branch you have
(11:48:38 AM) asac: just do: bzr branch ubufox.upstream myubufox.ubuntu
(11:48:50 AM) asac: that should create a new directory "myubufox.ubuntu"
(11:49:11 AM) asac: now the same procedure as before: copy the debian/ directory from the XPI.TEMPLATE directory into it
(11:49:29 AM) asac: cp -r XPI.TEMPLATE/debian myubufox.ubuntu/debian
(11:49:47 AM) asac: you can also use the debian directory from the other package we created
(11:50:14 AM) asac: so cp -r myubufox-0.1/debian/ myubufox.ubuntu/debian
(11:50:57 AM) asac: now commit those changes to your packaging branch and push it to launchpad ;)
(11:51:00 AM) asac: https://wiki.ubuntu.com/MozillaTeam/Firefox3Extensions/Packaging
(11:51:15 AM) asac: ^^ thats the last step in section "Packaging Procedure"
(11:51:28 AM) asac: you are still up?
(11:51:30 AM) asac: ;)
(11:51:53 AM) asac: or should i wait a bit ?
(11:52:48 AM) asac: as we don't have a .xpi in the upstream branch anymore, we have to produce one before the package building can go on.
(11:53:03 AM) asac: you can enable that by setting a proper build command in debian/rules
(11:54:11 AM) asac: conventiently ubufox has a build.sh script to produce the .xpi ... so you can just enable:
(11:54:15 AM) asac: #MOZ_XPI_BUILD_COMMAND = sh build.sh
(11:54:16 AM) asac: =>
(11:54:20 AM) asac: MOZ_XPI_BUILD_COMMAND = sh build.sh
(11:55:16 AM) asac: after that edit you can commit this to your packaging branch like:
(11:55:31 AM) asac: bzr commit -m "* enable sh build.sh to build the .xpi" debian/rules
(11:56:14 AM) asac: ok, to build the package, just run debuild -b again
(11:56:42 AM) asac: if you have that ... then we are through!
(11:57:16 AM) asac: if you couldn't finish everything, but want to learn more, you can always join #ubuntu-mozillateam and ask questions
(11:58:01 AM) asac: sorry for the quick pace in the end ... 1hour is so little ;) ... i tried to best to squeeze quite a bit out of it and show you that most extensions are pretty easy to package
(11:58:25 AM) asac: one more question which i find important:
(11:58:27 AM) asac:  jetsaredim> Q: what is the reason to package an extension vs letting people just get them from the addons.mozilla site?
(11:58:35 AM) Wutz: Thanks for the lesson
(11:58:44 AM) asac: thats frequently asked. but the answer is simple. The same reason why we want to package everything
(11:59:00 AM) asac: we can better integrate it and quality assure it
(11:59:11 AM) jetsaredim: fair enough
(11:59:12 AM) Alucard: Prof. Asac: thank you very much!
(11:59:13 AM) asac: and even auto-updates are not wanted in many environemtns
(11:59:20 AM) asac: (like corporations)
(11:59:25 AM) asac: they want to test and only get tested stuff
(11:59:28 AM) asac: which is what we provide
(11:59:30 AM) asac: thanks all!
(11:59:41 AM) phoenix24: Thanks!
(11:59:46 AM) asac: looking forward to see you all in #ubuntu-mozillateam helping to get a lot of extensions ready for hady
(11:59:49 AM) asac: hardy
(11:59:51 AM) Grazieno: asac: Thanks a lot!
(11:59:58 AM) asac: you can make a big difference!
(12:00:09 PM) barcc: asac: thanks!
(12:00:21 PM) ***asac hugs you all

MeetingLogs/devweek0802/FFExtensions (last edited 2008-08-06 16:37:32 by localhost)