Merges_080613

How To Merge A Package From Debian - Fri, Jun 13, 2008

[Fri Jun 13 15:00:00 2008] <nhandler> Hello everyone, and thanks for joining me for my lesson about merging packages from Debian.

[Fri Jun 13 15:00:15 2008] <nhandler> If you have any questions, please ask them in ##MergeAndSync-Questions. Be sure to prefix them with 'QUESTION:'.

[Fri Jun 13 15:00:34 2008] <nhandler> The wiki does an excellent job of explaining why we need to merge/sync packages from Debian.

[Fri Jun 13 15:00:46 2008] <nhandler> Here is an excerpt from https://wiki.ubuntu.com/UbuntuDevelopment/Merging.

[Fri Jun 13 15:01:03 2008] <nhandler> Ubuntu is based on the Debian GNU/Linux distribution and uses the same package management system. In the beginning of each Ubuntu development cycle the packages in Ubuntu are updated to those in Debian unstable. However, because Ubuntu is not the same as Debian, some of the packages need to be modified to work in Ubuntu. There might also be bug fixes that Ubuntu developers have introduced into the packages. You can

[Fri Jun 13 15:01:03 2008] <nhandler>  determine whether this has taken place by noting the package version. If the package version includes ubuntu in it (an example would be gimp 2.2.9-3ubuntu2) then the Ubuntu developers have made some change and it is no longer the same as the Debian package. There are more than 1000 such packages in the Universe repository.

[Fri Jun 13 15:01:45 2008] <nhandler> At the start of the development cycle a decision has to be made with regard to these Ubuntu-versioned packages. Of course if the Debian version hasn't changed since the last Ubuntu release then nothing needs to be changed. However, if there is a newer version of the package in Debian then one of two things should happen. If all of the reasons that the Ubuntu version existed (bug fixes, dependencies, etc.) are fixed

[Fri Jun 13 15:01:45 2008] <nhandler>  in the new Debian package then we can just take the Debian package directly. This is called a sync. However, if the new Debian version has the same issues that caused the Ubuntu version to be made, then those changes need to be applied to the new Debian version. This is called merging.

[Fri Jun 13 15:02:24 2008] <nhandler> Any questions so far?

[Fri Jun 13 15:03:06 2008] <nhandler> Please join ##MergeAndSync-Questions to ask questions

[Fri Jun 13 15:03:33 2008] <nhandler> Ok, I guess will move on

[Fri Jun 13 15:03:36 2008] <nhandler> The Ubuntu Merge-o-Matic (MoM), http://merges.ubuntu.com/universe.html, provides a list of packages that need to either be merged or synced.

[Fri Jun 13 15:04:01 2008] <nhandler> QUESTION: So are all the packages in Ubuntu from Debian or have some been created from the source?

[Fri Jun 13 15:04:28 2008] <nhandler> There are packages in Ubuntu that do not exist in Debian. These have a Debian revision of 0. So they would look like: foo-0ubuntu1

[Fri Jun 13 15:04:48 2008] <nhandler> However, we try to get all Ubuntu packages added upstream in Debian

[Fri Jun 13 15:05:12 2008] <nhandler> QUESTION: can you please explain the naming of packages by name/numbers

[Fri Jun 13 15:06:14 2008] <nhandler> There are a few parts to a package version. Take this example, foo 1.2.3-4ubuntu5

[Fri Jun 13 15:06:23 2008] <nhandler> "foo" is the name of the package

[Fri Jun 13 15:06:48 2008] <nhandler> 1.2.3 is the version of the source package.

[Fri Jun 13 15:07:07 2008] <nhandler> 4 is the Debian package revision

[Fri Jun 13 15:07:14 2008] <nhandler> And 5 is the Ubuntu package revision

[Fri Jun 13 15:08:06 2008] <nhandler> This means that Debian has made 4 sets of changes for version 1.2.3, and Ubuntu has made 5 sets of changes since the fourth Debian change came out

[Fri Jun 13 15:08:29 2008] <nhandler> Moving on...

[Fri Jun 13 15:08:32 2008] <nhandler> DaD, http://dad.dunnewind.net/universe.php, is another merge tool. Although we will be using MoM for our example today, you should always check DaD to make sure that someone isn't already working on merging the package you want to do. You also should ask the laster Ubuntu uploader if they are planning on doing the merge themself.

[Fri Jun 13 15:09:11 2008] <nhandler> Today, we will be merging a package called "tkdiff".

[Fri Jun 13 15:09:24 2008] <nhandler> Start by creating a directory called "Development" in your home folder. This folder will hold all of your merges.

[Fri Jun 13 15:09:59 2008] <nhandler> Next, download the grab-merge script, http://merges.ubuntu.com/grab-merge.sh, to the Development folder, and make it executable with 'chmod +x ~/Development/grab-merge.sh'.

[Fri Jun 13 15:10:19 2008] <nhandler> Let me know when you have this script downloaded in ##MergeAndSync-Quesetions

[Fri Jun 13 15:10:40 2008] <nhandler> QUESTION: do you want us to follow these directions or just listen?

[Fri Jun 13 15:11:05 2008] <nhandler> I would suggest following along, but that is really up to you. You are free to do whatever you want

[Fri Jun 13 15:11:40 2008] <nhandler> Have you downloaded grab-merge.sh?

[Fri Jun 13 15:12:05 2008] <nhandler> We will use grab-merge.sh to download all of the files that we need to perform the merge.

[Fri Jun 13 15:12:18 2008] <nhandler> Inside your Development folder, create a new folder called "tkdiff". This new folder will hold all the files related to merging tkdiff.

[Fri Jun 13 15:12:49 2008] <nhandler> Now, open a terminal (Applications->Accessories->Terminal), and type 'cd ~/Development/tkdiff' to enter our new tkdiff folder.

[Fri Jun 13 15:13:20 2008] <nhandler> We will now download the files we need to perform the merge. Type '../grab-merge.sh tkdiff'. This will download all the files we need.

[Fri Jun 13 15:13:44 2008] <nhandler> Let me know in ##MergeAndSync-Questions when grab-merge.sh is done downloading the tkdiff files.

[Fri Jun 13 15:14:26 2008] <nhandler> Once the script finishes running, type 'less REPORT' to view the report file that MoM generated for us. This report will show us which files had changes that were unable to be merged automatically.

[Fri Jun 13 15:14:48 2008] <nhandler> Near the bottom of the REPORT file, you should see a small list of files that looks like this:

[Fri Jun 13 15:15:01 2008] <nhandler> C  debian/control

[Fri Jun 13 15:15:01 2008] <nhandler> C  debian/rules

[Fri Jun 13 15:15:01 2008] <nhandler> C* debian/tkdiff.desktop

[Fri Jun 13 15:15:24 2008] <nhandler> Those are the files that we will be focusing on. I prefer using gedit while I am doing a merge. This is because it supports tabs. However, feel free to use any editor you want.

[Fri Jun 13 15:16:33 2008] <nhandler> First, 'cd tkdiff-4.1.4-1ubuntu1' to enter the source directory.

[Fri Jun 13 15:16:48 2008] <nhandler> The first thing you should do is look at the changelog file. This file shows all changes that were made in Ubuntu and in Debian. I prefer to just leave this file open in a tab in gedit so that I can refer to it later. To do this, type 'gedit debian/changelog'. Then, in the terminal, type Ctrl+z, and then 'bg'. This will send the task to the background.

[Fri Jun 13 15:17:28 2008] <nhandler> In the changelog, you want to focus on the changes that happened in versions 1:4.1.3-1ubuntu1 and 1:4.1.3-1ubuntu2. Notice that both of those versions have a Debian revision of 1? The debian revision is located after the '-' and before the 'ubuntu'. The reason we are looking at these changes is because they were made after the second most recent Debian version, 1:4.1.3-1.

[Fri Jun 13 15:18:06 2008] <nhandler> If you look at version 1:4.1.3-1ubuntu1, you will see that is was a merge (like what we are doing now). It says that it retained the Ubuntu changes. As a result, we have to look at version 1:4.0.2-4ubuntu1, since that was the most recent Ubuntu version prior to 1:4.1.3-1ubuntu1.

[Fri Jun 13 15:19:00 2008] <nhandler> In 1:4.1.3-1ubuntu1, you will see that a .desktop file and a .icon were added. Also, if you look at 1:4.1.3-1ubuntu2, one of the other versions we have to look at, you will see that the maintainer field in debian/control was updated.

[Fri Jun 13 15:19:29 2008] <nhandler> Any questions?

[Fri Jun 13 15:20:47 2008] <nhandler> No questions? Then I will continue.

[Fri Jun 13 15:20:54 2008] <nhandler> Now that we know what changes were made in Ubuntu, we need to look at the most recent Debian version, 1:4.1.4-1, to see if any of the Ubuntu changes were added upstream in Debian. As you can see from the changelog entry, Debian changed the Maintainer to the Debian QA Group, and they also added a .desktop file.

[Fri Jun 13 15:21:42 2008] <nhandler> Alright, now for the fun part. We are now able to perform the merge.

[Fri Jun 13 15:21:57 2008] <nhandler> Start by opening debian/control in gedit. You should see a section that looks like this:

[Fri Jun 13 15:22:07 2008] <nhandler> <<<<<<< tkdiff-1:4.1.3-1ubuntu2 (ubuntu)

[Fri Jun 13 15:22:07 2008] <nhandler> Maintainer: Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>

[Fri Jun 13 15:22:07 2008] <nhandler> XSBC-Original-Maintainer: Adrian Bridgett <bridgett@debian.org>

[Fri Jun 13 15:22:07 2008] <nhandler> Build-Depends-Indep: debhelper

[Fri Jun 13 15:22:07 2008] <nhandler> Standards-Version: 3.6.1.0

[Fri Jun 13 15:22:08 2008] <nhandler> =======

[Fri Jun 13 15:22:12 2008] <nhandler> Maintainer: Debian QA Group <packages@qa.debian.org>

[Fri Jun 13 15:22:14 2008] <nhandler> Build-Depends: debhelper (>= 5.0.0)

[Fri Jun 13 15:22:16 2008] <nhandler> Standards-Version: 3.7.3

[Fri Jun 13 15:22:18 2008] <nhandler> >>>>>>> tkdiff-1:4.1.4-1 (debian)

[Fri Jun 13 15:22:53 2008] <nhandler> The stuff above the '=======' are the Ubuntu changes. The stuff below it are the Debian changes. Whenever possible, we try to use the Debian changes instead of the Ubuntu ones, but this is not always the case.

[Fri Jun 13 15:23:38 2008] <nhandler> The first thing we will look at is the maintainer field. The Maintainer field should be set to 'Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>' for packages in Universe or Multiverse, and to Ubuntu Core Developers <ubuntu-devel-discuss@lists.ubuntu.com> for packages in main or restricted. You can read more about this here: https://wiki.ubuntu.com/DebianMaintainerField

[Fri Jun 13 15:24:47 2008] <nhandler> The XSBC-Original-Maintainer field is used to store the information of the Debian maintainer.

[Fri Jun 13 15:25:12 2008] <nhandler> In our case, tkdiff is in Universe, so the maintainer field should look like this:

[Fri Jun 13 15:25:17 2008] <nhandler> Ubuntu MOTU Developers <ubuntu-motu@lists.ubuntu.com>

[Fri Jun 13 15:26:04 2008] <nhandler> The Debian maintainer was changed to the Debian QA Group, as we saw in the changelog file. As a result, our XSBC-Original-Maintainer field should look like this:

[Fri Jun 13 15:26:11 2008] <nhandler> XSBC-Original-Maintainer: Debian QA Group <packages@qa.debian.org>

[Fri Jun 13 15:26:56 2008] <nhandler> The final change that you can see in the control file is that Debian bumped the Standards-Version to 3.7.3, the most recent version. We also want to keep this change.

[Fri Jun 13 15:27:35 2008] <nhandler> At this point, you should have a control file that has been successfully merged. Please upload your control file to http://paste.ubuntu.com/, and paste the URL into ##MergeAndSync-Questions.

[Fri Jun 13 15:28:10 2008] <nhandler> QUESTION: you want us to make these changes to the upper (Ubuntu) portion of the file?

[Fri Jun 13 15:29:19 2008] <nhandler> The idea of a merge is to keep some of the Ubuntu changes, and keep some of the Debian changes. In the end, you should only have 1 maintainer, 1 XSBC-Original-Maintainer, and 1 Standards-Version.

[Fri Jun 13 15:33:17 2008] <nhandler> I might not have been clear enough, but you want to remove the <<<<, =====, and >>>>> lines. You also want to remove the Ubuntu Build-Depends-Indep line, the Ubuntu Standards-Version line, and the Debian Maintainer line

[Fri Jun 13 15:34:29 2008] <nhandler> You can view my control file here: http://paste.ubuntu.com/19154/

[Fri Jun 13 15:34:59 2008] <nhandler> The next file that we need to look at is debian/rules. Open it in gedit, and locate this section:

[Fri Jun 13 15:35:30 2008] <nhandler> <<<<<<< tkdiff-1:4.1.3-1ubuntu2 (ubuntu)

[Fri Jun 13 15:35:30 2008] <nhandler>         dh_installdirs usr/bin

[Fri Jun 13 15:35:30 2008] <nhandler>         dh_install debian/tkdiff.desktop usr/share/applications

[Fri Jun 13 15:35:30 2008] <nhandler>         dh_install debian/tkdiff.xpm usr/share/pixmaps

[Fri Jun 13 15:35:30 2008] <nhandler>         dh_desktop

[Fri Jun 13 15:35:31 2008] <nhandler> =======

