user-avatar
Today is Saturday
February 4, 2012

January 11, 2012

Compiling firefox-9.0 on linux PPC

by Thomas Capricelli — Categories: Admin, Gentoo — Tags: , Leave a comment

The good point is that yes!, it is possible to compile firefox 8.0 or 9.0 on linux-ppc.

General point of view

The mozilla foundation has stopped supporting the PPC platform for firefox starting with version 4.0. Gentoo ebuilds, quite understandably, followed upstream by removing ppc keywords for all firefox ebuilds >=4.0.

Though… I still have this nice ibook overthere. I’m not sure what it is (ibook G3 something ?) but what is for sure is that the processor is a 32-bit PPC. I use a very convenient lightweight desktop on this, based on razor-qt and such. My main usecase for this computer is … browsing. I don’t update it very often and I still had firefox 3.x on it. I thought it was time to get something more recent.

It happens that a friend of mine had similar problems updating firefox on several Mac mini, those old ones with ppc processors too (hello Olivier :-) .

The one thing to know is that some google-related stuff in the crashreporter will NOT compile under recent gcc (we tested 4.3 and 4.6 I believe). So you have to disable the crashrepoter in order to get firefox compiling. Despite this, it should be ok, even though unsupported.

Howto for Gentoo users

First thing you need to do is to force the ppc (or ~ppc) keyword for firefox. Add this line

www-client/firefox **

into /etc/portage/package.keywords (record this path can either be a file or a directory whose files will be concatenated).

Fortunately, there’s a gentoo USE flag for the crashreporter, so you just need to disable it, by adding “-crashreporter”, either to the USE variable in /etc/make.conf, or in /etc/portage/package.use

Then be patient. Of course, on such old beasts, it will need several hours of compiling.

January 8, 2012

DjangoRedmineAdmin 1.0 released

by Thomas Capricelli — Categories: Admin, Django — Tags: , Leave a comment

I recently needed (again) to ‘browse’ a redmine database, and I used my DjangoRedmineAdmin application to do so. I took this opportunity to update the code and doing some more tests/fixes. As a result I decided to tag this as 1.0.

The main modifications are:

  • updated to comply with current redmine version (1.2.1 and 1.3.0)
  • updated to use Django 1.3 instead of Django 1.2, which is now deprecated.
  • added a lot of new improvements to the admin pages, such as displaying a list of related model instead of the raw id, or presenting data in a cleaner way.
  • it now works now with mysql too. Previous version would have problems handling boolean fields on a mysql database. We need to blame ruby ORB here, which actually handle boolean differently depending on the db backend. Sqlite3 was and is still supported.

You can clone the repository or download tarballs from the mercurial source page.

The wiki has more information / documentation.

December 2, 2011

Celery init scripts for Gentoo

by Thomas Capricelli — Categories: Admin, Django, Gentoo3 Comments

I’m using django-celery on a project. The only difficult part was that gentoo ebuilds would not provide init scripts. It might be that some ebuilds in some obscure overlay provides those, but this was far too far away from the mainstream portage tree for me.

Yes, the documentation about celery has some scripts using supervisord, but I still like the init.d kind of scripts, so here they are.

The first one is /etc/init.d/celeryd, used for every worker.

#!/sbin/runscript
# Copyright 2011 Sylphide Consulting / Thomas Capricelli

# this file should be installed as /etc/init.d/celeryd

# doc:
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

# configuration is taken from /etc/conf.d/celeryd
# You NEED to configure CELERYD_APP_DIR
# You MAY configure CELERYD_USER, CELERYD_GROUP, CELERYD_CONCURRENCY

depend() {
    need net

}

checkconfig() {
    if [ -z "${CELERYD_APP_DIR}" ] ; then
        eerror "Please configure /etc/conf.d/celeryd"
        return 1
    fi
}

