Archive for the 'Debian' Category

dpatch – using patch files in Debian packaging

I do a fair bit  of packaging of Debian and Ubuntu packages at work, often having to make tweaks to upstream packages. I used to just hack the upstream source directly, but have now discovered dpatch.

dpatch is a clever addition to the Debian packaging process which allows all your changes to be stored as patch files in the debian/ subfolder in the source package rather than having to modify the upstream source. There are good reasons to do this – You can easily see what you have changed in the source, and therefore can remove the changes easily if the need arises. It also allows upgrading the upstream source more easily as you do not have to patch the code yourself (and only have to do anything if the upstream code has changed too much for patch to figure out where the changes need to go)

http://matrixhasu.altervista.org/index.php?view=use_dpatch is an excellent introduction for dpatch, and certainly got me going.

The basics of dpatch are pretty simple. After installing dpatch on your system, you can start using it in your source package straight away.

I prefer to start with the debian/rules file and add dpatch support first, as dpatch can complain in some of its commands if you have not done this step first. The easiest way to do this is simply to add the following line near the top of debian/rules

include /usr/share/dpatch/dpatch.make

This pulls in several dpatch definitions for make, allowing it to be called easily. Next you have to change the build-stamp and clean definitions in your debian/rules. The basic idea is to tell dpatch to patch files before the build happens, and to remove the patches during the clean. This way you can work with the original package, and dpatch will add your patches automatically during package build.

build-stamp: patch-stamp
...
clean: unpatch

Now dpatch will apply any patches found in debian/patches (though it does need an index of patches to apply). Of course there are other ways to configure dpatch, see man dpatch for details.

Now you want to change your code. The dpatch-edit-patch command will copy your packages source tree to a temporary directory and put you in a new shell. You simply edit the code to make the change you want, then logout of that shell and dpatch will work out what you have changed and save those changes to a patch file.

For a new patch you probably want to use the –add2list flag as it adds your patch to the index of patches to apply. The following is an example of creating a new patch

dpatch-edit-patch --add2list 01_my_patch_name

If you want to go back and make changes to your patch you can just run

dpatch-edit-patch 01_my_patch_name

That is the basics of dpatch. You can apply all patches with dpatch apply-all and remove them all again with dpatch deapply-all and of course dpatch will do this for you when you run dpkg-buildpackage, debian/rules or debuild to build your package.

I recommend using dpatch whenever you need to change the upstream source in a package – being able to easily see what you changed to make that package work is really helpful (and don’t forget to tell upstream your changes where appropriate!)

Linux User Group @ Hursley

On Saturday I hosted a group for 30 people at IBM Hursley for a Hampshire Linux User Group meeting.

We had a good set of talks, including Andy Stanford-Clark talking about his twittering house and mousetraps as well as the twittering Red Funnel Ferries [telegraph.co.uk] and his energy monitoring via Current Cost devices.
I did a brief (although rather technical) introduction to Debian packages (which will turn into a blogpost soon with any luck).
Laura Cowen did a nice talk on InfoSplicer which was originally designed for the Sugar platform of the OLPC hardware.
Tony Whitmore gave a rather interesting talk on podcasting, from his experience in doing the Ubuntu UK Podcast
Adam Trickett talked about book reviews, and gave out a pile of free books for people to have in return for writing a review.

Laura Cowen also did an excellent writeup for eightbar

On Saturday, we were mostly in the Auditorium (where Spitfires were built during WWII), then when we led everyone down to the Clubhouse for lunch, we took the usual site tour scenic route via the Sunken Garden and fish pond. Although Hursley is out in the country, seemingly the middle of nowhere, it’s actually on the bus-route from Winchester so we had an excellent turnout of about 30 people. IBM Hursley also has a lot of cool people who do cool things that we can tell people about (although one piece of feedback I heard from a LUG person was that they thought we didn’t talk enough about what IBM does!).

It was a really enjoyable and relaxed day; kudos to Anton, Stephen, and John for organising it from the IBM end. Thanks also to the IBMers who came along and to the many HantsLUG members who turned up. I’d say it was a success and we should definitely do it again.
Linux Users descend on the House | eightbar

The day was terrific (at least for me) and I hope to organise another one in the near future, as it turned out to be nowhere near as hard as I thought it was going to be (I thought it was going to be difficult persuading security etc to let me bring 30 people on site over a weekend when the site only has minimal staff).

Thanks to all those that helped, particularly John Wesley and Stephen Godwin, and also thanks to all those who turned up!

Debian annouces fixed date release cycles

I seem to recall Mark Shuttlework saying in an interview (possibly for Linux Format, possibly somewhere else) that he wanted to work with Debian to get fixed release cycles to help the Debian->Ubuntu porting efforts – It looks like he succeeded in planting the idea! I am looking forward to predictable Debian releases.

The most exciting thing I know of being attempted in the next Debian release (Squeeze) is the multiarch support, which should make running 32 bit apps on a 64 bit OS much better (currently some apps can install if you install the ia32-libs package however others need to be installed in a 32 bit chroot because they have too difficult dependencies to resolve). Redhat adopted another approach where 32 bit is more of a default than 64 bit than on Debian (On Debian a 64 bit install has absolutely no 32 bit support other than the ia32-libs package). Most 32 bit stuff seems to work ok on a 64 bit Redhat box but I don’t know how their approach relates to multiarch. The idea with multiarch is to natively support both 32 and 64 bit packages on the same system (I believe by changing the installer to put 32 bit libs in /lib32/, whereas I believe redhat uses /lib64/ for the 64 bit stuff and /lib/ is still 32 bit only).
I am very interested to see how this pans out as I run a 64 bit desktop at work with lots of 32 bit apps (and gave up on my 64 bit install at home because it was too fiddly for the 32 bit proprietary apps I want to use)

