MergingFromDebian

Dev Week -- Getting started with merging packages from debian -- Bhavani Shankar -- Tue, Jul 12th, 2011

   1 [15:58] <coolbhavi> 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
   2 [16:00] <coolbhavi> Hey all
   3 [16:00] <coolbhavi> so lets get kicking on this
   4 [16:00] <coolbhavi> We are going to learn how to merge packages
   5 [16:00] <coolbhavi> But, first of all we need to understand what merging is
   6 [16:00] <coolbhavi> Today I'm going to show you how to do a merge using merge - o - matic (MoM). Ubuntu's semi automatic merging system
   7 === 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
   8 [16:01] <coolbhavi> efore we start off just a basic roundup of the concept(s) involved
   9 [16:01] <coolbhavi> 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)
  10 [16:02] <coolbhavi> There are two ways to import a package from debian (one is a sync and other is a merge)
  11 [16:02] <coolbhavi> Sync is importing the debian package "as is" without any further changes
  12 [16:02] <coolbhavi> whereas merging is importing the debian package and intoducing/including all the ubuntu changes.
  13 [16:02] <coolbhavi> 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
  14 [16:03] <coolbhavi> Now getting to know a short background lets move on
  15 [16:04] <coolbhavi> 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 [16:05] <coolbhavi> sudo apt-get install --no-install-recommends bzr-builddeb ubuntu-dev-tools fakeroot build-essential gnupg pbuilder debhelper
  17 [16:05] <coolbhavi> (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)
  18 [16:06] <coolbhavi> So assuming you have understood till now lets move on
  19 [16:06] <coolbhavi> First of all we need to check what packages have need to be merged. Thats where MoM comes into picture
  20 [16:06] <coolbhavi> MoM is available here: http://merges.ubuntu.com
  21 [16:06] <coolbhavi> First of all we need to create a work directory, I use ~/development, you could use  a directory of your own
  22 [16:07] <coolbhavi> From now on we are calling this $WORK_DIR, so please create a working directory for your own.
  23 [16:07] <coolbhavi> now store the path on the $WORK_DIR variable giving "export $WORK_DIR=/path/to/work/directory"
  24 [16:07] <coolbhavi> for convenience
  25 [16:08] <coolbhavi> which in my case will be "export WORK_DIR=~/development"
  26 [16:08] <coolbhavi> 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
  27 [16:08] <coolbhavi> Execute this in a terminal
  28 [16:08] <coolbhavi> cd $WORK_DIR ; wget -c http://merges.ubuntu.com/grab-merge.sh; chmod +x grab-merge.sh
  29 [16:09] <coolbhavi> I'll go a bit slow from now on for others to catch up if m going fast
  30 [16:10] <coolbhavi> So once its done we can start merging process
  31 [16:10] <coolbhavi> 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
  32 [16:11] <coolbhavi> See:  https://launchpad.net/ubuntu/+source/ldaptor
  33 [16:11] <coolbhavi> btw the complete list of universe package merges is here:
  34 [16:11] <coolbhavi>  https://merges.ubuntu.com/universe.html
  35 [16:12] <coolbhavi> 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
  36 [16:12] <coolbhavi> uploader of the package (sponsor of the package)
  37 [16:13] <coolbhavi> So if all is fine we are going to work on ldaptor package now
  38 [16:14] <coolbhavi> so we are going to create an empty directory to work on it and get into it:
  39 [16:14] <coolbhavi> mkdir $WORK_DIR/ldaptor ; cd $WORK_DIR/ldaptor
  40 [16:14] <coolbhavi> now we need to download the debian and ubuntu packages to work on them, that's easily done with the script we download earlier:
  41 [16:16] <coolbhavi> 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
  42 [16:17] <coolbhavi> Now I'll leave some time for the packages to download
  43 [16:19] <coolbhavi> most of the work have been already done by MoM, we only need to work on some fine tuning and the tasks
  44 [16:19] <coolbhavi> which need human intervention
  45 [16:20] <coolbhavi> ok, if everything is already downloaded we can see a file called REPORT, this is the first thing we
  46 [16:20] <coolbhavi> need to look at
  47 [16:20] <coolbhavi> In this case there are no conflicts so indicating that its a pretty simple merge but quite interesting :)
  48 [16:21] <coolbhavi> now we just need to look at the debian changelog and determine whether the ubuntu changes are still applicable or not
  49 [16:22] <coolbhavi> for that do cd ldaptor-0.0.43+debian1-5ubuntu1/debian  in my system
  50 [16:23] <coolbhavi> india@ubuntu11:~/development/ldaptor$ cd ldaptor-0.0.43+debian1-5ubuntu1/debian/
  51 [16:23] <coolbhavi> now once you are in the /debian directory
  52 [16:24] <coolbhavi> type in this command dch -e to edit the debian/changelog in your favourite editor
  53 [16:24] <coolbhavi> i use good old nano :)
  54 [16:26] <coolbhavi> you ll find a lines like this at the start ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low
  55 [16:26] <coolbhavi>   * Merge from debian unstable.  Remaining changes:
  56 [16:26] <coolbhavi>     -  SUMMARISE HERE
  57 [16:27] <coolbhavi> with the debian package changelog and previous ubuntu package chanbgelog merged together :)
  58 [16:28] <coolbhavi> Now if you take a look at the previous ubuntu specific changelog you ll find this:
  59 [16:28] <coolbhavi> ldaptor (0.0.43+debian1-4ubuntu1) oneiric; urgency=low
  60 [16:28] <coolbhavi>   * Merge from debian unstable. Remaining change:
  61 [16:28] <coolbhavi>     - Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations.
  62 [16:31] <coolbhavi> 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
  63 [16:32] <coolbhavi> without this change the package would have been imported as is giving raise to a sync :)
  64 [16:33] <coolbhavi> 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
  65 [16:33] <coolbhavi> ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low
  66 [16:33] <coolbhavi>   * Merge from debian unstable.  Remaining changes:
  67 [16:33] <coolbhavi>     - Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations.
  68 [16:35] <coolbhavi> Please take note of the spacings and the format of the changelog as it ll be machine parseable :)
  69 [16:35] <coolbhavi> Now save the changes in your favourite editor ]
  70 [16:36] <coolbhavi> and run the following command debuild -S
  71 [16:36] <coolbhavi> 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
  72 [16:37] <coolbhavi> (Note: this step is very important for ensuring quality work and quick sponsoring :) )
  73 [16:39] <coolbhavi> 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
  74 [16:40] <coolbhavi> <saimanoj79> QUESTION: make: dh: Command not found make: *** [clean] Error 127
  75 [16:41] <coolbhavi> saimanoj79, make sure you have installed all the packages correctlly required for ubuntu development as said above
  76 [16:41] <coolbhavi> <vanderson> debsign: gpg error occurred!  Aborting....debuild: fatal error at line 1256:running debsign failed   is it work?
  77 [16:43] <coolbhavi> 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
  78 [16:43] <coolbhavi> 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
  79 [16:45] <coolbhavi> 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
  80 [16:45] <coolbhavi> and attach ldaptor.diff as a patch to the bug I created as per the merge workflow as a patch
  81 [16:47] <coolbhavi> and last but not the least Subscribe the ubuntu-sponsors team on your merge request bug for feedback and uploading of your change :)
  82 [16:50] <coolbhavi> 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 :)
  83 [16:51] <coolbhavi> and we need to look at the importance of debian package change too while merging a package from debian
  84 [16:51] <coolbhavi> <and`> coolbhavi, QUESTION: as a side note, would you mind explaining what a fake sync is and why do we need that?
  85 [16:53] <coolbhavi> 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
  86 [16:55] <coolbhavi> and if you get stuck anywhere in the ubuntu development sphere please feel free to tap on us in #ubuntu-motu or #ubuntu-devel
  87 [16:55] <coolbhavi> we are always there to help you :)
  88 [16:56] <coolbhavi> <mjaga> QUESTION: in which directory did you issue the pbuilder command? I'm getting ... is not a valid .dsc file name
  89 [16:56] <coolbhavi> mjaga, its in the ldaptor directory that we created
  90 [16:57] <coolbhavi> <takdir> QUESTION: how to apply that patch (.diff) to ubuntu package
  91 [16:58] <coolbhavi> we use the generated diff to apply to the debian package in case of a merge takdir
  92 [16:59] <coolbhavi> so if anyone is on facebook you can catch me up on facebook.com/bshankar :)
  93 [17:00] <coolbhavi> thats all from my side now :)
  94 [17:00] <coolbhavi> thanks all for turning up for this session
  95 

MeetingLogs/devweek1107/MergingFromDebian (last edited 2011-07-13 09:20:22 by dholbach)