Thursday, April 15, 2010

Scripting with the Entropy codebase

I'm not a python developer myself at all, but I was just curious about the great codebase that Fabio wrote and documented.

Knowing I have the repository database on my hard disc I figured it should be simple to let it list the last 100 changed packages.
This is how its done:


#!/usr/bin/python
# -*- coding: iso-8859-1 -*-
from entropy.client.interfaces import Client
import time

client = Client()
repo = client.open_repository("sabayonlinux.org")
cur = repo._cursor().execute

for row in repo._cursor().execute('SELECT `extrainfo`.`datecreation`,`baseinfo`.`atom` FROM `baseinfo`,`extrainfo` WHERE `baseinfo`.`idpackage` = `extrainfo`.`idpackage` ORDER BY `extrainfo`.`datecreation` DESC LIMIT 100'):
my_time = float(row[0])
human_time = time.strftime("%a, %d %b %Y %H:%M:%S +0000", time.localtime(my_time))
print human_time,' ',row[1]

client.shutdown()

http://www.sabayon.org/entropy/api/docs/

If you want to know about the table layout, visually, you can use dev-db/sqlitebrowser

The database is located here:
/var/lib/entropy/client/database/x86/sabayonlinux.org/standard/x86/5/packages.db
or here
/var/lib/entropy/client/database/amd64/sabayonlinux.org/standard/amd64/5/packages.db

Friday, March 19, 2010

Sabayon 5.2 (soon to be released) on macbook 5.2

For the record I want to explain how to get 5.2 (as soon its out) can be installed successfully on a macbook 5.2 .

I take it one knows about refit, if not RTFM.

The first thing todo when booting the LiveDVD is edit the boot parameters and append: maxcpus=1 . Otherwise the kernel will panic (acpi issue).
Alternatively you can just disable all acpi but this will not do any good for day2day usage of the macbook.

Ok we start installer and we create 1 partition /dev/sda3 I used ext4, works just fine.
In the installer you need to check a box for advanced grub options and
select to NOT install it in MBR but in /dev/sda3 instead.
Personally I think this step actually is a bit buggy because after a
succesfull installation and syncing partition tables in refit you will
get a message that there is no operating system found if you try to
boot the linux partition. This is because it seems that grub2 actually
didn't install there at all.

To fix this I booted live again to manually install grub here are the
excact steps todo it:

open a terminal, become root

- mkdir sabayon && mount /dev/sda3 sabayon
- mount -o bind /proc sabayon/proc
- chroot sabayon
- grub2-install /dev/sda3 --force (I guess its this step where it went /dev/null during installation process)
- equo update && equo install grub (this will auto generate the shiny
sabayon grub2 theme and detect the kernels)
- exit

Now reboot and there it is. Keep in mind that you still might need to append the maxcpus=1 flag to your line, to perm edit that line you can have a look in /boot/grub/grub.cfg