Category: CLI

  • Hey, look! debian/control and friends are on Alioth!

    http://git.debian.org/?p=pkg-cli-libs/packages/ironruby.git;a=tree;f=debian;h=c5642e8a4a4aa3b5e15af5f607a1604f3169bd47;hb=449af4392c1fbddacee4f52b9998e23e674a7434

    *whew* now I won’t have to worry about losing (or misplacing) my changes.

    Thanks meebey and #debian-cli for your help. Now to tune those files a bit and get something that actually does what users expect ;)

  • GTK+ OpenGL work

    There’s an opening at Canonical that I’d like to take after the current contract is up. It’s an opening for a OpenGL dev on the Ubuntu desktop team.

    Don’t get me wrong; I enjoy working with my current group quite a bit. We’re building a pretty neat tool. However, building OpenGL into the GNOME desktop has been a personal goal of mine for quite a while now.

    I bought a Voodoo II in 1999, just after I graduated from high school with the hopes of building a video game. The tools for Linux were sparse. There was Blender, but the learning curve is very high, the source was not then open, and I knew I wouldn’t be able to build the whole game by myself. So I started building a 3d modeler myself.

    I got as far as building a quake .mdl loader with rotation, scaling and primitive animation. I was pretty proud of myself.

    I haven’t gotten too far along the path since then, however. Time required by work has increased, and I haven’t been able to find a way to make the two projects (food on the table, continuing work on the modeler) mesh.

    In 2006, I was able to take over maintaining gtkglarea and fix a couple of minor problems. I wrote a c# wrapper around the widget library using Mike‘s excellent gapi tool. I was able to help Rob, Dave and Dylan with Tao.OpenGL (which led to a bit of work on Prebuild). I helped Sam a bit to make gtkglarea-sharp production-ready. But I haven’t had a chance to get that modeler finished…

    I’m nothing if not persistent, though :)

  • IronRuby stuff

    I’ve been doing some work with the DLR team at Microsoft and the community of F/OSS developers they’ve inspired on IRC & the mailing lists. I’m providing a virtual host that is being used to perform continuous integration on Debian sid.

    The current status is here:

    http://twitter.com/IronRubyCI

    Maybe we’ll make an IronPerl one of these days :)

  • repository thoughts

    15:58 < cj> lluis: since my friend isn't online to bounce ideas off of, how 
                'bout I ask you? :)
    15:59 < lluis> cj: heh, ok
    15:59 < cj> a first pass would be a web form that takes some information about 
                a package and stores it to a database.  those data are exposed via 
                as an xml file, and all entries are listed on a separate page as a 
                registry
    16:00 < cj> http://someregistry.org/register_product.cgi, /list_products.cgi, 
                /view_product.cgi?id=1
    16:01 < cj> the data stored in relation to the product would be version, 
                package type, build type, license, distribution uri, author
    16:02 < cj> the IDE would add another tab next to 'browse', 'pkg-config' and 
                'gac' that would query /list_products.cgi and present them in a 
                manageable fashion
    16:03 < cj> I don't want to over-engineer, since I don't have a lot of spare 
                time to implement.  first pass = dumb but working
    16:03 < lluis> well, if we are going to have server side logic, we better use a 
                   web service
    16:04 < cj> sounds reasonable, but I don't have time to ramp up on that right
                now.  how 'bout I make the cgi's interface reliable so a web 
                service could be built to replace it?
    16:05 < mhutch> cj: clean urls please :)
    16:05 < cj> mhutch: define 'clean' :)
    16:06 < mhutch> no ".cgi" for a start
    16:06 < cj> okay
    16:06 < lluis> cj: what you plan to use to implement that?
    16:07 < cj> lluis: perl.  I'm good at it and can fix things without having to 
                ask stupid questions like "how do I construct an HTTP request 
                object" :)
    16:07  * mhutch cries
    16:08 < cj> enough from the peanut gallery
    16:09  * mhutch starts throwing peanuts at cj
    16:11 < lluis> cj: well, the server side implementation is not so important
    16:11 < lluis> as well as we have a client c# library that encapsulates it
    16:11 < lluis> I mean as long as
    16:12 < mhutch> IMO it would make sense to do it in a language that users (i.e. 
                    potential contributors) are likely to know
    16:12 < mhutch> but maybe that's just me
    16:12 < cj> mhutch: I promise that I'll write it in c# after I get it working
    16:13 < cj> mhutch: it's hard for me to get anything done, though, if I have to 
                learn how to do it while I'm doing it.  I enjoy re-writing my perl 
                code in c#, though.  that's how I started learning it in the first 
                place :)
    16:13 < mhutch> cj: I'd be happy to provide pointers
    16:14 < lluis> mhutch: I don't think it is so important for the server side.
    16:14 < mhutch> cj: some things would be easier to do directly in C#, for 
                    example, web services in C# are near-trivial
    16:17 < lluis> cj: hmm, in fact in my implementation proposal the reusable 
                   components are just add-ins, so we can just use the existing 
                   add-in repository format
    16:17 < cj> lluis: is there one?  I'll google it.
    16:18 < lluis> cj: I don't think it is documented. Add-in repos are just as set 
                   of files which can be generated using the mautil tool.
    16:53 < lluis> cj: if you are interested, I can send you the library repository 
                   client I wrote when I worked on that on the hack week
    17:11 < cj> lluis: sure, thanks.  I'll use it as reference as I poke.
    Day changed to 09 Jan 2009
    03:10 <@cj> okay... now for coding...
    03:20 <@cj> this is the part where I use my production web server to develop 
                code.  everybody watch!
    03:29 <@cj> http://repository.colliertech.org/
    03:29 <@cj> tada
    03:29 <@cj> I crack myself up.
    04:13 <@cj> http://repository.colliertech.org/register/
    04:13 < SeveredCross> Neato.
    04:14 <@cj> yeah.  doesn't store your data yet, but *shrug* it's >0
    04:15 < SeveredCross> What's the idea, to have a repository of info for 
                          Mono-related softwares that aren't packaged in distro 
                          repos?
    04:15 <@cj> no, to allow people to reference the packages registered here 
                through various tools, such as visual studio or monodevelop
    04:16 <@cj> http://wp.colliertech.org/cj/?p=301
    04:16 <@cj> http://wp.colliertech.org/cj/?p=307
    04:17 <@cj> at amazon, we had a 'cradle-to-grave' registration tool that allowd 
                folks to create source control repositories, fire off builds, 
                request and perform code review, etc.
    04:17 <@cj> I don't want to get that fancy, but it inspired me to make 
                something that helps to oranize all of these pieces of code we have 
                laying around
    04:18 <@cj> organize
    04:20 <@cj> pkg-config is useful for code you've got on your system, but the 
                process of grabbing, installing and then finally referencing is a 
                lot of overhead.  if you could do gmcs -r:repos://foo bar.cs 
                -o:baz.exe, that would really reduce the headache
    04:20 < SeveredCross> Cool beans.
    04:20 < SeveredCross> Sounds like a worthy project. :D
    
    
  • Quest for the re-usable software grail

    I’ve been reading Dreaming in Code and discussing project planning & management with my housemate. These topics have reminded me of the quest for “plugable,” re-usable software components. The quest has been ended for the most part for those who use Perl. The CPAN provides users of this particular language with a repository of code libraries (modules, in Perl parlance) which can be acquired, installed and applied with minimum fuss. The barrier to entry for getting your code into The CPAN is low to permit new ideas proposed by folks who don’t have the know-how to prepare and revise applications. This tends to cause some problems with regard to the signal-to-noise ratio, but I think it’s one of the primary reasons that the system is so successful.

    In addition to this repository of code, which contains a great deal of duplicated effort, lots of modules intended only as prototypes, and pipe dreams which were never completed, third parties provide statistics about the robustness, applicability, and overall “kwalitee” of the code archived therein. As famously noted in Zen and the Art of Motorcycle Maintenance, “Quality” is a subjective concept and cannot be measured as such. “Kwalitee,” on the other hand, is “a set of formalities that tend to coincide with quality, according to consensus.”

    There exist tools to analyze code for known problems which cause reduction in “kwalitee.” The action performed by such tools is often called “static analysis.” The sets of rules used in such systems to govern which parts of code are marked as somehow problematic are called “policies.” There can be different classes of policies, for example security, complexity, cosmetic. When developers write code keeping such policies in mind, they are said to be “using best practices.” It’s hard to keep every such policy in mind when building software, so static analysis tools were developed to help gently nudge contributors back to the narrow path.

    Why am I mentioning all of this? Why should any more effort be put into building a system of re-usable software if The CPAN already exists and provides all of these tools? As much as I love Perl (and I do! :) ), it has a tendency to be used to fix all problems, even when it may not be the best approach. Sometimes you need to get closer to the processor than an interpreted language lets you. Sure, there’s always XS when you need to do that. But the barrier to entry is high. Another reason is that not everybody loves Perl as much as I do. Some folks want to use (for instance) C++. If the library is written in Perl, and your application is written in C++, you either need to embed a perl interpreter in your application or break your application into different processes and communicate between them. This complicates the application and such complications and prone to error.

    So I guess what I’m trying to say here is that we need to take the lessons learned from The CPAN and apply them to a framework that all languages can interact with. In my experience, the most accessible language in terms of inter-language co-existence, the language most capable of getting close to the processor is C. All languages have a means by which they can re-use C libraries. The primary difficulty with C, though, is that it’s hard to get object orientation right with. It’s hard to create an object model that is flexible enough and consistent enough that interface bindings which feel “native” can be generated for every language.

    Lucky for us, that hard work has already been performed by the folks at Sun, RedHat, Ximian and Novell. I’m referring, of course, to the GObject framework, the cornerstone of The GNOME Desktop and the Mono CLR.

    So the next is a question for you, readers: What are your opinions about building a software repository intended to be “The CPAN of GObject modules”? Are there enough modules in existence to warrant the effort? Is the current system of distribution “good enough?” Is there a critical mass of people interested in using such a system?

    Most importantly, is there anyone else out there interested in building this infrastructure? I’ve finally come to accept the fact that as much as I’d like to deny it, I just can’t do everything I want to in the time I’ve been allotted. This seems like a project that would do a lot of good for a lot of people, but it’s just too much for me to do by myself.

  • Next article in the “Writing Free Software” series

    Hey all,

    I’m not certain what the next topic should be. I’ve got a few ideas. Could the interested parties let me know what they’re curious most about?

    • documentation
    • distributing .exe.config and .dll.config files
    • inter-package dependencies using pkg-config
    • creating sub packages
    • test harnesses and the “check” target
    • the debian/ directory and .deb packages
    • … something completely different

    I’m looking for comments on this one!

  • Writing Free Software – Part 10: Subdirectories

    In this installment, I’ll cover creating different subdirectories for different parts of the code. We’ll move NDesk.Options.cs into an ndesk directory and Greeting.cs into a src directory. Some modifications need to be made to various pieces of the distribution in order for this to work out correctly. We’ll do the minimum required now and cover the pieces that will make it more extensible but complex in future entries.

    Return to the workplace

    $ cd ~/src/greeting

    Move the source to their new directories

    $ mkdir src ndesk
    $ mv NDesk.Options.cs ndesk
    $ mv Greeting.cs src
    $ mv Makefile.am src

    Create a new root Makefile.am file

    $ cat > Makefile.am
    SUBDIRS = src ndesk

    bin_SCRIPTS = greeting
    ^D

    Create ndesk/Makefile.am

    $ cat > ndesk/Makefile.am
    EXTRA_DIST = NDesk.Options.cs

    Alter src/Makefile.am to cope with new layout

    $ patch src/Makefile.am

    10,11c10,11
    < Greeting.exe: Greeting.cs NDesk.Options.cs
    < # the same as $(CSC) -out:Greeting.exe Greeting.cs
    ---
    > Greeting.exe: Greeting.cs $(top_srcdir)/ndesk/NDesk.Options.cs
    > # the same as $(CSC) -out:Greeting.exe Greeting.cs ...
    14,15c14
    < EXTRA_DIST = Greeting.cs NDesk.Options.cs
    <
    ---
    > EXTRA_DIST = Greeting.cs
    18,19d16
    <
    < bin_SCRIPTS = greeting
    ^D^D
    patching file src/Makefile.am

    Alter configure.ac to cope with new layout

    $ patch configure.ac

    @@ -13,6 +13,8 @@
     
     AC_CONFIG_FILES([
     Makefile
    +ndesk/Makefile
    +src/Makefile
     greeting
     ])
     AC_OUTPUT
    missing header for unified diff at line 1 of patch
    patching file configure.ac
    

    Prove that we didn’t break anything

    $$ automake && autoconf && ./configure
    ...
    $ make
    ...
    $ sudo make install
    ...
    $ greeting
    Greetings, World!

    Conclusion

    In this lesson, I gave an example of re-factoring the build system to use subdirectories. This method can be used to separate portions of one’s codebase. In addition, we saw the use of the $srcdir variable, which stores the location of the root of the source distribution.

    In future posts, we will use the work done in this lesson as a basis for some more re-factoring. We will also learn how to do things such as

    • creating sub projects
    • inter-package dependencies using pkg-config
  • Writing Free Software – Part 9: Creating the wrapper script

    A previous post covered altering the install target so that it places the .exe assembly into the filesystem of the installer’s computer. In this part, we will cover creating the so-called “wrapper” script, which is the way recommended by the mono project’s application deployment guidelines to make the assembly executable on the system outside of the source distribution.

    Return to the workplace

    $ cd ~/src/greeting/

    Create the wrapper script template

    $ cat > greeting.in
    #!/bin/bash
     
    exec @RUNTIME@ @prefix@/lib/mono/@PACKAGE_NAME@/Greeting.exe "$@"
    ^D

    Alter the configure.ac file to process the wrapper template

    $ patch configure.ac

    @@ -13,6 +13,7 @@
     
     AC_CONFIG_FILES([
     Makefile
    +greeting
     ])
     AC_OUTPUT

    ^D^D

    Alter the Makefile.am file to distribute the wrapper template

    $ cat >> Makefile.am
     
    bin_SCRIPTS = greeting
     
    ^D

    Re-build the Makefile and wrapper script

    $ autoconf && automake && ./configure

    Test the install target

    $ make && sudo make install
    $ which greeting
    /usr/local/bin/greeting
    $ greeting ––number 8
    Greetings, Neptune!

    Conclusion

    In this post, I gave an example of creating a simple wrapper shell script and using the autotools infrastructure to locate and use the system C# compiler and CLI runtime. This may not seem like much of a feat, but many systems have their binaries installed in weird locations and other quirks. The autotools system is able to detect and take care of these details without having the maintainer of the software create system-specific tweaks that would undoubtedly reduce the number of platforms on which the software would work.

  • Writing Free Software – Part 8: Exploring configure.ac variables

    Introduction

    One of autotools’ primary purposes is to allow software to be built and installed on a wide range of platforms. The configure script is responsible for a great deal of this flexibility. When it is run, it interrogates the system on which it is being run to determine the features available. If required features are missing, the script can do any number of things, including but not limited to:

    • reporting a problem and bailing out
    • trying an alternate approach
    • attempting to fetch the missing software and continuing/aborting depending on the outcome
    • recommending that the person running the configure script install the required bits
    • mocking the user

    In this post, I will note a few of the variables that can be used to determine the configuration of the system.

    Return to the workplace

    $ cd ~/src/greeting

    Modify configure.ac to report some findings

    $ patch configure.ac

    --- configure.ac.orig	2009-03-20 14:49:16.000000000 -0700
    +++ configure.ac	2009-03-20 14:46:16.000000000 -0700
    @@ -1,5 +1,11 @@
     AC_INIT([greeting],[0.0.1])
     AM_INIT_AUTOMAKE([1.9 tar-ustar])
    +
    +AC_PATH_PROG(RUNTIME, mono, no)
    +if test "x$RUNTIME" = "x" ; then
    +  AC_MSG_ERROR([Can't find "mono" in your PATH])
    +fi
    +
     AC_PATH_PROG(CSC, gmcs, no)
     if test "x$CSC" = "x" ; then
       AC_MSG_ERROR([Can't find "gmcs" in your PATH])
    @@ -8,3 +14,12 @@
     Makefile
     ])
     AC_OUTPUT
    +
    +echo "================="
    +echo ""
    +echo "Thank you for configuring '$PACKAGE_NAME' version '$PACKAGE_VERSION'"
    +echo "Runtime:             $RUNTIME"
    +echo "C# compiler:         $CSC"
    +echo "installation prefix: $prefix"
    +echo ""
    +echo "================="
    ^D^D
    

    Re-run configure to see results

    $ autoconf && ./configure
    checking for a BSD-compatible install... /usr/bin/install -c
    checking whether build environment is sane... yes
    checking for a thread-safe mkdir -p... /bin/mkdir -p
    checking for gawk... no
    checking for mawk... mawk
    checking whether make sets $(MAKE)... yes
    checking how to create a ustar tar archive... gnutar
    checking for mono... /usr/bin/mono
    checking for gmcs... /usr/bin/gmcs
    configure: creating ./config.status
    config.status: creating Makefile
    =================
     
    Thank you for configuring 'greeting' version '0.0.1'
    Runtime: /usr/bin/mono
    C# compiler: /usr/bin/gmcs
    installation prefix: /usr/local
     
    =================

    Conclusion

    One of the primary reasons that autotools is so powerful is that it can figure out what’s on your system and use it to build the software in the package. In following posts, we will make use of some of these system configuration variables.

  • Writing Free Software – Part 7: Creating a working install target

    Introduction

    This entry will show how to add the bits required for an install target. There are two pieces that need to be added to the Makefile.am:

    • target_DATA, which is a list of files associated with the target
    • targetdir, which is the location where the above files will be installed

    Return to the workplace

    $ cd ~/src/greeting

    Add the required variables to Makefile.am

    $ cat >> Makefile.am
    Greeting.exedir = $(prefix)/lib/mono/greeting
    Greeting.exe_DATA = Greeting.exe
    ^D
    $ sudo make install
    ...
    $ ls /usr/local/lib/mono/greeting/
    Greeting.exe

    Conclusion

    We now have the bits in place to put Greeting.exe in the correct directory, but no way to execute it. We’ll address that in a future post. Until then, you might be interested in reading through the application deployment guidelines