Lazyness and Cabal Packages

Often times, when i'm working on random Haskell things, i find i'm doing the same actions over and over again. I've also found i've done the same groups of commands repeatedly, and alot of work could be automated. Last winter, Luke Macken and i had a bit of a chat about some ways we could work out a bit of a solution to the problem. He already had some code put together to make a quick developer shell for doing common Fedora related tasks.

My goal was to create something that can handle a workflow to automate most of the steps in making RPMs for basic Cabal packages. Cabal is the package manager for Haskell, similar to Python Eggs, or Ruby Gems. Since it's so well developed, 95% of the steps required to make an RPM can be automated to a few brief statements. Yesterday, i spent the better part of the day hacking together a module in fedora-devshell that can be used to download Cabal packages from Hackage, the Haskell source package repository, compile them, and install them either to root or to home. The user can also do it step by step, and intervene where necessary.

If you would like to follow along, you can get the source below. (GPL v2+)

http://fedorapeople.org/gitweb?p=ynemoy/public_git/fedora-devshell.git;a=summary

In this example, i'm assuming that all the source packages will go in ~/haskell, where i normally work. fedora-devshell does a bunch of things half baked, because i'm still working on them. The only modules and concepts you will need though are Package and Cabal. Package refers to any generic Linux/Unix package, and cabal refers specifically to a Cabal package. Essentially, ~/haskell will have a bunch of Packages, and each Package will have one or more Cabal package, although only one active package. And that's it for theoretical stuff. Just remember, a Package can have a different name than the Cabal package will.

To take a random tarball, and make a regular Package out of it, run:
~/haskell $ ports.py cabal xmonad-test copy_in /some/location/xmonad.darcs.tar.bz2

This will create a directory ~/haskell/xmonad-test, which will have a tarball, and two expanded trees of the tarball, one is the modifiable one, and one is a copy of the original. In the future, fedora-devshell will make it easy to modify the source, compile and test it, and then make diff files to use in RPMs or to send upstream.

to compile the Cabal package, you need the following steps:
~/haskell $ ports.py cabal xmonad-test configure
~/haskell $ ports.py cabal xmonad-test build
~/haskell $ ports.py cabal xmonad-test install

This will install it to $HOME.

You can also use the shortcut
~/haskell $ ports.py cabal xmonad-test install_source

If you want to do it all in one, with a tarball, you can just do this
~/haskell $ ports.py cabal xmonad-test install_sourceball /some/location/xmonad.darcs.tar.bz2

Let's say you want to get some version from Hackage
~/haskell $ ports.py cabal xmonad-test get_from_hackage xmonad 0.8

Or, if you want to download the latest
~/haskell $ ports.py cabal xmonad-test get_latest xmonad

You could install from hackage:
~/haskell $ ports.py cabal xmonad-test install_from_hackage xmonad 0.8

Or even just
~/haskell $ ports.py cabal xmonad-test install_latest xmonad

Essentially, it's yet another package installer for Cabal. If you're a regular haskell wondering why you need this, then it's probably not for you, because there are other tools that can do this better. If you're a packager though, it's a sneak preview of one of many tools that will be integrated together in fedora-devshell that will make your life alot easier.

When in Rome...

1) Which was your Linux distribution story?

I started with Debian when i was in high school and i was amazed with the sheer quantity of things i could do with it. Since then, i experimented with Knoppix, Knoppix STD, Gentoo, SuSE, Ubuntu, Crux, and Mandrake before it was Mandriva. I used Fedora 6 as my first RH derivative when i started working for Red Hat, and eventually went 100% RH in house.

2) What is your preferred $your_distribution version?

In Debian land, it is definitely Debian Potato. Woody was also nice. In Fedora, Fedora 10 beats the pants off pretty much anything done before.

3) Write a short story (more like and anecdote) about your past distribution.

I used to piss Seth Vidal off alot complaining about Yum, and how much it used to suck. It wasn't pretty. One day i met him in Raleigh, asked him two questions, and got the most logical answers ever. Suddenly it made sense, and yum stopped sucking. I don't think i've argued with Seth again. The morale of the story is to get to know your Open Source developers; the relationship is so much more rewarding.

Christmas translations gone horribly wrong, or how not to do localisation.

On an online dictionary that i often go to, i think i've found the most messed up translation for 'Merry Christmas'. At the bottom of the page, there is a table with translations into pretty much every language they could find a translation for. In Yiddish they translated it as 'freyleche nitl'. It seems the editor of that list should have done a bit of research. 'Nitlnacht' is a classic piece of Yiddish humour. It means 'worthless night'. Some mystics hold that it is a spiritually worthless night as well, and that anything done spiritually would be worthless. Since jews do not tear paper or cloth on the sabbath, some Rabbis and mystics would take the time to tear enough toilet paper for the entire year. This is how severe people would hold to this philosophy.

