PDA

View Full Version : [SOLVED] How to add a file as a patch.



MG&TL
November 1st, 2011, 12:36 AM
I've been working on a fairly simple, bite-size patch for me to get stuck into, however I have run into a problem. I need to add some files, as well as modify them, to apply my patch. (the issue is the icons for the .desktop files are missing, and the .desktop files don't reference an icon.)

I've been reading the various wikis on how to patch bugs in launchpad, but I can't work out how to add a file, rather than just modify it.


And a second issue (probably due to a lack of comprehension, but hey), the bzr bd command issued here: wiki.ubuntu.com/Bugs/Howtofix works fine, but throws errors, saying that the files I've added don't correspond with the orig.tar.gz....that I don't have. How does it find this tarball, and what can I do about it?

MG&TL
November 1st, 2011, 12:39 AM
Bug ref: https://bugs.launchpad.net/ubuntu/+source/ace-of-penguins/+bug/651366

MadCow108
November 1st, 2011, 01:10 AM
this particular package is a 3.0 (quilt) package so patches are best handled via quilt.
adding a new text file would go like this:


export QUILT_PATCHES="debian/patches"
quilt new my-patch-name
quilt add new-file
<create-and-edit-file>
quilt refresh

this will create a patch that will create a file when applied. patching existing files works the same way including the bug
you can apply and remove patch with quilt push and pop and get a list of applied patches with quilt applied

with the 3.0 format you can also just edit the source and execute debuild
that will create a patch from your changes for you and place it in debian/patches.
Make sure to rename it to something meaningful and fill out the header information in it.
Take care not to accidentally add these automatic patches.

adding binary files like icons is not possible with a normal patch (at least without encoding it which is discouraged).
you have to add the name of binaries to debian/source/include-binaries for them to be included.
You must make sure you forward this binary to the upstream developers so that it will be in the original tarball next release.
see man dpkg-source for more information


If you use bzr-buildpackage it will create the orig.tar.gz from the bzr repository for you.
I never use bzr builddeb.

SevenMachines
November 1st, 2011, 03:13 AM
One additional thing to remember about quilt is that patches are applied in series, so apply all current patches first, make your own changes as madcow108 shows, then unapply all patches afterwards before debuilding
$ quilt push -a
# do all the stuff to make your own patch here
$ quilt pop -a

MG&TL
November 1st, 2011, 07:45 PM
Cool. Thanks, guys. The confusion arose from trying to do this instead:

1. <create and edit files>

2. quilt new

3. quilt add

4. quilt refresh

...which obviously doesn't work. Thanks. :)


I already talked to the upstream people, they do not want to add icons, as apparently it's debian-specific. IDK, but I thought the free desktop specification thing was meant to be universal. But hey. I'll stick it in debian/include-binaries, and see what happens. Is this advisable?

MG&TL
November 1st, 2011, 08:25 PM
I think I've found a workaround/solution. If I put the files in debian/, they can't cause a problem, right? They don't need to be anywhere else.

MadCow108
November 1st, 2011, 10:09 PM
debian/ is a good place for files not associated with upstream, thought you have to make sure they are installed correctly yourself (e.g. by editing debian/install or debian/package-name.install, see man dh_install)

MG&TL
November 1st, 2011, 10:52 PM
Okay...so the steps would be?

My guess:

bzr branch
make orig.tar.gz w/out debian directory
copy files over
edit .install file
debuild
test
edit debian/changelog
bzr push lp:~/michaelrawson/ubuntu/oneiric/fixforace-of-penguins#1234 or something?

Only learned packaging about a month ago, so still newbish. Thanks for support :)

MadCow108
November 1st, 2011, 11:28 PM
with bzr its something around the lines of this:


bzr branch
edit and add stuff (use bzr add for new files)
edit changelog (with dch)
debcommit (will automatically link fixed bugs from the changelog) or bzr commit
bzr-buildpackage
test
repeat or push when done

MG&TL
November 1st, 2011, 11:47 PM
Thanks, madcow, I will try this in the morn.

MG&TL
November 2nd, 2011, 08:49 PM
Works fine up until building the package:


