[lang]

Present Perfect

Personal
Projects
Packages
Patches
Presents
Linux

Picture Gallery
Present Perfect

SCons = Pain

Filed under: General — Thomas @ 15:53

2006-06-11
15:53

Being the forward-looking person I am, I decided it was high time I learned some SCons. A big manual, lots of Wiki notes, not much could go wrong, right ?

Wrong.

The first thing I wanted to do was to write a simple SConstruct file that would basically do the equivalent of this Makefile:

fail:
          exit 1

Can't be hard, right ?

Wrong again.

The manual doesn't mention anywhere I could find how to run a simple shell command *that does not take or generate files*. The manual is full of examples that explain how to build a program from source files, libraries from source files, everything. The Wiki mentions some things about how to make unit tests run (which is what I wanted to do next, since it should just run a shell command for the unit tests), but they all rely on some source being there to be turned into a program.

I tried various approaches, like using the Builder class (but it gets really upset if you don't have sources or results), using the Execute action (but that always executes *while parsing*, no matter what I do, confusing), using the Command action (failing in various ways if you don't have sources), ...

I spent three hours trying various approaches and I could get nothing to work.

If there's someone out there with a little more SCons knowledge, please translate the above simple Makefile into an SConstruct script that should do the same ...

Mach to the rescue – again

Filed under: Hacking — Thomas @ 22:09

2006-06-10
22:09

A few months ago I used mach to upgrade an old Gallery install, taking it from PHP4 to PHP5. Today I wanted to hack on buildbot some more, and when trying it on my local SVN test repository I noticed that the repository was borked. Apparently it was once created with BDB 4.2, while my laptop is now using FC5 with BDB4.3. Gotta love Berkley.

Anyway, here's how I got out of the situation. The last Fedora that shipped with BDB 4.2 was FC3. So I did:

mach -r f3c setup
mach -r f3c yum install subversion
cp -pr /home/svn/test /var/lib/mach/root/fedora-3-i386-core/tmp
mach -r f3c chroot

Then, inside the chroot:

cd /tmp
svndump test > svn.dump
exit

And then, outside the chroot again:

svnadmin create test
svnadmin load test < /var/lib/mach/roots/fedora-3-i386-core/tmp/svn.dump

Apparently, Subversion has switched to using FSFS by default, leaving BDB behind. Sounds like a sane choice to me. But if you run into this problem, remember - mach is there to help.

net mapping code

Filed under: Hacking — Thomas @ 18:48

2006-06-09
18:48

I recently wrote some code that I am planning to use to figure out network topology inside Flumotion, based on the information about TCP connections between two hosts.

In short - every TCP connection has two endpoints, and each endpoint has two IP addresses - the local IP address, and the remote IP address. one endpoint's local address is not necessarily the same as the other endpoint's remote address - NAT will mangle one of the two.

The code I wrote exploits this to figure out where NAT hosts are, and which hosts are behind the same NAT box.

I'm sure there must be similar code out there somewhere - someone must have already thought about these problems, no ? My code is up at https://apestaart.org/thomas/trac/browser/tests/twisted/ten, feel free to take a look and give it a try.

new mach release

Filed under: Hacking,Releases — Thomas @ 18:44

18:44

Threw out a new mach release today. I did some nice fixes over the last two months related to reverting to a clean build state, because I was getting annoyed at various random failure cases. Most of them were happening when packages that are in the build list get an upgrade available, and then of course it tries to remove those. If the update is, say, glibc, oops :)

Lately I've been wondering about project maintenance and version numbering. I'm not getting any younger, and basically in the last ten years I don't think I've ever released any software that made it past 0.x Which, when you think of it, is a little silly, because I've written software that works fine, fulfills my needs, and works for others as well. I mean, really, when you are happy with it and you feel ok with recommending it to other people, 1.x should be fine.

So, given that mach mostly just works, that I'm already writing a next generation of it that's easier to maintain, and that I don't plan any major feature additions anyway to this one, I should be moving it to a 1.0 release. So this release jumped from 0.4.9 to 0.9.0.

I vaguely toyed with the idea of releasing it as 2.0 even (because this is the second generation of mach - the first one was makefile-based), but then I would feel forced to number releases of mach3 with 3.x, and it would feel wrong to have a "new-and-unstable" mach3-2.9 or whatever against a mature stable mach2-2.0.

I don't know why I obsess over these little details. Anyway, I am going to break my self-imposed ban on 1.x versions soon.

I Celebrated the release by packaging the latest Twisted releases, which are now split across several modules, as well as a huge chunk of the divmod stack. It's very satisfying to be able to do

mach build python-*/*.spec

, watch it build 15 src.rpm's, order them correctly, and build one after the other without a hitch...

More on twisted and DivMod later.

Recipes for disaster

Filed under: General — Thomas @ 19:28

2006-06-05
19:28

  • booting your software suspend-enabled linux kernel
  • upgrading the Fedora kernel package, which changes the default to the newly installed kernel
  • software suspending the machine because you're travelling
  • turning on the machine, GRUB boots the non-software-suspend kernel when you' re not looking
  • realizing this, cursing that you didn't save a bunch of stuff in your session, working for a while
  • shutting down because you'll be travelling again
  • remembering that you need to select the software suspend kernel at boot time
  • blink in astonishment as the kernel restores the previously hibernated session, wondering how this can work since it uses the swap partition for its storage
  • hack a little, compile a little, do some stuff
  • be very alarmed when the compile fails because it's trying to write to a read-only file system
  • check dmesg, notice your ext3 file system is experiencing a lot of errors
  • reboot, only to have the boot process tell you to check your file systems manually
  • get acquainted with a whole new class of ext3 errors that you didn't even know existed in the first place !

Do try this at home, it's fun ! And if anyone knows how the software suspend kernel manages to restore from a RAM image saved to a partition that got used for actual swap memory in between, do let me know.

« Previous PageNext Page »
picture