pkgin (probably not weekly) news 3

Tags: ,
No Comments »

I’ve just commited 0.5.2.1. As the version shows, it is a bugfix release; is@ got a very nasty bug that took me a while to figure out. For 3 years, the only pkg_summary(5) format I’ve seen was:

PKGNAME=foo
[...]

or, in case of conflicting packages:

CONFLICTS=bar
CONFLICTS=baz
PKGNAME=foo
[...]

Well it turns out that we can also find:

PKGNAME=foo
CONFLICTS=bar
[...]

which is pretty annoying when it comes to stick to an anchor. Until now, I did the following:

static int
chk_pkgname(char *field)
{
        if (strncmp(field, "PKGNAME=", 8) == 0 ||
                strncmp(field, "CONFLICTS=", 10) == 0)
                return 1;

        return 0;
}
[...]
                /* browse entries following PKGNAME and build the SQL query */
                while (*psum != NULL && !chk_pkgname(*psum)) {
                        update_col(sum, pkgid, *psum);
                        psum++;
                }

But with that new case, I had to check a little bit further:

static int
chk_pkgname(char *field, char *last_field)
{
	if (strncmp(field, "PKGNAME=", 8) == 0)
		return 1;
	/* in some very rare cases, CONFLICTS appears *after* PKGNAME */
	if (strncmp(last_field, "PKGNAME=", 8) != 0 &&
		/* never seen many CONFLICTS after PKGNAME, but just in case... */
		strncmp(last_field, "CONFLICTS=", 10) != 0 &&
		strncmp(field, "CONFLICTS=", 10) == 0)
		return 1;

	return 0;
}
[...]
		/* browse entries following PKGNAME and build the SQL query */
		while (*psum != NULL && !chk_pkgname(*psum, *(psum - 1))) {
			update_col(sum, pkgid, *psum);
			psum++;
		}

I really don’t like the way it’s done but I’ve no sexier way in mind at the moment. Maybe after some glasses of wine…

pkgin 0.5.1 released

Tags: ,
No Comments »

Finally, here comes a release ! Read the full announcement and changelog on pkgsrc-users.

pkgin (probably not weekly) news 2

Tags: ,
No Comments »

And here we are for week 2 !

There have been some fixes last week, issues were mainly spotted by orgrim, thanks to him !

The big one concerns a type of dewey/glob I’ve never been through before:

libao-[a-z]*-[0-9]*

Until now, I was able to handle the following (from pkg_str.c)

/*
 * AFAIK, here are the dewey/glob we can find as dependencies
 *
 * foo>=1.0 - 19129 entries
 * foo<1.0 - 1740 entries (only perl)
 * foo>1.0 - 44 entries
 * foo< =2.0 - 1
 * {foo>=1.0,bar>=2.0}
 * foo>=1.0<2.0
 * foo{-bar,-baz}>=1.0
 * foo{-bar,-baz}-[0-9]*
 * foo-{bar,baz}
 * foo-1.0{,nb[0-9]*} - 260
 * foo-[0-9]* - 3214
 * foo-1.0 - 20
 */

As there was no “easy” way of handling those double-globs dependencies, I took a simple approach: resolve dependency with a matching package when the pattern is too complex (sqlite_callback.c):

    /* map corresponding pkgname */
    if ((pkg_map = map_pkg_to_dep(plisthead, deptree->depend)) != NULL)
        XSTRDUP(deptree->name, pkg_map->name);
    else
        /* some dependencies just don't match anything */
        XSTRDUP(deptree->name, DEPS_PKGNAME);

Only drawback, this takes a bit more time, but at last, there’s no possible error on dependency resolution. Maybe there’s some more optimizations I can do to reduce time taken with this mapping.

As planned, pkgin now depends on pkgsrc’s pkg_install, and the latter is pushed on top of the upgrade-list if there’s a new version.
I also fixed the many-versions-of-the-same-package problem with the following query (pkgindb_queries.c)

const char DIRECT_DEPS[] = /* prefer higher version */
    "SELECT REMOTE_DEPS_DEWEY, REMOTE_DEPS_PKGNAME "
    "FROM REMOTE_DEPS WHERE PKG_ID = "
    "(SELECT PKG_ID FROM REMOTE_PKG WHERE PKGNAME = '%s' "
    "ORDER BY FULLPKGNAME DESC LIMIT 1);";

Needs to be done:

  • Tests, tests, tests !
  • reproduce and fix 2 different bugs two users had; I’ve been unable to reproduce them at the moment
  • test Minix 3.2.0

pkgin (probably not weekly) news

Tags: , , , ,
1 Comment »

Foreword: this post will be written in english as many pkgin users don’t speak french. Sorry to my french readers then, and sorry also to my english readers as i’m not as fluent in english as i am in french :)

I subscribed to jmmv’s blog, The Julipedia, a while ago and found his idea of the “Kyua: Weekly status report” very inspiring, that’s a good way to keep your users informed on how the project is moving and keeps you focused on your TODO (although i hate TODO’s…). I doubt i’ll have the time to write a weekly report, but at last i’ll try to write a post whenever important updates are made to my beloved project.

So let’s begin !
As you, pkgin users, may be aware of, i’m working on the future 0.5 release, which includes massive internal changes plus some features that have been asked and i found interesting. So, in addition to the features i already listed in this mail sent to pkgsrc-users@, here are some hilights on recent changes:

  • pkgin now has a new logo !
  • it is now possible to export / import your keep-list, pretty much like dpkg‘s get/set-selection. The exported list is in pkg_chk‘s format. Thanks wiz@ for the idea
  • pkgin install can now take a “blob” as an argument, i.e. pkgin in 'mysql-server<5.5', thanks filip@ for the idea
  • pkgin now uses pkgsrc’s pkg_install for NetBSD also
  • added the -t modifier, mostly for debugging purposes, in order to trace the dependency tree and impact lists
  • pkg_install error logs are handled in a nicer way
  • enlisted pkgin’s code to ohloh (click on “i use this” !)
  • plus usual bugfixes

Yeah, these were fairly productive holidays :) Of course most of these changes are only available in CVS, see http://pkgin.net for details. Some of them have already made their way to pkgsrc-wip, i try not to insert big changes now, so wip and CVS should be sync’ed quite often.

Needs to be done:

  • make pkgin’s pkgsrc package depend on pkgsrc’s pkg_install
  • reproduce and fix 2 different bugs two users had
  • optimize the dependency loop regarding packages that exists in many versions (i.e. bash)
  • check if pkg_install is to be upgraded and then push it on top of ordered list
  • test Minix 3.2.0

Hope i’ll make it to pkgsrc 2011Q4 !

Tiled blingbling

No Comments »

Que voulez-vous, je n’y résiste pas, j’ai beau me monter des setups les plus light possibles, j’aime bien voir bouger des couleurs partout qui me disent comment vont les ressources de ma machine.

Ainsi, afin de maximiser l’occuppation de l’espace de l’écran de mon fidèle Samsung NC10, je décidai avant de partir en vacances d’affubler le NetBSD 5.1 qui tourne sur ce netbook du géstionnaire de fenêtres awesome.
Pour mon plus grand plaisir, ce n’est pas la version 3 qui est disponible dans nos repositories, je n’avais de toutes façons ni l’envie ni le temps d’apprendre le lua pour configurer mon environnement de travail.

Alors ouiiii je saiiis, j’arrive 5 ans après la bataille, tout le monde a déjà fait le tour du propriétaire et a basculé vers awesome3, z’avez qu’à être à jour sous NetBSD bande de glandeurs. Oui bah en attendant ça marche plutot pas mal et la conf est accessible. Aussi, je vous livre ici le boût de .awesomerc nécessaire à faire clignoter plein de bidules-sensors:

