Patrick Matth i: After five years..
Yes after five years I had found the time to setup my whole new server and to start blogging again!
So hello world!
So hello world!
def solve_or(or):
best_real = None
best_virtual = None
for dep in or:
for target in dep:
if target.name == dep.name and best_real is None:
best_real = target
if target.name != dep.name and best_virtual is None:
best_virtual = target
if target.is_installed():
return target
return best_real if best_real is not None else best_virtual
Now, this way of solving dependencies is slightly problematic. Let us consider a package that depends on: a b, b. APT will likely choose to install a to satisfy the first dependency and b to satisfy the second. I currently have draft code around for a future version of APT that will cause it to later on revert unneeded changes, which means that APT will then only install b . This result closely matches the CUDF solvers and cupt s solver.
On the topic of solving algorithms, we also have the problem that optimizing solvers like the ones used with apt-cudf do not respect the order of dependencies, rather choosing to minimise the number of packages installed. This causes such a solver to often do stuff like selecting an sqlite database as backend for some service rather then a larger SQL server, as that installs fewer packages.
To make such solvers aware of the implicit preferences, we can introduce a new type of dependency category: Weak conflicts, also known as Recommends-Not. If a package P defines a Recommends-Not dependency against a package Q, then this means that Q should not be installed if P is installed. Now, if we have a dependency like:
Depends: a b c
we can encode this as:
Recommends-Not: c, c, b
Causing the solver to prefer a, then b, and then c. This should be representable as a pseudo-boolean optimization problem, as is common for the dependency problem, although I have not looked at that yet it should work by taking the standard representation of conflicts, adding a relaxation variable and then minimising [or maximising] the number of relaxation variables.
In case anyone s interested in such things, I ve packaged up some Oscar Wilde quotes, and threw them up on github (@fortunes-wilde)
If a ton of people are interested, i ll consider maintaining it for real :)
| Author: | Erich Gamma |
| Author: | Richard Helm |
| Author: | Ralph Johnson |
| Author: | John Vlissides |
| Publisher: | Addison-Wesley |
| Copyright: | 1995 |
| Printing: | September 1999 |
| ISBN: | 0-201-63361-2 |
| Format: | Hardcover |
| Pages: | 374 |
An updated version 0.1.4 of the
RcppExamples
package is now on on
CRAN.
RcppExamples
contains a few illustrations of how to use
Rcpp.
The NEWS entry is below: a new example was added illustrating use of the
(vectorised) random-number generators for three of the different
distributions --- and showing how it perfectly reproduces the values one gets
in R.
Changes in RcppExamples version 0.1.4 (2012-08-09)Thanks to CRANberries, you can also look at a diff to the previous release 0.1.3. Questions, comments etc should go to the rcpp-devel mailing list off the R-Forge page
- Added new example for Rcpp sugar and vectorised draws of RNGs
- Minor updates to reflect newer CRAN Policy
There's a post here describing SUSE's approach to implementing Secure Boot support. In summary, it's pretty similar to the approach we're taking in Fedora - a first stage shim loader is signed with a key in db, it loads a second stage bootloader (grub 2) that's signed with a key that's in shim, the second stage bootloader loads a signed kernel. The main difference between the approaches is the use of a separate key database in shim, whereas we are currently planning on using a built-in key and the contents of the firmware key database.
A new release 0.2.5 of
RProtoBuf
is now on CRAN.
RProtoBuf
provides GNU R
bindings for the
Google Protobuf data encoding
library used and released by Google.
This release once again contains a number of patches kindly contributed by
Murray Stokely, as well as some updates
to conform to CRAN Policy changes.
The NEWS file entry follows below:
Changes in version 0.2.5 (2012-08-08)CRANberries also provides a diff to the previous release 0.243. More information is at the RProtoBuf page which has a draft package vignette, a 'quick' overview vignette and a unit test summary vignette. Questions, comments etc should go to the rprotobuf mailing list off the RProtoBuf page at R-Forge.
- Applied patches by Murray to
- correctly deal with nested Protocol Buffer definitions, and also add new unit test for this
- test a a protocol buffer for missing required fields before serializing it, also add a unit test
- add a small stylistic fix and examples to the 'add.Rd' manual page
- Moved inst/doc/ to vignettes/ per newer CRAN Policy
Last week I helped organize the Open and User Innovation Conference at Harvard Business School. One of many interesting papers presented there was an essay on Institutional Change and Information Production by Fabio Landini from the University of Siena.
At the core of the paper is an economic model of the relationship between rights protection and technologies that affects the way that cognitive labor can be divided and aggregated. Although that may sound very abstract (and it is in the paper), it is basically a theory that tries to explain the growth of free software.
The old story about free software and free culture (at least among economists and many other academics) is that the movements surged to prominence over the last decade because improvements in communication technology made new forms of mass-collaboration -- like GNU/Linux and Wikipedia -- possible. "Possible", for these types of models, usually means profit-maximizing for rational, profit-seeking, actors like capitalist firms. You can basically think of these attempts as trying to explain why open source claims that free licensing leads to "better quality, higher reliability, more flexibility, lower cost" are correct: new technology makes possible an open development process which leads to collaboration which leads to higher quality work which leads to profit.
Landini suggests there are problems with this story. One problem is that it treats technology as being taken for granted and technological changes as effectively being dropped in from outside (i.e., exogenous). Landini points out that software businesses build an enormous amount of technology to help organize their work and to help themselves succeed in what they see as their ideal property rights regime. The key feature of Landini's alternate model is that it considers this possibility. What comes out the other end of the model is a prediction for a multiple equilibrium system -- a situation where there are several strategies that can be stable and profitable. This can help explain why, although free software has succeeded in some areas, its success has hardly been total and usually has not led to change within existing proprietary software firms. After all, there are still plenty of companies selling proprietary software. In Landini's model, free is just one of several winning options.
But Landini's model raises what might be an even bigger question. If free software can be as efficient as proprietary software, how would anybody ever find out? If all the successful software companies out there are doing proprietary software, which greedy capitalist is going to take the risk of seeing if they could also be successful by throwing exclusive rights out the window? In the early days, new paths are always unclear, unsure, and unproven.
Landini suggests that ethically motivated free software hackers provide what he calls a "cultural subsidy." Essentially, a few hackers are motivated enough by the ethical principles behind free software that they are willing to contribute to it even when it isn't clearly better than proprietary alternatives. And in fact, historically speaking, many free software hackers were willing to contribute to free software even when they thought it was likely less profitable than the proprietary alternative models. As Landini suggests, this group was able to build technological platforms and find new social and business arrangements where the free model actually is competitive.
I think that the idea of an "cultural subsidy" is a nice way to think about the important role that ethical arguments play in movements like free software and free culture. "Open source" style efficiency arguments persuade a lot of people. Especially when they are true. But those arguments are only ever true because a group of ethically motivated people fought to find a way to make them true. Free software didn't start out as competitive with proprietary software. It became so only because a bunch of ethically motivated hackers were willing to "subsidize" the movement with their with their failed, and successful, attempts at free software and free culture projects and businesses.
Of course, the folks attracted by "open source" style superiority arguments can find the ethical motivated folks shrill, off-putting, and annoying. The ethically motivated folks often think the "efficiency" group is shortsighted and mercenary. But as awkward as this marriage might be, it has some huge upsides. In Landini's model, the ethical folks can build their better world without convincing everyone else that they are right and by relying, at least in part, on the self-interest of others who don't share their principles. Just as the free software movement has done.
I think that Landini's paper is a good description of the critically important role that the free software movement, and the FSF in particular, can play. The influence and importance of individuals motivated by principles can go far beyond the groups of people who take an ethical stand. They can make involvement possible for large groups of people who do not think that taking a stand on a particular ethical issue is even a good idea.
Recently, I've started converting many of my subversion repositories
to git, some of which contain fairly large files (2-3G). However, git
can be slow to deal with repositories with large files, and it also
isn't able to selectively discard unneeded files when disk space is
pressing. Thankfully,
git-annex resolves most
of these problems with git, but the process required to use git-annex
on a converted subversion repository is slightly complicated.
Basic conversion of svn to git
The basic conversion of svn to git is done using git-svn:
git svn clone file:///srv/svn/foo --no-metadata -A authors.txt -T trunk foo
where /srv/svn/foo is the subversion repository, authors.txt is a list
of login = Full Name <email@example.com> pairs matching each of the
subversion commit authors, and foo is the git repository to create.
git-svn has a ton of useful options, but the basic invocation above is
all I'm concerned with.
Migrating large files from git into git-annex
In order to migrate from git to a git+git-annex setup, we'll have to
walk the entire commit history, and edit each commit to instead store
large files in git-annex, replacing the large file with a symlink, and
finally eliminate all of the references to the old large objects, and
do garbage collection.
Because we may have the same file move around, we're going to use the
git-annex SHA1 backend instead of the default WORM backend which is
based on filename and size, and init git-annex.
cd foo; echo '* annex.backend=SHA1' > .git/info/attributes
git annex init
Then, we're going to filter out the large files using git
filter-branch. To do that, we'll first, we'll create a little helper
script git_annex_add.sh, which will remove the file from the git
repository, add to git annex, and fix up the symlinks:
#!/bin/bash
f="$1";
git rm --cached "$ f ";
git annex add "$ f ";
annexdest="$(/bin/readlink -v $ f )";
ln -sf "$ annexdest#../../ " "$ f ";
echo -n "Added: "
ls -l "$ f ";
Then we will run filter-branch, and annex all files larger than 5
megabytes.
[Tweak the find command if you want to do something different.]
git filter-branch --tag-name-filter cat --tree-filter \
'find . -ipath \*.git\* -prune -o -path \*.temp\* -prune -o -size +5M -type f -print0 xargs -0 -r -n1 ~/git_annex_add.sh;
git reset HEAD .git-rewrite; :' -- master
This operation will take a while.
[It would be better to do this during the initial svn git conversion, but since that requires more knowledge of git-svn, svn, git, and git-annex internals than I have, and I only have to do this once for each repository, it's not worth my time.]
Now we have successfully switched everything to using git-annex, and
we need to clean out the old references to the files:
rm .git/svn -rf;
rm -rf .git/refs/original .git/refs/remote/trunk .git/refs/remote/git-svn;
git reflog expire --expire=now --all
git gc --prune=now
git gc --prune=now --aggressive
(I'm not sure if the last two commands need to be separate; I'm cargo
culting a bit there.)
Storing all git-annex files in a remote repository
Because git-annex allows you to easily throw away files which are no
longer referred to by the tip of any branch using git annex unneeded
(and because I'd like all of the files on my central remote
repository), I'm going to shove all of the git annex files into the
remote bare repository. Normally, you would use git annex copy
--to=remote; to do this, but because that only copies needed files,
not everything, we'll have to do it manually.
First, create the remote repository:
git init --bare /srv/git/foo.git
cd /srv/git/foo.git; git annex init foo.example.com
Add the remote to the local repository, push to the remote, and sync
the objects and sync the annex:
git remote add origin ssh://foo.example.com/srv/git/foo.git
git push origin master
rsync -avP .git/annex/objects ssh://foo.example.com/srv/git/foo.git/annex/.;
git annex sync
Finally, on the remote, run git annex fsck to clean up the links to
the imported objects:
cd /srv/git/foo.git; git annex fsck;
Unresolved issues
I don't know if the above works properly for branches. I suspect that
it does not. I also have not exhaustively tested this methodology to
verify that all of the history is present in every case. But hopefully
this post (or some modification of it) will be helpful to you.
Credit
Many of the methodologies described here I originally found in
tyger's git-annex forum post,
the git gc stuff came from random google searches about shrinking
git repositories, and the rsync suggestion came from joeyh (author of
git-annex) and the other helpful denizens of #vcs-home on
irc.oftc.net.
UK Readers Can Now Purchase DRM-Free Books From Tor UK
We believe that making our Tor ebooks DRM-free is the best for our readers, allowing you to use legitimately-purchased ebooks in perfectly legal ways, like moving your library from one ereader to another, says Jeremy Trevathan, Publisher at Pan Macmillan. We understand that DRM can make your ebooks less easy to read. It also makes building and maintaining your digital library more complicated. For these reasons, we are committed to remaining DRM-free.I'm really happy to see this and I hope more ebook sellers follow suit. Some of the others already doing DRM-free can be found on our list at Defective by Design. Also see StoryBundle, which just launched and offers a set of DRM-free ebooks on a pay-what-you-want basis, with some of the money going to charity.
I feel a sense of pride when I think that I was involved in the development and maintenance of what was probably the first piece of software accepted into Debian which then had and still has direct up-stream support from Microsoft. The world is a better place for having Microsoft in it. The first operating system I ever ran on an 08086-based CPU was MS-DOS 2.x. I remember how thrilled I was when we got to see how my friend s 80286 system ran BBS software that would cause a modem to dial a local system and display the application as if it were running on a local machine. Totally sweet.
When we were living at 6162 NE Middle in the nine-eight 292, we got an 80386 which ran Doom. Yeah, the original one, not the fancy new one with the double barrel shotgun, but it would probably run that one, too. It was also totally sweet and all thanks to our armadillo friends down south and partially thanks to their publishers, Apogee. I suckered my brothers into giving me their allowance from Dad one time so that we could all go in on a Sound Blaster Pro 16 sound card for the family s 386. I played a lot of Team Fortress and Q2CTF on that rig. I even attended the Quake 3 Arena launch party that happened at Zoid s place. I recall that he ported the original quake to Linux. I also recall there being naughty remarks included in the README.txt.
When my older brother, Aaron turned 16, he was gifted a fancy car. When asked what type of car I would like when I turned 16, I said that I d prefer a computer instead. So I got a high-end 80486 with math co-processor. It could compile the kernel in 15 minutes flat. With all the bits turned on on in /usr/src/linux/.config. But this was later. I hadn t even heard of linux when I got my system. I wanted to be entertained by the thing. I made sure to get a CD-Rom and a sound card. I got on the beta for Ultima Online and spent a summer as a virtual collier. Digging stuff out of mines north of Britannia and hauling them to town to make weapons and armor out of them. And then setting out in said armor only to be PK d because I forgot healing potions and I was no good at fighting.
While I was in the middle of all this gaming, my friend Lucas told me that I should try out this lynx thing that they run at the University of Washington. He heard that it was reported to run doom faster than it ran on MS-DOS. It turns out that it did, but that it was not, in fact, called lynx. Or pine. The Doom engine ran so fast that the video couldn t keep up. This was probably because they didn t use double buffering for frame display, since they didn t want to waste the time maintaining and switching context. I think I downloaded the boot/root 3.5 disk pair and was able to get the system to a shell with an on-phone assist from the Rev. I then promptly got lost in bash and the virtual terminals (OMG! I GET SIX CONSOLES!?) and bought a book on the subject. It shipped with slackware. Which I ran. Until Debian came along. Lucas also recommended that I try out this IRC thing, so I did. And I m still doing it on #linpeople just like I did back then.
I learned to write Pascal on dos. Then I learned c while they were trying to teach me c++. I learned emacs and vi when I was attending North Kitsap High School. I learned sed and only a little awk when I took Running Start classes in Lynnwood at Edmonds Community College and perl & x.509 while attending Olympic Community College and simultaneously jr-administering Sinclair Communications. I studied TCP/IP, UNP, APUE, C and algorithms & data structures while preparing for an interview with a company whose CEO claimed to have invented SCSI. I learned PGP and PHP while writing web-based adware for this company. I didn t want to write ads and instead wanted to work in security, so took a job with Security Portal. While there, I wrote what one might call a blogging platform. It worked and made it possible for authors to write prose and poetry. Editors didn t have to manage a database in order to review and publish the posts that were ready. Everyone but me was able to avoid html and cgi.
Then I sold pizza. Then I helped bring the bombay company onto the interwebs using the Amazon ECS (now AWS) platform. Then I helped support MaxDB. Then I helped develop and maintain the Amazon blogging platform. And then attempted to reduce the load on the Amazon pager system by doing and enforcing code reviews. It turns out that they prefer to run their support team at full bore and a load average of 16.
I feel a sense of pride when I think that I was involved in the development and maintenance of what was probably the first piece of software accepted into Debian which then had and still has direct up-stream support from Microsoft. The world is a better place for having Microsoft in it. The first operating system I ever ran on an 08086-based CPU was MS-DOS 2.x. I remember how thrilled I was when we got to see how my friend s 80286 system ran BBS software that would cause a modem to dial a local system and display the application as if it were running on a local machine. Totally sweet.
When we were living at 6162 NE Middle in the nine-eight 292, we got an 80386 which ran Doom. Yeah, the original one, not the fancy new one with the double barrel shotgun, but it would probably run that one, too. It was also totally sweet and all thanks to our armadillo friends down south and partially thanks to their publishers, Apogee. I suckered my brothers into giving me their allowance from Dad one time so that we could all go in on a Sound Blaster Pro 16 sound card for the family s 386. I played a lot of Team Fortress and Q2CTF on that rig. I even attended the Quake 3 Arena launch party that happened at Zoid s place. I recall that he ported the original quake to Linux. I also recall there being naughty remarks included in the README.txt.
When my older brother, Aaron turned 16, he was gifted a fancy car. When asked what type of car I would like when I turned 16, I said that I d prefer a computer instead. So I got a high-end 80486 with math co-processor. It could compile the kernel in 15 minutes flat. With all the bits turned on on in /usr/src/linux/.config. But this was later. I hadn t even heard of linux when I got my system. I wanted to be entertained by the thing. I made sure to get a CD-Rom and a sound card. I got on the beta for Ultima Online and spent a summer as a virtual collier. Digging stuff out of mines north of Britannia and hauling them to town to make weapons and armor out of them. And then setting out in said armor only to be PK d because I forgot healing potions and I was no good at fighting.
While I was in the middle of all this gaming, my friend Lucas told me that I should try out this lynx thing that they run at the University of Washington. He heard that it was reported to run doom faster than it ran on MS-DOS. It turns out that it did, but that it was not, in fact, called lynx. Or pine. The Doom engine ran so fast that the video couldn t keep up. This was probably because they didn t use double buffering for frame display, since they didn t want to waste the time maintaining and switching context. I think I downloaded the boot/root 3.5 disk pair and was able to get the system to a shell with an on-phone assist from the Rev. I then promptly got lost in bash and the virtual terminals (OMG! I GET SIX CONSOLES!?) and bought a book on the subject. It shipped with slackware. Which I ran. Until Debian came along. Lucas also recommended that I try out this IRC thing, so I did. And I m still doing it on #linpeople just like I did back then.
I learned to write Pascal on dos. Then I learned c while they were trying to teach me c++. I learned emacs and vi when I was attending North Kitsap High School. I learned sed and only a little awk when I took Running Start classes in Lynnwood at Edmonds Community College and perl & x.509 while attending Olympic Community College and simultaneously jr-administering Sinclair Communications. I studied TCP/IP, UNP, APUE, C and algorithms & data structures while preparing for an interview with a company whose CEO claimed to have invented SCSI. I learned PGP and PHP while writing web-based adware for this company. I didn t want to write ads and instead wanted to work in security, so took a job with Security Portal. While there, I wrote what one might call a blogging platform. It worked and made it possible for authors to write prose and poetry. Editors didn t have to manage a database in order to review and publish the posts that were ready. Everyone but me was able to avoid html and cgi.
Then I sold pizza. Then I helped bring the bombay company onto the interwebs using the Amazon ECS (now AWS) platform. Then I helped support MaxDB. Then I helped develop and maintain the Amazon blogging platform. And then attempted to reduce the load on the Amazon pager system by doing and enforcing code reviews. It turns out that they prefer to run their support team at full bore and a load average of 16.
A new bug-fix release of the RcppBDT package appeared on
CRAN earlier today. David Reiner
noticed that the functions getEndOfMonth and getEndOfBizWeek
were not working right. These are convenience wrappers around the real
functionality provided as a member function to the reference class built by
Rcpp modules---which works off a reference instance of the class, and these
two convenience functions were not updating the date. This is now fixed.
The complete NEWS entry is below:
Changes in version 0.2.1 (2012-08-08)Courtesy of CRANberries, there is also a diffstat report for 0.2.1 relative to 0.2.0. As always, feedback is welcome and the rcpp-devel mailing list off the R-Forge page for Rcpp is the best place to start a discussion.
- Bug for getEndOfBizWeek() and getEndOfMonth() who were lacking a call to fromDate(date) to actually pass the date for which the functions are computing the end of business week or month.
# uptimeSweet (: With these records, no wander I could forget about it
23:51:06 up 636 days, 8:36, 1 user, load average: 0.12, 0.43, 0.33 # who -b
system boot 2010-11-11 14:15 # cat /etc/debian_version
4.0
Most Debian source packages are using the 3.0 (quilt) format. This means that Debian changes to upstream files are managed in a quilt patch series. Knowledge of quilt is thus a must if you want to get involved in some serious packaging work. Don t worry, this tutorial will teach you how to use quilt in the context of Debian packaging.
Pre-requisites
Install the packaging-dev package to get a decent set of packages to do Debian packaging. It includes the quilt package.
$ sudo apt-get install packaging-devWhat s quilt? Read the description of the Debian package:
Quilt manages a series of patches by keeping track of the changes each of them makes. They are logically organized as a stack, and you can apply, un-apply, update them easily by traveling into the stack (push/pop). Quilt is good for managing additional patches applied to a package received as a tarball or maintained in another version control system. The stacked organization is proven to be efficient for the management of very large patch sets (more than hundred patches). As matter of fact, it was designed by and for Linux kernel hackers (Andrew Morton, from the -mm branch, is the original author), and its main use by the current upstream maintainer is to manage the (hundreds of) patches against the kernel made for the SUSE distribution.The various files involved
To better understand the various quilt commands, you should have a basic idea of how the tool works. The stack of patches is maintained in a dedicated directory ( patches by default, but in Debian packages we override this value to debian/patches ). This directory contains the patch files and a series file that gives an ordered list of patches to apply. Example:
$ ls debian/patches/ 01_use_stdlib_htmlparser_when_possible.diff 02_disable-sources-in-sphinxdoc.diff 03_manpage.diff 06_use_debian_geoip_database_as_default.diff series $ cat debian/patches/series 01_use_stdlib_htmlparser_when_possible.diff 02_disable-sources-in-sphinxdoc.diff 03_manpage.diff 06_use_debian_geoip_database_as_default.diffWhen quilt is used, it also maintains some internal files in a directory of its own (it s named .pc ). This directory is used to know what patches are currently applied (.pc/applied-patches) and to keep backup copies of files modified by the various patches. Configuring quilt Before going further, you should put this in your
~/.quiltrc file:
for where in ./ ../ ../../ ../../../ ../../../../ ../../../../../; do
if [ -e $ where debian/rules -a -d $ where debian/patches ]; then
export QUILT_PATCHES=debian/patches
break
fi
done
This ensures that quilt will always use debian/patches instead of patches when your current directory is within a Debian source package where debian/patches exists. If you only use quilt for debian packaging, then you can be more expedient and put a simple export QUILT_PATCHES=debian/patches in that file.
As a matter of personal preferences, I also have those lines in my ~/.quiltrc:
QUILT_PUSH_ARGS="--color=auto" QUILT_DIFF_ARGS="--no-timestamps --no-index -p ab --color=auto" QUILT_REFRESH_ARGS="--no-timestamps --no-index -p ab" QUILT_DIFF_OPTS='-p'It enables syntax coloring for the output of several commands and customizes the generated patches to get rid of useless information. I recommend you to use those settings too. Applying and unapplying patches, navigating in the stack of patches When you already have a patch series, you can navigate in the stack of patches so that any subset of consecutive patches (starting from the bottom) can be applied. quilt series will list all patches known by quilt. You can apply all patches with quilt push -a or unapply them all with quilt pop -a. You can also verify what patches are applied (quilt applied) or unapplied (quilt unapplied). quilt push applies the next unapplied patch (i.e. the patch returned by quilt next) and quilt pop unapplies the last applied patch (i.e. the patch returned by quilt top). You can give a patch name as parameter to quilt push/pop and it will apply/unapply all the patches required until the given patch is on the top. Here are some examples of navigation in a quilt patch series
$ quilt series 02_disable-sources-in-sphinxdoc.diff 03_manpage.diff 06_use_debian_geoip_database_as_default.diff $ quilt applied No patches applied $ quilt next 02_disable-sources-in-sphinxdoc.diff $ quilt push Applying patch 02_disable-sources-in-sphinxdoc.diff patching file docs/conf.py Now at patch 02_disable-sources-in-sphinxdoc.diff $ quilt push Applying patch 03_manpage.diff patching file docs/man/django-admin.1 Now at patch 03_manpage.diff $ quilt applied 02_disable-sources-in-sphinxdoc.diff 03_manpage.diff $ quilt unapplied 06_use_debian_geoip_database_as_default.diff $ quilt pop -a Removing patch 03_manpage.diff Restoring docs/man/django-admin.1 Removing patch 02_disable-sources-in-sphinxdoc.diff Restoring docs/conf.py No patches applied $ quilt push 03_manpage.diff Applying patch 02_disable-sources-in-sphinxdoc.diff patching file docs/conf.py Applying patch 03_manpage.diff patching file docs/man/django-admin.1 Now at patch 03_manpage.diff $ quilt top 03_manpage.diffCreating a new patch If there s no quilt series yet, you want to create the debian/patches directory first. If you already have one, you need to decide where to insert the new patch. Quilt will always add the new patch just after the patch which is currently on top. So if you want to add the patch at the end of the series, you need to run quilt push -a first. Then you can use
quilt new name-of-my-patch.diff to tell quilt to insert a new empty patch after the current topmost patch. In this operation quilt does almost nothing except updating the series file and recording the fact that the new patch is applied (even if still empty at this point!).
Now to add changes in this patch, you re supposed to modify files but only after having informed quilt of your intent to modify those files. You do this with quilt add file-to-modify. At this point quilt will make a backup copy of that file so that it can generate the final patch when you re done with your changes. It s quite common to forget this step and to be unable to generate the patch afterward. That s why I recommend you to use quilt edit file-to-modify which is a shorthand for doing quilt add and then opening the file in your favorite text editor.
If you want, you can review your work in progress with quilt diff.
When you re done with the changes, you should call quilt refresh to generate the patch (or to update it if it was already existing). And since you re a good packager, you call quilt header --dep3 -e to add DEP-3 meta-information to your patch header.
Importing an external patch
If someone else already prepared a patch, you can just import it right away with quilt import /tmp/the-patch. If you want to import it under a better name you can use the option -P better-patch-name . Like quilt new, it inserts the patch after the topmost patch.
Updating patches for a new upstream version
With some luck, your patches will still apply with some offsets in line numbers (quilt displays those offsets) and sometimes with some fuzz:
$ quilt push [...] Hunk #1 succeeded at 1362 (offset 11 lines). Hunk #2 succeeded at 1533 with fuzz 1 (offset 4 lines). [...]While offsets are nothing to worry about (it means some lines were added and/or removed before the patched part), fuzz means that patch had to ignore some context lines to find the place where to apply the changes. In that case, you need to double check that patch did the right thing because it might have made changes somewhere where it shouldn t. Also, you ll have to update those patches because dpkg-source doesn t accept any fuzz. If you re confident that all patches are correctly applied by quilt, you can refresh them to get rid of those warnings:
$ quilt pop -a [...] $ while quilt push; do quilt refresh; doneThat was for the easy case. Now let s deal with the case where some of the patches no longer apply. There s one case that is usually nice to have:
$ quilt push Applying patch 04_hyphen-manpage.diff patching file docs/man/django-admin.1 Hunk #1 FAILED at 194. 1 out of 1 hunk FAILED -- rejects in file docs/man/django-admin.1 Patch 04_hyphen-manpage.diff can be reverse-appliedWhen the patch can be reverse-applied, it means that the upstream authors included the Debian patch (or that they made the same change even though you forgot to forward the patch). You can thus get rid of it:
$ quilt delete -r 04_hyphen-manpage.diff Removed patch 04_hyphen-manpage.diffNote that without the -r the patch is only dropped from the series file. With -r the patch file is also removed. But there s a less desirable case where the patch is still relevant but it doesn t apply any longer:
$ quilt push Applying patch 01_disable_broken_test.diff patching file tests/regressiontests/test_utils/tests.py Hunk #1 FAILED at 422. 1 out of 1 hunk FAILED -- rejects in file tests/regressiontests/test_utils/tests.py Patch 01_disable_broken_test.diff does not apply (enforce with -f)In that case, you should follow quilt s advice to force the patch application, manually apply the parts of the patch that were rejected, and then refresh the patch.
$ quilt push -f Applying patch 01_disable_broken_test.diff patching file tests/regressiontests/test_utils/tests.py Hunk #1 FAILED at 422. 1 out of 1 hunk FAILED -- saving rejects to file tests/regressiontests/test_utils/tests.py.rej Applied patch 01_disable_broken_test.diff (forced; needs refresh) $ vim tests/regressiontests/test_utils/tests.py $ quilt refresh Refreshed patch 01_disable_broken_test.diffOther quilt commands You should probably read quilt s manual page too to learn about the various other commands and options that exist. There s at least
quilt rename new-name that you can also find useful to rename the topmost patch (you can use -P patch-to-rename to rename a patch which is not currently at the top).
Feedback
Please leave comments if you have suggestions of improvements, or if there are some tips that are good to know. I might incorporate them in this article.
Feel free to share this article with newbie packagers which are struggling with quilt. For your convenience, you can also refer to this article with this URL: http://raphaelhertzog.com/go/quilt
Found it useful? Be sure to not miss other packaging tips (or lessons), click here to subscribe to my free newsletter and get new articles by email.
2 comments Liked this article? Click here. My blog is Flattr-enabled.
So, I finally received my Canon 650D and Canon EF 40mm STM lens. I am very happy with the purchase. The STM lens is very, very compact, it is barely bigger than the lens cap that comes with the camera. The focusing is fast enough and it is very smooth and silent enough not to be audible in video mode. The largest bonus of the 650D compared to my old 550D is the articulated display. It has come in handy many times already. It is especially useful with the STM lens, live view and touch to focus function. Very useful to focus on something even when the camera is at an weird angle.
And a couple days ago I got to really use the new camera capturing the shot above (an others in that set). It turns out capturing cool lightning shots is quite easy:
Next.