In this article I'm going to describe how to do a merge using merge - o - matic (MoM), Ubuntu's semi automatic merging system. Most of the content was simply pasted from IRC, where Bhavani Shankar described it.
Thanks Bhavani Shankar aka coolbhavi!
Notice: When I've got some time, I'll edit/restructure this a bit.
Involved Concepts
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.
There are two ways to import a package from debian. One is a sync and other is a merge. Sync is importing the debian package "as is" without any further changes, whereas merging is importing the debian package and intoducing/including all the Ubuntu changes.
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.
Getting started
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 I'm pasting here for your kind reference):
$ sudo apt-get install bzr-builddeb ubuntu-dev-tools fakeroot build-essential gnupg pbuilder debhelper
(btw, this
merging-page provides a overview of merging workflow and we are going to see a simple example of it now)
First of all we need to check what packages have need to be merged. Thats where MoM comes into picture
MoM is available here:
merges.ubuntu.com
First of all we need to create a work directory, I use
~/development, you could use a directory of your own.
From now on we are calling this
$WORK_DIR, so please create a working directory for your own.
Now store the path on the
$WORK_DIR variable giving "
export $WORK_DIR=/path/to/work/directory"
for convenience
which in my case will be "
export WORK_DIR=~/development"
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
$ cd $WORK_DIR
$ wget -c http://merges.ubuntu.com/grab-merge.sh
$ chmod +x grab-merge.sh
So once its done we can start merging process
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
See:
https://launchpad.net/ubuntu/+source/ldaptor
btw the complete list of universe package merges is here:
merges.ubuntu.com/universe.html
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 uploader of the package (sponsor of the package)
so we are going to create an empty directory to work on it and get into it:
$ mkdir $WORK_DIR/ldaptor
$ cd $WORK_DIR/ldaptor
now we need to download the debian and ubuntu packages to work on them, that's easily done with the script we download earlier:
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
Most of the work have been already done by MoM, we only need to work on some fine tuning and the tasks which need human intervention
Ok, if everything is already downloaded we can see a file called REPORT, this is the first thing we need to look at
In this case there are no conflicts so indicating that its a pretty simple merge but quite interesting
Now we just need to look at the debian changelog and determine whether the ubuntu changes are still applicable or not
for that do
$ cd ldaptor-0.0.43+debian1-5ubuntu1/debian
in my system
india@ubuntu11:~/development/ldaptor$ cd ldaptor-0.0.43+debian1-5ubuntu1/debian/
Now once you are in the /debian directory
type in this command
dch -e to edit the
debian/changelog in your favourite editor (I use good old nano)
You'll find a lines like this at the start
ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low
* Merge from debian unstable. Remaining changes:
- SUMMARISE HERE
with the debian package changelog and previous ubuntu package chanbgelog merged together
Now if you take a look at the previous ubuntu specific changelog you ll find this:
ldaptor (0.0.43+debian1-4ubuntu1) oneiric; urgency=low
* Merge from debian unstable. Remaining change:
- Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations.
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
without this change the package would have been imported as is giving raise to a sync
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
ldaptor (0.0.43+debian1-5ubuntu1) oneiric; urgency=low
* Merge from debian unstable. Remaining changes:
- Remove empty POT files. Fixes FTBFS caused by pkgstriptranslations.
Please take note of the spacings and the format of the changelog as it'll be machine parseable.
Now save the changes in your favourite editor and run the following command:
$ debuild -S
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.
(Note: this step is very important for ensuring quality work and quick sponsoring )
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
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
In my system I would do: (the > should be >)
india@ubuntu11:~/development/ldaptor$ debdiff ldaptor_0.0.43+debian1-5.dsc ldaptor_0.0.43+debian1-5ubuntu1.dsc > ldaptor.diff
and attach ldaptor.diff as a patch to the bug I created as per the merge workflow as a patch.
Last but not the least subscribe to the ubuntu-sponsors team on your merge request bug for feedback and uploading of your change.
Debian Package Change
We need to look at the importance of debian package change too while merging a package from debian.
Questions
Whats fake sync?
- fake sync arises due to mismatching of orig tarballs in debian and ubuntu so it cant be synced directly from debian in short terms
in which directory did you issue the pbuilder command? I'm getting ... is not a valid .dsc file name.
- Its in the ldaptor directory that we created.
How to apply that patch (.diff) to ubuntu package?
- we use the generated diff to apply to the debian package in case of a merge takdir
Links