PatchingSourcePackages

Differences between revisions 3 and 13 (spanning 10 versions)
Revision 3 as of 2012-11-06 10:34:59
Size: 682
Editor: h-161-160
Comment:
Revision 13 as of 2013-04-02 23:59:07
Size: 2512
Editor: h-4-180
Comment:
Deletions are marked like this. Additions are marked like this.
Line 1: Line 1:
<<Include(UbuntuStudio/Navigation/Header)>>
||<tablestyle="width: 30%; float: right; background-color: #e1f0f4; border-radius: 10px;"><<Include(UbuntuStudio/Navigation/DevSideBar)>>||

Line 3: 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'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 =
Line 7: Line 41:
    Add the patch with: patch -p1 <mypatch
    Build package for local testing (without signing): dpkg-buildpackage -us -uc -nc
 * 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
Line 12: Line 47:
    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)
 * 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)
Line 16: Line 52:
    Upload to ppa: dput ppa:your-lp-id/ppa ../<new_source.changes>  * Upload to ppa: dput ppa:your-lp-id/ppa ../<new_source.changes>

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'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)