A copy of the Debian announcement is below:

Continue reading ‘Debian annouces fixed date release cycles’

Google chrome on linux

A colleague from uni who now works for google wrote a brief post about google chrome, which has just been released for linux and he is working on it.

I decided to grab a copy and try it out.

I am very impressed with it so far. It is basic – lacking plugins, so no flash or java, the UI options are almost non-existent and apparently printing does not work. Despite being basic, I am really liking it.

Chrome is incredibly fast -not only do new windows and tabs open instantaneously (wheras firefox has a bit of a delay), but the contents of windows is rendered so much faster than in firefox. Even very complex javascipt sites (such as a few I use at work that are a real pain because of the large tables and lots of js) load so much faster. Using chrome makes me feel like my broadband has got faster – which is a little bit of an odd feeling.

The current release is a development build, so expect problems and crashes if you try it out – I for one will probably be seeing how much I can manage to use Chrome for, as the speed increase is fantastic!

It installed easily on Debian Lenny and Ubuntu Jaunty – 32 and 64 bit debs available :)

Moving from debian+kde to ubuntu+gnome

I have been using Debian for quite a long time, and it has been my primary OS on my work laptop for about the last 3 years. Recently software suspend (sleep) started having problems where it often did not come back from sleep. For a laptop, this is a big annoyance to me, so I finally decided to try out Ubuntu.

I tried the usual Ubuntu Jaunty Live/install cd, but found that Ubuntu do not consider LVM a core part of Ubuntu and so the installer couldn’t install on my disk without serious reworking. So I grabbed the alternate install cd which is pretty much the old curses Debian installer, which does support LVM. Having backed up /home/ and /etc/ I started down the road installing. Things went very smoothly (short of a scary warning from the installer suggesting it was going to erase my LVM partition but actually doesn’t do anything more than rewrite the same partition table to the disk). In little over an hour I had Jaunty fully installed, and a large number of my work specific apps installed and running, including Lotus Notes and Lotus Symphony which are quite large downloads).

Of course firefox picked up all my custom plugins and current browsing session because I had left /home/ completely intact and reused it. I initially didn’t like the look of gnome and so tried kde briefly before managing to get it crashing regularly (probably one of the compiz 3d effects). I cleared out ~/.kde/ and got it a little more stable, but couldn’t get kde network manager to attempt to connect to my wifi, and wicd didn’t seem to finish connecting properly.

I decided to go back to gnome and try and see if I could get used to it. Customising it was a little interesting, as I like a launcher bar at the bottom and nothing in gnome seemed to be what I was looking for. Eventually I found gnome-do and the theme that has a recently launched bar at the bottom that resembles the osX launcher with icons that expand when you move the mouse over them. The gnome terminal is rubbish, so I am still using the kde konsole for now.

I am starting to get comfortable in gnome, and I think the fonts actually look better, though that could be something extra in Ubuntu or simply a better default setting somewhere that I would have found on a reinstall of Debian too. Gnome feels slightly faster than KDE, though that could be my imagination.

All-in-all I am impressed with the really good finish in Ubuntu Jaunty, and gnome is quite workable now (though I do miss the kde ctrl+alt+esc shortcut key to bring up a kill this window icon, which I have always found useful for when some Java applet tries to kill firefox). The gnome power/battery monitor applet has a rather cool power graph funcion which is interesting, though ultimately nothing more than a toy. I did like the kde4 application tray as you could set a wide panel and tell it ti use two rows to list running applications, which I cannot seem to get gnome to do.

Gnome’s philosophy of almost no options does kind of annoy me though. For a start I want my screensaver to be a random slideshow of photos I have on my computer, but the screensaver uses a hardcoded folder to display from, and doesn’t tell you what this folder is. This may be fine if the system created that folder for you but my system didn’t have it created (probably becaue my install reused an existing homedir) and I had to search for a while to find out that it was ~/Pictures. After that a symlink solved that probelm.

Another niggling issue I have is that under KDE I could configure the compiz effects to do an “expose” style window view – when Imove the mouse to a specified corner, all running applications are presented as nicely arranged tiles for me to select the one I want. Despite installing the compiz configuration package, I cannot seem to find a way to get gnome to do this, which is a shame as I could find that really useful.

It is still a novelty to me to have any 3d effects at all, so I have them all prettty much turned on and am loving it (I initially played with compiz when it first hit Debian Unstable, but the ATI graphics drivers for my T43p were not reliable enough and I had frequent crashes, so ultimately turned it all off again).

My new Ubuntu system is very stable, very flashy and I am really impressed. This is not to say I am going to move all my other machines from Debian to Ubuntu, but next time they are up for a reinstall (probably not until a major hardware upgrade) I will probably consider Ubuntu rather than just installing Debian straight away.

Apt-Pinning

If you run a Debian or Ubuntu system and have more than one release in your apt-sources file (/etc/apt/sources.list) then you should probably learn the basics of apt-pinning. Apt-pinning allows you to have a specific package stay at a certain level or set a preference for it to be installed from a specific release. This way you can have the latest version of package X from a cutting-edge server without worrying about the rest of your packages moving up to cutting-edge levels by accident.

Two excellent resources are: