Archive for February, 2008

Updated to Drupal 6.0

Saturday, February 16th, 2008

I’ve updated the site to run Drupal 6.0 (released a few days ago), with only a couple of minor hiccups along the way. Hopefully everything is working as it should. Some of the formatting on a couple of posts has been lost because the Textile module isn’t updated yet, and the comments RSS feed isn’t available either, but otherwise everything seems well-behaved.

Use flags II

Friday, February 8th, 2008

I’ve started implementing the flags, as discussed in the last post. The format is a little different to what I wrote then, because I forgot about the existing dependency annotation format (currently used just for cross/!cross marking). The format for dependencies is now:
@FooBar [foo,bar]@
If cross or !cross is specified, it has to come *first* – I didn’t want to disrupt the existing code more than necessary, but I would like all the flags to be unified in time. I’m declaring by fiat all flags to be lower-case alphanumeric, _possibly_ with hyphens. I think that should cover all the necessary cases, and fixing the case makes them easier to work with.

There is a script *UseFlags* that can be used to query the state of flags. Bare `UseFlags` gives a list of all enabled flags; `UseFlags ` gives a list of flags enabled relative to that program (at the moment, the same as the global set, but it leaves the possibility of enabling/disabling flags on a per-program basis later on); `UseFlags ` returns a true exit status if the flag is enabled, and 1 otherwise. The Python equivalent function returns a frozen set; that is cached, so it’s ok to call it more than once.

Flags are set in /System/Settings/UseFlags.conf with this format:
@# A comment@
Flags can also be set in the USE environment variable with the same format (space-separated), but that isn’t recommended for anything but testing. The environment is merged after the configuration file; it’s also possible that there’ll be a “system” flags configuration shipped with Scripts that is used as a basis. The special specification @-*@ clears all flags.

Implementing the variables and hooks in Compile is next in line, to the extent that that isn’t blocking on ChrootCompile integration. I would also like to log the flags actually used for compiling a program in Resources/UseFlags, but figuring that out could be a little complex. It may be that `UseFlags ` also loads the Dependencies file and parses out which flags are listed, but that requires a CheckDependencies call each time (and possibly GetAvailable too), and they can be a little slow.

Having installed programs automatically enable their corresponding use flags has come up a few times; precisely how that should happen is an interesting question. I am thinking of just merging in everything in /Programs at the beginning, but that may pad out the list impractically (especially given that Compile is likely to need to iterate through all the enabled flags at least once, to call the corresponding hook functions and handle the variables).

Both of those last two need a little further consideration prior to implementation.