22:02:24 <marga> #startmeeting
22:02:24 <MeetBot> Meeting started Sat May  7 22:02:24 2011 UTC.  The chair is marga. Information about MeetBot at http://wiki.debian.org/MeetBot.
22:02:24 <MeetBot> Useful Commands: #action #agreed #help #info #idea #link #topic.
22:02:35 <marga> Hello everybody and welcome to this tutorial about re-building Debian packages.
22:02:42 <marga> 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.
22:03:10 <marga> 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.
22:03:31 <marga> With that said, I'd like to know who is 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.
22:04:23 <tassia> tassia from brazil
22:04:26 <boutil> Hi! I am C├ędric from France, and I'm here for the tutorial.
22:04:29 <xakz> \o/
22:04:35 <agl2> me, germany
22:04:45 <szilka> I'm Shannon from Portland, OR, USA - I'm new to debian, but have some experience with php and web programming
22:04:59 <kostya> Russia
22:05:06 <marga> BTW, I'm Margarita from Argentina :)
22:05:09 <dunetna> spain
22:05:22 <ksn> south africa
22:05:29 <nomadium> Hi, I am Miguel from Venezuela. Interested in the tutorial but I already have experience packaging software in Debian
22:05:54 <leonardo_> Hi, Argentina, don't know how to use properly my IRC client :(
22:06:01 <shgz> bouvou
22:06:08 <PauloRMM> from Brazil (living in the USA)
22:06:12 <Cristian-cr> Hi, I'm Cristian from Costa Rica
22:06:29 <marga> If you don't feel too confortable speaking in english, you may want to join #debian-women-<language code> for your language. <language code> stands for the two letter code for your language, 'es' for Spanish, 'fr' for French, 'pt' for Portuguese, etc.
22:07:05 <marga> 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.
22:07:10 <f3rland> me, Canada
22:07:10 * paulproteus waves to the room!
22:07:47 <marga> 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.
22:08:17 <marga> 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).  The tutorial part will take about 1 hour, and then we'll do half an hour or so of questions.
22:08:39 <marga> 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.
22:08:54 <marga> This will install some packages that will be needed later on. We'll keep going with other stuff while the packages install.
22:09:22 <marga> 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.
22:09:25 <bongokader> me, senegal
22:09:57 <marga> \o/ yay! 2 people from Africa!
22:10:22 <marga> 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
22:10:42 <marga> 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
22:11:14 <marga> If you use stable/testing/whatever as your running distribution, getting source from unstable won't affect it.
22:11:25 <marga> 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.
22:11:35 <marga> Please tell me when you've run sudo apt-get update and it's successfully retrieve the source files.
22:12:58 <agl2> ok
22:13:01 <boutil> ok
22:13:04 <marga> BTW, for those joining later on, you can check the log at: http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-22.02.log.txt
22:13:28 <paulproteus> Welcome dsfsd + donatella.
22:13:40 <donatella> hi, thanks :)
22:13:56 <Barcelona_deb> hello, thanks :p
22:13:59 * paulproteus is Asheesh, a Debian developer, based in the Boston, MA area, and a big fan of this event.
22:14:10 <tassia> done
22:14:38 <marga> With the sources URL added to your apt repositories, you'll now be able to get the source of any Debian package that you like.
22:14:45 <paulproteus> marga: Can you say #topic #topic http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-22.02.log.txt (then the log is easy for people to find as they join) ?
22:14:52 <paulproteus> (er, just one #topic)
22:15:07 <marga> #topic http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-22.02.log.txt
22:15:20 <marga> Uhm, didn't work.
22:15:23 <paulproteus> (er, I thought that MeetBot would then set the topic... guess not.)
22:15:25 <paulproteus> (carry on.)
22:15:26 <szilka> done
22:15:48 <marga> 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
22:16:01 <dunetna> marga: maybe is /topic
22:16:14 * Barcelona_deb is reading the log =)
22:16:54 <marga> 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
22:17:30 <marga> 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.
22:18:20 <marga> 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
22:18:59 <marga> After this has run, you'll 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.
22:19:04 <paulproteus> (Welcome gardo. If you are joining the event late, you can catch up by reading the log at http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-22.02.log.txt . Say hi!)
22:19:35 <marga> 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/
22:19:41 * gardo is catching up
22:19:58 <marga> 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.
22:20:12 <marga> 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.
22:20:35 <marga> 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.
22:21:18 <marga> 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.
22:21:39 <marga> 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
22:22:18 <marga> Actually, when I say 'Debian' there, I mean the great apt tool.
22:22:54 <marga> Once you've downloaded these tools, you'll be ready to build the package.  Please tell me when you are done up to this point.
22:23:03 <f3rland> ready
22:23:19 <boutil> ready
22:23:20 <tassia> done
22:23:21 <szilka> done
22:23:58 <donatella> all good
22:24:00 <gardo> done
22:24:01 * marga fears we've lost a number of people along the way :-\
22:24:22 <kostya> ready
22:24:32 <ksn> ok
22:24:41 <tassia> marga, maybe they are just shy ;-)
22:24:46 <marga> As a first step, let's build the package without making any changes, just to be sure that it builds and it installs properly.  Do: fakeroot debian/rules binary
22:25:06 <marga> 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_<your arch>.deb' (in your own language).
22:25:31 <marga> (<your arch> can be i386, amd64, etc)
22:25:34 <paulproteus> psst, anyone, if you are lost, now is a good time to speak up!
22:25:35 <marga> The next thing to do now is install this file with: sudo dpkg -i ../fdupes_1.50-PR2-3_<your arch>.deb
22:26:22 <marga> After that, check that the bug is still present, running fdupes --help.
22:27:08 <marga> Now, we want to actually fix this bug. Here comes the fun part, are you ready? :)
22:27:17 <gardo> yep
22:27:18 <szilka> yep
22:27:21 <f3rland> yep
22:27:22 <PauloRMM> no
22:27:29 <marga> PauloRMM: what's up?
22:27:35 <komozo> yep
22:27:44 * franki^ is following along too!
22:27:47 <boutil> yes
22:28:22 <marga> 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.
22:28:33 <marga> In this particular case, the package uses the "dpatch" tool, a tool to manage patches for the package, so we will make use of that tool.  Other packages use a different tool, called quilt, to manage patches, but we won't be covering that one today.
22:28:50 <paulproteus> PauloRMM: If you want help, but you don't want to interrupt, you can send me a private message.
22:28:53 <PauloRMM> it's OK
22:28:56 <paulproteus> Same goes for everyone here.
22:29:12 <marga> [For those repeating the session from this morning, here's where it differs]
22:29:19 <tassia> marga, can you send the bug link again?
22:29:21 <franki^> Is quilt the ``recommended'' system for new packages?
22:29:29 <marga> tassia: http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585426
22:29:30 <gardo> http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=585426 tassia
22:29:38 <tassia> thanks!
22:29:53 <marga> franki^: I think it's getting more and more fans, but right now it's not officially recommended.
22:30:06 <franki^> marga: I see.  Thanks.
22:30:07 <marga> So, to create a new patch, you'll need to do the following.  Type: dpatch-edit-patch 80_bts585426_fix_help 70_bts537138_disambiguate_recurse.dpatch
22:30:23 <marga> The first parameter is the name that we are giving this patch.  The second parameter is the last patch that we want to be applied before ours.
22:30:29 <RoboTux> paulproteus: Or you can send message here to :)
22:30:34 <RoboTux> s/to/too/
22:30:35 <dunetna> ls
22:30:40 <dunetna> sorry :-)
22:30:48 <marga> This will start a new shell inside a special environment, where you can edit your files and dpatch will afterwards take care of getting the differences with the original.
22:31:03 <marga> Now we need to edit the fdupes.c file. You can edit the file with your prefered editor (vi fdupes.c, gedit fdupes.c, kate fdupes.c, etc).  Go to the line 1066 and delete it.
22:31:16 <marga> The line says: printf("                  \teach set of duplicates without prompting the user\n");
22:31:41 <marga> Once you are done, you should type 'exit' into the console.  It will end the special environment that dpatch created for us, and you'll have a new patch in the debian/patches/ directory.  Check it out with: cat debian/patches/80_bts585426_fix_help.dpatch
22:32:14 <marga> In order for this patch to get applied, you'll need to edit the debian/patches/00list file, and add '80_bts585426_fix_help' as the last line.
22:33:09 <marga> The 00list file is the dpatch file that lists all the patches that will be applied.  They are applied in order, from the one appearing in the first line, till the one appearing in the last line.
22:33:53 <marga> So, we've created a patch with dpatch-edit-patch and the added the name of that patch to the 00list file.
22:34:00 <marga> Please tell me when you're done.
22:34:03 <tassia> marga, paulo is coming can we wait a little bit for him?
22:34:08 <f3rland> done
22:34:09 <marga> Yep
22:34:16 <donatella> so far so good
22:34:27 <boutil> ready
22:34:32 <marga> Any questions while we wait a little bit for Paulo?
22:35:07 <gardo> done
22:35:22 <ksn> ok
22:35:49 <leonardo_> ok
22:35:50 <boutil> Is the number 80_ in the name of the patch a cosmetic thing?
22:35:51 <f3rland> question about dpatch-edit-patch params
22:36:02 <f3rland> where did you get your params?
22:36:17 <f3rland> i mean the bts****
22:36:40 <paulproteus> Welcome Tungste. If you are just joining, take a look at the log so far at http://meetbot.debian.net/debian-women/2011/debian-women.2011-05-07-22.02.log.txt
22:36:56 <marga> The first one is the name of the patch.  I chose a name similar to the other ones.  "bts" stands for "bug tracking system", the number is the bug number that we are closing.
22:37:03 * paulproteus dances, Yay! Someone PM'd me to ask a question. I would be happy to answer more, too.
22:37:20 <f3rland> cool thanks :)
22:37:23 <marga> I could have chosen any name, I just tried to follow the pattern.
22:37:56 <franki^> So, the number prefix is purely aesthetic?
22:38:34 <marga> franki^: it's so that you can get them in order when you list them with ls.  The order of application is the order in which they appear in the 00list file.
22:38:49 <boutil> thanks for the answer, marga!
22:39:02 <marga> Some maintainers choose to give them numbers, some don't.  But when you are patching a package, you should try to follow whichever pattern the maintainer chose.
22:40:01 <franki^> Okay
22:40:30 <marga> Okay, I think we should go on.
22:40:33 <marga> Before rebuilding the package with this patch, 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
22:40:39 <tassia> marga, go on
22:40:55 <tassia> marga, I'll help paulo he needs
22:41:04 <marga> 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
22:41:05 <PauloRMM> don't worry about me
22:41:27 <RoboTux> tassia: paulo can ask paulproteus and me questions if needed
22:42:01 <tassia> PauloRMM, yes we do :-D
22:42:04 * lisandropm is also available for private questions
22:42:06 <tassia> RoboTux, thanks!
22:42:13 <marga> So, you are editing the changelog file now. What you have to enter in this file is some description of the change that we've made.  For example: "Added a patch to fix the --help issue with the --debug option.  Closes: #585426".  Do this in the line with the empty '*'
22:43:24 <marga> Once this is done, we have to first clean the building directory, so that everything is back as it started, with: fakeroot debian/rules clean
22:43:41 <marga> And then we can rebuild the package again by doing the same thing as before: fakeroot debian/rules binary
22:43:57 <marga> This time, the package created should be: ../fdupes_1.50-PR2-3.1_<your arch>.deb, the version changed because dch changed it for us in the changelog.
22:44:16 <marga> (-3.1 instead of -3, that is)
22:44:25 <marga> Now install it with sudo dpkg -i ../fdupes_1.50-PR2-3.1_<your arch>.deb, and test that the help is now correct. :)
22:45:06 <marga> I'll wait here until everyone has correctly built their package.
22:45:33 <ksn> working :) How does dch pick the number "3.1"?
22:45:47 <boutil> ok
22:46:34 <marga> ksn: we used 'dch -n', because we are not the maintainer of the package (n stands for non-maintainer).  Then it's 3.1.  If you were the maintainer, you'd have done dch -i, and it would have chosen -4
22:46:55 <ksn> thx
22:47:08 <donatella> ok
22:48:03 <RoboTux> ksn: It took the latest number and added .1
22:48:23 <RoboTux> if latest revision number was -3.2 it would have been -3.3
22:49:40 <marga> Congrats to everybody that has followed up to here on fixing their first bug ! 8)
22:49:51 * franki^ dances.
22:50:06 <marga> Once a bug is fixed, you might want to also build the source package.  This means not only the .deb file, but the other files that we downloaded at the beginning.  This is done with: dpkg-buildpackage -us -uc
22:50:15 <marga> The extra parameters are to prevent it from signing the package, since we don't need to sign it right now.
22:51:22 <paulproteus> Hey, everyone. Some people have been asking me what the bug is, exactly.
22:51:32 <gungfuwayne> okay time to go home and enjoy the weekend happy packaging everyone!
22:51:35 <paulproteus> Can some non-marga person try to explain the bug, so I can check the rest of you know what it's about? (-:
22:51:54 <paulproteus> Also! Now that you're all here, and celebrating your first bug fix, I want to invite you to stay in touch with the Debian community.
22:52:28 <paulproteus> I hope that you all pop back on and off IRC -- #debian-women is a good place to be, as is #debian-mentors . Most new contributors to Debian discuss their work on the http://lists.debian.org/debian-mentors/ list.
22:52:29 <franki^> The bug was that the help message contained an incorrect line
22:52:56 <franki^> The one reading ``each set of duplicates..'', right?
22:53:17 <marga> franki^: yep! :)
22:53:18 <gungfuwayne> oh wait nevermind, no enjoying the weekend just yet
22:53:26 <franki^> Yay!
22:53:29 <dunetna> I have one question: once you have all of this, what exactly do you send to the BTS?
22:53:30 <RoboTux> paulproteus: You said it before me, I was busy on debian-mentors :)
22:53:33 <paulproteus> RoboTux: (-:
22:53:37 <marga> dunetna: I'm getting there.
22:53:42 <gungfuwayne> paulproteus, i would like to get involved in debian
22:53:45 <marga> Just 2 more lines and we are there.
22:53:52 <marga> If you've build the source package, go to the previous directory with 'cd ..' and check the files there with 'ls'.  You'll see that you have more files there now.  Including 2 dsc files, one for the original package and one for the one you just made.
22:53:55 <paulproteus> gungfuwayne: I'll say more about that after marga's done (-:
22:53:56 <franki^> For the record, I've been following the Debian Mentors mailing list for a while, but I'm not sure how to get started helping Debian. :-)
22:54:06 <donatella> at first, I didn't get what the bug was, until we made the edit in the help line
22:54:07 <dunetna> thanks marga
22:54:10 <RoboTux> gungfuwayne: great :)
22:54:13 <paulproteus> franki^: I can give you some tips then, post-tutorial, too (-:
22:54:16 <donatella> thanks!
22:54:41 <marga> Once you've built any source package, you can find out the difference between your package and the original one, by using debdiff: debdiff fdupes_1.50-PR2-3.dsc fdupes_1.50-PR2-3.1.dsc > my_first_debdiff.diff
22:54:54 <gregoa> donatella: never mind, it also took me some time when reading the bug report for the first time :)
22:55:25 <marga> So, to answer dunetna's question: in this case, what we would send to the BTS as a patch is the dpatch file that we created, because the change that we made is enclosed there.
22:55:31 <franki^> paulproteus: Cool!
22:55:46 <marga> But if we hadn't used dpatch, we could use the output of that debdiff and send that to the BTS.
22:56:20 <marga> dunetna: does that answer your question?
22:57:36 <ksn> nice tut!
22:57:59 <marga> Anyway, I'm done with the tutorial. Please do ask as many questions you like now! There's plenty of people besides me willing to answer them.
22:58:02 <dunetna> so, we don't send anything about changelog?
22:58:41 <tassia> marga, thanks
22:58:42 <marga> dunetna: not necessarily, but you can send that too, it depends on the bug that you are fixing.
22:59:22 <marga> dunetna: sending the debdiff output is always acceptable.
22:59:24 <dunetna> sending a changelong with a nmu is considered, nt plite?
22:59:39 <dunetna> s/nt/not
22:59:44 <paulproteus> marga: Thanks for the tutorial! I had fun even though I'm already a DD. (-:
23:00:07 <franki^> Si, muchas gracias, marga. :-)
23:00:08 <boutil> what is the quickest/easiest way to find out which tool (if any) is used to manage patches?
23:00:13 <ksn> Does this workflow work for all packages?
23:00:18 <f3rland> thanks marga
23:00:19 <RoboTux> dunetna: Some people might take a NMU as a punishment but most will be happy I would say
23:00:31 <lisandropm> ksn: most of them
23:00:36 <marga> dunetna: no.  What _some_ (not all) maintainers don't like is if when someone actually uploads an NMU.  Sending a patch to the BTS is always/immer/siempre/sempre well received!
23:00:59 <dunetna> marga: ok
23:01:05 <moray> dunetna: if you're sending only a small and simple patch it's normal to let the maintainer write the changelog; if it's a big NMU update then yes you should send the changelog as part of your big patch to the BTS
23:01:06 <paulproteus> Paricularly for all the women in the room, there is email list that covers the "Debian Women project" that marga and others are a part of. I hope you join it at http://lists.debian.org/debian-women/
23:01:07 <marga> boutil: there should be a debian/README.source file.
23:01:08 <gregoa> boutil: if there's a build dependency on quilt or dpatch in debian/control. or if there's a debian/README.source file
23:01:26 <paulproteus> Everyone, you should please join the debian-mentors mailing list so you that you can email it when you have questions: http://lists.debian.org/debian-mentors/
23:01:54 <marga> ksn: as lisandropm said, the workflow is quite general.  The only thing that might change is the patch management system (dpatch/quilt/none).  The rest is basically always the same.
23:01:58 <boutil> marga: thanks for the answer.
23:02:13 <dunetna> marga: thanks again
23:02:15 <gregoa> boutil: and then there are weird cases where you have to guess from reading debian/rules :)
23:02:18 <paulproteus> I want to hear from at least 3 people in the room that you've newly joined one of these two email lists!
23:02:28 <moray> paulproteus: before you'll let them /part? ;)
23:02:40 <paulproteus> If I could have my way about it, yes moray (-:
23:02:41 <marga> :)
23:02:46 <gungfuwayne> i want a sandwich
23:03:00 <moray> oh, and I think I've fixed my own autotools woes while the tutorial was going on
23:03:01 <franki^> sudo make gungfuwayne a sandwich
23:03:13 * paulproteus will be quiet until he hears 3 people say they've joined a list.
23:03:25 <boutil> thank you very much for the tutorial!
23:03:55 <tassia> thank you everybody
23:04:00 <tassia> I need to go now
23:04:10 <Pashupati> paulproteus, I did after searching stuffs after the first tutorial.
23:04:41 <paulproteus> There's 1... now who will be number 2 and number 3?
23:04:47 <dunetna> If someone is also interested in packaging from scratch I'd recommend  http://www.debian.org/doc/manuals/maint-guide/
23:04:52 <franki^> paulproteus: I would join the list, but I've been following it for months already!
23:04:59 <marga> It looks like there are no more questions, so I'll stop the log.  But feel free to ask any questions even after that.
23:05:03 <marga> #endmeeting