The times they are a changin’

•May 30, 2011 • Leave a Comment

Everything changes, so do our packages. But change needs to be explained in order to become relevant. Regarding packaging, this involves the art of writing good changelog entries. Here is an example from an otherwise very capable packager:

  • Spec files updates:
    • Changes in License.
    • Updates in Group:, Summary: and %description entries.
    • Updates in %build section for lib64 compilation.
    • Minor other updates.

More often, a reviewer stumbles upon those classics:

  • Fixed build
  • Fixed dependencies
  • Changed license to $FOO

These lines surely took some time to write but they explain only what was changed, not why. The ‘what’ is easily visible from the diff of the old and new package version (kindly provided by the Open Build Service), but it’s the ‘why’ that matters. Your benevolent Factory review team kindly overlooks such insignificant matters most of the time, but you may leave your users baffled. Changelogs usually serve a purpose, for the package reviewer it’s ‘Why should I take the time to look at this at all and why does it belong into Factory?’. For the user it’s simply, ‘Dang, yet another update, why’s that for?’. You better provide some good answers for those questions or your carefully crafted fix may remain misjudged. As a reference you may use guides that others have written. They’re mostly about VCS commit messages, but it’s the same thing:

Happy changelog writing!

Importing Amarok statistics into Clementine

•April 27, 2011 • 12 Comments

Recently, I switched from Amarok to Clementine for my daily music needs. Clementine is basically a port of the old Amarok 1.4 to Qt4 with some fancy features added. However, my old Amarok database is full of playcounts, scores and ratings for my music, so I wrote this little shell script to import it into Clementine’s SQLite database:  
https://github.com/saschpe/amarok2clementine

It updates (i.e. overwrites) both scores and ratings and adds your old (Amarok) playcounts to the playcounts in Clementine. Note that it is not particularly fast as it uses neither MySQL’s nor SQLite’s C/C++ library interface but the respective command line tools instead. In case anything goes wrong, you will find a backup of your Clementine database in /tmp/clementine.db.backup. Enjoy!

Summer of Code approaches

•February 21, 2011 • Leave a Comment

As in the past years, Google’s Summer of Code is going to happen again and we’re currently collecting ideas for openSUSE. So if you want to support your favorite distribution or seek a way to getting involved more deeply, be sure to check out our GSoC info page.

Or, if you want it cross-distro, the awesome Build Service always needs some helping hands that are curious on how to expand it’s massive feature set :-) . This includes adding support for currently unsupported distros like Arch Linux or Pardus as well as making it’s web user interface more social.

Feel free to add you ideas to our list and discuss them on our IRC channel (#opensuse-project on FreeNode).

I can haz groups in deh Build Service!

•February 18, 2011 • Leave a Comment

A new feature of the upcomming openSUSE Build Service release is the revised role management for users and groups in the web user interface:

As you can see, all the available roles are now directly exposed, allowing you to manage all users and groups for your project or package in one place. Currently, group creation is reserved to administrators, but that is likely to change soon. So for now you have to bug your local OBS admin if you need a new group.

On splitting strings

•February 17, 2011 • 2 Comments

Splitting strings is cool, but most languages have their subtle differences in how it is done. The three contenders are JavaScript, Python and Ruby. As an example, suppose you’re getting a string in the form “type_role_name” and you want to split it into type, role, name. The little twist here is that ‘name’ can also contain underscores. Let’s start reversed, it’s an easy job in Ruby:

irb> type,role,name = "user_admin_john_doe".split('_', 3)
=> ["user", "admin", "john_doe"]

Ruby’s split method want’s to know how much pieces you want. Onwards with Python:

>>> type,role,name = 'user_admin_john_doe'.split('_', 2)
('user', 'admin', 'john_doe')

I prefer this style slightly, as you have to express how many splits you want. The mindset here is that when you’re saying ‘split twice’, you’re expecting that the last element may contain the remainder of the string. By contrast, when saying, ‘give me three pieces’, it is unclear whether you want the remainder or not. Besides that, both are equally cool. Last but not least, how to do it in JavaScript? Well, turns out it’s rather messy:

“user_admin_john_doe”.split(‘_’, 3)
["user", "admin", "john"]

Altough this is somewhat similar to Ruby (i.e. ‘gimme three pieces’), it continues to split and discards the remaining stuff. Furthermore, JavaScript doesn’t support multiple assigment (could also be called iterable unpacking), so you have to store the result into an array first and assign individually. But more importantly, how to get “john_doe”? Turns out that you have to fiddle with splitting off substrings:

str = "user_admin_john_doe"
type = str.slice(0, str.indexOf('_'));
str = str.slice(str.indexOf('_') + 1);
role = str.slice(0, str.indexOf('_'));
str = str.slice(str.indexOf('_') + 1);
name = str

Not exactly what I would call elegant but it does the trick. I’d say, it’s a draw game between Python and Ruby, whereas JavaScript failed big time :-)

Getting the sources of your RPMs

•February 17, 2011 • Leave a Comment

According to the GPL, you have to provide the source code of any (GPL-licensed) software you distribute (i.e. package and publish). Traditionally, this is satified by Linux distributions in several ways. Like any other package management system, RPM metadata contains the URL of the upstream project that created the software. This is where the (unmodified) source code can be retrieved.

But, packaging almost always means modifying the original sources. This could be in order to add patches or to make it conform better to certain (distro-specific) conventions. Therefore, distros offer a download repository where you can fetch source RPMs, i.e. packages which distribute the modified sources (containing the spec file, patches and additional files).

However, out of curiosity or to contribute back, you may want to know where exactly your package is maintained and developed. Luckily, packages that originate from one of the many Build Service instances (like build.opensuse.orgpackman.links2linux.com or build.meego.com) have that information:

% rpm -q --qf "%{DISTURL}\n" bash   obs://build.opensuse.org/openSUSE:Factory/standard/fd6e76cd402226c76e65438a5e3df693-bash

Now you can copy this URL into your browser, replace ‘obs:’ with ‘http:’ and you should see something interesting :-) Well, this is gonna be part of the next OBS release, for now you have to modify the URL slightly further to use the OBS test instance (stage):


https://build.opensuse.org/stage/openSUSE:Factory/standard/fd6e76cd402226c76e65438a5e3df693-bash

Additionally, you could simply put the disturl into the Build Service search and it will come up with the same results. Now you can inspect the development history (revisions) of the package, see who did it and become a part of it! The only thing that is left would be a RPM patch allowing a saner syntax, like:

% rpm -q --disturl bash

Reclaim me blocks!

•December 20, 2010 • Leave a Comment

Ever wondered why your filesystems fill up so quickly and why those new discs aren’t as big as advertised? While the latter may have several reasons (measuring units, the metric system or just damn lies), it may also be just an overly precautious default filesystem setting. On Linux, every filesystem gets some 5% of the available blocks reserved for the root user. This way, you can still work on your machine even if you forgot to rotate your log files Changing this default to something more realistic on today’s big hard discs may come with a nice surprises. Here’s my laptops root partition before:

saschpe@minime:~% df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 168G 144G 16G 91% /

Now let’s do a courageous tune2fs changing this to 0.2% (more than enough to be able to login and remove logfiles):
sudo tune2fs -m 0.2 /dev/sda1

And check again:

saschpe@minime:~/download% df -h
Filesystem Size Used Avail Use% Mounted on
/dev/sda1 168G 144G 24G 86% /

How neat, 8 fresh new gigs of storage :-)

 
Follow

Get every new post delivered to your Inbox.