start() {
    concurrency=${CELERYD_CONCURRENCY:-1}
    options="--workdir=${CELERYD_APP_DIR} --pidfile=/var/run/celeryd.pid --logfile=/var/log/celeryd.log --concurrency=${concurrency} --events"
    if [ -n "${CELERYD_USER}" ] ; then
        options="${options} --uid=${CELERYD_USER}"
    fi
    if [ -n "${CELERYD_GROUP}" ] ; then
        options="${options} --gid=${CELERYD_GROUP}"
    fi
    ebegin "Starting celeryd"
    start-stop-daemon \
        --chdir ${CELERYD_APP_DIR} \
        --start \
        --pidfile /var/run/celeryd.pid \
        --exec ${CELERYD_APP_DIR}/manage.py -- \
        celeryd_detach ${options}
    eend $?
}

stop() {
    ebegin "Stopping celeryd"
    start-stop-daemon --stop --pidfile=/var/run/celeryd.pid
    eend $?
}

The second one is /etc/init.d/celerybeat, for the scheduler. I’m using redis, but if you dont, just comment out the after redis line.

#!/sbin/runscript
# Copyright 2011 Sylphide Consulting / Thomas Capricelli

# this file should be installed as /etc/init.d/celerybeat

# doc:
# http://www.gentoo.org/doc/en/handbook/handbook-x86.xml?part=2&chap=4#doc_chap4

# configuration is taken from /etc/conf.d/celerybeat
# You NEED to configure CELERYBEAT_APP_DIR
# You MAY configure CELERYBEAT_USER, CELERYBEAT_GROUP

depend() {
    need net
    after redis
}

checkconfig() {
    if [ -z "${CELERYBEAT_APP_DIR}" ] ; then
        eerror "Please configure /etc/conf.d/celerybeat"
        return 1
    fi
}

start() {
    options="--workdir=${CELERYBEAT_APP_DIR} --pidfile=/var/run/celerybeat.pid --logfile=/var/log/celerybeat.log --detach"
    if [ -n "${CELERYBEAT_USER}" ] ; then
        options="${options} --uid=${CELERYBEAT_USER}"
    fi
    if [ -n "${CELERYBEAT_GROUP}" ] ; then
        options="${options} --gid=${CELERYBEAT_GROUP}"
    fi
    ebegin "Starting celerybeat"
    start-stop-daemon \
        --chdir ${CELERYBEAT_APP_DIR} \
        --start \
        --pidfile /var/run/celerybeat.pid \
        --exec ${CELERYBEAT_APP_DIR}/manage.py -- \
        celerybeat ${options}
    eend $?
}   

stop() {
    ebegin "Stopping celerybeat"
    start-stop-daemon --stop --pidfile=/var/run/celerybeat.pid
    eend $?
}

November 14, 2011

New lightweight admin-oriented linux kernel mercurial mirror

by Thomas Capricelli — Categories: Admin, Gentoo, Linux kernel — Tags: Leave a comment

On most servers I’m responsible for, I use to compile my own kernels. Instead of downloading/applying patches, which is cumbersome, I was using the (now broken) mercurial mirror http://www.kernel.org/hg/linux-2.6
It was great as i just had to do something like “hg pull -u; hg up -r v2.6.xx” to update my tree.

Though, this has several drawbacks, and among them some very important:
* the minor versions are not there, such as 2.6.xx.y
* the repository cloning is worth 2.1G, not including the checkout
* you need to specify the tag to get a stable kernel
* the repository contains all intermediate versions, which slows down updating both from network and local checkout.

The first point is the one what bothers me the more. For example at some given date, say the 2.6.39 is not yet released, the last version available in the hg mirror is 2.6.38, although 2.6.38.6 is available. So I  still need to manually patch my checkout because I think 6 minor stable versions are worth having.

My solution to this is a script that I’ve called by the pretty name of eudyptula (this is a very small penguin..). Eudyptula automatically (using cron) updates a mercurial repository to the latest ‘stable’ version of the linux kernel, according to what is found on the official ftp server. The result is here:

