• attachment:UbuntuPackagingGuideJa/conventions/important.png Requirements: build-essential, automake, gnupg, lintian, fakeroot, patchutils, debhelper, pbuilder.

  • attachment:UbuntuPackagingGuideJa/conventions/important.png 必要なパッケージ: build-essential, automake, gnupg, lintian, fakeroot, patchutils, debhelper, pbuilder

Ubuntu is based on the Debian Linux distribution and uses the same package management system (APT). At the beginning of each Ubuntu development cycle, the packages in Ubuntu are updated to those in the Debian unstable branch. 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 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 changes, and it is no longer the same as the Debian package. There are more than 1000 such modified packages in the Universe repository.

UbuntuはDebian Linuxを基に作られ、同じパッケージ管理システム(APT)が使われています。Ubuntuの開発サイクルの最初の段階では、Ubuntuに存在するパッケージが、Debianの不安定版(unstable)のそれにアップデートされます。しかしながら、UbuntuはDebianとまったく同じと言うわけではありませんので、パッケージのいくつかはUbuntuで動作するように修正する必要があります。そのパッケージを修正するUbuntu開発者によって、不具合も修正されるかもしれません。これはパッケージのバージョンによって判別することができます。パッケージのバージョンにubuntuという単語が含まれている場合(例えば、gimp-2.2.9-3ubuntu2)、Ubuntu開発者によって修正が行われており、Debianパッケージとは異なることを意味します。Universeレポジトリには1000以上の修正済みパッケージが存在します。

At the start of each Ubuntu development cycle, a decision is made regarding 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 for Ubuntu modifications (bug fixes, dependencies, etc.) are fixed in the new Debian package, then we can just take the Debian package directly. This decision 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, too. This decision is called merging.



The merging process involves looking at the changes to both the Debian and Ubuntu source packages and determining what has changed and which changes are Ubuntu-specific. Let us now look at an example, a popular CD creation program called xcdroast.


To start, make a folder to hold our project, then navigate there:


mkdir ~/xcdroast
cd ~/xcdroast

Now download all of the source packages involved into this directory:


  • The xcdroast source tarball that is used by all versions:

  • すべてのバージョンで利用されているxcdroastのソースアーカイブ:

  • The Ubuntu Breezy source package files:
  • Ubuntu Breezyのソースパッケージ関係のファイル:
  • The Debian source package files that the Breezy packages are derived from:
  • Breezyのパッケージの元になった、Debianのソースパッケージ関係のファイル:
  • The new Debian source package files that the Dapper packages will be derived from:
  • Dapperのパッケージの元になる予定の、Debianの新しいソースパッケージ関係のファイル:
    • xcdroast_0.98+0alpha15-3.dsc

    • xcdroast_0.98+0alpha15-3.diff.gz

    • attachment:UbuntuPackagingGuideJa/conventions/note.png These steps can also be done by searching for the Debian packages at [packages.debian.org packages.debian.org] and the Ubuntu packages at [packages.ubuntu.com packages.ubuntu.com].

    • attachment:UbuntuPackagingGuideJa/conventions/note.png これらの作業は[packages.debian.org packages.debian.org]にてDebianのパッケージを、[packages.ubuntu.com packages.ubuntu.com]にてUbuntuのパッケージを検索することで行えます。

    • attachment:UbuntuPackagingGuideJa/conventions/tip.png A very useful package to have installed when doing merges (or any Ubuntu packaging) is devscripts. If you do not have that already installed, install it before proceeding.

    • attachment:UbuntuPackagingGuideJa/conventions/tip.png マージ作業(やその他のパッケージ作成作業)において、devscriptsパッケージをインストールしておくと大変便利です。まだインストールしていない場合は、ここでインストールしておいてください。

By looking at the Ubuntu changelog you should be able to see which differences to expect between the Ubuntu package and the Debian package from which it was derived. For xcdroast, the Ubuntu changelog can be found at changelogs.ubuntu.com. It says that a .desktop file was fixed and properly installed to close a bug reported in Malone.

まずUbuntuのchangelogファイルに目を通して、Ubuntuパッケージと元になったDebianパッケージの間の変更点を確認します。xcdroastの場合、Ubuntuのchangelogファイルはchangelogs.ubuntu.comで確認できます。それによると、Maloneで報告された不具合を修正するために、.desktopファイルを用意し、適切な場所にインストールしているようです(訳注:MaloneはLaunchpad Bugsのコードネームです)

Now inspect the actual changes in the source packages:


debdiff xcdroast_0.98+0alpha15-1.1.dsc xcdroast_0.98+0alpha15-1.1ubuntu1.dsc | \
        ubuntu.debdiff | less ubuntu.debdiff