[Fri Jun 13 15:35:33 2008] <nhandler> >>>>>>> tkdiff-1:4.1.4-1 (debian)

[Fri Jun 13 15:36:07 2008] <nhandler> Do you notice how the Debian section is empty? This means that Ubuntu added these lines. These lines are used to install the .desktop and icon file that were added in version 1:4.0.2-4ubuntu1. We want to keep these lines, so simply remove the '<<<<<<<', '=======', and '>>>>>>>' lines.

[Fri Jun 13 15:36:51 2008] <nhandler> That is all that we need to do for the rules file. Please upload your debian/rules file to http://paste.ubuntu.com/, and paste the URL in ##MergeAndSync-Questions.

[Fri Jun 13 15:39:07 2008] <nhandler> The empty Debian section I was talking about is located between the '=======' and '>>>>>>>' lines.

[Fri Jun 13 15:40:29 2008] <nhandler> You can view my rules file here: http://paste.ubuntu.com/19155/

[Fri Jun 13 15:40:48 2008] <nhandler> The final file we need to look at is debian/tkdiff.desktop. However, I probably should have said files. There is a tkdiff.desktop.DEBIAN and a tkdiff.desktop.UBUNTU. We need to look at both of these files, and choose which one to keep.

[Fri Jun 13 15:41:51 2008] <nhandler> QUESTION:- Does it matter if the order of the fields in the control file are different?

[Fri Jun 13 15:42:38 2008] <nhandler> No, the order of the fields in the control file does not matter. As long as the fields are located in the correct section, you are fine.

[Fri Jun 13 15:43:06 2008] <nhandler> Since all of the fields we were modifying were located in the Source section of the control file, the order does not matter.

[Fri Jun 13 15:43:39 2008] <nhandler> Moving on...

[Fri Jun 13 15:43:41 2008] <nhandler> Open both of these files in gedit. You will notice that the only difference is that tkdiff.desktop.UBUNTU has a line that looks like this:

[Fri Jun 13 15:43:54 2008] <nhandler> Encoding=UTF-8

[Fri Jun 13 15:44:14 2008] <nhandler> QUESTION:- So any order is fine as long as the fields are present and in the correct place?

[Fri Jun 13 15:44:33 2008] <nhandler> Yes, any order is fine as long as the fields are present in the correct section of the control file.

[Fri Jun 13 15:44:55 2008] <nhandler> Going back to the lesson...

[Fri Jun 13 15:44:57 2008] <nhandler> As a result, we want to keep tkdiff.desktop.UBUNTU. Start by deleting tkdiff.desktop.DEBIAN, because there is no reason to keep it. Next, rename tkdiff.desktop.UBUNTU to tkdiff.desktop.

[Fri Jun 13 15:45:46 2008] <nhandler> We are almost done with this merge. The only thing left to do is edit debian/changelog to reflect our changes. Type 'dch -e' to edit the changelog file.

[Fri Jun 13 15:46:24 2008] <nhandler> You should see an entry that looks resembles this:

[Fri Jun 13 15:46:35 2008] <nhandler> tkdiff (1:4.1.4-1ubuntu1) intrepid; urgency=low

[Fri Jun 13 15:46:35 2008] <nhandler>   * Merge from debian unstable, remaining changes:

[Fri Jun 13 15:46:35 2008] <nhandler>     - SUMMARISE HERE

[Fri Jun 13 15:46:35 2008] <nhandler>  -- Ubuntu Merge-o-Matic <mom@ubuntu.com>  Fri, 30 May 2008 22:43:39 +0100

[Fri Jun 13 15:47:47 2008] <nhandler> QUESTION: I get command not found for dch

[Fri Jun 13 15:48:00 2008] <nhandler> Do 'sudo apt-get install devscripts build-essential wget fakeroot cdbs patchutils debhelper'

[Fri Jun 13 15:48:13 2008] <nhandler> That will install the packages you will need.

[Fri Jun 13 15:57:52 2008] <nhandler> There are a few things you should notice. First, on the first line, it says 'intrepid'. This is because Ubuntu 8.10, Intrepid Ibex, is the current development release of Ubuntu. Second, the last line of the entry should have your name and email address instead of 'Ubuntu Merge-o-Matic <mom@ubuntu.com>'.

[Fri Jun 13 15:58:46 2008] <nhandler> Before we can finish this changelog entry, we need to create a bug report on https://launchpad.net/. I have already done this, and you can view this report here: https://bugs.edge.launchpad.net/ubuntu/+source/tkdiff/+bug/237717. You want to copy the bug number, 237717, from the report.