https://bitbucket.org/orzel/linux-kernel-stable

The repository clone weights only 220M (excluding the checkout, on my ext4 partition), and contains only one changeset for each update from a stable version to the next. ‘hg pull -u’ is enough to get the latest stable source. Hence the name.

A typical history will look like

* 2.6.38

* 2.6.38.1

* 2.6.38.2

* 2.6.38.3

* 2.6.38.4

* 2.6.38.5

* 2.6.38.6

* 2.6.39

* 2.6.39.1

and will drop any 2.6.38.x release that could appear after 2.6.39 is released.

As a convenience, I’m also tagging versions the same way they are tagged in the official git/mercurial repositories (‘v2.6.38.4″ for example).

Of course, it does NOT makes sense to use this repository if you intend to do kernel development. It is supposed to be used  readonly.

This is a long term project. As of today (november 14th, 2011), I’ve been using this for updating ~10 servers for the last 9 months. I intend to maintain this clone for long, checking and fixing problems if they ever occur.

If there’s enough interest, I could do another mirror for the long-term support versions. Though those versions, officially created and maintained by kernel developers, are not as formally described, and this is more difficult to do from a cron job.

November 9, 2011

EmergeActivity gets a graphical interface: releasing 2.0

by Thomas Capricelli — Categories: Admin, Gentoo, KDE — Tags: , , , Leave a comment

I’m still using this small utility that displays the activity of ‘emerges’ on the misc gentoo boxes I’m admin for. I’ve wanted to add a graphical interface for very long, but did not have the time… until recently. So here it is.

It is available for download from the homepage and as a mercurial clone.

September 18, 2011

A small step forward for the mercurial activity plugin, releasing version 2.0

by Thomas Capricelli — Categories: Admin, Gentoo, KDE — Tags: , , Leave a comment

As time goes, my mercurial ‘activity’ plugin has got more and more options. Useful and requested options of course, but still it kinda clobber the –help output and it is more and more cumbersome to play with. This is why I have introduced a new frontend, based on Qt, to play/decide about those options.

First, let me issue a very strong statement: this is optional and it is still possible to use the extension in an desktop-less environment (aka a server). This is an important point as many people, including myself, use the extension to provide activity information on some html page, maybe even integrating with the mercurial web interface.

So how does it work ? The extension now has a new option –mode. There are currently three possible values:

  • file: this is the previous behaviour, and is the default value. A image file is created and it exits.
  • display: this opens a window with the activity graph, using matplotlib, you can not change anything.
  • gui: this opens a full-fledge window, where you can change options and see ‘in real time’ how the graph changes.

This looks like this:

You’ll notice that the bottom of the window contains the corresponding command line, that you can copy/paste.

Last thing: the extension is now a python module, and as such, the way you configure the extension in your ~/.hgrc has slightly changed. Instead of having

activity=/home/orzel/hg/hgactivity/activity.py

you should now have

activity=/home/orzel/hg/hgactivity/activity

May 13, 2011

How to detect Altivec availability on linux/ppc at runtime

by Thomas Capricelli — Categories: Gentoo, Linux kernel — Tags: , Leave a comment

It is easy to find information on how to detect the availability of the different SSE instructions sets on the x86 platform.. but this get trickier when you’re looking after AltiVec.

This page provide some code and a link explaining why methods based on try and catch exception are bad:

http://freevec.org/function/altivec_runtime_detection_linux

I did few modifications to this code, that I consider enhancements:

  • use /proc/self/ instead of /proc/%d/ based on getpid() to simplify the code, as suggested in comment
  • use of bool for the result variable and the return value
  • clean ugly use of goto when possible
  • do not cache the result in a static variable
#include <fcntl.h>
#include <linux/auxvec.h>
#include <asm/cputable.h>