debdiff xcdroast_0.98+0alpha15-1.1.dsc xcdroast_0.98+0alpha15-1.1ubuntu1.dsc > ubuntu.debdiff
less ubuntu.debdiff

The lines that start with - have been removed from the Debian package, and those that start with + have been added to the Ubuntu package.


The following is what we see: 次のような変更がなされています:

  • In debian/rules install is being used instead of cp to install the xcdroast icon. Also, there is a new line installing the .desktop file.
  • debian/rulesでは、xcdroastのアイコンに対して、cpコマンドの代わりにinstallコマンドが利用されています。また、.desktopファイルをインストールするための行が追加されています。
  • In debian/changelog the changes made are added to the changelog entry.
  • debian/changelogに新しいエントリが追加されています。
  • In debian/dirs usr/share/applications has been added for the install lines above to work properly.
  • debian/dirsでは、上記のインストール行が正しく動作するようにusr/share/applicationsが追加されています。
  • xcdroast.desktop is added
  • xcdroast.desktopファイルが追加されています。

Now we know how the Ubuntu source was changed. Now we need to see what has changed in the Debian sources.


debdiff xcdroast_0.98+0alpha15-1.1.dsc xcdroast_0.98+0alpha15-3.dsc > debian.debdiff
less debian.debdiff

There is a lot more in this debdiff than in the last one. One way we can get a better idea of what has changed is to see what files were changed in the debdiff:


grep diff debian.debdiff

This indicates that debian/postinst, debian/rules, debian/changelog, debian/doc-base.manual, debian/control, and debian/menu were changed in the new Debian version.


Thus we can see that we need to check debian/rules to see if the Ubuntu changes were made. We can also see that debian/dirs was not changed from the old Debian version. Let us now look at the files. We can unpack the source package by using dpkg-source:


dpkg-source -x xcdroast_0.98+0alpha15-3.dsc

This will decompress the xcdroast_0.98+0alpha15.orig.tar.gz file, create a xcdroast-0.98+0alpha15 directory, and apply the changes found in xcdroast_0.98+0alpha15-3.diff.gz.


Now navigate to the debian directory: debianディレクトリに移動しましょう。

cd xcdroast-0.98+0alpha15/debian

One can see in rules that changes made by Ubuntu were not applied to the new Debian version. This means that:


cp debian/xcdroast.xpm `pwd`/debian/$(PACKAGE)/usr/share/pixmaps

...should be changed to:


#cp debian/xcdroast.xpm `pwd`/debian/$(PACKAGE)/usr/share/pixmaps

#install desktop and icon
install -D -m 644 $(CURDIR)/debian/xcdroast.desktop \
install -D -m 644 $(CURDIR)/debian/xcdroast.xpm \

Now in dirs, the following line needs to be added for the .desktop file to be installed:



Now we need the actual .desktop file (saved as debian/xcdroast.desktop). From the ubuntu.debdiff (or the Ubuntu source package), we see that it is:


[Desktop Entry]
Comment=Create a CD

The last change that needs to be made is in changelog. Not only do we need to add what we have just done (merge with Debian), but we should also add in the previous Ubuntu changelog entries. To do this, run dch -i -D dapper and put something to the effect of:

最後にchengelogを変更する必要があります。今やっている作業(Debianとのマージ作業)についてだけでなく、以前のUbuntu changelogエントリも追加する必要があります。まず、dch -i -D dapperを実行して以下の内容を追加してください:

xcdroast (0.98+0alpha15-3ubuntu1) dapper; urgency=low

  * Resynchronise with Debian.

Make sure to change the version number to the correct Ubuntu version. Also add:


xcdroast (0.98+0alpha15-1.1ubuntu1) breezy; urgency=low

  * Fix and install existing .desktop file. (Closes Malone #2698)

  -- Captain Packager <[email protected]>  Sat,  1 Oct 2005 19:39:04 -0400

between the 0.98+0alpha15-1.1 and 0.98+0alpha15-2 log entries.


Now you can build and test the new source packages. There are different ways to do this, but one example is:


cd ..
debuild -S
cd ..
sudo pbuilder build xcdroast_0.98+0alpha15-3ubuntu1.dsc

This will recreate the source package, sign it with your default GPG key, and build the package in a pbuilder environment to make sure it builds correctly. Make sure to always test your packages before submitting patches. The last step is to make a debdiff that can be attached to an existing bug report or given to the MOTUs in the #ubuntu-motu IRC channel. To do this, we get the difference between the Debian unstable source package and the new Ubuntu version:


debdiff xcdroast_0.98+0alpha15-3.dsc xcdroast_0.98+0alpha15-3ubuntu1.dsc > \

UbuntuJapaneseWiki: UbuntuPackagingGuideJa/ubuntu-sync (last edited 2012-01-10 11:49:21 by anonymous)