20:05:09 #startmeeting 20:05:09 Meeting started Thu Nov 18 20:05:09 2010 UTC. The chair is MadameZou. Information about MeetBot at http://wiki.debian.org/MeetBot. 20:05:09 Useful Commands: #action #agreed #help #info #idea #link #topic. 20:05:31 #help 20:05:33 Hi, let's start. 20:05:38 Please have your tuna fish sandwiches ready. 20:05:44 This is an interactive tutorial for making Debian packages. 20:05:49 I show and tell things, and you ask questions. 20:05:55 Questions are welcome, at any time. 20:06:04 However, to keep this channel focused, let's use a different channel for questions. 20:06:07 #dw-question is the channel. 20:06:17 No talk in this channel during the tutorial, please. 20:06:22 MadameZou will paste questions from that channel back to this one, one-by-one. 20:06:27 I'll answer each question before the next one gets pasted. 20:06:34 To simplify this, if you have a question, start it with "QUESTION:". 20:07:11 This will be an introductory tutorial. 20:07:19 I will not get very deep into the more intricate bits of Debian packaging. 20:07:27 I will show how to make Debian packages for software that is simple to package. 20:07:38 I will use only the dh command from debhelper 7. 20:07:54 Over the 17 years of its existence, Debian has come up with a lot of tools for packaging. Some of them layered deep. 20:08:09 My favorite by far is dh, from debhelper version 7 onwards. 20:08:16 So that's what we'll cover today. 20:08:28 I will assume that you understand installation of binary packages. 20:08:36 Also, general command line use, and editing of text files using whatever text editor they like: emacs, vi, gedit, kate, anything is fine. 20:08:46 You should have the packages build-essential, devscripts, and debhelper installed. 20:08:51 The versions in lenny should be good enough, but I'm using squeeze. 20:09:17 that was a lot of text, fairly fast... is anyone having trouble keeping up? I'll try to go slower, so there's time to read and think 20:10:09 Let's start with some central concepts. 20:10:32 The three central concepts here are upstream tarball, source package, and binary package. 20:10:37 Most people package software that someone else has written. 20:10:49 This someone else is called the upstream developer. 20:10:57 They will make a release of their software, and the concrete result of that is the "upstream source archive file", or tarball. 20:11:07 A tarball is the ".tar.gz" or ".tgz" file upstream makes. 20:11:15 ("tarball" is a bit of computer jargon that you will run into a lot when making Debian packages.) 20:11:26 The tarball is what Debian takes and builds a package out of. 20:11:34 Sometimes there is no upstream tarball, but we'll not get into that now. 20:11:39 Sometimes you are the upstream developer, but we'll not get into that now, either. 20:11:45 Let's keep things simple, and learn the typical simple case first. 20:12:02 So you have the upstream tarball. 20:12:06 The next step is to make the Debian source package. 20:12:13 From this, we can then build the Debian binary package, which is what actually gets installed. 20:12:24 The source package consists of the upstream tarball, plus some files that you yourself create. 20:12:32 The source package consists, in its simplest form, of three files. 20:12:37 1) The upstream tarball, renamed to follow a systematic pattern. 20:12:47 2) A patch file, with any changes made to to upstream source, plus all the files created for the Debian package. This has a .diff.gz ending. 20:13:06 3) A description file (with .dsc ending), which lists the other two files. 20:13:11 This sounds a bit more complicated than is necessary, at first sight. 20:13:16 It would be simpler to just have everything in one file. 20:13:39 However, it turns out that it saves a lot of disk space and bandwidth to keep the upstream tarball separate from any Debian specific changes. 20:13:48 It's also easier to keep track of what has been necessary to change for Debian. 20:14:02 This in turn makes it easier to report any bug fixes and other improvements made in Debian to the upstream developer. 20:14:09 The packaging workflow is usually like this: 20:14:16 1) rename the upstream tarball to follow a specific naming pattern 20:14:23 2) unpack the upstream tarball 20:14:29 3) add the Debian packaging files (in a subdirectory called debian), and make any other necessary changes 20:14:35 4) build the source package 20:14:41 5) build binary package 20:14:50 6) upload the source and binary packages to Debian 20:14:59 Some people say you should do some testing before the final step. 20:15:09 Testing is what those people do who can't everything right the first time. 20:15:18 Er, I guess we all need to do that, then. 20:15:32 any questions so far? all clear? 20:16:14 QUESTION: quilt? 20:16:27 quilt is a tool for managing patches 20:16:50 I'll mention it at the end, again, but it's outside of the narrow scope for this tutorial; but we can discuss it more at the end 20:17:11 another question liw :) 20:17:14 yep 20:17:23 QUESTION: you are talking about the official way to do it. Is it ths same when I do my own little inofficial stuff? 20:18:10 it is pretty much the same for one's own little inofficial packages, though one does not need to care about quite every detail; I'll point out some in the examples soon 20:18:23 next question 20:18:38 QUESTION: Can I generate a multi-arch package? 20:18:48 evenin 20:19:16 I don't think Debian supports multi-arch packages, yet, but I'll cover "Architecture: all" packages later 20:19:20 next question 20:19:25 QUESTION: please clarify about packaging those packages that are already in binary form, i.e. nvidia blob or likewise 20:20:04 for binary blob packages, you treat the tarball with the blogs as the source package, and just avoid compiling them from source; I've never had to do this, though 20:20:28 that seems to have been the last question for now, so I'll go forward 20:20:31 QUESTION: is there anything like ppa in ubuntu? 20:20:48 questions to #dw-question please, but I'll answer this one now 20:21:27 Debian does not run a PPA service like Ubuntu, but all the tools to make apt repositories yourself are there, it's just a lot to configure oneself 20:21:34 In order to not be completely theoretical, let's walk through an actual example. 20:21:40 There is a sample application at http://liw.fi/hithere/ 20:21:44 QUESTION: the log of the channel will be available later? 20:22:03 Please download the upstream source tarball, you'll have to follow a link to find it. 20:22:15 This is good practice for packaging things for real: some upstreams hide the upstream tarball very, very well. 20:22:18 jordan___: yes it will be, questions to #dw-question please 20:22:25 So, step 0 is to download the tarball. 20:22:31 # wget http://code.liw.fi/hithere/hithere-1.0.tar.gz 20:22:43 Step 1 is to rename it. 20:22:50 The Debian packaging tools assume the upstream tarball has a very specific name. 20:22:57 The name consists of the source package name, an underscore, the upstream version number, followed by ".orig.tar.gz". 20:23:01 The source package name is should be all in lower case, and can contain letters, digits, and dashes. 20:23:12 Some other characters are also allowed, but let's stick to those for now. 20:23:17 If the upstream developer uses a name that looks like a good Debian source package name, then you should use that. 20:23:24 Otherwise, change the upstream name as little as possible to make it fit for Debian. 20:23:29 In this case, upstream has wisely picked a suitable name, "hithere", so we don't need to worry about it. 20:23:37 What a smart upstream. 20:23:44 We should end up with a file called hithere_1.0.orig.tar.gz 20:23:50 Note that there is an underscore, not a dash, in the name. 20:23:55 This is important, because the packaging tools are picky. 20:24:00 # mv hithere-1.0.tar.gz hithere_1.0.orig.tar.gz 20:24:14 Step 2 is to unpack the tarball. 20:24:19 We should have a directory called "hithere-1.0". 20:24:26 In general, the sources should go into a directory named after the source package name and upstream version, with a hyphen (not underscore) in between. 20:24:33 This is again because the packaging tools are picky. 20:24:57 (There's a reason they are picky. Things work better that way in the long run.) 20:25:03 In this case, upstream has again been wise and made the tarball pack into the right subdirectory. 20:25:13 # tar xf hithere_1.0.orig.tar.gz 20:25:19 Step 3 is to add some Debian packaging files. 20:25:26 All of these files go into the debian/ subdirectory inside the source tree. 20:25:39 # cd hithere-1.0 20:25:44 # mkdir debian 20:25:48 There are a bunch of files we need to provide. 20:25:52 I'll walk through them in order. 20:25:58 First file is debian/changelog. 20:26:02 This is the log of changes to the Debian package. 20:26:08 It does not need to list everything that has changed in upstream code, though it can be helpful to users to summarize those changes, too. 20:26:19 Or not, if that is a lot of text. 20:26:22 Since we are now making the first version, there is nothing to log. 20:26:28 However, we still need to make a changelog entry, because the packaging tools read certain information from the changelog. 20:26:34 Most importantly, they read the version of the package. 20:26:39 debian/changelog has a very particular format. 20:26:45 (picky, picky, picky) 20:26:54 The easiest way to create it is to use the dch tool. 20:26:57 # dch --create -v 1.0-1 --package hithere 20:27:01 This will result in a file like this: http://paste.debian.net/100134/ 20:27:30 A couple of notes. 20:27:33 The "hithere" part MUST be the same as the source package name. 20:27:40 "1.0-1" is the version. The "1.0" part is the upstream version. 20:27:47 The "-1" part is the *Debian* version: the first version of the Debian package of upstream version 1.0. 20:27:55 If the Debian package has a bug, and it gets fixed, but the upstream version remains the same, then the next version of the package will be called 1.0-2. 20:28:03 Then 1.0-3, and so on. 20:28:09 "UNRELEASED" is called the upload target. 20:28:20 It tells the upload tool where the binary package should be uploaded. 20:28:25 "UNRELEASED" means the package is not yet ready to be uploaded. 20:28:41 It's a good idea to keep the "UNRELEASED" there so you don't upload by mistake. 20:29:02 (Been there, done that. Got a good deal on brown paper bags.) 20:29:07 Ignore "urgency=low" for now. Just keep it there. 20:29:13 The "(Closes: #XXXXXX)" bit is for closing bugs when the package is uploaded. 20:29:18 This is the usual way in which bugs are closed in Debian: when the package that fixes the bug is uploaded, the bug tracker notices this and marks the bug as closed. 20:29:24 However, we don't need to worry about that now. 20:29:33 We can just remove the "(Closes...)" bit. Or not. It doesn't matter right now. 20:29:36 Hi there 20:29:37 The final line in the changelog tells who made this version of the package, and when. 20:29:54 The dch tool tries to guess the name and e-mail address, but you can configure it with the right details. 20:29:59 See the dch(1) manual page for details. 20:30:04 That's it for the changelog. 20:30:09 The next file is called debian/compat. 20:30:16 This file should contain the number 7. 20:30:21 This is a magic number. 20:30:26 Do not put any other number in there. 20:30:32 Otherwise your package may transmogrify into an MS-DOS installation floppy. 20:30:37 Or, more realistically, it will probably not build. 20:30:44 (debian/compat specifies the "compatibility level" for the debhelper tool. We don't need to go into what that means, right now.) 20:31:54 question please 20:32:08 < captnfab> QUESTION: do we need to repack the original tarball if it 20:32:09 doesn't contains a properly named foo-1.0 folder? 20:32:12 ops, sorry 20:33:13 I think that these days, you don't need to repack it. It used to be necessary, many many years ago, but now the "dpkg-source -x" command will name the directory the right way, if necessary. 20:33:16 next question 20:33:17 QUESTION: do we need to repack the original tarball if it doesn't contains a properly named foo-1.0 folder? 20:33:32 yeah, it was the previous :/ 20:33:44 no worries 20:33:55 QUESTION: can you explain better why things works better changing underscore in hypen in the orig.tag.gz file? 20:34:52 the dpkg-dev tools make assumptions on the name of the various files; this makes them simpler to implement, and simplicity makes things work better in general 20:35:02 next question, please 20:35:13 < dnf> QUESTION: how can i install dch tool? 20:35:30 erm 20:35:36 dch is in the devscripts package; you will need build-essential and debhelper as well 20:35:42 next question, please 20:37:03 liw: just a moment, there's a very synthetic formulation :) 20:37:48 QUESTION: I can see "official" DEB packages in 20:37:49 /var/cache/apt/archives without changelog and compat files. Why? 20:38:24 the .deb packages in /var/cache/apt/archives are binary packages; the changelog is included in them (under a different name), the compat file is only in the source package 20:38:41 next question, please 20:39:32 iiw said the the compat file should comtain the magic number 7, I assume this just means as single char files as produced by 'echo 7 >deabian/compat' ? 20:39:50 yep, a single character 7 is enough to have in debian/compat 20:40:14 next question, please 20:40:21 QUESTION: I've heard of non-maintainer specific format 20:40:22 for debian revision numbers 20:41:21 ehm, the question is all here ^ 20:41:42 I think you mean either the "native package" format (in which the version number would be just 1.0, not 1.0-1); or the "non-maintainer upload" format, in which case that's too much detail for this session to get it right in all cases, but "1.0-1.1" would be an example 20:41:47 next question, please 20:42:24 QUESTION: When is "dpkg-source -x" run? Is it done manually? 20:43:03 "dpkg-source -x" is the command to unpack a Debian source package after it has already been built (usually by someone else); it is not usually run when creating the package 20:43:10 sorry, should have clarified that earlier 20:43:24 ok, going forward 20:43:29 You'll notice during this tutorial there seems to be a lot of magic going on. 20:43:34 Do not read http://en.wikipedia.org/wiki/Clarke%27s_three_laws (it's a distraction). 20:43:39 Also do not read http://marcel-oehler.marcellosendos.ch/comics/ch/1986/06/19860614.gif (it's another distraction). 20:43:46 I'm skipping a lot of details to concentrate on the things that are important to know right now. 20:43:52 You can get back to the magic bits later. 20:43:59 The magic is not particularly advanced technology, it is just details we do not need to understand know. 20:44:04 It's a good idea to come back to the magic bits later, to understand what is really going on, but for now, we need to get something working at all first. 20:44:24 debian/control is a bit less magic. 20:44:27 http://paste.debian.net/100138/is an example of what it might look like. 20:44:33 The control file describes the source and binary package, and gives some information about them, such as their names, who the package maintainer is, and so on. 20:44:41 There are several required fields, but you can just treat them as magic, for now. 20:44:47 So, in debian/control, there are two paragraphs. 20:44:51 The first one describes the source package. 20:44:54 The "Source:" field gives the source package name. 20:45:01 "Maintainer:" gives the name and e-mail address of the person responsible for the package. 20:45:11 "Build-Depends:" lists the packages that need to be installed to build the package. 20:45:18 They might or might not be needed to actually use the package. 20:45:29 The second paragraph describes the binary package built from this source. 20:45:34 Actually, there can be many binary packages built from the same source. 20:45:37 But we will only build one now. 20:45:52 "Package:" is the binary package name. 20:45:57 The name might be different from the source package name. 20:46:02 "Architecture:" tells which computer architectures the binary package is expected to work on: i386 for 32-bit Intel CPUs, amd64 for 64-bit, armel for ARM processors, and so on. 20:46:09 Debian works on about a dozen computer architectures in total, so this architecture support is crucial. 20:46:23 The "Architecture:" field can contain names of particular architectures, but usually it contains one of two special values. 20:46:30 "any" (which we see in the example) means that the package can be built for any architecture. 20:46:36 In other words, the code has been written portably, so it does not make too many assumptions about the hardware. 20:46:43 However, the binary package will still need to be built for each architecture separately. 20:46:49 The other special value is "all", which means that the same binary package will work on all architectures, without having to be built separately for each. 20:46:57 For example, a package consisting only of shell scripts would be "all". 20:47:06 Shell scripts work the same everywhere and not need to be compiled. 20:47:37 question, please 20:47:43 Question: This control file will not work with the debhelper version in lenny? 20:48:36 KatharsisFreak, please ask in #dw-question 20:48:48 liw: we have some questions ;) 20:48:56 MadameZou, yep, fire away 20:49:33 QUESTION: how can one determine the needed packages to 20:49:35 be used by Build-Depends 20:50:04 I usually do that by a) trial and error and b) reading the source of the program 20:50:15 both are usually necessary 20:50:22 .oO(or documentaion) 20:50:23 aste next question, please 20:50:26 QUESTION: can i build package for armel from my i386, and can i do it easy? 20:50:57 that would be cross-compilation, and I don't think there is an easy to do it; there are tools for it, but I am not familiar with them, sorry 20:51:00 paste next question, please 20:51:49 QUESTION: and what's the difference between Depends and Build Depends, in what case i have to use only Depends instead of Build-Depends 20:52:21 Build-Depends are needed _only_ during package build, while it is being compiled, and its test suite is being run 20:52:37 Depends is needed _only_ when the package is actually being used, after being installed 20:53:02 some things might be both build and runtime dependencies, and in that case you need to put them into both Build-Depends and Depends 20:53:49 ok, that covers perfectly my next question ;) 20:54:02 as an example, if a package contains a PHP script, but it does not get run while the package is built, then PHP would go into Depends only, not Build-Depends 20:54:18 QUESTION: may I have a Build-Depends that does not have a corresponding Depends? I'm thinking to statical linked libraries 20:54:21 however, if the PHP script is only used to run a test, and does not get inclued in the binary package, it would only be in Build-Depends and not in Depends 20:54:51 sc, please ask in #dw-question, but I'll answer this one right now 20:55:04 liw sorry 20:55:43 Build-Depends and Depends are pretty much entirely separate, and it is perfectly ok (from a packaging tool point of view) to have dependencies only in one and not the other, or in both 20:55:50 paste next question please 20:55:54 Question: This control file will not work with the debhelper version in lenny? 20:56:20 I did not test these files with lenny, sorry; I was under the impression they should work there, but they might not 20:56:25 paste next question please 20:56:51 QUESTION: when i build a package with "Architecture: all" field, some of the resulting file (b.build, .changes) still have the build architecture in the name. Is a right behaviour? 20:57:06 yep, that is the right behavior, no need to worry about it 20:57:11 paste next question please 20:57:12 QUESTION: Is there another package for source package or its the same of binary package? I will generate and mantain two packages (binary and source)? 20:57:54 you edit the source package and then run a command (which I will get to in a bit) to build the binary package out of the source package 20:58:11 I hope that part gets clearer when we get to the end of the example 20:58:12 paste next question please 20:58:17 QUESTION: It's not clear to me if "Architecture" options will make effect over source package (building process) or binary package (install and run). 20:59:08 the "Architecture:" field tells whoever is building the package whether there is any point in building the package on a particular computer architecture 20:59:19 so if it says i386 and amd64 only, then there's no point in building it on amd64 21:00:00 the, er, entity paying most attention to it are the automatic build servers Debian uses, which look at Architecture to see if they need and can build a package 21:00:11 Debian has at least one build server for each architecture, often several 21:00:15 paste next question please 21:00:22 liw: no more questions 21:00:32 ah, good, going forward then :) 21:00:44 oh cool, I'm not TOO late? 21:00:51 The "Depends:" field lists the packages that must be installed for the program in the binary package to work. 21:01:01 Listing such dependencies manually is tedious, error-prone work. 21:01:02 liw: there's the one about ${shlibs:Depends}, but I suppose you're going to explain that right now :-) 21:01:08 It is therefore a perfect job for computers. 21:01:14 To make this work, the "${shlibs:Depends}" magic bit needs to be in there. 21:01:30 The other magic bit is there for debhelper. The "{misc:Depends}" bit. 21:01:39 sorry, more magic stuff 21:02:04 the shlibs magic is for shared library dependencies, the misc magic is for some stuff debhelper does 21:02:33 for other dependencies, you need to add them manually to Depends or Build-Depends 21:02:48 oh, and the ${...} magic bits only work in Depends 21:02:56 (that's a simplification, but good enough for now) 21:03:01 "Description:" is the package description. 21:03:04 It is meant to be helpful to users. 21:03:08 Even though the example entirely fails to do so, it is a good idea to spend some effort into making it actually helpful to the user, so they will know what the package will do for them, and can make an informed decision of whether to install it or not. 21:03:22 That's it for debian/control. Save the example and let's continue. 21:03:25 debian/copyright is the next file. 21:03:40 It is quite an important file, but for now we will be happy enough with an empty file. 21:03:44 For Debian, this file is used to keep track of the legal, copyright-related information about a package. 21:03:53 However, it is not important from a technical point of view. 21:03:57 For now, we'll concentrate on the technical aspects. 21:04:00 We can get back to debian/copyright later, if there's interest. 21:04:05 debian/rules is also a magic file. 21:04:08 It should look like this: http://paste.debian.net/100139/ 21:04:22 The last line should be indended by one TAB character, not by spaces. 21:04:27 The file is a makefile, and TAB is what the make command wants, for reasons that will require a time machine to really figure out. 21:04:32 (If you have any handy cardboard boxes, please use one and return give us the answer to the question.) 21:04:42 debian/rules can actually be quite a complicated file. 21:04:45 However, the dh command in debhelper version 7 has made it possible to keep it this simple in many cases. 21:04:57 This is the primary reason why I like dh. 21:05:05 We'll see if it works this time. I don't know if it does. 21:05:09 Let's hope I can stand the suspense. 21:05:12 (http://marcel-oehler.marcellosendos.ch/comics/ch/1991/04/19910406.gif) 21:05:20 The final file we need is debian/source/format, and it should contain the version number "1.0". 21:05:25 This is the version number for the format of the source package, and even though it happens to be the same as the upstream version, that is just a co-incidence. 21:05:34 Just treat it as an other bit of magic. 21:05:57 All right, that should be all we need. 21:06:01 Now we can build the package. 21:06:07 The command to do that is "debuild -us -uc". 21:06:10 There are many commands we could use for this, but this is the one we'll use. 21:06:16 If you run the command, you'll get output similar to this: http://paste.debian.net/100144/ 21:06:23 Something went wrong. 21:06:46 There is actually a lot more output than is on pastebin, but I've extracted the important part at the end of the total output. 21:06:54 liw: question for you 21:06:55 I'll get to that, I see we have a question. 21:07:04 and QUESTION: isn't source format 3.0 the magic to be used these days? 21:08:21 yes, the 3.0 format is the new magic, but the 1.0 version works quite as well for the examples, and for people's initial packages, and does not require me to consider whether to teach "3.0 (native)", "3.0 (quilt)", "3.0 (git)" or something else :) 21:08:38 getting back to the example 21:08:44 There is actually a lot more output than is on pastebin, but I've extracted the important part at the end of the total output. 21:08:48 This is what usually happens. 21:08:56 You do your best creating debian/* files, but there's always something that you don't get right. 21:09:03 Not to worry, the intrepid Spaceman Spiff will come to the rescue! 21:09:08 Er, sorry about that. Didn't mean to get quite so excited. 21:09:13 I'm feeling better now. 21:09:16 So, the thing that went wrong is this bit: 21:09:19 * dapal hands some tea to liw 21:09:22 install hithere /home/liw/debian-packaging-tutorial/x/hithere-1.0/debian/hithere/usr/local/bin 21:09:32 The upstream Makefile is trying to install the compiled program into the wrong location. 21:09:38 Actually, that looks like a very weird location. 21:09:43 There's a couple of things going on here. 21:09:48 First is a bit about how Debian packaging works. 21:09:54 When when program has been built, and is "installed", it does not get installed into /usr or /usr/local, as usual, but somewhere under the debian/ subdirectory. 21:10:01 what package in format 3.0? 21:10:11 We create a subset of the whole filesystem under debian/hithere, and then we put that into the binary package. 21:10:18 So the .../debian/hithere/usr/local/bin bit is fine, except that it should not be installing it under usr/local, but directly under usr. 21:10:22 We need to do something to make it install into the right location (debian/hithere/usr/bin). 21:10:30 The right way to fix this is to change debian/rules so that it tells the Makefile where to install things. 21:10:35 http://paste.debian.net/100145/ is the preferred way to do that. 21:10:46 It's again a bit of magic, and to understand it you'll need to know how Makefiles work, and the various stages of a debhelper run. 21:10:53 For now, I'll summarize by saying that there's a command debhelper runs that takes care of installing the upstream files, and this stage is called dh_auto_install. 21:11:23 We need to override this stage, and we do that with a rule in debian/rules called override_dh_auto_install. 21:12:08 The final line in the new debian/rules is a bit of 1970s technology to invoke the upstream Makefile from debian/rules with the right arguments. 21:12:16 If hithere had been written by someone who actually knows how to do things right, there would have been a properly written configure script, and then everything would have worked automatically, without the override. 21:12:22 But I guess from a pedagogical point of view it was good to learn about the overrides, even if they look a bit scary. 21:12:29 ok, questions now, please 21:12:43 QUESTION: that example debian/rules contains only #!make -f , what to do with ./configure , or cmake or scons or .. anything else part? 21:13:22 dh has a lot of heuristic, so a package with a ./configure script, or one of the other common ways of building packages, will usually build without any additions 21:13:42 my example program does not have one of the common ways, so it needs a bit of tweaking 21:14:00 clear 21:14:09 continuing 21:14:16 Let's try to build things again. 21:14:21 Oh no! It still fails! 21:14:26 This time, this is the failing command: 21:14:30 install hithere /home/liw/debian-packaging-tutorial/x/hithere-1.0/debian/hithere/usr/bin 21:14:36 We are now trying to install into the right place, but it does not exist. 21:14:41 See for yourselves: ls debian/hithere 21:14:45 To fix this, we need to tell the packaging tools to create the directory first. 21:14:50 Ideally, the upstream Makefile would create the directory itself, but in this case the upstream developer was too lazy to do so. 21:15:16 The packaging tools (specifically, debhelper) provide a way to do that. 21:15:51 I was just told that lenny has a version of debhelper that is older than what the Build-Depeds I show has, but if you replace the version number with 7.0 it might work 21:16:24 Create a file called debian/hithere.dirs, and make it look like this: http://paste.debian.net/100149/ 21:16:31 The second line is creates the directory for the manual page. We will need it later, I'm shortcutting a bit. 21:16:38 Now the build succeeds, but there's still some small problems. 21:16:48 debuild runs the lintian tool, which checks the package that has been built for some common errors. 21:16:54 It reports several for this new package: http://paste.debian.net/100150/ 21:17:00 These should eventually be fixed, but none of them look like they'll be a problem for trying the package. 21:17:07 So let's ignore them for now. 21:17:11 Look in the parent directory to find the package that was built. 21:17:15 # ls .. 21:17:18 Output: http://paste.debian.net/100152/ 21:17:40 we'll discuss those things in a moment, but first, we have a question 21:17:44 please, slower 21:17:52 PaulRufous, ack, I'll go slower 21:19:34 QUESTION: heuristics is good, but what if we need to pass --with-something-special to configure or cmake arguments, does heuristics handle those source packages that need ./waf and other tools to build ? 21:20:41 I like dapal's answer: 21:20:42 lilith: using dh7, if you want to pass something to ./configure, just do something like: 21:20:42 override_dh_auto_configure: 21:20:42 dh_auto_configure -- --your-params 21:21:13 dh has a nice extension/override mechanism that allows you to override particular parts; it is pretty easy to use, once you've read the docs 21:21:28 ok, continuin with the example 21:21:38 The following command will install the package that you've just built. 21:21:43 Do NOT run it on a computer you don't mind breaking. 21:21:54 In general, it is best to do package development on a computer that is well backed up, and that you don't mind re-installing if everything goes really badly wrong. 21:22:05 Virtual machines are a good place to do development. 21:22:10 That said, here's the command: 21:22:15 # sudo dpkg -i ../hithere_1.0-1_amd64.deb 21:22:22 Output: http://paste.debian.net/100151/ 21:22:25 So, that seemed to work, at least for me. 21:22:46 QUESTION: where can we find docs for override stuff of debhelper 7? 21:22:53 (good question, eh. :-D) 21:23:01 yes, it is 21:23:57 dh runs a specific sequence of commands to build a package; each command is called dh_something, and each such command can be overridden by having a debian/rules entry called override_dh_something 21:24:14 add the --no-act option to the dh command in debian/rules to see what commands it runs 21:24:22 ah, cool 21:24:45 you then have to read the manual page for that command to see if you can configure it (via a file such as debian/hithere.dirs), or if you need to override it 21:24:50 paste next question please 21:24:51 QUESTION: from where do you usually run your commands? inside the dir hithere-1.0 or outside? should there be an outer dir called hithere (without number) 21:25:24 I always run the packaging commands in the hithere-1.0 directory, and i usually have a directory above that called hithere 21:25:43 but the parent directory is not necessary, it is just neater, so files from different projects don't get mixed up 21:25:54 paste next question please 21:26:09 reluctant to paste this, but... 21:26:10 QUESTION: i must not have done something right because my BIN dir is empty in package data.tar.gz and i have no binary for hithere anywhere 21:27:12 yeah, something must gone wrong, yang; let's postpone debugging that, but I'll mention that the #debian-mentors channel is supposed to be a place to ask such questions, and a number of people hang out there willing to help you learn to package and help you debug these kinds of problems 21:27:21 going forward 21:27:31 How do we test the package? 21:27:36 Why, we can run the command. 21:27:41 # hithere 21:27:46 It works! 21:27:51 Well, it works for me. 21:28:09 Even the manual page works. 21:28:17 I declare this package a success. For me. 21:28:36 But, it's not perfect. 21:28:41 Remember, lintian had things to say, and debian/copyright is empty, etc. 21:28:51 We have a package that works, but it isn't yet of the high quality that is expected of a Debian package. 21:28:59 There's probably a whole lot of other things that can be fine-tuned. 21:29:04 However, let's not forget what we do have a working Debian package. 21:29:09 Adding 7 fairly simple files to the upstream source is all it takes. 21:29:12 Or at least that's what it takes for simple packages. 21:29:20 There are programs that are quite hard to make packages for. 21:29:26 Most programs, however, are quite easy. 21:29:31 There's a reason for that: Debian developers like to package all the software they use, so the packaging process is pretty simple, after you get over the initial learning curve. 21:30:09 However, packaging something like a web application, or any very large piece of software, is going to be quite challenging, even for experienced deveopers. 21:30:14 That is not a reason to not try. 21:30:20 It's a reason to allocate more time for it than just one evening. 21:30:25 And it is always OK to ask for help if you get stuck. 21:31:01 QUESTION: I have a upstream that needs a qmake (uses Qt) before make. Can I add it to debian/rules? How? 21:31:03 That ends my lecture. 21:31:37 Thank you liw 21:31:41 I think you need a override_dh_auto_build rule in debian/rules, but I haven't built any Qt packages, so I am not sure 21:31:46 liw: thanks a lot for this great tutorial!! 21:31:46 liw: COOL, MANY THANKS 21:31:47 The floor will soon open for questions and discussion. 21:31:50 But before that, I'll have a couple more things to point out. 21:31:51 hups 21:31:56 thank you very much liw 21:31:57 Once you've built your own packages, you'll eventually want to learn how to set up your apt repository, so your package is easy to install. 21:32:02 The best tool for that I know of is reprepro. 21:32:10 For more testing of your package, you may want to look at the tool called piuparts. (I wrote it originally so it is perfect and never has any bugs. er...) 21:32:16 And, finally, if you start making changes to the upstream source, you'll want to learn about the quilt tool. 21:32:25 and also thanks to the moderators :) 21:32:28 And, finally, if you start making changes to the upstream source, you'll want to learn about the quilt tool. 21:32:33 All of these things are big enough that they won't fit into this tutorial, but it's good to know about. 21:32:38 Other things you might want to read are listed on the http://www.debian.org/devel/ web page. 21:32:43 http://code.liw.fi/hithere/ also has a tarball with the contents of the debian/ directory in my example. 21:32:47 OK, discussion and questions now. 21:32:52 < bognu> QUESTION: I have a project, where I make the 21:32:52 deb package "by hand" more or less. I dont have a lot of 21:32:52 things you mentioned... but lintian tells me no 21:32:52 warnings. So what das this mean for me? Is the package really fine then? 21:33:42 bognu, it means your package is probably fine; like I said at the beginning, Debian's packaging tools have a 17 year old history, and there are many tools, and many ways in which to do things; every way that works is fine 21:33:47 next question, please 21:33:49 < valhalla> QUESTION: what is a good workflow to update 21:33:51 a package to a new upstream version? 21:35:10 ah, I am not sure what is the best workflow for that, but bascially: unpack the upstream source to a new directory, copy the debian/* directory from the old package, update debian/copyright ("dch -v 1.2.3-4") and try to build, and fix anything that is broken 21:35:30 * ibid likes uupdate for that 21:35:33 s/copyright/changelog/ 21:35:36 that's not a really good workflow, but for that you will need to learn quilt, and possibly how to use version management with debian packaghing, and that's too big a topic for this session, sorry 21:35:44 spion, er, yes, you're right 21:35:54 there are too many files beginning with c in there 21:35:59 :) 21:36:03 next question, please 21:36:08 < sdd> QUESTION: Could you estimate the amount of work 21:36:08 to get to being an average packager? (how long did it 21:36:08 take you to a state where you could release, resp. teach) 21:37:14 I learned this stuff some time last decade, so I have a very bad idea of how easy it is to learn, never mind using modern tools 21:37:48 but I suspect if you have access to people you can ask, and your first packages are fairly simple, then a few evenings should be enough to make a working package you don't mind sharing with others 21:37:53 next question, please 21:37:55 < acr> QUESTION: source packages may be builded with 21:37:56 some options to configure script, what official way to 21:37:56 determine from binary package what options used? 21:38:20 the official way is to find the corresponding source package and see what it uses in debian/rules 21:38:25 next question, please 21:38:36 QUESTION: Once I’ve made one or more packages you’d like to share, should I look into becoming a DM/DD/DMember? 21:38:45 yes, you should :) 21:39:01 QUESTION: this "upstream" thing is still confuing to me, cause I never used it. Upstream is provided by NOT debian people, right? So there is no format for this tarball? All it need is a Makefile? Or how is this defined 21:39:21 merwok, go look at the New Maintainer pages, and ask for feedback on debian-mentors 21:40:09 Thanks liw. 21:40:16 < bognu> QUESTION: this "upstream" thing is still 21:40:17 confuing to me, cause I never used it. Upstream is 21:40:17 provided by NOT debian people,right? So there is no 21:40:17 format for this tarball? All it need is a Makefile? Or how is this defined 21:40:24 MadameZou: FAIL :-) 21:40:40 MadameZou: :* 21:40:43 bognu, upstream is the people who wrote the program originally, and not Debian, correct; simplifying a bit, Debian needs a tarball (if you have something else you need to convert); the tarball has no standard, but most sensible people have a ./confiugure script and a Makefile and that usually is enough 21:41:02 oh god! dapal was faster! 21:41:10 (sorry) 21:41:14 merwok, gregoa reminds me that another good way to learn is to join a packaging team, such as debian-perl, and I agree 21:41:18 next question, please 21:41:34 QUESTION: Isn't packaging the easy bit, what about maintaining it? (Bug triage, fixing, patch integration etc.) 21:41:46 I’m still confused about DM vs. DD vs. DMember (the new thing) vs. in a team, but I’ll go to #d-m :) 21:42:30 #endmeeting 21:42:35 MadameZou: could you please? ↑ 21:42:38 wait 21:42:47 ah, right 21:42:49 tixy, yes, you are quite correct; the initial packaging is the easy bit, and the other work is a lot more 21:42:49 sorry liw 21:43:11 are there more questions waiting? if not, I could do with a break 21:44:00 #endmeeting