== Dev Week -- Getting started with merging packages from debian -- Bhavani Shankar -- Tue, Jul 12th, 2011 == {{{#!irc [15:58] hey all before I start the session I am bhavani shankar a ubuntu contributor and MOTU and ll be showing a simple example using merge o matic [16:00] Hey all [16:00] so lets get kicking on this [16:00] We are going to learn how to merge packages [16:00] But, first of all we need to understand what merging is [16:00] Today I'm going to show you how to do a merge using merge - o - matic (MoM). Ubuntu's semi automatic merging system === 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: Getting started with merging packages from debian - Instructors: coolbhavi [16:01] efore we start off just a basic roundup of the concept(s) involved [16:01] On our first stage of development cycle we import packages from debian unstable (sid). (In case of a LTS we import packages from debian testing) [16:02] There are two ways to import a package from debian (one is a sync and other is a merge) [16:02] Sync is importing the debian package "as is" without any further changes [16:02] whereas merging is importing the debian package and intoducing/including all the ubuntu changes. [16:02] But we need to cross verify whether the ubuntu changes are applicable for the present version and the ubuntu changes have been superceeded by debian in which case its a sync [16:03] Now getting to know a short background lets move on [16:04] Please enable universe and main repositories and pull in all the packages essential for ubuntu development environment (as mentioned in the ubuntu packaging guide which m pasting here for your kind reference [16:05] sudo apt-get install --no-install-recommends bzr-builddeb ubuntu-dev-tools fakeroot build-essential gnupg pbuilder debhelper [16:05] (PS: btw, this page provides a overview of merging workflow https://wiki.ubuntu.com/UbuntuDevelopment/Merging and we are going to see a simple example of it now) [16:06] So assuming you have understood till now lets move on [16:06] First of all we need to check what packages have need to be merged. Thats where MoM comes into picture [16:06] MoM is available here: http://merges.ubuntu.com [16:06] First of all we need to create a work directory, I use ~/development, you could use a directory of your own [16:07] From now on we are calling this $WORK_DIR, so please create a working directory for your own. [16:07] now store the path on the $WORK_DIR variable giving "export $WORK_DIR=/path/to/work/directory" [16:07] for convenience [16:08] which in my case will be "export WORK_DIR=~/development" [16:08] By MoM way we use a script called grab-merge.sh which is available in ubuntu-dev-tools but for convineince I'll download the script here [16:08] Execute this in a terminal [16:08] cd $WORK_DIR ; wget -c http://merges.ubuntu.com/grab-merge.sh; chmod +x grab-merge.sh [16:09] I'll go a bit slow from now on for others to catch up if m going fast [16:10] So once its done we can start merging process [16:10] Since we are new contributors I ll take a simple example of a universe package merge which is ldaptor a pure python based LDAP client in short [16:11] See: https://launchpad.net/ubuntu/+source/ldaptor [16:11] btw the complete list of universe package merges is here: [16:11] https://merges.ubuntu.com/universe.html [16:12] Here we find a large list of packages, with their ubuntu, debian and base version also we see the last uploader, which is the last person who work on the package, and in some cases the [16:12] uploader of the package (sponsor of the package) [16:13] So if all is fine we are going to work on ldaptor package now [16:14] so we are going to create an empty directory to work on it and get into it: [16:14] mkdir $WORK_DIR/ldaptor ; cd $WORK_DIR/ldaptor [16:14] now we need to download the debian and ubuntu packages to work on them, that's easily done with the script we download earlier: [16:16] Now I assume everyone has created a directory named ldaptor we ll execute grab-merge.sh script which on my system will be india@ubuntu11:~/development/ldaptor$ ../grab-merge.sh ldaptor [16:17] Now I'll leave some time for the packages to download [16:19] most of the work have been already done by MoM, we only need to work on some fine tuning and the tasks [16:19] which need human intervention [16:20] ok, if everything is already downloaded we can see a file called REPORT, this is the first thing we [16:20] need to look at [16:20] In this case there are no conflicts so indicating that its a pretty simple merge but quite interesting :) [16:21] now we just need to look at the debian changelog and determine whether the ubuntu changes are still applicable or not [16:22] for that do cd ldaptor-0.0.43+debian1-5ubuntu1/debian in my system [16:23] india@ubuntu11:~/development/ldaptor$ cd ldaptor-0.0.43+debian1-5ubuntu1/debian/ [16:23] now once you are in the /debian directory [16:24] type in this command dch -e to edit the debian/changelog in your favourite editor [16:24] i use good old nano :) [16:26] you ll find a lines like this at the start ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low [16:26] * Merge from debian unstable. Remaining changes: [16:26] - SUMMARISE HERE [16:27] with the debian package changelog and previous ubuntu package chanbgelog merged together :) [16:28] Now if you take a look at the previous ubuntu specific changelog you ll find this: [16:28] ldaptor (0.0.43+debian1-4ubuntu1) oneiric; urgency=low [16:28] * Merge from debian unstable. Remaining change: [16:28] - Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations. [16:31] which is pretty interesting as the package fails to build on the official buildds of ubuntu due to a package which strips translations pertaining to the package and if the po or pot files are empty it causes a build failure [16:32] without this change the package would have been imported as is giving raise to a sync :) [16:33] so now we need to update the changelog for the latest ubuntu version of the package we are working on which on my system now will be [16:33] ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low [16:33] * Merge from debian unstable. Remaining changes: [16:33] - Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations. [16:35] Please take note of the spacings and the format of the changelog as it ll be machine parseable :) [16:35] Now save the changes in your favourite editor ] [16:36] and run the following command debuild -S [16:36] So that builds the .dsc file and generates the .changes file now you should test build the package .dsc file in a pbuilder or sbuild to check whether the package builds correctly not and generates the deb file [16:37] (Note: this step is very important for ensuring quality work and quick sponsoring :) ) [16:39] so after building the .dsc please test it in a pbuilder so issue the following command: sudo pbuilder build ldaptor_0.0.43+debian1-5ubuntu1.dsc [16:40] QUESTION: make: dh: Command not found make: *** [clean] Error 127 [16:41] saimanoj79, make sure you have installed all the packages correctlly required for ubuntu development as said above [16:41] debsign: gpg error occurred! Aborting....debuild: fatal error at line 1256:running debsign failed is it work? [16:43] vanderson, please create a GPG key too because its required to sign the .dsc built and .changes with your gpg key https://wiki.ubuntu.com/GnuPrivacyGuardHowto should help you [16:43] Once the package builds correctly generate the debdiff between the current debian_version.dsc and current ubuntu_version.dsc and attach it to a bug opened as defined in the merging workflow in this link: https://wiki.ubuntu.com/UbuntuDevelopment/Merging [16:45] so in my system I would do: india@ubuntu11:~/development/ldaptor$ debdiff ldaptor_0.0.43+debian1-5.dsc ldaptor_0.0.43+debian1-5ubuntu1.dsc > ldaptor.diff [16:45] and attach ldaptor.diff as a patch to the bug I created as per the merge workflow as a patch [16:47] and last but not the least Subscribe the ubuntu-sponsors team on your merge request bug for feedback and uploading of your change :) [16:50] so this was a session on how to get started merging packages from debian. This I believe can get you started into merging packages The above example was a simple one and various packages have various sort of conflicts which are need to be handled diligently :) [16:51] and we need to look at the importance of debian package change too while merging a package from debian [16:51] coolbhavi, QUESTION: as a side note, would you mind explaining what a fake sync is and why do we need that? [16:53] and`, fake sync arises due to mismatching of orig tarballs in debian and ubuntu so it cant be synced directly from debian in short terms [16:55] and if you get stuck anywhere in the ubuntu development sphere please feel free to tap on us in #ubuntu-motu or #ubuntu-devel [16:55] we are always there to help you :) [16:56] QUESTION: in which directory did you issue the pbuilder command? I'm getting ... is not a valid .dsc file name [16:56] mjaga, its in the ldaptor directory that we created [16:57] QUESTION: how to apply that patch (.diff) to ubuntu package [16:58] we use the generated diff to apply to the debian package in case of a merge takdir [16:59] so if anyone is on facebook you can catch me up on facebook.com/bshankar :) [17:00] thats all from my side now :) [17:00] thanks all for turning up for this session }}}