PatchingSourcePackages

Differences between revisions 11 and 14 (spanning 3 versions)
Revision 11 as of 2013-03-11 00:29:34
Size: 971
Editor: h-4-180
Comment:
Revision 14 as of 2013-04-03 01:35:37
Size: 2571
Editor: h-4-180
Comment:
Deletions are marked like this. Additions are marked like this.
Line 2: Line 2:
<<Include(UbuntuStudio/Navigation/DevSideBar)>> ||<tablestyle="width: 30%; float: right; background-color: #e1f0f4; border-radius: 10px;"><<Include(UbuntuStudio/Navigation/DevSideBar)>>||
Line 7: Line 7:
== Patch source package, commit patch, and upload to PPA for testing == = About Debian Patches =

A patch is a diff file, which usually includes some sort of a bug fix that needs to be applied to source code. We'll be using two methods for creating Debian patch files, each with their own tool, '''dquilt''' and '''edit-patch''' (the latter being a wrapper script for tools like dquilt).

= Using dquilt to patch Debian packages =

First, you will need to set up dquilt. [[http://www.debian.org/doc/manuals/maint-guide/modify.en.html#quiltrc]]

What dquilt does is remembers what you edit in a debian source package, and adds those changes into a patch file that you have named.

Start the new patch. Naming is important - It should describe what the patch does. Also, some packages have a system for naming, using numbers for ordering the patches. The patch file will end up in ''./debian/patches/''
{{{
$ dquilt new 010-my-patch-name.patch
}}}

For each file you are about do changes on, you will need to do
{{{
$ dquilt add path/to/file-to-be-edited
}}}

Now, do your edits. When you're done, in order to refresh the patch file (you can do this as many times as you want during editing), you'll need to do:
{{{
$ dquilt refresh
}}}

Now, the patch is working. But, it's not documented yet, which is equally important (the reviewer needs to see what the origin of the patch is, and what it does). You'll need to add a header for your patch. You can find guidelines on what to add here [[http://dep.debian.net/deps/dep3/]]
{{{
$ dquilt header -e
}}}

= Patch source package, commit patch, and upload to PPA for testing =

For future reference: edit-patch, sbuild

About Debian Patches

A patch is a diff file, which usually includes some sort of a bug fix that needs to be applied to source code. We'll be using two methods for creating Debian patch files, each with their own tool, dquilt and edit-patch (the latter being a wrapper script for tools like dquilt).

Using dquilt to patch Debian packages

First, you will need to set up dquilt. http://www.debian.org/doc/manuals/maint-guide/modify.en.html#quiltrc

What dquilt does is remembers what you edit in a debian source package, and adds those changes into a patch file that you have named.

Start the new patch. Naming is important - It should describe what the patch does. Also, some packages have a system for naming, using numbers for ordering the patches. The patch file will end up in ./debian/patches/

$ dquilt new 010-my-patch-name.patch

For each file you are about do changes on, you will need to do

$ dquilt add path/to/file-to-be-edited

Now, do your edits. When you're done, in order to refresh the patch file (you can do this as many times as you want during editing), you'll need to do:

$ dquilt refresh

Now, the patch is working. But, it's not documented yet, which is equally important (the reviewer needs to see what the origin of the patch is, and what it does). You'll need to add a header for your patch. You can find guidelines on what to add here http://dep.debian.net/deps/dep3/

$ dquilt header -e

Patch source package, commit patch, and upload to PPA for testing

Test locally First

  • Add the patch with: patch -p1 < ../mypatch

  • Get build dependencies for the package: sudo apt-get build-dep <packagname>

  • Build package for local testing (without signing): dpkg-buildpackage -us -uc -nc

Ready to upload

  • Clean from previous builds: fakeroot debian/rules clean
  • Commit changes and make it a patch: dpkg-source --commit
  • Edit Changelog: dch -i
  • Build new source for upload: debuild -S -sd (Use -k if keysign failed) (debuild -S -sa to include the *.orig in the upload)
  • Upload to ppa: dput ppa:your-lp-id/ppa ../<new_source.changes>

If there was an upload error, and you need to do it again, delete the ppa files found in the same folder as the source.change file.

UbuntuStudio/PatchingSourcePackages (last edited 2013-05-17 01:35:57 by h-4-180)