2009-06-18
Next Session: TBD |
1 [19:06] <JontheEchidna> Hello all, and welcome to my packaging training session.
2 [19:06] <neversfelde> :)
3 [19:06] <JontheEchidna> Packaging simple KDE apps and plasma widgets (plasmoids) is quite easy.
4 [19:07] <JontheEchidna> Today I am going to walk you through packaging an example plasmoid and answer some questions afterwards.
5 [19:07] <JontheEchidna> The plasmoid I chose for today is the Plasmaboard plasma widget (http://kde-look.org/content/show.php/Plasmaboard?content=101822)
6 [19:07] <JontheEchidna> this is a virtual keyboard applet
7 [19:07] <JontheEchidna> To start things off, just hit the first download button and save the file as "plasma-widget-plasmaboard_0.51.orig.tar.gz"
8 [19:07] <JontheEchidna> Next, navigate to the directory you saved it in and run "tar -xvf plasma-widget-plasmaboard_0.51.orig.tar.gz"
9 [19:07] <JontheEchidna> For good measure, we can rename the resulting directory to plasma-widget-plasmaboard-0.51 using "mv plasmaboard plasma-widget-plasmaboard-0.51"
10 [19:08] <JontheEchidna> Now we're all set. Almost. ;-)
11 [19:08] <JontheEchidna> As you may or may not know, packaging an application involves making a set of rules for the packaging application.
12 [19:08] <JontheEchidna> These rules are contained in a "debian" directory that we place inside the program's folder.
13 [19:08] <JontheEchidna> I have an unfilled skeleton debian dir that we can use here: http://www.2shared.com/file/6363052/c020b794/debiantar.html (Click the "click here" link near the bottom of the blue box)
14 [19:09] <JontheEchidna> extract that with tar -xvf and copy the debian directory over to the source directory.
15 [19:09] <JontheEchidna> now I'll wait for everybody to catch up
16 [19:09] <JontheEchidna> Now we can get started packaging.
17 [19:09] <JontheEchidna> cd to the debian directory
18 [19:10] <JontheEchidna> You'll see 5 files
19 [19:10] <JontheEchidna> these contain the info that the devscripts use to build the package
20 [19:10] <JontheEchidna> First off, open the "changelog" file with nano/kate/vim/emacs or whatever text editor you like.
21 [19:10] <JontheEchidna> We want to make it look like:
22 [19:10] <JontheEchidna> plasma-widget-plasmaboard (0.51-0ubuntu1) karmic; urgency=low
23 [19:10] <JontheEchidna> * Initial release.
24 [19:10] <JontheEchidna> -- Your Name <your@email.www> Thu, 13 Dec 2007 17:00:00 +0000
25 [19:10] <JontheEchidna> From our skeleton file, I gave the package a name (plasma-widget-plasmaboard) and a version (0.51)
26 [19:11] <JontheEchidna> The bottom line you'd fill in yourself ;-)
27 [19:11] <lex79> hi JontheEchidna :P
28 [19:11] <JontheEchidna> \o
29 [19:11] <neversfelde> Questions later?
30 [19:11] <JontheEchidna> I can take questions now in #ubuntu-classroom-chat
31 [19:12] * nellery can paste them for you if you want
32 [19:12] <JontheEchidna> thanks
33 [19:12] <JontheEchidna> Oh, we also want to close a "needs-packaging" bug when we make new packages
34 [19:12] <JontheEchidna> * Initial release. (LP: #bugnumbergoeshere)
35 [19:13] <JontheEchidna> currently plasmaboard doesn't have a bug, but that'd need to change before this package could be uploaded to ubuntu
36 [19:13] <JontheEchidna> debian/compat: this file just contains a compatiblity level which tells the devscripts how to behave. For this package we want '7'.
37 [19:13] <JontheEchidna> <neversfelde> JontheEchidna: I always wonder what to do, if there is a wrong directory layout after unpacking the source. Am I allowed to rename the directory manually?
38 [19:13] <nellery> Question: I always wonder what to do, if there is a wrong directory layout after unpacking the source. Am I allowed to rename the directory manually?
39 [19:13] <JontheEchidna> eheh
40 [19:14] <nellery> you can probably handle it on your own :P
41 [19:14] <JontheEchidna> yeah
42 [19:14] <JontheEchidna> I don't think its too evil to just rename the directory after you extract it and repack it
43 [19:14] <JontheEchidna> though I generally just rename it locally, make my package, then build the package without changing the orig
44 [19:16] <JontheEchidna> Anyway, compat we dont' need to touch for now, so continuing
45 [19:16] <JontheEchidna> Control is where a lot of the magic happens. Open that up in your text editor next.
46 [19:16] <JontheEchidna> Let's go over each field:
47 [19:16] <JontheEchidna> Source: this is the name of the source package; in this case: plasma-widget-plasmaboard
48 [19:16] <JontheEchidna> I should note that the debian/kubuntu standard for naming plasmoids is plasma-widget-x
49 [19:17] <JontheEchidna> <kervel> JontheEchidna: about renaming files : when you just go mess around in the "upstream" source by hand when creating a package, you have to redo that on every release , right ?
50 [19:17] <JontheEchidna> you'd generally have to rename the directory each time you updated the package, but for source code changes we have patch systems
51 [19:18] <JontheEchidna> Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> - all packages in universe have this Maintainer field.
52 [19:18] <JontheEchidna> XSBC-original-maintainer is where you put your info
53 [19:18] <JontheEchidna> Build-Depends: what the source needs to be built (successfully) We will want what's already there plus pkg-kde-tools, which has various tools for building kde packages and kdelibs5-dev, which contains the development files that all KDE apps need.
54 [19:19] <JontheEchidna> Build-Depends: debhelper (>= 7), cdbs, pkg-kde-tools, kdelibs5-dev
55 [19:19] <JontheEchidna> ^is what it would look like
56 [19:19] <JontheEchidna> JontheEchidna> Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com> I've seen recently that since MOTU is going away, we use a different address for new packages
57 [19:20] <JontheEchidna> I've vaguely heard about this, but nothing concrete
58 [19:20] <JontheEchidna> <neversfelde> JontheEchidna: which build deps should get a version like debhelper (>= 7). As many as possible?
59 [19:20] <JontheEchidna> we generally only do this when its necessary
60 [19:21] <JontheEchidna> like when a package won't build with a lesser version
61 [19:21] <JontheEchidna> but for debhelper we generally always give a minimum version
62 [19:21] <JontheEchidna> Standards-Version - the debian-policy version that this package complies with. Current is 3.8.2. One can always find the lastest version here: http://www.us.debian.org/doc/debian-policy/
63 [19:22] <JontheEchidna> Homepage: simply a link to the projects homepage. (http://kde-look.org/content/show.php/Plasmaboard?content=101822)
64 [19:22] <JontheEchidna> Now for the binary package:
65 [19:22] <JontheEchidna> but first a question: <neversfelde> JontheEchidna: so for plasmaboard kdelibs5-dev should be (>=4.2.90) because it does not work with KDE 4.2.4?
66 [19:23] <JontheEchidna> yes, that'd be a good idea. for example this would show that it would not be a good idea to backport this to jaunty
67 [19:23] <JontheEchidna> and in fact I hadn't thought about that
68 [19:23] <JontheEchidna> moving on:
69 [19:24] <JontheEchidna> Package - name of the package, for single packages it should be the same as Source.
70 [19:24] <JontheEchidna> Architecture: Set this to any, since it can build on any cpu architecture. Packages that don't have to be compiled could use "all"
71 [19:24] <JontheEchidna> Depends: ${shlibs:Depends} - the build process calls a script called dh_shlibs which calculates all the dependencies that the package needs to run and replaces them here. For a simple KDE package like this, this should be fine as it is
72 [19:24] <JontheEchidna> Description: a short description of what the package contains and underneath that a longer description of the package.
73 [19:24] <JontheEchidna> Any questions on control?
74 [19:25] <neversfelde> yes
75 [19:26] <neversfelde> we place for example Section: kde
76 [19:26] <JontheEchidna> oh, forgot that one
77 [19:26] <JontheEchidna> yes, section would be kde
78 [19:26] <JontheEchidna> which would make this show up in the kde section of package managers
79 [19:26] <neversfelde> on the second position, debian sometimes places it after Standards-Version, I guess we are right? :)
80 [19:27] <JontheEchidna> The order isn't so important
81 [19:27] <JontheEchidna> as long as its in a somewhat normal position
82 [19:27] <JontheEchidna> well, for section anyway
83 [19:27] <neversfelde> ok
84 [19:27] <JontheEchidna> debian/copyright: This file is very, very important. Otherwise chances are that the package won't get past the NEW queue. Every license and copyright holder must be listed. What I do is go around the source: `grep "Copyright" *` and filtering it all out later by directories.
85 [19:28] <JontheEchidna> looks to pretty much be Copyright (C) 2009 by Björn Ruberg <bjoern@ruberg-wegener.de>
86 [19:29] <JontheEchidna> you'd also fill in some info about the package itself
87 [19:30] <JontheEchidna> the creation date, and the license that you're releasing the packaging under (usually the same as the software)
88 [19:30] <JontheEchidna> debian/rules: This is where all the magic *really* happens.
89 [19:30] <JontheEchidna> This file tells the devscripts how to build the package.
90 [19:31] <JontheEchidna> Fortunately, many smart dudes have made pre-made cdbs files which do all that for us.
91 [19:31] <JontheEchidna> All we have to do for a simple package such as this is put in the file:
92 [19:31] <JontheEchidna> include /usr/share/cdbs/1/rules/debhelper.mk
93 [19:31] <JontheEchidna> include /usr/share/pkg-kde-tools/makefiles/1/cdbs/kde.mk
94 [19:31] <JontheEchidna> (under what is already there)
95 [19:31] <JontheEchidna> kde.mk is the file that has all the magic and tells the devscripts how to build the package, but it needs debhelper.mk so we include that also.
96 [19:32] <JontheEchidna> kde.mk is from pkg-kde-tools, which is why we have a build-dep on that
97 [19:32] <JontheEchidna> and that is pretty much it
98 [19:32] <JontheEchidna> Install fakeroot and devscripts next.
99 [19:32] <JontheEchidna> Then you can build your package by running "debuild -us -uc", and if all went well it should build the plasmoid and package it.
100 [19:32] <JontheEchidna> If you have a GPG key set up you can just do "debuild" but for now making unsigned packages should be sufficient for our purposes.
101 [19:33] <JontheEchidna> and I will take questions after I move my laundry on (be back in 3 or so minutes)
102 [19:35] <JontheEchidna> eh, laundry's not quite dry yet
103 [19:35] <JontheEchidna> once debuild is done doing its thing, go up to the directory above the source directory
104 [19:35] <JontheEchidna> and you should have debs
105 [19:36] <JontheEchidna> sudo dpkg -i *deb
106 [19:36] <JontheEchidna> run kbuildsycoca4
107 [19:36] <JontheEchidna> and then the plasmoid should appear in the widgets list
108 [19:37] <JontheEchidna> this would also be how you package simple KDE apps
109 [19:37] <JontheEchidna> more complicated ones that ship their own libraries would require more complicated packaging
110 [19:37] <JontheEchidna> but that'd be a whole other session :)
111 [19:38] <JontheEchidna> <kervel> JontheEchidna: can you tell a bit about how debuild manages to get all the "to be installed" files in a .deb without touching /usr and so on
112 [19:39] <JontheEchidna> the /usr/share/pkg-kde-tools/makefiles/1/cdbs/kde.mk file does all that magic
113 [19:39] <JontheEchidna> it tells cmake to install all the files to debian/tmp/ and then it copies all of those into the .deb
114 [19:39] <JontheEchidna> <loic-m> Question: plasma widgets don't come with their own icon?
115 [19:39] <JontheEchidna> they should. Probably would need to bug upstream about that
116 [19:41] <JontheEchidna> <kervel> JontheEchidna: and it does so without doing configure --prefix=debian/tmp (as the prefix is sometimes hardcoded in binaries)
117 [19:42] <JontheEchidna> I believe kde.mk gets that stuff from cmake.mk from the cdbs package
118 [19:48] <JontheEchidna> Well, that's pretty much all I had for this session
119 [19:48] <JontheEchidna> you can find me in #ubuntu-motu or #kubuntu-devel if you have questions, plus I'll probably idle here for a bit
120 [19:49] <nellery> thanks for the great session JontheEchidna
121 [19:49] <JontheEchidna> you're welcome
122 [19:50] <javi> thank you very much :D
123 [19:50] <fabrice_sp> thanks JontheEchidna :-)
124 [19:52] <neversfelde> thanks JontheEchidna
125 [19:53] <JontheEchidna> One last thing, if you're interested in contributing I'd recommend getting a GPG key and signing the ubuntu code of conduct: https://launchpad.net/codeofconduct
126 [19:53] <JontheEchidna> and then get your package into revu
127 [19:54] <JontheEchidna> https://wiki.ubuntu.com/MOTU/Packages/REVU
128 [19:57] <loic-m> thanks for the session JontheEchidna
Packaging/Training/Logs/2009-06-18 (last edited 2009-06-18 20:03:42 by cpe-72-229-211-120)