michael@michael-desktop:~/Documents/ace-of-penguins$ bzr-buildpackage
Building using working tree
Building package in normal mode
Looking for a way to retrieve the upstream tarball
Using apt to look for the upstream tarball.
apt could not find the needed tarball.
Trying to use get-orig-source to retrieve needed tarball.
dh get-orig-source
dh: Unknown sequence get-orig-source (choose from: binary binary-arch binary-indep build build-arch build-indep clean install install-arch install-indep)
make: *** [get-orig-source] Error 255
Trying to run get-orig-source rule failed
Using uscan to look for the upstream tarball.
uscan warning: In /tmp/tmpsGnU7N no matching hrefs for version 1.3-3 in watch line
http://www.delorie.com/store/ace/ace-([\d\.]*)\.tar\.gz
uscan could not find the needed tarball.
bzr: ERROR: Unable to find the needed upstream tarball for package ace-of-penguins, version 1.3-3.


What am I doing wrong?

SevenMachines
November 2nd, 2011, 09:23 PM
bzr-buildpackage tries a sequence of different ways to get an orig tarball, some of those below you might want to check you have enabled

* Make sure you've got a deb-src entry in apt sources.list, eg

/etc/apt/sources.list

deb-src http://archive.ubuntu.com/ubuntu oneiric restricted main multiverse universe* install pristine-tar

$ sudo apt-get install bzr-builddeb pristine-tarSee if either of those are missing

MG&TL
November 2nd, 2011, 10:08 PM
Nope, they're both installed. :confused:

MG&TL
November 2nd, 2011, 10:17 PM
I'm using Lubuntu-is this an issue?

MG&TL
November 2nd, 2011, 10:19 PM
File tree (sorry, big file):


