Ubuntu Open Week - Launchpad Code Hosting - Jonathan Lange - Thu, Apr 30th, 2009
(06:00:06 PM) jml: Ok, we ready to go? (06:00:21 PM) jml: Let's start. (06:00:37 PM) jml: Today we're talking about hosting code on Launchpad. (06:00:42 PM) jml: As you can see by the text to left, I'm jml. (06:00:47 PM) charlie-tca left the room ("Looks like I'm going now ..."). (06:01:00 PM) jml: My name is Jonathan Lange, I live in Sydney (so it's actually 8am in the morning for me) and my hobbies are drinking coffee. (06:01:10 PM) jml: I've been working on Launchpad's codehosting system for Canonical for over two years now. (06:01:37 PM) jml: There's so many things I could talk about today (06:01:45 PM) jml: so please please please ask questions. (06:01:58 PM) jml: I've prepared this session based on an imaginary version of you. (06:02:16 PM) jml: I might have assumed that you're familiar with things you don't actually know at all; something that I think you might not know might already be old-hat to you. (06:02:31 PM) jml: so interrupt. (06:02:42 PM) jml: (or do the QUESTION: thing in -chat) (06:02:50 PM) jml: Anyway! (06:03:06 PM) jml: Someone once said that Launchpad is like a massive Open Source supermarket: You can just stroll in and pick up any project you want. (06:03:25 PM) jml: For example, if you want to get the full version control history of the Gnome Do project, do 'bzr branch lp:do'. (06:04:16 PM) jml: In fact, for almost any project you can think of, you can do 'bzr branch lp:<project>' and you'll get a copy of their trunk branch. (06:04:37 PM) jml: Or if you just want to get the latest code for, say, Banshee, do 'bzr co --lightweight lp:banshee'. (06:04:54 PM) jml: How familiar are you all with bzr? (06:05:10 PM) jml: ok :) (06:05:14 PM) Eveready: no familiar (06:05:25 PM) jml: no worries, I'll talk a bit about Bazaar then :) (06:05:39 PM) Eveready: I guess its like subversion (06:06:03 PM) jml: Yeah, Bazaar is a version control thing like Subversion (06:06:08 PM) Eveready: cvs checkout client (06:06:18 PM) Eveready: Ive used those some (06:06:18 PM) jml: The big difference from Subversion is that it doesn't rely on a central repository (06:06:39 PM) jml: Instead of getting just the files and telling a central server about the history, you get the full history (06:06:50 PM) jml: So you don't need "commit privileges" to hack on a project (06:06:51 PM) jml: QUESTION: if a package is maintained outside of launchpad, bzr branch will only get me the ubuntu/debian patches for this package, right? (06:07:05 PM) jml: Very good question. (06:07:17 PM) jml: There are two sorts of branches on Launchpad (06:07:37 PM) jml: there's upstream code -- like Gnome Do, Banshee, Twisted, Bazaar itself etc (06:07:46 PM) jml: there's also code for ubuntu packages (06:08:11 PM) jml: so, if you branch from an upstream project, you'll actually get everything (06:08:20 PM) jml: all the code that it's in there, that's ever been there. (06:08:50 PM) Eveready: ok (06:08:54 PM) jml: code for ubuntu / debian packages has kind of been a second-class citizen on Launchpad until very very recently. (06:09:35 PM) jml: At the start of this month, we released an alpha version of support for branches of source packages (06:09:40 PM) jml: I'll talk about that a bit later (06:09:46 PM) jml: (last month! sheesh!) (06:10:26 PM) jml: The platform team are working with that right now to make sure that the patches for a package are uploaded with version control (06:10:32 PM) jml: there's a doc on a wiki somewhere... (06:10:42 PM) jml: http://wiki.ubuntu.com/DistributedDevelopment/ (06:10:44 PM) ***JManGt is away: Vengo al ratin... (06:10:59 PM) jml: that talks about the plan. if you're at UDS, we'll be talking about it a lot. (06:11:28 PM) jml: So, Launchpad is a great big open source supermarket (06:11:53 PM) jml: For the code side of things, what we want is to give you a simple and consistent way to get the source code for every Free Software project that you can think of. (06:12:05 PM) jml: so that you can start fixing bugs or making things better :) (06:12:43 PM) jml: If you go to https://launchpad.net and click on the "Code" tab, you'll see a bunch of projects that use Launchpad directly (06:12:59 PM) jml: but there are also a heap of projects that don't use Launchpad themselves (06:13:04 PM) jml: we sync their code anyway :) (06:13:22 PM) jml: "supermarket" is a pretty lousy term (sorry kiko!). (06:13:36 PM) jml: A supermarket is a place where you *get* things. Launchpad is that, but it's also a place where you *put* things. (06:14:16 PM) jml: You might you be starting your own project or already run one, and you want to use Launchpad to host it, manage it, and to link up with other, related projects. (06:14:20 PM) jml: and with Ubuntu, of course :) (06:14:49 PM) jml: Or you might want to patch Gnome Do or some other project that uses Launchpad (06:15:04 PM) jml: Or you might just want somewhere to put a little script that you are working on. (06:15:24 PM) jml: <ryanakca> QUESTION: Does Canonical plan on ever adding support to Launchpad for a (D)VCS other than bzr? Eg. git, mercurial, darcs, etc. I don't know how wide spread bzr is outside of the Ubuntu/Launchpad circle, but offering support for other VCS would attract more users, no? (06:15:39 PM) jml: So, we already *do* support VCS's other than Bazaar, in a sense (06:15:50 PM) jml: you can import branches from CVS or Subversion into Bazaar (06:16:16 PM) jml: And *right now*, other guys on the Code team are working on Git imports (06:16:50 PM) jml: which are very very close to being ready (06:16:54 PM) jml: on the cusp, if you will. (06:17:16 PM) jml: Darcs? Yeah, probably what pwnguin said. :) (06:17:43 PM) jml: Mercurial -- definitely something we're considering, and probably will do, but there are other things we want to do first. (06:17:54 PM) ryanakca: *nod*, but say, if project XYZ had chosen the DVCS ``LMNOP'', but also wanted to use Launchpad without having to switch to Bzr, they'd be out of luck? (06:18:29 PM) jml: Maybe. (06:18:56 PM) jml: Bazaar is really tightly bound up with how Launchpad thinks about code. (06:19:23 PM) jml: But with things like bzr-svn and bzr-git, maybe there's something we can do. (06:19:51 PM) ***ryanakca nods, great, thanks (06:20:06 PM) jml: <somnoliento> QUESTION: Wouldn't the upstream developer consider it... 'rude' if I slurp all the code for the project? like my own 'rogue' version.. ? (06:20:10 PM) jml: most of the time, no. (06:20:44 PM) jml: With projects that are still using SVN and CVS, it's often an opportunity to try out a next-gen version control system. (06:20:54 PM) jml: And it's often free mirroring. (06:20:55 PM) jml: But! (06:21:14 PM) jml: It's always good to ask. (06:21:39 PM) jml: Because actually more interesting than any tool is building good human-being style relationships with people in other projects. :) (06:22:13 PM) jml: What we want for Launchpad is to be a front-end to the free software world (06:22:19 PM) jml: so if we "Import his code and revisions... and keep tracking the project outside of its preferred environment.. using LP's bugtracker and all associated tools" (06:22:29 PM) jml: it actually doesn't cause problems (06:22:42 PM) jml: because we're integrating really really well with the preferred environment (06:23:03 PM) jml: that's the extended answer to ryanakca's question too. (06:23:30 PM) jml: So I guess I should talk about how you can actually get code onto Launchpad (06:23:49 PM) jml: There are three ways. (06:23:51 PM) jml: Not two (06:23:53 PM) jml: Not four (06:23:57 PM) jml: Three (06:24:09 PM) jml: 1. Get us to mirror it. (06:24:13 PM) jml: 2. Importing it from another VCS. (06:24:17 PM) jml: 3. Pushing it yourself. (06:24:28 PM) jml: five is right out! (06:24:48 PM) jml: Hmm. (06:24:58 PM) jml: So, actually the last one is the most interesting. (06:25:01 PM) jml: I'll start with that (06:25:22 PM) jml: If you haven't done so already, install bzr (06:26:04 PM) jml: you might want to use this ppa: https://edge.launchpad.net/~bzr/+archive/ppa (06:26:09 PM) jml: so that you get the latest and greatest(06:26:44 PM) jml: Making a Bazaar branch is cake. (06:26:51 PM) jml: $ cd /tmp (06:26:56 PM) jml: $ bzr init something (06:27:03 PM) jml: $ cd something (06:27:08 PM) jml: $ cat > README (06:27:11 PM) jml: Oooh look at me, I'm a README. (06:27:20 PM) jml: (hit Ctrl-D) (06:27:25 PM) jml: $ bzr add (06:27:30 PM) jml: $ bzr commit -m "My first commit!" (06:27:37 PM) jml: done. (06:27:44 PM) jml: That's a branch. (06:28:05 PM) jml: You don't have to use cat if you don't want to. That's me showing off leet unix skills. (06:28:22 PM) jml: to push it up to Launchpad... (06:28:30 PM) jml: $ bzr push lp:~jml/+junk/something (06:28:42 PM) jml: except don't use jml (06:28:47 PM) jml: use your own login name (06:28:57 PM) jml: Oh actually that reminds me. (06:29:08 PM) jml: my Launchpad login is the same as my Ubuntu login, and I've had them both for ages. (06:29:22 PM) jml: You need to tell Bazaar, what your Launchpad login is. (06:29:30 PM) jml: $ bzr lp-login <username> (06:29:47 PM) jml: Also, you'll need to set up a public SSH key with Launchpad. (06:30:06 PM) jml: if you know what that means, go to https://launchpad.net/people/+me/+editsshkeys and get set up now. (06:30:17 PM) jml: if you don't, then https://help.launchpad.net/YourAccount/CreatingAnSSHKeyPair should get you started. (06:30:39 PM) jml: So the trick is: bzr push lp:~<username>/+junk/<branch> (06:30:51 PM) jml: The "+junk" bit is Launchpad's way of talking about Bazaar branches that don't belong to any project. (06:31:17 PM) jml: Generally you don't want to put anything serious there. I use it for Emacs files and little scripts and my D&D 3rd ed character generator. (06:31:29 PM) jml: "junk" :) (06:31:57 PM) jml: You can also push a branch to a project: e.g. bzr push lp:~jml/do/tweak-docky-animation (06:32:13 PM) jml: This is actually one of the cool things about Launchpad (06:32:16 PM) ***JManGt is back (gone 00:21:32) (06:32:27 PM) jml: you don't need to be an official contributor to push up branches. (06:32:39 PM) jml: you can push to any project (06:32:47 PM) jml: and contribute code in just the same way as a core dev (06:33:45 PM) jml: I want to say a million things next (06:33:50 PM) ***jml picks one (06:34:05 PM) jml: if *ever* you want to experiment with something on Launchpad, you can use https://staging.launchpad.net. (06:34:19 PM) jml: staging has all the data that the main site has, but any changes that get made are thrown away at the end of the day -- and it doesn't send out any email. (06:34:29 PM) jml: so you can muck around without hurting or spamming anybody (06:34:40 PM) Eveready: thatd be fer me (06:34:43 PM) jml: to push branches up there, use lp://staging/<whatever> (06:35:01 PM) jml: register projects, push branches, anything (06:35:31 PM) jml: <somnoliento> QUESTION: We're talking only about source code here, right? not translations, for instance. (06:35:44 PM) jml: I'm only talking about source code, yes. (06:35:45 PM) jml: but! (06:36:13 PM) jml: the translations guys have just made some changes so Launchpad can snarfle up .pot files from source code branches (06:36:21 PM) jml: and I think they are working on getting .po files too (06:36:46 PM) jml: bear in mind, I live on an English speaking island in the middle of nowhere, so my knowledge of translations is pretty dim. (06:37:06 PM) jml: snarfle. it's a verb meaning to extract translation files :) (06:37:25 PM) jml: <mwhudson> i think import of .po files is live now (06:37:27 PM) jml: rockin (06:37:57 PM) jml: if you ask on #launchpad, you can find out more about translations and branches. (06:38:32 PM) jml: So, another option with hosting your source code is that you can keep it on Bazaar branches on your own server (06:38:38 PM) jml: or someone else's server (06:38:42 PM) jml: and we'll mirror it for you (06:38:58 PM) jml: e.g. browse to a project page or your own person page (06:39:10 PM) jml: https://code.launchpad.net/people/+me will always redirect to your own branch page, btw (06:39:26 PM) jml: there'll be a "Register a branch" link on the top-right (06:39:51 PM) jml: I'm looking at https://code.staging.launchpad.net/bzr/+addbranch right now. (06:40:20 PM) jml: type in the name of the branch, and the URL where it's hosted and click "Register" (06:40:29 PM) jml: and that'll mirror the branch. (06:40:49 PM) jml: (you can just use http://branch.example.com/whatever if you want to try) (06:41:03 PM) jml: at the very top you'll see text like: (06:41:13 PM) jml: The resulting location of the branch will be: ~jml/bzr/whatever (06:41:20 PM) jml: (before you hit submit, that is) (06:41:47 PM) jml: once you've registered the mirror and Launchpad has had a chance to actually mirror it (15mins on staging, ~2-4 on the main site) (06:42:01 PM) jml: you can go 'bzr branch lp:~jml/bzr/whatever' and get the branch (06:42:13 PM) jml: don't worry too much about the status -- most people don't really use those. (06:42:25 PM) jml: also, don't worry too much about "branch type". If you are at this form, you almost always want to select a mirrored branch. (06:42:38 PM) jml: (I filed bugs about those two things while preparing this session!) (06:43:15 PM) jml: Very quickly on importing branches (06:43:31 PM) jml: there are projects that don't use Launchpad or Bazaar (06:43:40 PM) jml: xchat (my IRC client of choice) is a good example. (06:44:10 PM) jml: if you ever come across a project like that, you should request that Launchpad import it. (06:44:31 PM) jml: browse to the project, e.g. https://code.staging.launchpad.net/xchat (06:44:41 PM) jml: and click the "Import your project" link (06:45:05 PM) jml: You'll need to get the version control details from the main site (google can help here) (06:45:18 PM) jml: and as mentioned before: cvs and svn only for now (06:45:21 PM) jml: git real soon (06:45:24 PM) jml: mercurial later (06:46:06 PM) jml: darcs when you need ice skates in the sahara (06:46:25 PM) jml: Importing code from Subversion into Bazaar is an art, not a science. (06:46:30 PM) jml: Importing from CVS is a black art. (06:46:44 PM) jml: so we review all of the imports before we start running them (06:46:58 PM) jml: there are some guidelines about this (06:47:08 PM) jml: and we'll be opening those up as we get closer to open sourcing (06:47:29 PM) jml: in the mean time, if you have any problems, ask on https://answers.launchpad.net/launchpad-code or on #launchpad (06:47:37 PM) jml: mwhudson: that right? (06:47:59 PM) jml: ... (06:48:02 PM) jml: silence means "yes" (06:48:04 PM) jml: good :) (06:48:13 PM) jml: COMING SOON! (06:48:29 PM) jml: git imports, as mentioned before (06:48:39 PM) jml: we'll start with small git repos and then move on up (06:48:47 PM) jml: source package branches (06:48:52 PM) jml: right now you can only push to: (06:48:59 PM) jml: lp:~user/project/branch (06:49:04 PM) jml: or lp:~user/+junk/branch (06:49:16 PM) jml: this doesn't help ubuntu much or debian much (06:49:27 PM) jml: very recently, we added support so that you can push to lp:~user/ubuntu/karmic/package/branch (06:49:36 PM) jml: you can try this out on staging or the main server today (06:49:49 PM) jml: lp://staging/~user/ubuntu/... for staging (06:50:01 PM) jml: you can also push to lp:~user/debian/squeeze/package/branch as well (06:50:39 PM) jml: it won't integrate well with the rest of the site, but the actual hosting of package branches is rock solid (06:50:56 PM) jml: e.g. lp:~jml/ubuntu/karmic/pulseaudio/fix-my-headset (06:51:22 PM) jml: the platform team are working on actually making the official branches for every source package in ubuntu (06:51:27 PM) jml: james_w: how many is that? (06:51:36 PM) james_w: too many :-) (06:51:44 PM) jml: :) (06:51:54 PM) james_w: around 16000 packages (06:51:59 PM) jml: as that happens, you'll be able to get code by doing 'bzr branch lp:ubuntu/karmic/pulseaudio' (06:52:11 PM) jml: that'll have all of the patches on top of the upstream tarball, right? (06:52:19 PM) james_w: 5 branches for Debian, and up to 40 for Ubuntu per package (06:52:25 PM) jml: ! (06:52:58 PM) james_w: yep, the result is the same as unpacking the source package, and you'll be able to see what's added in the packaging, and what's in the upstream tarball (06:53:06 PM) jml: cool. (06:53:25 PM) jml: man, I haven't even talked about code reviews yet (06:53:40 PM) jml: <RainCT> jml: QUESTION: Does this only work for existing packages or can we also push new packages there (ie., for review before actually uploading them to Ubuntu)? (06:53:52 PM) jml: in the initial phase, existing packages only. (06:54:23 PM) jml: but probably in the future, new packages as well (06:54:38 PM) jml: although maybe you'll need to register them on the website first, just like upstream projects. (06:55:09 PM) jml: also, we really really really want to be able to make it braindead-simple to make a PPA based on a package branch- (06:55:52 PM) jml: but part of the thing is that we don't really know what Ubuntu development will look like with every package in a branch (06:56:29 PM) jml: so it's important that you guys try it out and prod us on #launchpad and tell us what's happening, what's working, what we should change (06:56:38 PM) jml: oh, and contribute patches once we open source :) (06:56:57 PM) jml: <AmanicA> QUESTION: should I have one project for all the cool little scripts I want to be able to install through a ppa? or should I create a project for each? (06:57:05 PM) jml: good question (06:57:30 PM) jml: (I don't know the answer, actually) (06:57:45 PM) jml: I'd guess that it depends on what would make your users happiest (06:58:01 PM) ***jml opens the floor (06:58:32 PM) jml: (oh, btw, when I fix bug 345737, you'll be able to branch lp:ubuntu/pulseaudio) (06:58:51 PM) jml: we have two minutes left (06:58:56 PM) jml: any more questions (06:59:32 PM) jml: hmm, so the schedule doesn't have anyone listed after this (06:59:56 PM) jml: so, I love talking about launchpad and bazaar (07:00:29 PM) jml: it's challenging to prepare a session because there are so many things you can do with them and so many levels of knowledge (07:00:41 PM) jml: so actually the best thing you can do is ask me on #bzr or #launchpad (07:00:55 PM) jml: Or ask the channel, we're a pretty friendly bunch. (07:01:30 PM) jml: and lots of us have had to climb the learning curve recently, so we know what it's like (07:01:55 PM) jml: That's it from me (07:02:22 PM) jml: You're all wonderful :) (07:02:22 PM) jml: happy hacking!