[Fri Jun 13 16:00:40 2008] <nhandler> Now, go back to the changelog, and edit the line that says "* Merge from debian unstable, remaining changes:" to say "* Merge from debian unstable, remaining changes (LP: #237717):". The '(LP: #237717)' part will cause the bug to be marked as 'Fix Released' once the patch has been uploaded.

[Fri Jun 13 16:01:27 2008] <nhandler> We now need to document what Ubuntu changes we kept. These are the Ubuntu changes that have not been added upstream in Debian, but are still needed.

[Fri Jun 13 16:01:50 2008] <nhandler> The Ubuntu changes that you need to include are:

[Fri Jun 13 16:01:56 2008] <nhandler> Updating the Maintainer field in debian/control according to the debian-maintainer-field spec.

[Fri Jun 13 16:01:56 2008] <nhandler> Adding the dh_install lines in debian/rules to install the .desktop file and the .xpm icon.

[Fri Jun 13 16:02:15 2008] <nhandler> Once you make these changes, please upload you changelog file to http://paste.ubuntu.com/, and paste a link in ##MergeAndSync-Questions.

[Fri Jun 13 16:13:04 2008] <nhandler> You can view my debian/changelog file here: http://paste.ubuntu.com/19159/

[Fri Jun 13 16:13:26 2008] <nhandler> The only thing left to do is generate the patch. First, we have to build the source backage. To do this, type 'debuild -S'. If you don't have a GPG key, you can do 'debuild -S -us -uc'.

[Fri Jun 13 16:24:54 2008] <nhandler> This will create a file called tkdiff_4.1.4-1ubuntu1.dsc. We now need to generate 2 debdiff files. One will show the changes between the Debian version, 1:4.1.4-1, and this one, 1:4.1.4-1ubuntu1. The second one will show the changes between the last Ubuntu version, 1:4.1.3-1ubuntu2, and this one, 1:4.1.4-1ubuntu1. You can generate the Debian->Ubuntu debdiff by running this command from ~/Development/tkdiff:

[Fri Jun 13 16:25:19 2008] <nhandler> debdiff tkdiff_4.1.4-1.dsc tkdiff_4.1.4-1ubuntu1.dsc > tkdiff_4.1.4-1ubuntu1.debdiff

[Fri Jun 13 16:26:51 2008] <nhandler> You would then attach that patch to the bug report that we made earlier.

[Fri Jun 13 16:27:29 2008] <nhandler> You can generate the Ubuntu->Ubuntu debdiff by running this command from ~/Development/tkdiff:

[Fri Jun 13 16:27:34 2008] <nhandler> debdiff tkdiff_4.1.3-1ubuntu2.dsc tkdiff_4.1.4-1ubuntu1.dsc > tkdiff_4.1.4-1ubuntu1.debdiff

[Fri Jun 13 16:35:55 2008] <nhandler> You would then attach that patch to the bug report as well.

[Fri Jun 13 16:35:59 2008] <nhandler> This last step isn't required, but it is still a good thing to do. You should add the debian/changelog entry that we made to the bug report as well.

[Fri Jun 13 16:36:44 2008] <nhandler> The last step is to add our bug to the sponsorship queue (https://wiki.ubuntu.com/MOTU/Sponsorship/SponsorsQueue). Once it is in the queue, a MOTU will review our patch. If it is acceptable, he will upload it.

[Fri Jun 13 16:37:16 2008] <nhandler> To add our bug to the queue, set the Status to 'Confirmed', and make sure it isn't assigned to anybody. Now, we need to subscribe, not assign, 'ubuntu-universe-sponsors' to the bug since it is in Universe. If it had been in main or restricted, we would subscribe 'ubuntu-main-sponsors' instead.

[Fri Jun 13 16:37:44 2008] <nhandler> After you have done that, you are done with the merge.

[Fri Jun 13 16:39:41 2008] <nhandler> I left out one step, and that is actually building the merged version, tkdiff_4.1.4-1ubuntu1. I left this step out because you need to be running Intrepid (the development release), or have an intrepid pbuilder environment set up in order to do it. You can look at the wiki for instructions on building the merged version of the package if you are interested. If you are doing merges for real, you should always make s

[Fri Jun 13 16:39:41 2008] <nhandler> ure the package builds.

[Fri Jun 13 16:40:19 2008] <nhandler> I hope you have learned a lot from this lesson.

[Fri Jun 13 16:40:24 2008] <nhandler> Before we conclude, does anyone have any questions?

[Fri Jun 13 16:42:01 2008] <nhandler> Then that concludes our lesson on merging packages from Debian.

Cheater7/Lectures/Merges_080613 (last edited 2008-08-06 16:14:32 by localhost)