11:00:53 #startmeeting 11:00:53 Meeting started Sat May 7 11:00:53 2011 UTC. The chair is marga. Information about MeetBot at http://wiki.debian.org/MeetBot. 11:00:53 Useful Commands: #action #agreed #help #info #idea #link #topic. 11:00:57 There you go. 11:01:16 Hello everybody and welcome to this tutorial about re-building Debian packages. 11:01:39 The first thing that you need to know is that this tutorial is NOT about creating new packages for Debian. You can find a tutorial about that at http://wiki.debian.org/IntroDebianPackaging and we will probably hold another session about that in the near future, so I'd suggest to stay tuned. 11:02:19 This tutorial is about taking an existing package, re-building it, applying changes to it, and preparing those changes so that you can send them to a bug as a patch. 11:04:16 #help 11:04:37 If English is not your native language, I suggest you join #debian-women- for your language. Where is the 2 letter code for your language ('es' for Spanish, 'fr' for French, 'ca' for Catalan, 'de' for German, etc). You might be able to ask questions there with other people that also speak your language 11:05:57 there's no one in: #debian-women-sw 11:06:45 So, before beginning, I'd like to know who's here for the tutorial, and if you feel like it you can include your country and your name, just to know a little bit more about the audience. 11:07:16 me, Greece 11:07:41 was just trolling for #debian-women-sw (Swahilli) 11:07:48 I'm here for tutorial. 11:07:52 i am here for the tutorial. i am wayne from the US. 11:07:53 I'm here for the tutorial, first name is Maryline, France 11:07:53 From Brazil 11:08:03 hi, germany 11:08:04 * geekosopher is Nitesh from India 11:08:05 me, From France 11:08:08 Hi, me too, Germany 11:08:09 me too, i'm here for the tutorial 11:08:13 me, sweden :) 11:08:17 me, Norway 11:08:19 Me too, also french 11:08:20 o/ also in #debian-women-ca 11:08:20 hi, again from germany 11:08:29 My name is Nikita, I am from Belarus, I speak russian. 11:08:34 Im here for the tutorial too. Kurian from India. 11:09:05 * franki^ is idling and reading a book in the UK. 11:09:09 * eof Alexander, belarus (russian lanuage) 11:09:21 Ok, great :) 11:09:29 In order to follow what we'll do here, you'll need administration rights in a computer (either root or sudo) running Debian or a Debian based distribution. We will be using the console/terminal, but you don't need to know any commands yet, I'll list all the commands that you have to use. 11:10:33 Every time that we'll need admin rights, I'll add 'sudo' in front; if you don't use sudo, just get the rights whatever way you like. 11:11:04 Feel free to ask for clarifications when something is not clear, but keep in mind that there will be a Question & Answers section at the end to ask other questions (related or not to the tutorial). 11:11:53 In order to build _any_ package you will need to have certain tools installed. Before starting to work with any packages, you should run: sudo apt-get install build-essential fakeroot devscripts. 11:12:44 This will install some packages that will be needed later on. We'll keep going with other stuff while the packages install. 11:13:12 The next thing you need to do, is make sure that you have some source repositories configured in your computer. Open your /etc/apt/sources.list file and check if you have one or more lines that start with 'deb-src'. These lines are needed in order to work with source packages. 11:14:09 If you don't have any deb-src lines, you'll need to add at least one. You can do that by running an editor with admin rights (sudo gedit, sudo kate or sudo vim) adding this line: deb-src http://http.us.debian.org/debian unstable main 11:14:38 Usually, it's a good idea to use unstable as the repository, since you'll be working with the latest version of the package, but if you intend to modify a package as it is in stable or testing you could use those distributions as well. 11:14:57 Once you've added the line, you'll need to do sudo apt-get update in order to update the list of packages available for installation. 11:15:52 can I add a unstable repository together the stable one? 11:16:07 Please tell me when you've run sudo apt-get update and it's successfully retrieve the source files. Something like 'Obj http://http.us.debian.org unstable/main Sources' 11:16:44 yuriaoto: yes. This is only for source packages. You will not be installing any packages from that URL, only getting the source code. 11:16:54 ok 11:17:52 Done for me. 11:17:56 done 11:18:00 done 11:18:07 I'm done. 11:18:16 ok for me 11:18:49 done 11:19:04 Ok, great. BTW, for those joining in a bit later, you can see the log of the current session at: http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-11.00.log.txt 11:19:35 With the sources URL that you've just added to your apt repositories, you'll now be able to get the source of any Debian package that you like. 11:19:52 It's always a good idea to have a directory that you use to work with source software, separated from other directories used for other stuff. In case you don't already have one, I'd suggest that you create a directory 'src' with another called 'debian' inside it: mkdir -p src/debian/; cd src/debian 11:20:19 marga: with our current directory being ... ? 11:20:41 olspookishmagus: whichever you want to be the previous dir, but I was thinking of /home/you/ 11:21:11 Inside this directory we will get the source of the package that we want to work with. For this tutorial, I'm going to use a package called 'fdupes', a tool to detect duplicate files, and we will be fixing the bug: http://bugs.debian.org/585426 11:21:40 I think I've a problem 11:21:51 Pashupati: what problem? 11:22:04 I've updated and it doesn't tells me "Obj http://... Sources" 11:22:37 Pashupati: ok, we'll know for sure on the next step. 11:22:38 me neither, but I guess since I've added the source repository everything will be fine 11:22:44 what marga said 11:23:41 If you don't have fdupes installed, it'd be a good idea to install it now (sudo apt-get install fdupes), and check that the bug is still present. You can do that by running fdupes --help and checking that the second line of info for the '--debug' option still doesn't make any sense. 11:24:44 So, now we want to fix this bug. In order to get the source of 'fdupes', what you need to do is run (as normal user): apt-get source fdupes 11:25:29 If you get an error doing that, it means the source URL thing didn't work, and we need to revisit that. 11:26:04 So, please tell me when you've successfully done this too. 11:26:08 No problem here. 11:26:11 where will that put the source by default? cause I have created another source path 11:26:11 It works! 11:26:28 do i have to disable the other src entry in my source list? 11:26:35 olspookishmagus: in the current directory 11:26:40 marga: seen that, ok 11:26:45 bertie_wooster: no, there's no need. 11:27:09 marga: is there a switch to tell it where to put it? in order to not to have to move it later on each time/ 11:27:10 it got the source from wheezy/main and not from unstable 11:27:11 looks good 11:27:39 It is work for me 11:27:51 ok for me 11:27:53 Is the package source is present in several repositories, will it work like "apt-get install" to choose which one is downloaded ? 11:27:55 olspookishmagus: not that I know of, I just apt-get source it in the dir I intend to have it. 11:28:08 orion_elenion[fr]: yes 11:28:34 bertie_wooster: try apt-get source -t unstable fdupes 11:29:14 fdupes has the same version in squeeze and wheezy and sid at the moment 11:29:31 right, that's why it chose wheezy, thanks gregoa, I was pondering :) 11:29:36 So, you'll now have download 3 files (dsc, tar, diff), that add up the to create the Debian source package. It probably also informed you that fdupes is maintained with Git, but we won't be using that today. 11:29:57 Once the package is downloaded, you can check the directory where you were (typing 'ls'), and you'll find that appart from the 3 files that were downloaded you also have a directory, called fdupes-1.50-PR2. This is the 'unpacked' source of the Debian package. Type: cd fdupes-1.50-PR2/ 11:30:34 When you check the contents of this directory (typing 'ls' again), you'll see quite a number of files of different sorts, and a 'debian' directory. 11:30:57 Every Debian (or Debian derivative) package includes a debian directory, where all the information related to the Debian package is stored. Anything that's outside of that directory, is the 'upstream code', i.e. the original code released by whoever programmed the software. 11:31:52 Go into the Debian directory, by typing 'cd debian' and the look at its contents by typing 'ls'. We won't be going any deeper about this files here, but just keep in mind that the 'rules' file is the executable file that we will be running in order to build the package. All the other files have diverse information about the package, and there are a number of patches applied by the maintainer in the 'patches' directory. 11:32:43 The content of those files is covered more extensively in tutorials about creating new packages, if you want to investigate about it. 11:33:01 marga: rules is a makefile? 11:33:22 olspookishmagus: yes. 11:33:29 So, basically, to create a package from source, all that is needed is to add a debian directory with appropriate content, right ? No need to change the source code... That's great. 11:33:31 marga: a regular or a special one? 11:33:34 olspookishmagus: a very particular one, but yes, it's a Makefile. 11:33:48 orion_elenion[fr]: indeed, that's correct. 11:34:11 olspookishmagus: it has particular rules, specific to making Debian packages. 11:34:38 Let's move one directory back, by doing 'cd ..'. You should be again at fdupes-1.50-PR2, the main directory of the source code. 11:34:55 In order to build almost any program, you will need some 'dependencies' installed. The dependencies are the programs or libraries needed to compile your program. Debian provides a way of easily installing all the needed dependencies: sudo apt-get build-dep fdupes 11:35:23 Once you've downloaded these tools, you'll be ready to build the package. 11:35:48 marga: how does debian help us on that? 11:36:03 olspookishmagus: I mean 'apt' 11:36:20 dpatch is the only dependency? 11:36:33 vikapi: YOUR only missing dependency 11:36:59 olspookishmagus: you don't need to check the dependencies and then install them one by one, you just do apt-get build-dep package and it automatically gets all the missing dependencies needed to build the package. 11:37:04 marga: so the build dependencies of a package are part of the apt infrastructure? nothing to add/maintain ass a package creator/maintainer? 11:37:15 as* 11:37:20 * olspookishmagus blushes 11:37:25 i still can't get the source from unstable, error message reads 11:37:25 E: Ignore unavailable target release 'unstable' of package 'fdupes' 11:37:25 E: Unable to find a source package for 11:37:45 bertie_wooster: forget the unstable part 11:37:48 olspookishmagus: they are stored in the 'debian/control' file, and yes, they are maintained by the maintainer. apt reads this file and helps you with the installation of the pacakges. 11:37:53 bertie_wooster: just do it without the -t switch 11:38:08 marga: thanks for clarifying that 11:38:11 without unstable it gets the source from testing (which is what i am running) 11:38:13 bertie_wooster: the wheezy version is ok, because they are the same. 11:38:18 ok 11:39:17 So, if you are still with me and you've installed the build-dep packages, what we'll do next is build the package without making any changes, just to be sure that it builds and it installs properly. Do: fakeroot debian/rules binary 11:40:32 This will run a number of commands (the ones that are listed in the 'debian/rules' file) and will hopefully end with a message like: dpkg-deb: building package `fdupes' in `../fdupes_1.50-PR2-3_i386.deb' (in your own language) 11:40:46 Please tell me when you've correctly built the .deb 11:40:51 done 11:40:54 done 11:40:55 done 11:40:58 done 11:40:58 I love it when a Makefile compiles without any error. It's done. 11:41:01 Done. 11:41:04 done 11:41:06 done 11:41:13 done 11:41:30 Awesome, the next thing to do now is install this file with: sudo dpkg -i ../fdupes_1.50-PR2-3_i386.deb 11:41:47 After that, check that the bug is still present, running fdupes --help. 11:41:50 done 11:42:13 done 11:42:24 Now, we want to actually fix this bug. 11:42:33 When you are trying to fix a package bug, sometimes it will be located in the upstream source, sometimes it will be related to how the program was packaged for Debian. So you'll be editing different files depending on where the problem is. 11:42:36 Hint: you may have to replace "i386" by whatever your architecture is. Just check the real generated package name. 11:42:48 Done 11:42:53 done 11:42:54 yes, orion_elenion[fr], you are right :) 11:42:57 done 11:43:00 is it good idea to install package via dpkg? 11:43:19 eof, yes apt use dpkg too 11:43:20 eof: this is a package you've just generated, it's not in the apt repositories. 11:43:30 done 11:43:35 eof: normally, you don't want to use dpkg directly, but in this case it's the only way. 11:43:45 clear 11:43:50 In this case it's a bug in the upstream code, so we'll be editing the fdupes.c file. Go to the line 1066 and delete it. 11:44:34 It's the line that says: printf(" \teach set of duplicates without prompting the user\n"); 11:44:36 Done. 11:44:40 doe 11:44:43 *done 11:44:47 HINT: $ vi fdupes.c +1066 11:45:01 yes^^ vi(vim) is so good 11:45:26 Before rebuilding the package with the modified line, we want to make our package different from the original one, so that we can afterwards extract the changes in order to send them as a patch to the bug. In order to do this, type: dch -n 11:45:48 This will add a new entry in the changelog file, maybe with your name (depending on other configurations that we are not going to cover now), with the current date, and open the changelog with the configured command-line editor. In case this is vi, and it's your first time with vi, you can start editing by pressing the Insert key, and after you are finished, you can save an close by pressing: ESC :wq 11:45:59 What you have to enter in this file is some description of the change that we've made. For example: "Fix the --help problem. Closes: #585426" 11:46:39 done 11:46:51 marga: we insert under the prefixed with `--' and our name line, or above it 11:47:04 or this is a signature so we insert above it? 11:47:11 olspookishmagus: You should write that line at the empty * 11:47:20 olspookishmagus: it's there hanging for you to fill it in. 11:47:37 I'm done, thanks! 11:47:54 Done. 11:47:56 Once this is done, we can rebuild the package again by doing the same thing as before: fakeroot debian/rules binary 11:48:02 dch an acronym for debianchage, eh? nice one 11:48:06 aaaa why is it using nano where is my vi 11:48:46 gungfuwayne: export VISUAL=vi 11:49:04 gungfuwayne: that's your configured editor. Try: sudo update-alternatives --config editor 11:49:30 gungfuwayne: actually, use marga's way. This is the proper one. 11:49:45 This time, the package created should be: ../fdupes_1.50-PR2-3.1_.deb, the version changed because dch changed it for us in the changelog. 11:49:51 hmm, dch set the new version as fdupes_1.50-PR2-3.1 instead of fdupes_1.50-PR2-4 11:49:58 yay thanks orion_elenion[fr] and marga 11:50:00 Now install it with sudo dpkg -i ../fdupes_1.50-PR2-3.1_i386.deb, and test that the help is now correct. :) 11:50:35 xdanx: yes, that's correct. Because we aren't the maintainer of fdupes, and so we update the version as a "Non maintainer upload" 11:50:36 yes it is work! 11:50:52 Nice ! 11:50:55 I'll wait here a little bit until everybody has installed the fixed package. 11:50:58 marga: aah, good to know 11:51:09 worked.... 11:51:49 * olspookishmagus meows 11:52:12 It works here too 11:52:18 worked for me too 11:52:25 I FIXED IT TOO! 11:52:34 yes, working fine 11:52:50 working fine here too 11:53:04 8) 11:53:13 Wow! It works. Amazing! 11:53:41 remember people, this is how it's done NOT what it takes to get it done :P 11:54:53 i forgot to plug in my laptop so it powered down...too early in the morning 11:55:49 gungfuwayne: check this then: http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-11.00.log.txt 11:56:12 thanks olspookishmagus 11:56:29 So, congratulations everyone on fixing your first bug :) 11:56:46 yes! 11:56:47 :) 11:56:49 thanks for showing us! 11:56:58 Thanks, marga! 11:57:01 I've squashed it to marmelade 11:57:07 now where's my bread? 11:57:08 thanks marga 11:57:11 Yes thanks 11:57:12 Thanks marga 11:57:19 Now, what we did here was a bit 'dirty', we modified the package directly, but we usually want to create a patch. 11:57:37 thanks 11:57:40 olspookishmagus: the bear ate it. 11:57:41 Actually, I just realize that with this particular bug it's going to be a bit harder than usual, so I think we'll just leave it there. 11:57:50 marga: are we now into the Q&A part of the tutorial? 11:57:59 So yes, let's do Q&A 11:58:05 * geekosopher is puzzled a bit, what do we submit to the bug report? 11:58:22 geekosopher: well, normally we should submit a diff. 11:58:50 marga: and what do we do for that? 11:58:56 geekosopher: but as I said, I just realized that the bug was actually inside one of the patches in the debian/patches directory, which makes a bit harder to submit a diff :-\ 11:59:47 07-_fix_manpage? 11:59:56 50_bts284274_hardlinkreplace.dpatch 12:00:03 ok, but what would we do in other cases? 12:00:04 but why it is not apply on the deb? 12:00:35 geekosopher: you would build the source package with dpkg-buildpackage and then use interdiff -z over the 2 .diff.gz files in order to get a diff. 12:00:41 since this is a tutorial, and since all ve the source, y don't we jus edit some lines in the source, (corresponding to --help) and then create a diff out of it? 12:00:58 aha! ok, thanks :) 12:01:41 geekosopher: also, this package uses dpatch, which has it's own tools to getting diffs, but I think we are going outside the scope of the tutorial. 12:02:34 So, sorry for not getting to the diff thing... Are there more Questions that need Answers? 12:02:41 geekosopher: or "debdiff", if you want to try another nice tool :) 12:02:56 I have one, when you're ready ask 12:03:06 olspookishmagus: go ahead 12:03:19 svn: Merge source required how i can download the source required for merge? 12:03:35 marga: Suppose you have a package that's missing something not relevant to the program (source) but something of the debian/gnome/menus. How do you insert/propose such a change? Example: if you install either Beneath a Steel Sky [1] or Flight of the Amazon Queen [2] you'll see that the menu option created in: Applications -> Games, miss appropriate icons. [1] http://packages.debian.org/wheezy/beneath-a-steel-sky [2] http://packages.debian 12:03:36 .org/wheezy/flight-of-the-amazon-queen 12:05:08 * olspookishmagus can hear a pin drop 12:05:10 I guess this is somewhere inside the debian directory... 12:05:21 olspookishmagus: that might be bug in the debian/ part of the package. The procedure is very much the same in any case. You edit the relevant .desktop file to add the path to the icon. If you need to add an icon, you add that to the package in the debian/ dir as well. 12:06:00 marga: OK, does these actions have to be in response to some bug report/feature request or can I feel free to start adding stuff and submitting? 12:06:08 The .desktop file might be part of the Debian package or part of the upstream code. It depends on whether the upstream author included one or not. 12:06:20 olspookishmagus: you can always submit a bug WITH the patch. 12:06:29 marga: as a general rule we EDIT only whithin the debian directory? 12:06:43 marga: you mean a patch with the bug eh? :p 12:06:46 I've one. Fixing a bug and installing like we did will confuse the apt in a further upgrade or installing some package wich depends on the first? 12:07:12 olspookishmagus: yes. when you edit outside, you afterwards create a patch and put it in the patches/ directory 12:08:08 yuriaoto: not much. But if the maintainer releases a new version, that version will override your current version. That's why it's always a good idea to submit bug+patch to the BTS so that when the maintainer uploads the new version it will include your fix 12:08:39 And how we submit a bug+patch? 12:08:41 marga: how do we submit a bug and a ... 12:08:46 * olspookishmagus touches neo2500 12:09:06 another question: assuming I want to test to package a new upstream version. Is the procedure more or less the same? 12:09:17 BTS = bug tracking system? 12:09:27 gungfuwayne: we'll done, here's a candy! 12:09:28 Yes, BTS = bug tracking system, sorry for that :) 12:09:36 * gungfuwayne noms 12:09:47 To submit a bug, you can use the 'reportbug' tool. 12:10:46 To send a patch to a bug that already exists, you just send a mail to the corresponding address. For example in the bug we checked, it'd be 585426@bugs.debian.org 12:11:29 xdanx: unfortunately, no. Upgrading to a new version is usually not trivial, because patches may stop applying and the like. 12:11:38 i see 12:11:53 marga: to submit an icon for a package it must be licenced to the public domain? 12:12:22 xdanx: the 'quick & dirty' way is to decompress the upstream source and copy the 'debian/', it might work, but it might not... There are better tools for that as well, like uupdate. 12:12:37 Debian Women hold a session about BTS (09-Dec-2010): http://wiki.debian.org/HowtoUseBTS 12:12:46 maybe it's useful :-) 12:13:03 olspookishmagus: not necessarily. It must be free. It can be Creative Commons 3.0 (BY and SA admitted), it can be GPLed, it can be BSD, MIT, etc. Any free license. 12:13:10 ah, I see, uupdate is in package devscripts 12:13:27 thanks dunetna 12:13:32 xdanx: yes. There are many useful tools to work with packages in devscripts. 12:14:24 Any more questions? 12:15:21 how i can delete the last commit ? http://svn.debian.org/wsvn/pkg-gnome/packages/experimental/nautilus-actions/?op=log&rev=0&sc=0&isdir=1 12:15:53 i wish i had more questions 12:16:00 heh 12:16:25 I'll take a break now, but feel free to stay around and ask questions as you come up to them. 12:16:50 thanks marga for giving this tutorial 12:16:55 Also, if you want, it's a good idea to take a package that you want to fix, like olspookishmagus mentioned, and try to go ahead and fix it. 12:17:02 We'll be here to lend a hand. 12:17:04 marga: make sure your future tutorials get announced the same way this got announce 12:17:17 yes! 12:17:22 where is a good place to start looking for packages that need fixing? 12:17:23 thanks marga :) 12:17:29 aliceinwire: commits can't be deleted in svn; you can do a "reverse merge" and commit this. cf. http://svnbook.red-bean.com/en/1.0/ch04s04.html -> "Undoing changes" 12:17:36 thanks for all marga 12:17:39 gungfuwayne, debian wnpp 12:17:50 thanks aliceinwire 12:17:51 marga: you haven't told us your name and where you're from ^^ 12:17:57 gungfuwayne, http://www.debian.org/devel/wnpp/ 12:18:50 heh, I'm Margarita Manterola, from Argentina. I'm a Debian Developer and part of the Debian Women project. I maintain a few packages (not many), but I enjoy fixing bugs more than making new packages, that's why I gave this tutorial :) 12:19:01 These tutorial sections occur frequently? 12:19:36 Another URL: http://wiki.debian.org/DebianWomen/TrainingSessions 12:19:59 gungfuwayne: usually, just pick a package that you like and check bugs for that package: http://bugs.debian.org/packagename 12:20:14 what if I get this: NOTICE: 'zsnes' packaging is maintained in the 'Git' version control system at: 12:20:19 About the training sessions, yes, check the page dunetna mentioned. 12:21:08 thanks, added to bookmarks :) 12:21:22 olspookishmagus: it's just a mention that the maintainers use git, and if you want you can use their source in order to get the latest version and to prepare your patches. But you can still just get the source code and prepar the patch in the other way. 12:21:37 i am thinking about upgrading to unstable, maybe that would help me find packages to fix 12:22:14 gungfuwayne: well, you don't need to run unstable to run into bugs. 12:22:21 marga: ok, I've compared the zsnes package (that comes with an icon) with the others mentioned earlier, what seems to missing is an .xpm file in the debian directory 12:22:36 olspookishmagus: right. 12:22:46 gungfuwayne, you can use the chroot or pbuilder 12:22:53 if I place a file in the debian directory of the other directories, how do I make sure that it will know where to put it? 12:23:02 I guess I should stop the log now. 12:23:05 #endmeeting