// from http://freevec.org/function/altivec_runtime_detection_linux
static inline bool altivecAvailable(void)
{
    bool result = false;
    unsigned long buf[64];
    ssize_t count;
    int fd, i;

    fd = open("/proc/self/auxv", O_RDONLY);
    if (fd < 0) {
        return false;
    }
    // loop on reading
    do {
        count = read(fd, buf, sizeof(buf));
        if (count < 0){
            break;
        for (i=0; i < (count / sizeof(unsigned long)); i += 2) {
            if (buf[i] == AT_HWCAP) {
                result = !!(buf[i+1] & PPC_FEATURE_HAS_ALTIVEC);
                goto out_close;
            } else if (buf[i] == AT_NULL)
                goto out_close;
        }
    } while (count == sizeof(buf));
out_close:
    close(fd);
    return result;
}

April 7, 2011

Mercurial mirror for Django stable branch 1.3

by Thomas Capricelli — Categories: Admin, Django — Tags: , , 4 Comments

Django recently released the 1.3 version, and as such a new ‘stable’ branch was created in subversion. As I did for the 1.2 branch, there’s now a mercurial mirror, following the 1.3 branch. It is updated every (european) night.

The 1.2 mirror is not removed, it is still running and maintained.

The url for this new mirror is http://bitbucket.freehackers.org/django-1.3-mirror

October 4, 2010

announcing qxv

by Thomas Capricelli — Categories: Gentoo, KDE — Tags: , 2 Comments

Well… you know how it is, you get used to a tool, and even if some brand new software is now available, you keep on using this old stuff. In his case, i’m speaking of xv, whose last release was in 1994. It’s still my default viewer for all image formats in my KDE/firefox/whatever settings.

So it’s old, it’s unmaintained, but there’s something even worse : it’s not Free Software. That’s probably the reason nobody took off maintainance, by the way.

Because of all those reasons, most distributions do not ship it anymore, and that’s a shame (my distribution of choice, Gentoo, does though, congrats!)

This project is about providing a key-to-key compatible image viewer, GPL, and maintained. Using a toolkit sush as Qt, it’s not very difficult. The two main features are “Free Software” and “maintained”. I use it everyday, trust me it will be maintained :-)

I’ll also probably provide binaries for MacOS and Windows, because we basically have this for free thanks to Qt portability.

qxv is a single binary, and does not depend on any other files (despite, of course, dynamically linked libraries, whatever they are).

The 0.1 release provide those features (all present in xv)

  • create list of images from comand line
  • those keys are handled the same way as xv : space(next image), backspace(previous image), enter(reload current image), “,”(shrink), “.”(grow), “<”(shrink a lot), “>”(grow a lot), “t”(rotate clockwise), “T”(rotate counterclockwise), q(quit), h(horizontal flip), v(vertical flip)
  • basic control window (available by a right click on the main window)

More information:

September 9, 2010

New mercurial mirror for Django stable branch 1.2

by Thomas Capricelli — Categories: Admin, Django — Tags: , , Leave a comment

I have tried for the last few years to use one of the mercurial mirrors on bitbucket.org to follow Django. Since far before Django 1.0 was released, I was following trunk, but I have switched to the stable branch around Django 1.1.

I’ve always had problems with the mirrors on bitbucket, they seem mostly unmaintained. There are several of them, mostly because they create a new one when one fails… so you have to guess which one is the ‘current’ one. As of today, the one I’m using has not been updated for one month,… and I would like to merge the recent important security fix to my own Django branch (that I use for my Consulting jobs).

So I decided to create, and maintain, a mercurial mirror of Django stable, which is 1.2 currently. I publish it on

http://bitbucket.freehackers.org/django-1.2-mirror

and it is updated nightly.

The history/log only starts at the 1.2 branching in svn, which allows to keep the mirror size very small. For comparison, the “.hg” directory was worth 130Mb using the mirror provided by bitbucket staff, and this one is 17M.

© 2012 Thomas Capricelli All rights reserved - Wallow theme v0.46.5 by ([][]) TwoBeers - Powered by WordPress - Have fun!