/srv/irclogs.ubuntu.com/2009/05/14/#ubuntu-classroom.txt

=== photon is now known as Guest52575
ricarro_date -u06:17
ricarro_exit06:17
=== mimir|zZz is now known as mimir|on
=== mh_ is now known as rtr
funkyHatHi:)13:00
asachi all13:01
asacso i had offered to run a packaging training session today13:03
* ianto applauds13:03
* funkyHat bounces13:03
asacin particular about patchsystems13:03
* juanje applauds13:03
asacso who is here ;)?13:03
* ianto looks around13:04
iantome13:04
juanjeme13:04
kmdmhere :)13:04
funkyHatasac: will you be joining #ubuntu-classroom-chat, or should we just ask questions in here?13:04
* jp_sf raising hand13:04
asaci would like to have this kind of interactive so please ask here13:04
asacso anyone worked on packages has probably noticed that the sources usually ship a upstream tarball and a diff.gz13:05
=== ChtiSeb is now known as ChtiSeb_06
Ludozaevening asac13:06
asacso while this works great for packages where you dont need to modify the upstream code base, it can be tricky if you need to maintain multiple patches13:06
asacpatch systems are there to help you keep those changes in a separate and clean fashion13:07
asacso if you start to work on a package that has a patchsystem it usually has a debian/patches/ directory13:08
asacmaybe check out the source for gwibber: apt-get source gwibber13:08
oldman_:)13:09
asacit uses a so called "simple" patchsystem13:09
asacsimple patchsystem is simple in the sense that you just drop your patches in that directory13:10
apwasac w13:10
funkyHatI don't see debian/patches :/13:10
asacand the order used to apply the patches is solely determined by the lexicographical order13:10
apwwhich version of gwibber?  i see no patches in jaunty13:10
asac0.813:10
iantofunkyHat: cd gwibber-0.8/debian/patches13:10
asacapw: after i did apt-get source gwibber, there is a gwibber-0.8/debian/patches directory13:11
funkyHatAh, I'm looking at 0.9.213:11
oldman_yeah gwibber-0.9.2 on karmic also13:11
apwyeah in 0.9.2 from jaunty its gone, and looks to be in bzr13:11
ianto3rd party repo probably ;-/13:11
asacheh so you are more modern than me ;)13:11
mnemoQUESTION: asac, is "simple" the same as cdbs? because if I grep for "cdbs" in gwibber sources I get some hits... otherwise, whats a good method to determine the patch system for a given package (I usually grep for the string quilt, cdbs and dpatch etc)13:11
funkyHatcan I apt-get source a specific version?13:12
asacok so if you have 0.9.6 and no debian/patches, run13:12
asacdget https://edge.launchpad.net/ubuntu/jaunty/+source/gwibber/0.8-0ubuntu5/+files/gwibber_0.8-0ubuntu5.dsc13:12
asacand then dpkg-source -x gwibber*dsc13:12
asac;)13:12
iantodget -x does the same job? ;)13:12
asacthat will give you the 0.8 sources i am looking at13:13
asacianto: could be ;)13:13
asacmnemo: yes, actually the simple patchsystem is a cdbs specific patchystem13:13
asacmnemo: you can identify packages that use the simple patchsystem by looking in debian/rules13:13
asacthere is a line like: include /usr/share/cdbs/1/rules/simple-patchsys.mk13:14
funkyHatOk now I am on the same page as you :)13:14
persia(and if you're very lucky, debian/README.source will also explain which patch system is in use)13:14
asacok so everyone looks at the same package source i guess ...13:15
asacso there are now a few common you usually want to do with patches:13:15
asac1. drop a patch13:15
asac2. add a new patch13:16
asac3. edit a patch13:16
asac4. update a patch when upstream code-base changed13:16
asacso 1. is obviously simple with simple-patchsys13:17
asacjust remove the patch13:17
asacsometimes - if the dropped patch interleaves with some other patch that gets later applied, this can also lead to 4.13:17
asacfor adding a new patch there are two variants:13:18
asaca) just put the new patch in the debian/patches/ directory13:18
asacb) the other way is to just use the same mechanism as 3. edit a patch ... just that you use a new patchname13:19
asacso lets look at 3. edit a patch13:19
asacconsider we found out that 03_locale.patch is wrong and we want to change it we would use cdbs-edit-patch to update it13:20
asace.g. cdbs-edit-patch 03_locale_dir.patch13:21
asacwhen you run this, cdbs will copy the current source tree to a temp directory and apply all the patches up to the patch you want to edit13:21
asacand leave you in a shell that allow you just to edit the source tree in your preferred editor13:22
asacso for this case lets edit gwibber.desktop.in and fix some typo (change whatever you like)13:23
asaconce you are happy with your change you can exit the cdbs edit shell by typing exit 013:23
asacif you exit with a non-zero code the changes you did will not get applied13:24
asacso in case i figure that i did something wrong or want to do something else, use exit 1 or something13:25
asacany questions on how to edit patches using cdbs-edit-patch?13:25
funkyHatSo it's not so much editing the patch as replacing it?13:26
asacfunkyHat: no its really an edit13:26
=== asna is now known as asnarr
asacif you run cdbs-edit-patch PATCHNAME13:27
asacit will apply the current patch, so the previous changes are already there13:27
mnemoQUESTION: asac, this "simple" patch system seems very straight forward, why would one want to complicate things further?? why use quilt or so for example where the patches have to be popped and pushed explicitly?13:28
funkyHatOk... I just tried it and the patch file is only showing my changes, nothing else13:28
asacfunkyHat: if i run: 1. cdbs-edit-patch 03_locale_dir.patch 2. echo test >> gwibber.desktop.in 3. exit 013:29
asaci see both changes in 03_locale_dir-patch13:29
asacmnemo: thats in deed a valid question. in particular if you compare it with dpatch13:29
asacmnemo: so there are a few cases where dpatch or quilt make more sense.13:30
asacdpatch allows you to do arbitrary stuff in patches ... so you are basically not constrainted patches in the sense of a "diff"13:30
funkyHatasac: oh, was the original change on the _Name line?13:31
asacfor instance you could create a backup of a file, then run some sed statement to replace all occurences of a string you want to change13:31
asacthe tricky thing with dpatch with using scripts is that you always have to take care that the "unpatcH" operation gets you really back to the state you had before applying the patch13:31
mnemoQUESTION: asac, so is there like a "holy grail" of patch systems towards which all the debian packages are migrating? (I mean is there an agreed upon "best" system and its just a matter of man power to get it standardized?)13:32
asacmnemo: no. there are valid use cases13:34
asacfor other patchsystems13:34
asaclet me continue with quilt13:34
asacquilt is a real patchsystem in the sense that its not really specific to ubuntu packages or cdbs13:34
asacusing quilt is definitly handy if you maintain a lot of patches and in particular when you have a large source tree13:34
asacexample is xulrunner-1.9 ... if we would use  simple-patchsystem there editing just a single line of a patch would create a full copy of a 350M source tree13:36
asacand then when you exit the cdbs shell it takes a couple of minutes just to update the patch13:36
asacthats usually just annoying13:36
asacso maybe lets stick to gwibber and see how we can convert that tree to use quilt ;)13:36
asacyou obviously need to install the quilt package13:36
asaconce you have that you could replace the simple-patchsys in debian/rules with /usr/share/cdbs/1/rules/patchsys-quilt.mk13:38
asacquilt is a bit more sophisticated and doesnt apply all patches it finds in a directory.13:38
asacinstead it looks at a file called "series" in the patches directory13:38
asacso to convert gwibber we need to create a first series file manually13:40
asacwhich basically is just adding all files that are currently in debian/patches/13:40
asacso something like: ls debian/patches/ | grep -v series > debian/patches/series will work13:40
asacnow in order to play around with quilt set the QUILT_PATCHES env variable like:13:40
asacexport QUILT_PATCHES=debian/patches13:40
asaconce you did that you can use a few commands ... maybe run them and see what they do:13:40
asacquilt push13:41
asac -> this will apply the next unapplied patch in the series files13:43
asacquilt pop13:43
funkyHatooh13:43
asac -> this will unapply the topmost applied patch13:43
asacquilt series13:43
asac -> this will give you a list of all patches13:43
asacquilt applied13:43
asac -> this will give you a list of already applied patches13:43
asacquilt unapplied13:43
asac -> this will give you a list of not-yet-applied patches in the series13:43
asacso if you did what i said you now have a debian/patches/series file and running quilt push  three times will finally apply the 03_locale_dir.patch13:43
asacanyone who doesnt have that?13:43
* rraphink finds it useful to add "export QUILT_PATCHES=debian/patches" to his .bashrc for when there are packages using quilt 13:46
asacyes, thats a good idea if you regular work on packages13:46
=== rraphink is now known as raphink
raphinktogether with the debhelper variables, too13:46
asacpersonally, i sometimes use quilt for upstream trees too ... so its not always the same13:46
asacok so lets look how to edit a patch ;)13:46
bacasac: is there a shortcut to apply all patches at once so you don't have to push n times?13:46
asacto edit a patch you basically use quilt push/pop until the patch you want to edit is on top13:46
asac(quilt top)13:46
asacbac: to apply all patches at once you can use quilt push -a13:46
asacsimilarly you can use quilt pop -a13:46
asacor you can even name a patch13:46
bacthx13:46
asace.g. quilt push 02_twitter_api_fix.patch13:48
asacso lets assume we want to edit the 03_locale_dir.patch13:48
asacquilt push 03_locale_dir.patch13:48
asac...13:48
asacNow at patch 03_locale_dir.patch13:48
asacwhen you get that you can look what the current diff of that patch is by running:13:48
asacquilt diff13:48
asacnow the important part. quilt is great becaues it doesnt need to diff a full tree (so its fast)13:51
asaconce negative side-affect is that you explicitly have to tell quilt to include a certain file in the patch _before_ you edit it13:51
asacso in we want to edit gwibber.desktop.in13:51
asac(like we did for simple patch)13:51
asacyou have to run quilt add gwibber.desktop.in _before_ you edit the patch13:51
asacerr edit the file ;)13:51
asacthats really important and you easily get trapped if you dont run quilt add path/to/filename first13:51
asacbecause if you forget it its not really easy for you to get the changes backed out  and so on13:51
asacso after running quilt add gwibber.desktop.in13:51
asacyou can again edit that file, like: echo append >> gwibber.desktop.in13:51
asacafter editing it you should see your changes in quilt diff13:51
asacnote that quilt diff shows the full diff of the current topmost patch together with your new changes13:53
asacso its basically a projection of how the diff would look like if you decide to refresh the patch13:53
asacso a) when you are happy with what quilt diff shows you, you need to explicitly refresh the patch like: quilt refresh13:53
asacand b) if you are unhappy with what you changed you can undo your latest changes with quilt pop -f13:53
asacany questions on how to edit patches with quilt?13:56
asacimportant commadns to remember (besides push/pop et al):13:56
* apw points asac at quilt edit, which seems to handle the adding13:56
asac quilt add FILENAME (add a file you want to modify to to be tracked by current quilt patch)13:56
asac quilt diff (look at how the patch looks with your current local changes)13:56
funkyHatI much prefer this to simple patches :)13:56
asac quilt refresh (update the patch to match what you see in quilt diff)13:56
raphinkquilt is almost like a VCS in a way13:56
asacas i said above ... if you ever used simple-patchsystem with a package that isnt tiny you will definitly look for something else13:59
asacand quilt is pretty much the only option you have ... unless you dont want to use a patchsystem at all ;)13:59
asacthat said ... simple patchsystem will work for most packages in the archive13:59
raphinkunless you're not using cdbs ;)13:59
asachowever, if you are also doing upstream development and want something lightweight to maintain patches while tracking upstream VCS as a baseline quilt is also really helpful13:59
raphinki.e. converting a package to simple-patchsys often means converting it first to cdbs13:59
Railasac: is there any easy (automatic) way to convert feature branches into cdbs/quilt patches?14:00
Railfor git-builddeb for example14:01
asacRail: that depends on how you want to export feature branches. so exporting commits is quite easy in git14:01
asace.g. lets say git tree has a tag release1.0 ... and you committed a few things on top that you want as individual patches you could use git format-patch release1.014:01
asacthen you can just copy the patches in debian/patches/14:01
asacand if you use quilt also add that to series14:01
Railyes, it's easy to git diff but sometimes you can forget to di this14:01
Rail*do14:02
asacRail: git format-patch14:02
asacexports commits14:02
asacif you really have feature branches you need to bzr diff them anyway i guess14:02
asaci dont know about anything automated for that ... but maybe i am wrong14:03
Railthanks14:03
Railand one advise from me, don't forget to use patch tags ;)14:05
Railhttps://wiki.ubuntu.com/UbuntuDevelopment/PatchTaggingGuidelines14:05
asacyeah. patch tagging is nice14:05
asacin anycase, please also properly document stuff in changelog14:05
asacpersonally i think patch tagging is good, but as long as that info is easily discoverable thats good as well14:05
asacchangelog entry can help14:05
asacalso the filename can indicate launchpad bug id or upstream bug tracker14:06
asacbut yeah, if you do new patches, please use https://wiki.ubuntu.com/UbuntuDevelopment/PatchTaggingGuidelines14:06
asacoh ... i think i forgot to say how to add new patches with quilt/simple patch14:08
asacso since time is over just quick:14:08
asacthe procedure is the same as for editing patches, just that for simple patchsystem you us a name that isnt used yet14:08
asacand for quilt you first run quilt new NEW-PATCH-NAME.patch14:08
mnemoQUESTION: when apps are built and packaged using bazaar LP branches, do they still use a patch system?14:08
asacquilt will add a new patch after the current top patch ... so if you want to add a new patch that is applied before everything else is applied you can first pop all patches and then use quilt new14:08
asacmnemo: yes. patchsystems are not really replacable by VCS ....14:08
asacthe only way that would be possible would be if you had a feature branch for each patch14:08
asachowever, this is quite problematic because once the patches interleave and touch same files14:09
asacyou need an order of feature branches and so on14:09
asacfor bzr there is the loom extension14:09
asacwhich somehow tries to do that, but personally i found it rather high-overhead14:09
asacso my personal preference is to just maintain a bzr branch with just the debian/ directory14:09
asacand still maintain patches therein14:09
* Rail prefers the same method :)14:10
asacof course how you produce those patches is left open to the author ... if oyu have multiple long running feature development going on you might want to use feature branches and regular export those14:13
asacbut saying that those are th eofficial sources for producing a package would make it harder for others to help out14:13
asachope that answers the question14:13
mnemoyup14:13
asacanything else?14:13
asac314:13
asac214:13
asac114:13
asacdone... thanks all14:13
ckingasac, thanks!14:13
mnemothanks a lot asac14:13
micmordasac: thanks14:13
Railthanks a lot asac14:13
oldman_great job asac14:13
dholbachthanks asac!14:13
asacyou can find me in #ubuntu-mozillateam or #ubuntu-desktop if more questions come up later or tomorrow14:13
hifithanks, I'll read the logs14:13
asacdont hesitate to ask14:13
asacthanks14:16
* asac goes to lunch14:16
oldman_:)14:16
pitihum, I have a question: are the sessions loggued somewhere ?14:17
funkyHatasac: I had an issue with changing the patch using the simple patch system14:17
funkyHatasac: hm, sorry. Seems to work now that I try it again. I must have missed something :)14:17
funkyHatThanks :)14:17
hifipiti: yes they are14:22
hifihttps://wiki.ubuntu.com/Classroom14:22
pitihifi: I meant the content of the sessions (so I can take a look a while after, or retreive the beggining if I came to late)14:23
hificlick a past topic14:24
pitihum, ok great14:26
=== asna is now known as Guest76328
=== Guest76328 is now known as asnarr
vocksoam i too late?16:00
vocksodate -u16:02
kklimondayes, the session is over16:05
vocksooh ok.16:06
vocksowhere can i see the logs?16:08
persiairclogs.ubuntu.com16:08
vocksothank you and bye.16:08
=== RoAk is now known as RoAkSoAx
oldsilverbeard...rats...missed the class19:33
=== mimir|on is now known as mimir|zZz

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!