/srv/irclogs.ubuntu.com/2008/06/03/#ubuntu-classroom.txt

=== Moot2 is now known as MootBot
=== Mamarok_ is now known as Mamarok
=== persia_ is now known as persia
* persia will be giving a special packaging lesson on how to package scripts, webapps, and firmware installers in #ubuntu-classroom starting at 15:30 UTC today.16:23
persiaWelcome to the special session on packaging scripts, webapps, firmware installers, and other things without code.16:30
persiaFirst off, let's take a quick attendance.  Please indicate your presence.16:31
* sebner hugs persia =)16:31
* Iulian waves16:31
mok0here16:31
albert23+116:31
schmiedchere16:31
* ssweeny coughs16:32
persiaGreat.  We've passed the quorum of 5 active students :)16:32
sebnerpersia: what if there would be less?16:33
lukehasnoname>_>16:33
persiaSo, this is about packaging those special types of package that don't have any source.16:33
persiasebner: I'd reschedule.16:33
sebnerpersia: kk16:33
persiaThe important thing to consider is how the typical meanings of "source package" and "binary package" apply in these cases.16:33
amikropHello. I will be away, but logging.16:34
persiaThere typically isn't anything to compile, and you just want to put the files on the target system.16:34
persiaSo, at a high level, a "source" package is the set of files that is used to edit and maintain a package.16:34
persiaA "binary" package is the set of files that get installed on a user system.16:34
persiaEven where most of the files are the same, it is useful to maintain this distinction, because there may be some files (README, COPYING, etc.) that don't need to be installed on a user system.16:35
persiaAlso, there may be special configuration changes that need to be applied to a user system, but which are not required for development.16:35
persiaBy keeping separate source and binary packages, it becomes very easy to separate these files into the appropriate places, and improves the experience for both users and developers.16:36
persiaThis is true even though the binary package may not have any actual binaries.16:36
persiaAs an example, we're going to package the very simple script from http://paste.ubuntu.com/16605/16:38
persiaNow, the first thing to notice is that upstream didn't license this script properly, so we need to ask upstream for a license.16:38
mok0so, see you next week?16:39
sebnerlol16:40
persia(three months pass)16:40
persiaSo upstream finally provides http://paste.ubuntu.com/16607/16:40
persiaThis, we can package.16:40
persiaas upstream just sent us the script in a pastebin, we'll need to create an orig.tar.gz ourselves.16:40
persiaSo we create a directory hello-host-0.116:41
persiaAnd we copy the script into the directory, and call it hello-host.16:41
persiaWe then tar and compress the directory, and get hello-host-0.1.tar.gz16:41
persiaThis needs to be renamed to hello-host_0.1.orig.tar.gz.16:42
persiaAfter we have the orig.tar.gz, we can start the packaging.16:42
persiaFirst, we'll create a debian/ directory.16:42
persiaOur first target will be copyright.16:42
persiaThis needs to include information about the package license.16:43
persiaAs this package doesn't have a homepage, we can get away with something simple.16:43
persiahttp://paste.ubuntu.com/16608/16:46
persia(Note that those preferring machine-readable debian/copyright are welcome to do it that way)16:46
persia(in fact, if someone wants to draft that, and post for the rest of the class, it would be appreciated)16:46
persiaNext, we'll need a debian/control.  This is again fairly simple.  Just use the minimum information.16:47
persiaI recommend using CDBS for this type of package, only because it means less typing, although those familiar with debhelper 7 may find that as easy a choice.16:47
mok0aie16:48
persiahttp://paste.ubuntu.com/16609/ is a quick debian/control for our package.16:49
persiaNote that because it's just scripts, and we're not using any special handlers, we have to set all the Dependencies manually.16:49
persiaIn this case, it's a bash script, so we depend on bash.16:49
sebnerpersia: is that necessary?16:50
mok0bash is in the minimal installation16:51
persiasebner: I'm actually not sure.  I know bash is no longer the default /bin/sh, but I don't know if it is still Priority: Essential.16:51
mok0ok16:51
persiaFor something like a PHP script, it is much more important.16:51
sebnerok16:51
mok0we can convert it php later :-)16:52
mok0to php16:52
persiamok0: Right :)16:52
persiaSo, for this example, I'm using CDBS, so debian/rules looks like http://paste.ubuntu.com/16610/16:52
persiaI use this mostly because I don't want to think about it, and will use the implied debhelper calls for most things.16:53
persiaNow comes the important part: this needs to be installed somewhere.16:53
persiaThis is handled by the implied call to dh_install.16:53
persiaWe create a debian/install file that specifies where the files go.  Our example is http://paste.ubuntu.com/16611/16:54
persiaNow this directory doesn't exist yet, so we need a debian/dirs to create it (http://paste.ubuntu.com/16612/)16:54
persiaOOps.  I made a mistake with debian/install.  It should really have been http://paste.ubuntu.com/16613/16:55
persiaIt is important not to have the leading / to make sure that it installs in the package, instead of the developer's system.16:55
persiaNow we have a package that installs the scripts into the right places, and has all the necessary bits to make a good package.16:56
persiaThere are still a couple pieces missing: we probably want to create a manual page, as otherwise lintian will complain, and we'll never get it past REVU.16:57
persiaIf we're packaging a firmware installer, or something that needs to initialise a database, we might want to do something with debconf or maintainer scripts.16:58
persiaAnd so on.16:58
persiaNow, any questions?16:58
sebnernot yet =)16:59
sebner*silence*17:01
persiaOK.  If there are no questions, I presume that you all are prepared to package random bash scripts, quick python bits, and so on.17:01
sebnerpersia: that was it?17:02
persiaIf you get as far as trying to package an entire Ruby-on-Rails application, don't forget to install the necessary integration hooks for the webservers, and handle the DB startup and cleanup in the maintainer scripts.17:02
persiasebner: Yep.  Packaging scripts is pretty easy.  Once the files are installed in the right place, the user is typically happy.17:02
sebnergreat17:03
* sebner hugs persia :)17:03
schmiedcso but how do i know what i have to write in the certain scripts17:03
persiaThe really tricky bit is understanding the difference between a "source" package and a "binary" package when the "binary" package looks like it contains source.17:03
persiaschmiedc: Which scripts?17:03
schmiedcfor example the debian/control17:04
persiaschmiedc: OK.  We created debian/copyright, debian/control, debian/rules, debian/changelog, and debian/install.17:04
persiadebian/rules can almost always be just the two lines for script packages.17:05
persiadebian/install is set up based on where the files need to end up.  This is usually available in the upstream documentation.17:05
persiaOh, and I forgot about debian/dirs.17:05
persiadebian/dirs needs to include all the directories used in debian/install.17:06
persiadebian/changelog is best created with dch --create17:06
persiadebian/copyright is often just a quick summary of: who packaged it and when, the authors, the copyright holders, the upstream license, and the packaging license.17:07
persiadebian/control is a bit trickier.  Let's look at http://paste.ubuntu.com/16609/ carefully.17:07
persiaThere are two stanzas, the source stanza and the binary stanza17:07
persiaThe source stanza describes the source package, and the binary stanza the binary package.17:08
persiaFor the source stanza, you need to set the Source: header to be the name of the package.17:08
persiaThe Section header should match one of the package sections17:08
* persia digs for the URL17:08
persiahttp://www.debian.org/doc/debian-policy/ch-archive.html#s-subsections17:09
persiaPriority is almost always "optional" for new packages, although it can be "extra" if it breaks something (try not to do this)17:09
persiaThe Maintainer is the person responsible for the package.17:09
persiaBuild-Depends should be "cdbs": you shouldn't need anything else for a simple scripts package.17:10
albert23should debhelper be added?17:10
persiaStandards-Version: should match whatever the current standards are when you package it.17:10
persiaalbert23: It's not required, as cdbs depends on debhelper.17:11
albert23lintian complained17:11
persiaIf you use a feature from a newer debhelper than the version depended upon by CDBS, you can add a versioned depends.17:11
persiaalbert23: You remind me, it's a good idea to add a debian/compat file containing any of "5", "6", or "7".17:12
albert23that was the other lintian complaint indeed17:12
persiaIn which case, you want to add "debhelper (>= 5)" (or 6 or 7) to your Build-Depends.17:12
persiaalbert23: Thanks for checking :)17:12
persiaNow, for the binary stanza, we again have the package name17:13
persiascripts are always Architecture: all17:13
persiaAs mentioned previously, you need to manually set the Depends: depending on what the scripts require.  I tend to always include ${misc:Depends} just in case some of the CDBS magic requires something.17:14
persiaAnd the Description is as normal.17:14
persiamore information about writing control files is available from http://www.debian.org/doc/debian-policy/ch-controlfields.html17:14
schmiedcok thxc17:14
persiaschmiedc: Does that answer it?17:14
schmiedcbut architecture would be i368 and so on or?17:15
schmiedcyes17:15
schmiedcthe thing is that i concider about getting involved17:15
schmiedcand haven't done any work yet17:15
persiaschmiedc: No point.  As these are just scripts, it ought be architecture: all.  That way they can work for anyone, regardless of their architecture (as long as they meet the Depends)17:15
persiaAny other questions?17:16
schmiedcyes but for other packages17:16
sebnerschmiedc: #ubuntu-motu ;)17:16
persiaschmiedc: Oh, sure, for non-script packages, you might need to set architectures.  "any" is a good choice.17:16
schmiedcam there ..17:16
schmiedcok17:17
persiaAny other questions?  Iulian?17:18
schmiedcnot yet ..17:18
persiassweeny:?17:18
mok0I think, for consistency, it is better to name install and dirs -> <package>.install and <package>.dirs17:18
schmiedcwhen should the next lesson take place?17:18
persiamok0: It works either way, but sure.17:19
schmiedcor to mention in the beginning to replace debian/ with the packages name17:19
persiaschmiedc: I tend to do ad-hoc lessons.  You might check the MOTU School schedule on the wiki.17:19
schmiedcok17:19
persiaschmiedc: No, you use debian/$(pacakgename).install and debian/$(packagename).dirs, etc.17:20
schmiedcok17:20
mok0schmiedc: debian/ is sacred17:20
schmiedcwhere is a good place to look for simple upstreams to play with?17:22
persiaschmiedc: http://bashscripts.org/ has heaps of samples, although many are not suitable for packaging17:23
schmiedcok17:23
persiahttp://www.scripts.com/ has some python and perl (but be careful, some of these may be more than scripts)17:24
schmiedcok thx17:25
schmiedcshould be enought for today17:25
persiaOn the other hand, aside from experimentation (for which variations on hello-host work just fine), you'd do best to wait until you found something so useful you didn't know how you worked without it before packaging it for general release.17:25
schmiedchave to do something for school17:25
* persia rings the 300 second bell17:25
persiaAny last questions?17:26
schmiedcso you mean i should beginn straight with packaging for releases?17:27
mok0schmiedc: you can create a PPA on launchpad17:27
persiaschmiedc: If you have something worthwhile to package, why not?17:27
schmiedcPPAA?17:27
schmiedcPPA*17:28
=== gordon is now known as Guest71188
persiaThanks to everyone for attending, even with the short notice.  Good luck with your script packaging, and don't hesitate to ask in #ubuntu-motu if you have any further questions.17:29
schmiedcwhats PPA?17:29
albert23thanks persia17:29
schmiedcthanks17:29
mok0schmiedc: personal package archive17:29
schmiedcwhere do i create one?17:30
mok0schmiedc: on Launchpad.net17:30
schmiedchave an account ..17:30
schmiedcoh here17:30
schmiedcfound it :)17:30
mok0schmiedc: :-)17:30
mok0schmiedc: you upload a "source package"17:30
mok0schmiedc: it compiles and publishes it for you17:31
schmiedcnice17:31
mok0schmiedc: yes, really cool17:31
persia(or if it's a script, it organises it for user-release and publishes it for you)17:31
mok0schmiedc: so you can distribute apt-get'able software17:31
sebnerpersia: overtime ^^17:32
persiasebner: Yeah, well.  Give me an apple!17:33
schmiedcgg17:33
mok0sebner: give persia a Mac17:34
sebnerrofl rofl rofl17:34
IulianAhh17:39
=== schmiedc1 is now known as schmiedc
Anon234d21:36

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!