Home Home > 2009 > 05 > 04
Sign up | Login

Deprecation notice: openSUSE Lizards user blog platform is deprecated, and will remain read only for the time being. Learn more...

Archive for May 4th, 2009

GSoC introduction – openSUSE@ARM

May 4th, 2009 by

Hi openSUSE community!

I’m glad my proposal was accepted and today I want to introduce myself and my GSoC project.

/me , thats Jan-Simon Möller and I’m just finishing my Diploma in electrical engineering at the Leibniz Universität Hannover. I’m coordinator of the openSUSE Weekly Newsletter and contribute also to the hamradio repository, the iFolder project and the openSUSE Build Service. See also my “People of openSUSE” interview.

My Project in short:  openSUSE@ARM
My aim during GSoC 2009 is to port first the base to the ARM platform. Then KIWI needs also some attention when it comes to imaging and after that the tools, Kernel and X11.

I’ll heavily use the capabilities of the openSUSE Build Service, which is now ready for ARM.

During the last few days, I’ve done many little preparations to get it all flying when GSoC coding period starts.

Stay tuned !

Factory USB Images

May 4th, 2009 by

If you’re interested in USB images, I’m publishing factory USB images built in the build service. They are completely fresh and see no testing at all, so if you find a problem, send me a patch 🙂

They are compressed .bz2, so the download is roughly the same as a CD ISO, but they are actually .raw images. So you can deploy them on a USB stick and carry around your personal linux hard drive. But you will need something > 3G. Installing them is pretty easy.

Put your USB stick in your computer, then check /dev/disk/by-id/usb* for the name of your stick. Mine is named /dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B751D8C1994-0:0. You can double check by looking if it points to the same sdX that you see last in dmesg. Like this:

sd 29:0:0:0: [sde] Assuming drive cache: write through
sde: sde2
sd 29:0:0:0: [sde] Attached SCSI removable disk


desdemona:~ # ls -l /dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B751D8C1994-0:0
lrwxrwxrwx 1 root root 9 4. Mai 15:47 /dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B751D8C1994-0:0 -> ../../sde

Bot are sde – fine. What partitions are on it, doesn’t matter – all data will be erased by this.

Now the command (for gnome.x86_64 – there are 3 other choices):

wget -O - http://download.opensuse.org/repositories/openSUSE:/Factory:/Live/images/openSUSE-11.2-usb-gnome.x86_64-2.8.0-Build18.1.raw.bz2 | bzcat | dd of=/dev/disk/by-id/usb-Kingston_DataTraveler_II+_5B751D8C1994-0:0 bs=4M

Depending on the speed of your USB stick, this can take a while, but the good thing is that this command doesn’t require any temporary space. My stick is a very fast one and it takes around 10 minutes to download and “burn”. After that, either reboot or put the stick in the computer you like to boot. On first boot, it will expand to the size of your USB stick, creating another partition.

Note that this images come without live installer, but you can of course zypper in yast2-live-installer and xdg-su -c /sbin/yast2 live-installer.

Suppressing KeyboardInterrupt traceback in Python

May 4th, 2009 by

If you have a running program in Python and press Ctrl+C, you’ll get a traceback like this:

$ scout java foo
^CTraceback (most recent call last):
  File "/usr/bin/scout", line 11, in 
    ret = scout.ScoutCore.run()
  File "/usr/lib64/python2.6/site-packages/scout/__init__.py", line 945, in run
    result = module.ScoutModule().main(clp.module_args)
  File "/usr/lib64/python2.6/site-packages/scout/__init__.py", line 873, in main
    return self.do_query(args.query, repos, args.inversesearch)
  File "/usr/lib64/python2.6/site-packages/scout/__init__.py", line 890, in do_query
    result.add_rows(self._query(repo, query, inversesearch))
  File "/usr/lib64/python2.6/site-packages/scout/__init__.py", line 896, in _query
    r = db.query(self._sql, '%%%s%%' % term)
  File "/usr/lib64/python2.6/site-packages/scout/__init__.py", line 485, in query
    if len(row) == 1:           #(2)
KeyboardInterrupt

It is useful suppress it, because user knows he breaks the program and this output should be considered as a bug. Possible solution is wrap a main function by one big try: except KeyboardInterrupt:

try:
  main() # the main function
except KeyboardInterrupt:
  pass # KeyboardInterrupt supressed

But it makes a new level of indentation which should be uncomfortable – especially in Python. Or when you have multiple entry-points, or just don’t well structured program (which is common when you write your private helper script :)), you maybe prefer another solution.

Python has a sys.excepthook, which is called for traceback printing, so we could define our own and suppress unnecessary output here. And it would be nice suppress only one exception and handle other ones using existing function. And this function make it:

def suppress_keyboard_interrupt_message():
    old_excepthook = sys.excepthook

    def new_hook(type, value, traceback):
        if type != exceptions.KeyboardInterrupt:
            old_excepthook(type, value, traceback)
        else:
            pass

    sys.excepthook = new_hook

Function suppress_keyboard_interrupt_message (it is really nice name, don’t it ;-)) stores an existing hook and register an inner function new_hook as a new one. Advantage is that old_excepthook exists only in a scope of this function, so you don’t need use global variables for it.

Update: typos fixed