Because Yiddish is so similar to German in grammar and vocabulary, it's quite easy to misunderstand Yiddish terms. The meaning of the word can vary widely based on some Jewish joke, sometimes with roots in mysticism or ancient Hebrew vocabulary. Often, words were chosen to be intended as an insult to the christian governments that gave Jews second class citizen status, as well. So sure, you can look up Christmas in your handy copy of Weinreich, (who doesn't have one?) but you won't really understand the translation at all. It's this kind of double entendre that makes the translation completely worthless.

The thought of non-Jews going around wishing each other a 'freyleche nitl' has me cracking up now. :D

The GPL is not a burden.

One editor of the LWN commented recently on his yearly predictions for the ecosystem and how well they performed. The article is titled "The Grumpy Editor's 2008 retrospective." Perhaps the grumpy editor was a bit too grumpy this year. There hasn't even been enough coal to go around in people's stockings.

He comments:
The other prediction was that GPL enforcement actions would continue, and perhaps grow. The recent FSF lawsuit against Cisco makes it clear that the GPL enforcers are serious about what they are doing. Your editor cannot help but wonder, though, whether the increasingly litigious actions by the Software Freedom Law Center might not eventually lead to a serious backlash within the community. We are about freedom, not punitive damages. Enforcement of the GPL is necessary if we expect our licenses to be taken seriously, but overly zealous - or greedy - litigation could encourage those who say that use of free software exposes companies to an unacceptable level of risk.

Simply put, i fail to see in how the FSF is being 'greedy'. There have been attempts by the FSF since 2003 to bring Cisco into compliance, and the standard procedure has failed. More importantly, i don't think the GPL is necessarily a burden on companies either.

For instance, consider the EULAs provided with other industry software. The Windows Vista EULA is so onerous, and that's before even considering building a one-off product based on Vista. Between Oracle and SAP, with the multiple levels of licensing, it's a wonder companies don't get sued off the face of the earth just for using a free trial. Legalese has a very broad effect on the industry, and the way companies and other organisations operate. Schools and daycares, for example tend to be so liability conscious that they have very strict rules about what may and may not be done there. In the proprietary world, the burden has definitely been pushed from the software provider to the software consumer in many cases. Compared to the GPL, compliance is very simple.

Compliance can be even easier. Basic compliance roughly requires that all components that are liable under the GPL must be released with both the binary code and source code. GPLv3 compliance requires a few more steps that are a critical part of the design process. For example, the requirement not to use DRM or other methods to lock the user out of using the software on a target platform is a fairly high level engineering decision. GPL compliance also requires being aware of which components use GPL code. How easy is it to be in compliance then? Pretty easy. All you need to do is have a link that says 'source code over here', and you're done.

But what if projects under the GPL could be developed out in the open. I mean, if the linux kernel were hosted somewhere where anyone could see the kernel before it's even released, the source code would lead the binary code. If there was a website to host and house projects that are open source, it would be even simpler. It's a shame we don't have such tools and websites available. ;)

The open source methodology is to release early and release often. In Fedora-land, we have a number of tools, including Fedora Hosted, that are not only open for any takers, but can also be deployed free of charge, because they themselves are open source projects. Any company that wants to stay in compliance needs to understand that in some ways, open source software is easier than closed source.

Open Source and Anarchism?

Summary, in case you want to skip this.

Open Source development is pretty close to Anarchism. Still, we rely on the courts and government to protect Open Source. What if we were to lose that support, what would the Open Source ecosystem look like then?

Before i begin, let me redefine Anarchism away from the bad taste in your mouth, purely chaotic society where anyone will kill his parents if it means a few bucks. It's really an insult to the decency of mankind to presume anyone would act in such a way. When i refer to anarchism, i refer to a self regulating, self ruling society where the individual decides which rules are important.

I was watching an interview with Eric S. Raymond where the interviewer asked him the million dollar question: "Is Open Source Communism?". His response was extreme disgust, and his argument against this was about the very nature of Communism. Communism forces the individual to share and participate in a single monoculture society, where if you chose not to be a member, you were thrown in the Gulag, shot in the back of the head, and even buried in an unmarked grave. The question was raised around the 'viral' aspect around the GPL, in how it forces the redistributor to retain that license on all modified code. But let's face it, very few people actually want to force people to use the GPL and nothing but the GPL.

Let's take this completely the other direction. Economically, Capitalism is considered the economic polar opposite* of Communism. The idea behind Red Hat is that Open Source makes perfect business sense, because it's been proven to encourage faster economic development than the traditional methods that preceded Open Source development. Capitalism is certainly akin to Anarchism, in that they both encourage a certain free growth, unimpeded by any other limitations. For example, in our society, most capitalistic economies are limited by government regulation, but are otherwise completely subject to the consumer demand.** Capitalism, especially as Open Source moves into it more, relies on a set of organically grown collective agreements between the different corporations. Still, it relies on a level of government regulation and intervention to support and maintain these agreements. For example, corporations rely more than ever on the court systems to enforce trademarks worldwide, because without an overarching court, any individual can use a trademark freely with little retribution. Open Source moves corporations into a space though, where they no longer compete with each other directly, but actually support each other. This is fairly close to an anarchistic economy.

Although Anarchists vary widely on what a post-revolution anarchistic society would look like, there is a consensus that individuals who recognize the value in serving other people's needs will provide the needs selflessly. Issues such as protective militias, police forces, social welfare, care of the sick, production of food, etc.. would all be handled by volunteers. There would be no governmental safety net to fall back on, and a truly independent individual will realize this. Likewise, if the 'community' feels an individual is taking, but not giving back, that person will get an automatically diminished say and respect in the 'society'. Furthermore, the society could choose to find a way to address the issue, or leave it alone. The development of Open Source, initially as a purely volunteer movement, and a shift to a cooperative corporate and volunteer culture really parallels the ideals of many anarchistic thinkers. Individuals and corporations alike have donated countless man-hours, server power, storage and hosting space, and money to do everything the Open Source ecosystem needed.

Open Source succeeded because of its licensing model. I would like to say a set of 'strong' licenses, but no one has really challenged them in court until very recently. Presumably, either they are weak, and we don't know it yet***, or they are so strong that lawyers are afraid to touch it with a 10 foot pole. The licenses are one of the key factors that supported the anarchistic model in a non anarchistic society. The GPL in particular, because of it's 'virility' (sorry, couldn't resist the half pun), has pushed this anarchistic ideal more than anything else. It's license/contract rules force the consumer of GPL licensed software to participate in the anarchism. On the contrary, the BSD license has a key fundamental difference. The rules allow the consumer to release changes under proprietary terms, which lets consumers retain the non anarchistic methods of our society. You could call the GPL non anarchistic, in that it forces the rules on the consumer, but this is simply not true either. The consumer is still fundamentally choosing the software out of free will.

In an anarchistic society, there would be no overarching court system that must be obeyed. If a consumer wanted to rerelease GPL software under another license, the copyright holder would have some alternatives, but none of them include getting the courts to physically stop this person. The copyright holder could convince the offender to cease and desist under a mutual agreement, or he could ask some friends to force him creating ill will. Anarchist argue, of course, that this situation is still fundamentally better, because it encourages people to think more about direct and peaceful confrontation. But here's my question to you, dear Lazyweb reader. This is a bit of a thinking exercise. What would the GPL in a truly anarchistic society work? Without a court to actually enforce the GPL, how would we, the open source developers, convince corporations that Open Source is the way to go? What do we do, when a corporation takes an objectivist point of view, argues that the financial gains outweigh the damages of disrespect, and violates what is essentially now just a Social Contract? What methods do we have to encourage the continued development and momentum of Open Source and Free Software, even when people have a right to do otherwise?

It hit me, that while writing this, this doesn't just have applications in a doom and gloom scenario where some government collapses in our current economic crisis. This could have some very real and practical application, even if the sky doesn't fall. Let's take another thought exercise. Let's say a bunch of high powered and expensive lawyers for Cisco manage to overturn the GPL in courts. What if the government decides not to enforce the GPL, and we lose the ability to enforce our own beloved anarchism? How do we continue the ideals of Free Software and pretty much bluff our way into winning?


* Don't take my word for it, i'm just an academic hack.
** Yes, this oversimplifies things immensely.
*** And let's hope to $deity_or_other that we never get to this point.

FUDCon Ho!

Is anyone still looking for roomate for FUDCon? I am still looking for a roomate, although i have a room reserved. I would prefer to hear from someone i've met personally, but any vouchesafe from a well known Fedora developer will do.

If you're interested, you can find me as 'loupgaroublond' on freenode, in several fedora channels, or email me at ynemoy redhat *point* com

Monospace Haiku

The goal of a monospace haiku is to encapsulate something that the normal geek or hacker might encounter. This must be summed up in a very precise meter, although meter itself is pretty flexible. The only rule is that the text line up in monospace. For example

food is good
good is food
and i am fed

So let your inner geekpoet flow.

LiveCD is the new Black?

Well, Fedora is blue, not black, so that statement might not be 100% correct.

In any case, now that finals are over, i'm finally getting around to installing Fedora 10 on my main box, and i'll probably roll my server over soon too. Traditionally, i've used a DVD to do my installations, but it seems like i might change that in the future. I burned a DVD so i can do the installation, but when i ran the media test, it failed. Going back to my Fedora 9 installation and checking the SHA1SUM showed that the original file was not corrupt. I'm not sure why the gnome tools for burning a DVD might have failed, but i'm not really inclined to figure it out. Instead, i'm going to just copy a run of the mill LiveSD to my USB key, and i'll do the installation from there. One big advantage to using the USB key is that it takes alot less time to copy the ISO over.