├── ace-of-penguins #This is the modded one
│ ├── aclocal.m4
│ ├── AUTHORS
│ ├── ChangeLog
│ ├── config.guess
│ ├── config.h.in
│ ├── config.sub
│ ├── configure
│ ├── configure.in
│ ├── COPYING
│ ├── debian
│ │ ├── ace-of-penguins.6.pod
│ │ ├── ace-of-penguins.debhelper.log
│ │ ├── ace-of-penguins.doc-base
│ │ ├── ace-of-penguins.install
│ │ ├── ace-of-penguins.lintian-overrides
│ │ ├── changelog
│ │ ├── clean
│ │ ├── compat
│ │ ├── control
│ │ ├── copyright
│ │ ├── debian-compile.mk
│ │ ├── debian-vars.mk
│ │ ├── dirs
│ │ ├── icons
│ │ │ ├── 128x128
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 16x16
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 22x22
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 24x24
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 32x32
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 36x36
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 48x48
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 64x64
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 72x72
│ │ │ │ └── ace-of-penguins.png
│ │ │ └── 96x96
│ │ │ └── ace-of-penguins.png
│ │ ├── manpages
│ │ ├── menu
│ │ ├── NEWS.Debian
│ │ ├── patches
│ │ │ ├── 10-autoreconf-fi--2.65.patch
│ │ │ ├── 20-lib--make-imglib.c-closedir.patch
│ │ │ ├── 30-spider.c-implicit-pointer-conversion.patch
│ │ │ ├── 40-include.patch
│ │ │ └── series
│ │ ├── penguin-canfield.desktop
│ │ ├── penguin-freecell.desktop
│ │ ├── penguin-golf.desktop
│ │ ├── penguin-mastermind.desktop
│ │ ├── penguin-merlin.desktop
│ │ ├── penguin-minesweeper.desktop
│ │ ├── penguin-pegged.desktop
│ │ ├── penguin-solitaire.desktop
│ │ ├── penguin-spider.desktop
│ │ ├── penguin-taipei.desktop
│ │ ├── penguin-taipei-editor.desktop
│ │ ├── penguin-thornq.desktop
│ │ ├── pod2man.mk
│ │ ├── README.source
│ │ ├── rules
│ │ ├── source
│ │ │ └── format
│ │ ├── source.lintian-overrides
│ │ └── watch
│ ├── depcomp
│ ├── docs
│ │ ├── as.gif
│ │ ├── COPYING
│ │ ├── intro.html
│ │ ├── penguin.gif
│ │ ├── title.gif
│ │ └── toolkit.html
│ ├── games
│ │ ├── canfield.c
│ │ ├── canfield.png
│ │ ├── freecell.c
│ │ ├── freecell.html
│ │ ├── freecell.png
│ │ ├── golf-arrow.png
│ │ ├── golf.c
│ │ ├── golf.html
│ │ ├── golf-noarrow.png
│ │ ├── golf.png
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── mastermind-b.png
│ │ ├── mastermind.c
│ │ ├── mastermind-c.png
│ │ ├── mastermind-eb.png
│ │ ├── mastermind-e.png
│ │ ├── mastermind-g.png
│ │ ├── mastermind.html
│ │ ├── mastermind-k.png
│ │ ├── mastermind-o.png
│ │ ├── mastermind.png
│ │ ├── mastermind-p.png
│ │ ├── mastermind-r.png
│ │ ├── mastermind-w.png
│ │ ├── mastermind-y.png
│ │ ├── merlin-b.png
│ │ ├── merlin.c
│ │ ├── merlin-c.png
│ │ ├── merlin.html
│ │ ├── merlin.png
│ │ ├── minesweeper.c
│ │ ├── minesweeper-c12.png
│ │ ├── minesweeper-c24.png
│ │ ├── minesweeper-c36.png
│ │ ├── minesweeper-c48.png
│ │ ├── minesweeper.html
│ │ ├── minesweeper.png
│ │ ├── minesweeper-t.png
│ │ ├── minesweeper-x.png
│ │ ├── pegged.c
│ │ ├── pegged-h.png
│ │ ├── pegged.html
│ │ ├── pegged.png
│ │ ├── pegged-p.png
│ │ ├── solitaire.c
│ │ ├── solitaire.html
│ │ ├── solitaire.png
│ │ ├── spider.c
│ │ ├── spider.html
│ │ ├── spider.png
│ │ ├── taipedit-bs.png
│ │ ├── taipedit-bt.png
│ │ ├── taipedit-bu.png
│ │ ├── taipedit.c
│ │ ├── taipedit.html
│ │ ├── taipedit.png
│ │ ├── taipei-bridge.tp
│ │ ├── taipei.c
│ │ ├── taipei-castle.tp
│ │ ├── taipei-cube.tp
│ │ ├── taipei-glyph.tp
│ │ ├── taipei.h
│ │ ├── taipei.html
│ │ ├── taipei-jason.tp
│ │ ├── taipeilib.c
│ │ ├── taipeilib.h
│ │ ├── taipei.png
│ │ ├── taipei-pyramid.tp
│ │ ├── taipei-rebecca.tp
│ │ ├── taipei-simple.tp
│ │ ├── taipei-smiley.tp
│ │ ├── taipei-spiral.tp
│ │ ├── taipei-standard.tp
│ │ ├── taipei-tiles.png
│ │ ├── thornq-arrow.png
│ │ ├── thornq.c
│ │ ├── thornq.html
│ │ ├── thornq-noarrow.png
│ │ └── thornq.png
│ ├── INSTALL
│ ├── install-sh
│ ├── lib
│ │ ├── cards.h
│ │ ├── funcs.c
│ │ ├── funcs.h
│ │ ├── help.c
│ │ ├── imagelib.c
│ │ ├── imagelib.h
│ │ ├── images.in
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── make-imglib.c
│ │ ├── penguins.c
│ │ ├── png
│ │ │ ├── a-k.2.png
│ │ │ ├── a-k.png
│ │ │ ├── back.png
│ │ │ ├── back-tile.png
│ │ │ ├── big-penguin.png
│ │ │ ├── jack.png
│ │ │ ├── king.png
│ │ │ ├── no-drop.25.png
│ │ │ ├── no-drop.50.png
│ │ │ ├── penguin.png
│ │ │ ├── queen.png
│ │ │ ├── splash.png
│ │ │ ├── suits.13.png
│ │ │ ├── suits.26.png
│ │ │ ├── suits.39.png
│ │ │ ├── suits.9.png
│ │ │ ├── xemboss.png
│ │ │ ├── youlose.png
│ │ │ └── youwin.png
│ │ ├── stack.c
│ │ ├── table.c
│ │ ├── table.h
│ │ ├── table_rn.c
│ │ ├── text2c.c
│ │ ├── xwin.c
│ │ └── xwin.h
│ ├── ltconfig
│ ├── ltmain.sh
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── missing
│ ├── mkdist
│ ├── mkinstalldirs
│ ├── NEWS
│ ├── README
│ └── tests
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── penguins.c
│ ├── test1.c
│ ├── test3.c
│ ├── test4.c
│ ├── test5.c
│ ├── test6.c
│ └── test6.png
├── ace-of-penguins.diff #this is where I keep changes for safe-keeping
│ ├── aclocal.m4
│ ├── AUTHORS
│ ├── ChangeLog
│ ├── config.guess
│ ├── config.h.in
│ ├── config.sub
│ ├── configure
│ ├── configure.in
│ ├── COPYING
│ ├── debian
│ │ ├── ace-of-penguins.6.pod
│ │ ├── ace-of-penguins.debhelper.log
│ │ ├── ace-of-penguins.doc-base
│ │ ├── ace-of-penguins.install
│ │ ├── ace-of-penguins.lintian-overrides
│ │ ├── changelog
│ │ ├── clean
│ │ ├── compat
│ │ ├── control
│ │ ├── copyright
│ │ ├── debian-compile.mk
│ │ ├── debian-vars.mk
│ │ ├── dirs
│ │ ├── icons
│ │ │ ├── 128x128
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 16x16
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 22x22
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 24x24
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 32x32
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 36x36
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 48x48
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 64x64
│ │ │ │ └── ace-of-penguins.png
│ │ │ ├── 72x72
│ │ │ │ └── ace-of-penguins.png
│ │ │ └── 96x96
│ │ │ └── ace-of-penguins.png
│ │ ├── manpages
│ │ ├── menu
│ │ ├── NEWS.Debian
│ │ ├── patches
│ │ │ ├── 10-autoreconf-fi--2.65.patch
│ │ │ ├── 20-lib--make-imglib.c-closedir.patch
│ │ │ ├── 30-spider.c-implicit-pointer-conversion.patch
│ │ │ ├── 40-include.patch
│ │ │ └── series
│ │ ├── penguin-canfield.desktop
│ │ ├── penguin-freecell.desktop
│ │ ├── penguin-golf.desktop
│ │ ├── penguin-mastermind.desktop
│ │ ├── penguin-merlin.desktop
│ │ ├── penguin-minesweeper.desktop
│ │ ├── penguin-pegged.desktop
│ │ ├── penguin-solitaire.desktop
│ │ ├── penguin-spider.desktop
│ │ ├── penguin-taipei.desktop
│ │ ├── penguin-taipei-editor.desktop
│ │ ├── penguin-thornq.desktop
│ │ ├── pod2man.mk
│ │ ├── README.source
│ │ ├── rules
│ │ ├── source
│ │ │ └── format
│ │ ├── source.lintian-overrides
│ │ └── watch
│ ├── depcomp
│ ├── docs
│ │ ├── as.gif
│ │ ├── COPYING
│ │ ├── intro.html
│ │ ├── penguin.gif
│ │ ├── title.gif
│ │ └── toolkit.html
│ ├── games
│ │ ├── canfield.c
│ │ ├── canfield.png
│ │ ├── freecell.c
│ │ ├── freecell.html
│ │ ├── freecell.png
│ │ ├── golf-arrow.png
│ │ ├── golf.c
│ │ ├── golf.html
│ │ ├── golf-noarrow.png
│ │ ├── golf.png
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── mastermind-b.png
│ │ ├── mastermind.c
│ │ ├── mastermind-c.png
│ │ ├── mastermind-eb.png
│ │ ├── mastermind-e.png
│ │ ├── mastermind-g.png
│ │ ├── mastermind.html
│ │ ├── mastermind-k.png
│ │ ├── mastermind-o.png
│ │ ├── mastermind.png
│ │ ├── mastermind-p.png
│ │ ├── mastermind-r.png
│ │ ├── mastermind-w.png
│ │ ├── mastermind-y.png
│ │ ├── merlin-b.png
│ │ ├── merlin.c
│ │ ├── merlin-c.png
│ │ ├── merlin.html
│ │ ├── merlin.png
│ │ ├── minesweeper.c
│ │ ├── minesweeper-c12.png
│ │ ├── minesweeper-c24.png
│ │ ├── minesweeper-c36.png
│ │ ├── minesweeper-c48.png
│ │ ├── minesweeper.html
│ │ ├── minesweeper.png
│ │ ├── minesweeper-t.png
│ │ ├── minesweeper-x.png
│ │ ├── pegged.c
│ │ ├── pegged-h.png
│ │ ├── pegged.html
│ │ ├── pegged.png
│ │ ├── pegged-p.png
│ │ ├── solitaire.c
│ │ ├── solitaire.html
│ │ ├── solitaire.png
│ │ ├── spider.c
│ │ ├── spider.html
│ │ ├── spider.png
│ │ ├── taipedit-bs.png
│ │ ├── taipedit-bt.png
│ │ ├── taipedit-bu.png
│ │ ├── taipedit.c
│ │ ├── taipedit.html
│ │ ├── taipedit.png
│ │ ├── taipei-bridge.tp
│ │ ├── taipei.c
│ │ ├── taipei-castle.tp
│ │ ├── taipei-cube.tp
│ │ ├── taipei-glyph.tp
│ │ ├── taipei.h
│ │ ├── taipei.html
│ │ ├── taipei-jason.tp
│ │ ├── taipeilib.c
│ │ ├── taipeilib.h
│ │ ├── taipei.png
│ │ ├── taipei-pyramid.tp
│ │ ├── taipei-rebecca.tp
│ │ ├── taipei-simple.tp
│ │ ├── taipei-smiley.tp
│ │ ├── taipei-spiral.tp
│ │ ├── taipei-standard.tp
│ │ ├── taipei-tiles.png
│ │ ├── thornq-arrow.png
│ │ ├── thornq.c
│ │ ├── thornq.html
│ │ ├── thornq-noarrow.png
│ │ └── thornq.png
│ ├── INSTALL
│ ├── install-sh
│ ├── lib
│ │ ├── cards.h
│ │ ├── funcs.c
│ │ ├── funcs.h
│ │ ├── help.c
│ │ ├── imagelib.c
│ │ ├── imagelib.h
│ │ ├── images.in
│ │ ├── Makefile.am
│ │ ├── Makefile.in
│ │ ├── make-imglib.c
│ │ ├── penguins.c
│ │ ├── png
│ │ │ ├── a-k.2.png
│ │ │ ├── a-k.png
│ │ │ ├── back.png
│ │ │ ├── back-tile.png
│ │ │ ├── big-penguin.png
│ │ │ ├── jack.png
│ │ │ ├── king.png
│ │ │ ├── no-drop.25.png
│ │ │ ├── no-drop.50.png
│ │ │ ├── penguin.png
│ │ │ ├── queen.png
│ │ │ ├── splash.png
│ │ │ ├── suits.13.png
│ │ │ ├── suits.26.png
│ │ │ ├── suits.39.png
│ │ │ ├── suits.9.png
│ │ │ ├── xemboss.png
│ │ │ ├── youlose.png
│ │ │ └── youwin.png
│ │ ├── stack.c
│ │ ├── table.c
│ │ ├── table.h
│ │ ├── table_rn.c
│ │ ├── text2c.c
│ │ ├── xwin.c
│ │ └── xwin.h
│ ├── ltconfig
│ ├── ltmain.sh
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── missing
│ ├── mkdist
│ ├── mkinstalldirs
│ ├── NEWS
│ ├── README
│ └── tests
│ ├── Makefile.am
│ ├── Makefile.in
│ ├── penguins.c
│ ├── test1.c
│ ├── test3.c
│ ├── test4.c
│ ├── test5.c
│ ├── test6.c
│ └── test6.png
├── build-area

MadCow108
November 2nd, 2011, 11:47 PM
you branched this?

bzr branch lp:ubuntu/ace-of-penguins

you can also just download the tarball from debian or launchpad.
or apt-get source package-name
or pull-debian-source package-name
or pull-lp-source package-name
or dget url-to-dsc-file
etc etc

MG&TL
November 3rd, 2011, 08:42 AM
OKay, but ho do I tell bzr where the tarball is? If I point it to the dir with ---orig-dir= it still searches apt, etc.

And no, I got lp:~ubuntu/oneiric/ace-of-penguins

MG&TL
November 3rd, 2011, 05:44 PM
Okay, I have a ~/Documents/debian directory containing all my changes.

How would you suggest that I went about applying the patch? (I thought I'd simplify things a bit)