# [...]
    statusbar mystatusbar
    {
        position = "right"
# [...]
	iconbox cputemp { image = "/home/imil/gfx/icons/cpu-temp.png" }

	textbox "cpu_temp" { }

	iconbox battery { image = "/home/imil/gfx/icons/battery.png" }

	textbox "batt_charge" { }

	progressbar "wifi"
	{
		data "signal"
		{
			bordercolor = "#006e96"
			bg          = "#000000"
			fg          = "#7080ff"
			fg_off		= "#000000"
		}
		width = 10
		vertical = true
	}

	emptybox spacer1 { width = 5 }

	progressbar "hw"
	{
		data "cpu"
		{
			bordercolor = "#006e96"
			bg          = "#000000"
			fg          = "#3040f0"
			fg_center   = "#daaf0a"
			fg_end      = "#ff0000"
			fg_off		= "#000000"
		}
		data "mem"
		{
			bordercolor = "#006e96"
			bg          = "#000000"
			fg          = "#00ff00"
			fg_center   = "#daaf0a"
			fg_end      = "#ff0000"
			fg_off		= "#000000"
		}
		width = 20
		vertical = true
	}

	textbox "clock" { }
# [...]

Mais aussi et surtout, ce script qui envoie au window manager les informations nécessaires à la mise à jour des barres de progression et autres textbox. Ce dernier n’a d’intérêt, par rapport aux miliers d’exemples que l’on trouve déjà sur le web, qu’il s’applique à NetBSD.

#!/bin/sh

PATH=$PATH:/bin:/sbin:/usr/bin:/usr/sbin:/usr/pkg/bin:/usr/pkg/sbin

cpu_usage()
{
	up=`echo "$(uptime|sed -E 's/.*[^,]\ ([0-9\.]+),.*/\1/') * 100"|bc`

	echo 0 widget_tell mystatusbar hw data cpu $up
}

mem_usage()
{
	# pkgin install free pour ce sensor
	total=`free -m|grep ^Mem:|awk '{print $2}'`
	used=`free -m|grep ^Mem:|awk '{print $3}'`

	percent=`echo "scale=2;($used / $total) * 100"|bc`

	echo 0 widget_tell mystatusbar hw data mem $percent
}

clock()
{
	echo 0 widget_tell mystatusbar clock text " `date "+%D - %H:%M:%S"` "
}

wifi()
{
	sig=`wiconfig ath0|grep signal|sed -E 's/.*\[ [0-9]+ ([0-9]+).*/\1/'`

	echo 0 widget_tell mystatusbar wifi data signal $sig
}

cpu_temp()
{
	cpu_temp=`echo "($(envstat |grep cpu[0-9]|awk '{print $3}'|xargs|sed 's/ /+/'))/2"|bc`

	echo 0 widget_tell mystatusbar cpu_temp text "${cpu_temp}C"
}

batt_charge()
{
	bat=`envstat -s "acpibat0:charge"|grep charge|sed -E 's/.*\(([0-9]+)\.[0-9]+%\).*/\1/'`

	echo 0 widget_tell mystatusbar batt_charge text "$bat% "
}

while [ 1 ]; do
	cpu_temp
	batt_charge
	cpu_usage
	mem_usage
	clock
	wifi

	echo "" # flushes data
	sleep 1
done | awesome-client

Il conviendra d’ajouter ce script à votre .xinitrc si vous démarrez X11 via les commandes xinit ou startx. Pour info, le mien ressemble à ceci:

export SSH_ASKPASS=/usr/X11R7/bin/ssh-askpass

feh --bg-scale /home/imil/gfx/netbsd-rgb.png

xset m 1 1

/home/imil/bin/awe.sh &
exec ssh-agent sh -c 'ssh-add </dev/null && exec awesome'

Le screenshot ! le screenshot !
Allez.

Un logo en carton

Tags: , , ,
2 Comments »

J’aime aussi les vacances parce qu’elles me donnent des idées, et ce matin, alors que j’attendais que la piscine se réchauffe, j’ai pondu ça:

WP Theme & Icons based on GlossyBlue by N.Design Studio
Banner from www.trynthlas.com
Entries RSS Comments RSS Log in
Performance Optimization WordPress Plugins by W3 EDGE