2010-08-05

   1 [07:00] <dholbach> good morning everyone!
   2 === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - https://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi || Questions in #ubuntu-classroom-chat || Current Session: Packaging Training: Fixing Small Bugs In Ubuntu - Instructor: dholbach
   3 [07:00] <dholbach> who do we have here for the Packaging Training session?
   4 [07:01] <dholbach> … come on, don't be shy :)
   5 [07:03]  * micahg will be in and out
   6 [07:03] <dholbach> hey micahg :)
   7 [07:03] <dholbach> ok, who else do we have here?
   8 [07:03] <chilicuil> o/
   9 [07:04] <sbronsted> +1
  10 [07:04] <dholbach> awesome, seems like not everyone of the 119 folks in here are sleeping :)
  11 [07:05] <dholbach> Ok…
  12 [07:05] <dholbach> I had a quick look into Launchpad and found a few easy to solve bugs and I'll show you how to do it
  13 [07:06] <dholbach> this isn't so much about the exact fix, but the proper way to do it and get it included into Ubuntu
  14 [07:06] <dholbach> (or at least one way to get it in)
  15 [07:06] <dholbach> Do you guys have your SSH keys already set up in Launchpad?
  16 [07:06] <chilicuil> yep
  17 [07:07] <sbronsted> yep
  18 [07:07] <dholbach> awesome
  19 [07:07] <dholbach> for those who read the logs afterwards:
  20 [07:07] <dholbach> check if you have ~/.ssh/id_rsa.pub or ~/.ssh/id_dsa.pub
  21 [07:07] <dholbach> if not, run: ssh-keygen -t rsa
  22 [07:07] <dholbach> (you might need to install openssh-client first)
  23 [07:07] <dholbach> afterwards, head to https://launchpad.net/people/+me/+editsshkeys and add your ssh key there
  24 [07:08] <dholbach> alright… with that out of the way, let the real fun begin
  25 [07:08] <dholbach> please run:
  26 [07:08] <dholbach> sudo apt-get install --no-install-recommends bzr bzr-builddeb pbuilder ubuntu-dev-tools build-essential debhelper
  27 [07:08] <dholbach> this will install a couple of tools we'll need in our endeavours
  28 [07:09] <dholbach> bzr is a distributed version control system that's very well integrated into Launchpad
  29 [07:09] <dholbach> bzr-builddeb is a bzr plugin that helps with building packages from bzr branches
  30 [07:09] <dholbach> pbuilder is a tool with which you can build packages locally, in a sane and clean way (kind of what happens in a PPA, when packages get built there)
  31 [07:10] <dholbach> ubuntu-dev-tools (and devscripts which it pulls in) gives you a set of scripts that are incredibly useful for package maintenance, especially repetitive tasks like updating the changelog, etc. become very pain-free
  32 [07:11] <dholbach> build-essential pulls in make, gcc and other bits for very basic compilation bits
  33 [07:12] <dholbach> and debhelper is used in almost every package as a build-dependency - it's very useful to have it around, it automates lots of things in the actual build process
  34 [07:12] <dholbach> do you have any questions already?
  35 [07:12] <sbronsted> no
  36 [07:12] <chilicuil> nop =)
  37 [07:12] <dholbach> if you do, please ask, or I'll be typing my fingers off and probably bore you to death :)
  38 [07:12] <dholbach> alright, let's crack on then
  39 [07:13] <dholbach> to tell bzr who you are and how things work, I did the following
  40 [07:13] <dholbach> bzr launchpad-login dholbach
  41 [07:13] <dholbach> bzr whoami "Daniel Holbach <daniel.holbach@canonical.com>
  42 [07:14] <dholbach> launchpad-login is your personal Launchpad ID (if you're unsure, head to https://launchpad.net/people/+me and see where it redirects you, it's the bit after the "~" in the URL)
  43 [07:14] <dholbach> and please use your own email and not mine :-P
  44 [07:14] <micahg> otherwise bzr blame doesn't work right :)
  45 [07:14] <dholbach> haha
  46 [07:15] <dholbach> alright, job done, next we edit ~/.bashrc (if you use another shell, please edit whatever file else you need)
  47 [07:15] <dholbach> and add something like this to the bottom of it:
  48 [07:15] <dholbach> export DEBFULLNAME='Daniel Holbach'
  49 [07:15] <dholbach> export DEBEMAIL='daniel.holbach@ubuntu.com'
  50 [07:16] <dholbach> afterwards, you can just run    source ~/.bashrc   (or restart the session) and you should be sorted out
  51 [07:16] <dholbach> now the packaging tools and the distributed development tools should know who you are and will make use of that information in commits and all the rest of it
  52 [07:16] <dholbach> woohoo
  53 [07:17] <dholbach> next, please edit ~/.pbuilderrc
  54 [07:17] <dholbach> and add this to it
  55 [07:17] <dholbach> COMPONENTS="main universe multiverse restricted"
  56 [07:17] <dholbach> MIRRORSITE=http://archive.ubuntu.com/ubuntu/
  57 [07:17] <dholbach> it will basically make use of all components (instead of just 'main') and default to the standard archive
  58 [07:18] <dholbach> save the file and run
  59 [07:18] <dholbach> sudo pbuilder create
  60 [07:18] <dholbach> … which will take a bit of time
  61 [07:18] <dholbach> it will set up the initial, minimal build environment which will be re-used for all the local test builds that you do
  62 [07:19] <dholbach> --- now we're done with preparations ---
  63 [07:19] <dholbach> just one more word on your development environment
  64 [07:19] <dholbach> you need to run the latest development release, in our case maverick
  65 [07:20] <dholbach> it doesn't need to be your main system
  66 [07:20] <dholbach> you can have it on a spare partition or in a virtual machine or on a separate computer
  67 [07:20] <dholbach> but you need to be able to test all the stuff in the development release that is currently being worked on
  68 [07:20] <dholbach> https://wiki.ubuntu.com/UbuntuDevelopment/UsingDevelopmentReleases has a lot of information about how to do it and stay sane
  69 [07:21] <dholbach> are there any questions up until now?
  70 [07:21] <chilicuil> in the last udw u've told me that I should look at pbuilder-dist if I wanted to create diff chroots, I've done it but it doesnt seem to use the ~/.pbuilderrc, which file should I edit?
  71 [07:21] <dholbach> hum
  72 [07:21] <dholbach> let me find out
  73 [07:22] <dholbach> why doesn't it use ~/.pbuilderrc?
  74 [07:22] <dholbach> or: how did you notice it didn't?
  75 [07:22] <chilicuil> coz I've set some vars there and it doesnt use them , for example the place where it puts the results
  76 [07:23] <dholbach> aha, let me have a quick look at the code
  77 [07:24] <chilicuil> if u want u can help me to find it out after the classroom I dont want to bother all the nice ppl here
  78 [07:25] <dholbach> I suggest you have a chat with Laney or RainCT in #ubuntu-motu - they wrote the tool
  79 [07:25] <dholbach> maybe it's a bug, it's hard for me to tell right now
  80 [07:25] <chilicuil> I'll do
  81 [07:25] <dholbach> awesome
  82 [07:25] <dholbach> any more questions?
  83 [07:26] <dholbach> alright
  84 [07:26] <dholbach> on to bugs :)
  85 [07:27] <dholbach> https://bugs.launchpad.net/ubuntu/+source/phpldapadmin/+bug/609403 is the first one I picked
  86 [07:27] <ubot2> Ubuntu bug 609403 in phpldapadmin (Ubuntu) (and 1 other project) "Call to undefined function spritnf() in /usr/share/phpldapadmin/lib/functions.php on line 2180 (affects: 1) (heat: 565)" [Undecided,New]
  87 [07:27] <dholbach> the analysis of the bug is quite good, so let's see how easy it is to fix
  88 [07:28] <dholbach> let's get the source code first, so please run
  89 [07:28] <dholbach>   bzr branch lp:ubuntu/phpldapadmin
  90 [07:28] <dholbach> lp:ubuntu/<packagename> will always get you the source of the latest development release
  91 [07:28] <dholbach> so at the moment it's identical to
  92 [07:28] <dholbach>   bzr branch lp:ubuntu/maverick/phpldapadmin
  93 [07:29] <dholbach> first we should check and see if the bug still exists
  94 [07:29] <dholbach> I had a quick look and it seems to be still there
  95 [07:29] <dholbach> daniel@miyazaki:~/phpldapadmin$ grep -r spritnf .
  96 [07:29] <dholbach> ./lib/functions.php:                         $new_value = spritnf('{SMD5}%s',base64_encode(mhash(MHASH_MD5,$password_clear.$salt).$salt));
  97 [07:29] <dholbach> daniel@miyazaki:~/phpldapadmin$
  98 [07:29] <dholbach> so let's go and edit lib/functions.php
  99 [07:30] <dholbach> just search for spritnf and replace with sprintf
 100 [07:31] <dholbach> depending on what editor you use if will show you visually how it recognises sprintf as a function name (as opposed to spritnf)
 101 [07:31] <dholbach> at least vi did that for me
 102 [07:31] <dholbach> ok, now save the file - bug should be fixed
 103 [07:31] <dholbach> next we should go and document it
 104 [07:31] <dholbach> for that   dch -i   should do the job
 105 [07:32] <dholbach> it'll automatically start the editor with debian/changelog (which is the changelog for the debian/ubuntu releases of the package)
 106 [07:32] <dholbach> and add a boilerplate entry for us
 107 [07:32] <dholbach> ok, let's go through the first line one by one
 108 [07:32] <dholbach> phpldapadmin (1.2.0.5-1.1ubuntu2) maverick; urgency=low
 109 === mdeslaur-afk is now known as mdeslaur
 110 [07:33] <dholbach> first up is the package name
 111 [07:33] <dholbach> in parentheses we have the version number of the package
 112 [07:33] <dholbach> or in our case of our suggested revision later on
 113 [07:34] <dholbach> 1.2.0.5 is the upstream version number, so what the phpldapadmin authors released on their web page
 114 [07:34] <dholbach> the part after the '-' is the package revision
 115 [07:35] <dholbach> if we split up 1.1ubuntu2, '1.1' is the debian revision we inherited from debian and '2' the revision in Ubuntu
 116 [07:35] <dholbach> so: upstream released 1.2.0.5, there was revision 1, then 1.1 in Debian and we introduced 2 changes to it
 117 [07:36] <dholbach> if you review debian/changelog you can see at least the history of what happened in debian and ubuntu regarding the package
 118 [07:36] <dholbach> ok, moving on: maverick is just the name of the release where you want to upload your package to (current development release always is the default)
 119 [07:37] <dholbach> urgency=low is the default and rarely changed
 120 [07:37] <chilicuil> question: can ubuntu revisions have point in between as debian ones?
 121 [07:37] <dholbach> yes
 122 [07:37] <dholbach> I think it's mostly used for stable release updates and security updates
 123 [07:37] <dholbach> normally we just increment by one
 124 [07:38] <dholbach> in Debian I think it's done similarly, also NMUs (non maintainer uploads, which is a concept we don't have) use those
 125 [07:38] <dholbach> pretty safe to ignore for now :)
 126 [07:38] <chilicuil> ok, great =)
 127 [07:38] <dholbach> let's document our changes now
 128 [07:39] <dholbach> I just put something in there like this:
 129 [07:39] <dholbach>  * lib/functions.php: fixed typo: spritnf() → sprintf. (LP: #609403)
 130 [07:39] <dholbach> so first of all I mention which file I changed
 131 [07:39] <dholbach> then I try to explain what I did there
 132 [07:40] <dholbach> that's the most important thing: you really don't want others to have to guess why you made a weird change somewhere
 133 [07:40] <dholbach> or you don't want to have to guess 2 months later yourself :)
 134 [07:40] <dholbach> we maintain all packages as one big team, so that somebody has a look at your changes later on is not unlikely :)
 135 [07:40] <dholbach> in our case it should be pretty obvious though
 136 [07:41] <ansgar> Does Ubuntu introduce patch systems such as quilt in d/rules or switch to source 3.0 (quilt) when they introduce changes to packages that had none before?
 137 [07:41] <dholbach> ansgar: I wouldn't recommend it - I'd use whatever the package itself uses
 138 [07:41] <dholbach> ansgar: but I've seen it happen
 139 [07:42] <dholbach> just to explain: patch systems are used to store patches on top of upstream source code in packages
 140 [07:42] <dholbach> in this case the package doesn't use any
 141 [07:43] <dholbach> ok, with '(LP: #609403)' I document where the discussion of the bug happened
 142 [07:43] <dholbach> or rather discussion of the change
 143 [07:43] <dholbach> in our case it's very obvious and simple
 144 [07:43] <dholbach> but you might have to change something and somebody might question later on where the decision and idea came from - in that case it's good to reference a bug report, an upstream commit or a mailing list discussion
 145 [07:44] <dholbach> also by using the specific format like in '(LP: #609403)' the bug will get closed automatically once it gets uploaded to Ubuntu
 146 [07:44] <dholbach> with that done, most of our work is done :-)
 147 [07:44] <dholbach> can you save the file, run bzr diff and paste the output to paste.ubuntu.com and give the link here?
 148 [07:45] <chilicuil> http://paste.ubuntu.com/473408/
 149 [07:46] <sbronsted> http://paste.ubuntu.com/473409/
 150 [07:47] <dholbach> chilicuil: not sure if "chilicuil <chilicuil@i.am>" is what you want in there, I'll leave that to you, maybe you need to edit the values in ~/.bashrc again :)
 151 [07:47] <dholbach> apart from that it looks great
 152 [07:47] <dholbach> sbronsted: seems you added an additional changelog entry (just edit debian/changelog and remove it)
 153 [07:48] <dholbach> also does sb@sb-laptop.casalogic.lan not look like a real email address :)
 154 [07:48] <dholbach> you might want to change it in ~/.bashrc too
 155 [07:48] <dholbach> apart from that: good work!
 156 [07:48] <dholbach> awesome
 157 [07:48] <dholbach> now please run
 158 [07:48] <dholbach>   debcommit
 159 [07:48] <dholbach> this will commit your changes locally
 160 [07:49] <dholbach> using information from the changelog entry we just wrote
 161 [07:49] <dholbach> so it'll automatically pass on info like that it fixes bug#609403, etc
 162 [07:49] <dholbach> next please run
 163 [07:50] <dholbach>   bzr push lp:~<launchpad id>/ubuntu/maverick/phpldapadmin/fix-609403
 164 [07:50] <dholbach> I'd run
 165 [07:50] <ClassBot> There are are 10 minutes remaining in the current session.
 166 [07:50] <dholbach>   bzr push lp:~dholbach/ubuntu/maverick/phpldapadmin/fix-609403
 167 [07:50] <dholbach> '~dholbach' means: use my personal namespace
 168 [07:50] <dholbach> 'ubuntu' is the distro we're working on
 169 [07:51] <dholbach> 'maverick' the development release we're working on
 170 [07:51] <dholbach> 'phpldapadmin' the package in question
 171 [07:51] <dholbach> 'fix-609403' just a name for the branch
 172 [07:51] <dholbach> now we need to test our package
 173 [07:51] <dholbach> please run
 174 [07:51] <dholbach>   bzr bd -- -S -us -uc
 175 [07:52] <dholbach> this will build a source package from your local branch (so the original upstream tarball, plus the debian/ubuntu changes, plus some descriptional file)
 176 [07:52] <dholbach> -us -uc will just avoid signing it, it's not necessary
 177 [07:53] <dholbach> now please run
 178 [07:53] <dholbach>   sudo pbuilder build ../phpldapadmin_1.2.0.5-1.1ubuntu2.dsc
 179 [07:53] <chilicuil> question: can I run there $ debuild -S -uc -us instaed?
 180 [07:54] <dholbach> chilicuil: the arguments after 'bzr bd --' are passed to debuild
 181 [07:54] <micahg> dholbach: good question ^^ ;)
 182 [07:54] <dholbach> chilicuil: but it will ignore .bzr for example, etc.
 183 [07:54] <dholbach> 'bzr bd --' is a cleaner way to do it
 184 [07:55] <ClassBot> There are are 5 minutes remaining in the current session.
 185 [07:55] <dholbach> alright, for me the build passed
 186 [07:55] <dholbach> now I would try to install the package, make sure it works and all the rest of it, but  we can't cover that here
 187 [07:56] <dholbach> (the resulting package is in /var/cache/pbuilder/result)
 188 [07:56] <dholbach> once you're happy with all your testing, you'd run
 189 [07:56] <dholbach>   bzr lp-lopen
 190 [07:56] <dholbach> in your branch
 191 [07:56] <dholbach> and it will open the branch's Launchpad page and there you can click 'Propose for merging'
 192 [07:57] <dholbach> which will give Ubuntu Reviewers the opportunity to review your code changes and merge them into Ubuntu
 193 [07:57] <dholbach> so to sum up what you need to do to work on a fix is:
 194 [07:57] <dholbach>  - bzr branch lp:ubuntu/<pkg>
 195 [07:57] <dholbach>  - cd <pkg>
 196 [07:57] <dholbach>  # work on the fix
 197 [07:57] <dholbach>  - dch -i        (to document it)
 198 [07:58] <dholbach>  - debcommit      (to commit locally)
 199 [07:58] <dholbach>  - bzr bd -- -S -us -uc    (to build a source package which you can then pass to pbuilder and other tools)
 200 [07:58] <dholbach>  # test-build the package and test it locally
 201 [07:59] <dholbach>  - bzr push lp:<lpid>/ubuntu/<release>/<pkg>/<branchname>
 202 [07:59] <dholbach>  - bzr lp-open
 203 [07:59] <dholbach>  # click 'propose for merging'
 204 [07:59] <dholbach> DONE
 205 [07:59] <dholbach> that's not too bad, is it?
 206 [07:59] <ajmitch> dholbach: thanks :)
 207 [07:59] <sbronsted> dholbach: thanks :)
 208 [08:00] <dholbach> do you have any last questions, before I take the dog for a walk and you can ask even more questions in #ubuntu-motu and #ubuntu-packaging?
 209 [08:00] <dholbach> :-)
 210 [08:00] <ansgar> And remember to forward the patch upstream after this (if relevant to upstream) ;-)
 211 [08:00] <dholbach> ansgar!
 212 === ChanServ changed the topic of #ubuntu-classroom to: Welcome to the Ubuntu Classroom - http://wiki.ubuntu.com/Classroom || Support in #ubuntu || Upcoming Schedule: http://is.gd/8rtIi
 213 [08:00] <dholbach> very important point
 214 [08:00] <chilicuil> awesome, thx dholbach =)
 215 [08:00] <dholbach> https://wiki.ubuntu.com/Bugs/HowToFix has more info on when to send stuff upstream and the like
 216 [08:01] <dholbach> https://wiki.ubuntu.com/MOTU/GettingStarted links to a lot of other important stuff like the packaging guide, ubuntu development procedures and all the rest of it
 217 [08:01] <dholbach> unfortunately we only got one bug done, but we at least covered a bunch of details in there
 218 [08:01] <dholbach> https://bugs.edge.launchpad.net/ubuntu/+source/sbackup/+bug/384334 was the other one I picked earlier today
 219 [08:01] <ubot2> Ubuntu bug 384334 in sbackup (Ubuntu) "Bad grammar in "Backup Now!" tooltip (affects: 1) (heat: 8)" [Undecided,New]
 220 [08:02] <dholbach> if there are no more questions right now, I'll leave you be
 221 [08:02] <dholbach> and thanks a lot for your interest
 222 [08:02] <kermiac> thanks for the great session dholbach :)
 223 [08:02] <dholbach> hope you enjoyed it and will enjoy it even more to make Ubuntu even better :)
 224 [08:02] <sbronsted> dholbach: How often is http://qa.ubuntuwire.org/ftbfs/ updated?
 225 [08:03] <dholbach> sbronsted: maybe wgrant in #ubuntu-motu knows - I'm afraid I don't know
 226 [08:03]  * chilicuil is gonna fix 384334 if nobody stop him
 227 [08:05] <dholbach> alright my friends - thanks again, all further questions can go into one of the other channels
 228 [08:05] <dholbach> I'll put up logs later on
 229 [08:05] <dholbach> byeeeeeeeeeeee

Packaging/Training/Logs/2010-08-05 (last edited 2010-08-11 09:09:28 by port-83-236-187-42)