== Dev Week -- Introduction to Ubuntu Distributed Development (UDD) -- barry -- Mon, Feb 28th, 2011 == {{{#!irc === 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 || Event: Ubuntu Developer Week - Current Session: Introduction to Ubuntu Distributed Development (UDD) - Instructors: barry [18:01] hi, my name is barry warsaw, and i live near washington dc. i work for canonical, do ubuntu development, am a core python developer and project leader for gnu mailman. i'm here to introduce you to a new way of developing ubuntu, called 'ubuntu distributed development', or 'udd' [18:01] next up is the ROCKing Barry Warsaw [18:01] thanks dholbach! [18:01] ... not only an Ubuntu, Launchpad and Python hacker, but also a fun guy, friend and exceptional bass player [18:02] aw shucks, thanks :) [18:02] enjoy the session, you'll love Ubuntu Distributed Development afterwards [18:02] in a nutshell, udd uses the bazaar revision control system to fix bugs and develop features in ubuntu packages. in this session, we'll learn how to fix a bug by: [18:02] * creating a local branch of the project [18:02] [18:02] * developing a fix, then committing it to your local branch [18:02] * link the branch to the bug report in launchpad [18:02] * request a 'merge proposal' for the package maintainer to review [18:03] we'll probably just be scratching the surface of how this works, but hopefully you will come out of this session feeling more confident about using bzr to work on you ubuntu packages. i won't cover much about packaging in particular, or bzr, but i will try to answer any questions you have! [18:03] just a note: we'll be using a bug in computer-janitor as an example. c-j is a little different than most packages in ubuntu because it's developed natively in launchpad. for the purposes of this class, this difference won't matter too much. if it comes up, i'll point it out. [18:04] why use bzr when the old tools work just fine? bzr gives you the benefit of a full distributed version control system to manage package changes. [18:04] * incremental changes can be committed locally as you go [18:04] * logging, diffing, intelligent merging [18:04] * interact better w/other ubuntu devs by sharing works-in-progress [18:04] * work disconnected [18:04] * manage all artifacts in launchpad [18:04] * request reviews online [18:05] * automatic requests for sponsorship review [18:05] * soon: build-from-branch-to-archive [18:05] for now, the documentation is a little bit scattered, but the best place to start is on the wiki. we are acdtively working on cleaning this up and moving it to the official ubuntu developers documentation. [18:05] https://wiki.ubuntu.com/DistributedDevelopment/Documentation [18:06] so, i'm going to give folks a few minutes to catch up on all the prepared overview above, then i'll start digging in... [18:08] anybody need a few more minutes to catch up? [18:08] or are there any questions about the introductory material, or what i hope to cover today? [18:09] so, we need to start by making sure you have the basic tools. you'll need bazaar and a special plugin that adds a lot of useful stuff [18:10] start by doing this: [18:10] sudo aptitude install bzr bzr-builddeb [18:10] you're also going to need to know your launchpad id. dholbach covered this in the previous session. it's the bit after the ~ in your launchpad url [18:11] if you don't have a launchpad login yet, either go get one now or there will be a few steps later that don't work for you. no worries, you can still follow along [18:11] dholbach: points out that you can visit this url: [18:11] https://launchpad.net/people/+me [18:12] and after it redirects, you can look for the ~ in the url. the bit after that is your launchpad id [18:13] monish001 asked: bzr launchpad-login monish001 bzr: ERROR: The user name monish001 is not registered on Launchpad. [18:13] monish001: be sure you've registered on launchpad first. 'bzr launchpad-login' will not create a login for you [18:14] also, some folks may not have aptitude, you can install the bzr tools with this instead: [18:14] sudo apt-get install bzr bzr-builddeb [18:15] okay, now, i'd like you to run this command: [18:15] bzr --version === evilshadeslayer is now known as shadeslayer [18:15] and note the version of bzr that you are using [18:16] we are going to use two different urls later to refer to package source in launchpad. if you are using bzr version 2.3 or higher, you will be able to do things like this: [18:16] bzr branch ubuntu:mypackage [18:16] to get the version of 'mypackage' in natty [18:17] if you have bzr 2.2 or older, this will be spelled like this: [18:17] bzr branch lp:ubuntu/mypackage [18:17] if you sat in on dholbach's session, you've already done this: [18:17] bzr whoami "Your Name " [18:17] bzr launchpad-login mylpid [18:17] and now we're ready to use bzr to fix a bug in ubuntu! [18:18] hugohirsch asked: Is it a problem that I still run 10.10? My bzr is 2.2.1 [18:18] hugohirsch: it is not a problem. this will work just fine. just remember to use the lp:ubuntu/foo urls instead of ubuntu:foo [18:18] cire831 asked: how does it know to get the natty version? what if I'm running lucid and want that version? [18:19] cire831: the ubuntu:foo urls always pick the current in-development version of ubuntu, i.e. as we speak, that's natty [18:19] you can always use ubuntu:natty/foo or ubuntu:maverick/foo etc. to get a specific version of a package in a specific version of ubuntu [18:20] those could also be spelled as lp:ubuntu/natty/foo or lp:ubuntu/maverick/foo or lp:ubuntu/lucid/foo etc [18:20] palhmbs asked: Why does bzr-builddeb setup mail, do I really need it? [18:21] it sets up your email which will be used when you commit changes later on (i.e. it'll show up in your debian/changelog file) [18:21] chilicuil asked: can I use bzr and lp to pull debian versions? [18:21] yes. you can use urls like this: [18:21] debian-lp:squeeze/foo [18:21] or [18:22] lp:debian/squeeze/foo [18:22] okay, let's fix a bug! [18:22] go ahead and open this url in your browser: http://launchpad.net/bugs/726616 [18:22] someone noticed a typo in a file in the package. we'll fix that the udd way :) [18:23] go ahead and cd to a location where you want to do the work. we'll be creating a bunch of directories in there [18:23] cd someplace [18:23] now, just a little bazaar boilerplate to make things efficient: [18:23] bzr init-repo janitor [18:23] cd janitor [18:24] and now we're going to grab the source branch for the current version of computer-janitor in natty: [18:24] bzr branch ubuntu:computer-janitor natty [18:24] * barry will give you a moment to catch up [18:24] mhall119 asked: why is init-repo necessary? why not just bzr branch? [18:25] it's not strictly necessary, but as you'll see in the next step, using a bazaar 'shared repository' like this will make future steps go much faster by reducing the amount of network traffic you'll consume [18:25] (i.e. bzr can cache things locally if you use a shared repo) [18:26] cire831 asked: didn't work. bzr branch ubuntu:computer-janitor natty says not a branch. [18:26] does 'bzr branch lp:ubuntu/computer-janitor' work for you? [18:27] ah. this ubuntu: url might not work for computer-janitor. remember i said it was a little weird because c-j is developed in launchpad natively? if it does not work for you, use this url instead: [18:27] bzr branch lp:computer-janitor [18:27] in general you will use the ubuntu: urls, but in this case it's a little different. don't let that confuse you too much ;) [18:28] everybody good? [18:28] bzr branch lp:computer-janitor natty [18:28] ^^ [18:28] (that just gives you the branch in a directory called 'natty') [18:29] okay, so we're going to work on bug 726616. let's branch the current c-j trunk to a working directory which will only contain our fix [18:29] bzr branch natty bug-726616 [18:29] cire831 asked: what exactly does the natty on the end do? rather than say bzr lp:ubuntu/natty/computer-janitor [18:29] all it does is leave you with a local directory called 'natty' instead of the default 'computer-janitor'. there's no other difference [18:30] it's totally up to you [18:30] now... [18:30] cd bug-726616 [18:30] and we're sitting in a directory where we'll make our fix! [18:31] look around. you'll see the upstream source code, and a debian directory with all the packaging information. it looks like a pretty typical ubuntu source package, right? [18:31] cire831 asked: so I should be able to do bzr branch lp:ubuntu/lucid/computer-janitor lucid to get the lucid version? [18:31] yes [18:31] these urls are very handy when you want to backport fixes for sru's and such [18:33] okay, sorry, just triaging some questions [18:34] so, now, if you open the NEWS file in your favorite editor, and search for the word 'publically' you see the typo [18:34] just use your favorite editor to spell check this to 'publicly' and congratulations! you've just fixed an ubuntu bug [18:35] but of course, now you'd like to share your fix with the world and get it into ubuntu, right? let's do that now [18:35] exit your editor and then at the command line do this: [18:35] bzr diff [18:36] you should see that the NEWS file has the fix. what you'll see is a unified diff between your local change and the original source code [18:36] next thing you want to do is commit this change, but before you do that, you also want to add a debian/changelog entry which records what you've done [18:36] type this: dch -i [18:37] this will open an editor providing you with a template to fill in your change [18:37] you'll add a little bit of descriptive text, such as what i did here: [18:37] computer-janitor (2.1.0-0ubuntu4~udd0) UNRELEASED; urgency=low [18:37] [18:37] * NEWS: fixed a typo. (LP: #726616) [18:37] [18:37] -- Barry Warsaw Mon, 28 Feb 2011 11:18:20 -0500 [18:37] [18:37] note a couple of things: [18:38] the version number will be filled in, but when you see it, it won't have the ~ppa0 suffix. that's a trick we use to specify a version "in the middle" of the previous release and what will be the next release [18:38] using a ~ suffix makes it easier for testing later, but it's not strictly necessary [18:39] also notice the UNRELEASED tag. we'll eventually change that to 'natty' but again, this is a middle step so we can do some testing [18:39] finally, the most important part [18:39] notice this text at the end of the description line: [18:39] (LP: #726616) [18:39] that is really critical to include. it will be used to link your branch with the fix to the bug report [18:39] it must be exactly like that (the parentheses are optional) [18:40] but it must be of the form: [18:40] LP: #123456 [18:40] with a space between the colon and hash, and the hash must be there [18:40] anyway, save the changelog and exit your editor. i'll take some questions now [18:40] fisch246 asked: "bzr branch natty bug-726616" what command do i use if i'm on maverick? === Nik is now known as Nekhelesh [18:41] note that 'natty' in the above example is the local directory of the source branch that you checked out previously. you'd still use that, since you're working on the natty version of the package, even though you're on maverick [18:41] darkdevil56 asked: bash: cd: bug-726616: No such file or directory? [18:42] did you do the 'bzr branch natty bug-726616' command from earlier? [18:43] figure002 asked: where does dch get your email address from? [18:44] in the previous session, dholbach described how to set the DEBEMAIL and DEBFULLNAME environment variables. dch gets those values from there by default, but do a 'man dch' for details [18:44] okay. now, we've fixed the bug, and we've added a changelog entry. we just need to commit our changes to the local branch [18:45] run this: debcommit [18:45] this will call 'bzr commit' with some useful defaults, so it's mostly a convenience. you could use 'bzr commit' but for now, 'debcommit' is better [18:45] you can ask bzr to show you the history of the change you just made: [18:46] bzr log -c -1 [18:46] up to now though, your fix is just sitting in a branch on your local machine. we want to push the change to launchpad so we can share it with others. to do this, run this command: [18:46] bzr push lp:~myid/computer-janitor/bug-726616 [18:47] where of course you use your launchpad id instead of 'myid' [18:47] that'll take just a few seconds to run, and then when the command comes back, type this: [18:47] bzr lp-open [18:47] this should open your web browser to the launchpad page that represents your just pushed branch [18:48] palhmbs asked: if you fix a bug that hasn't been reported, what then, create a bug on launchpad? [18:48] it's generally good practice for there to always be a bug report first. it's not strictly required for any of the udd tasks, but it makes everyone's life easier to track the issue if there is a bug report [18:49] so i do suggest creating the bug report first. do that directly in launchpad not through bzr though [18:49] jderose asked: when i fix a bug, i like to do a PPA test build (also so others can easily test fix) - in this case, is it okay to commit, say, "natty" in the changelog rather than "UNRELEASED"? Wont the PPA builders choke on UNRELEASED? [18:49] i'm running out of time, but i do plan on covering this later. or if time runs out i will answer this in -chat [18:50] cire831 asked: where can I find out how all these tools are integrated. ie. how the bzr stuff knows about LP: # etc. [18:50] more info can be found in #ubuntu-devel or #udd or #bzr [18:50] okay, so we've pushed our fix branch to launchpad, now what? [18:51] if you look at the page that 'bzr lp-open' opened in your browser, scroll down to the 'related bugs' section [18:51] you should see a link to bug 726616 [18:51] There are 10 minutes remaining in the current session. [18:51] this was done automatically by debcommit, and launchpad when you pushed your branch. it was made possible by the 'LP: #726616' text you added in debian/changelog [18:52] if you click on the related bug link, you'll hop over the bug. notice that the bug page also has a link for 'related branches'. that should let you get back to the branch page [18:52] though, there may be multiple such branches from all the other folks in this class :) [18:52] be sure to pick yours! or use the back button [18:52] now, make sure you're on your branch page. scroll down and look for a link that says 'propose for merging' [18:53] click on that [18:53] what that does is inform the owner of the master branch, and all the ubuntu sponsors, that you have a fix for an ubuntu bug [18:53] so you don't have to request a sponsor, or a review, explicitly. (again, here's where computer-janitor is a little odd, but the above is true for 99% of branches) [18:53] er, packages [18:55] maco points out that sponsors aren't specifically notified, but your branch does show up in the sponsorship queue automatically. you can still ping a sonsor directly as normal [18:55] There are 5 minutes remaining in the current session. [18:55] cire831 asked: mine didn't link automatically. I can do it by hand though. [18:56] it can take several minutes for launchpad to process your branch and create the link. you can of course do it manually if you get impatient :) [18:56] cire831 asked: should we actually go ahead and do it? [18:56] go for it! don't worry, i'll be processing that bug when the class is over :) [18:56] darkdevil56 asked: aborting commit write group: PointlessCommit(No changes to commit) bzr: ERROR: No changes to commit. Use --unchanged to commit anyhow.? [18:57] bzr will spit this out if you've already committed all your changes. just use --unchanged, or make another change. [18:57] it can happen if you used 'bzr commit' before you did debcommit [18:58] please note that i skipped a lot of stuff about doing test builds, creating source packages, uploading to a ppa etc. we've basically run out of time, but i'll head over to #ubuntu-classroom-chat to continue for a while [18:58] remember that all the gory details are on the wiki: [18:58] https://wiki.ubuntu.com/DistributedDevelopment/Documentation [18:59] i'll take a few more questions before the next session starts, and thank you all for listening! [18:59] stefwal82 asked: is the worked on problem now uploaded? [18:59] no. a sponsor would have to merge your branch, build the source package, and upload that [19:00] in the future though, there will be some very cool stuff to do even that automatically in launchpad [19:00] if you have upload rights of course :) [19:00] hugohirsch asked: If i fix a bug do I need to create a PPA or is a branch sufficient enough? === 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 || Event: Ubuntu Developer Week - Current Session: Taking bite out of Unity - Instructors: DBO, jcastro [19:01] Logs for this session will be available at http://irclogs.ubuntu.com/2011/02/28/%23ubuntu-classroom.html following the conclusion of the session. [19:01] a branch is sufficient for a sponsor to review and apply your change. a ppa is not necessary at all! but it's useful for testing your package, or sharing your changes with others before it gets uploaded [19:02] woo, thanks barry, great job! }}}