The Boston Diaries

The ongoing saga of a programmer who doesn't live in Boston, nor does he even like Boston, but yet named his weblog/journal “The Boston Diaries.”

Go figure.

Monday, February 25, 2013

Something you never want to hear from an airline pilot

Ladies and gentlemen, this is your captain speaking. We have a small problem. All four engines have stopped. We are doing our damnedest to get them going again. I trust you are not in too much distress.

British Airways Flight 9

And this reminds me of the following quote: “Superior pilots will use their superior judgement to avoid sitations that require their superior skills.”


Some impressions about LuaRocks

I've gone off against “control panels” (and “package managers”) a few times so it's odd that I find myself playing around with LuaRocks, a package manager for installing Lua-based software (Perl has CPAN, Ruby has RubyGems, so it's not uncommon for package management to exist for languages).

So far, it hasn't been that horrible. One neat aspect of LuaRocks is that the specification for a “rock” can exist outside the source code that comprises a “rock.” For instance, the following “rockspec:”

package = "OrgConman"
version = "1.0.0-1"

source =
{
  url    = "git://github.com/spc476/lua-conmanorg.git",
  branch = "master",
}

description =
{
  homepage   = "https://github.com/spc476/lua-conmanorg",
  maintainer = "Sean Conner",
  license    = "LGPL",
  summary    = "Useful modules.  A lot of useful modules",

  detailed = [[ 
	A lot of useful routines to manipulate tables.  Yes, I should write
	more text here.  But I'm still playing aorund with this stuff.
  ]],
}

supported_platforms =
{
  "linux",
  "macosx",
  "freebsd",
  "unix"
}

dependencies =
{
  "lua ~> 5.1"
}

external_dependencies =
{
  TCC     = { header  = "libtcc.h" },
  OPENSSH = { library = "crypto"   },
  MAGIC   = { header  = "magic.h"  },
  RT      = { library = "rt"       },
}

build =
{
  type = "make",
  copy_directories = {},
  variables =
  { 
	CC     = "$(CC) -std=c99", 
	CFLAGS = "$(CFLAGS)",
	LFLAGS = "$(LIBFLAG)",
	LUALUA = "$(LUADIR)",
	LUALIB = "$(LIBDIR)",
  },
}

can be used, as is, to install the package, even though no existing “rock” exists, nor has it been published anywhere. All it takes is saving it in a file called orgconman-1.0.0-1.rockspec, and running luarocks build orgconman-1.0.0-1.rockspec—it will then download the code from github, build it and install it (assuming you meet the dependencies listed).

And once published, it will be a simple luarocks install orgconman to install the code (this will check the “rock servers” listed in the configuration file for the named “rock”, download the “rockspec” and then build and install it).

Even nicer, you can specify different locations to install the resulting “rocks” beside the default /usr/local/lib/lua/ (such locations can be specified in the configuration file, or on the command line).

So far, the only problematic aspect of LuaRocks I've encountered is actually making a “rock.” luarocks pack rockspec doesn't quite work out of the box:

[spc]lucy:/tmp>luarocks pack orgconman-1.0.0-1.rockspec
Initialized empty Git repository in /tmp/luarocks_orgconman-1.0.0-1-7168/lua-conmanorg/.git/
remote: Counting objects: 41, done.
remote: Compressing objects: 100% (37/37), done.
remote: Total 41 (delta 11), reused 11 (delta 2)
Receiving objects: 100% (41/41), 60.55 KiB, done.
Resolving deltas: 100% (11/11), done.
sh: line 0: cd: lua-conmanorg: No such file or directory
Packed: /tmp/orgconman-1.0.0-1.src.rock

It seems like it's not switching into the temporary build directory when trying to make the “rock.” I can work around it (by checking out the code at the same level as the “rockspec”), but I still find that bug annoying.

Another issue—there is no easy way to specify the language level (C89 or C99) in a platform independent way. Here, I have to assume the given platforms I do support use gcc, but not all platforms I currently use Lua on have gcc (Solaris comes to mind). Again, I'm working around the issue, but I feel it is something that should be addressed somehow.

This is also having me rethink how I develop the modules I have developed. Right now, they all exist in a single repository, but all the modules are mostly independent. But there isn't a simple way to checkout specific files using git, so I may have to make sepearate repositories for each module (so far, 22 existing modules, two additional ones I could add).

Update on Tuesday, February 25th, 2013

The issue wasn't with LuaRocks

Obligatory Picture

[The future's so bright, I gotta wear shades]

Obligatory Contact Info

Obligatory Feeds

Obligatory Links

Obligatory Miscellaneous

You have my permission to link freely to any entry here. Go ahead, I won't bite. I promise.

The dates are the permanent links to that day's entries (or entry, if there is only one entry). The titles are the permanent links to that entry only. The format for the links are simple: Start with the base link for this site: https://boston.conman.org/, then add the date you are interested in, say 2000/08/01, so that would make the final URL:

https://boston.conman.org/2000/08/01

You can also specify the entire month by leaving off the day portion. You can even select an arbitrary portion of time.

You may also note subtle shading of the links and that's intentional: the “closer” the link is (relative to the page) the “brighter” it appears. It's an experiment in using color shading to denote the distance a link is from here. If you don't notice it, don't worry; it's not all that important.

It is assumed that every brand name, slogan, corporate name, symbol, design element, et cetera mentioned in these pages is a protected and/or trademarked entity, the sole property of its owner(s), and acknowledgement of this status is implied.

Copyright © 1999-2024 by Sean Conner. All Rights Reserved.