You are viewing illiterat

James Antill

Sep. 26th, 2011

03:05 pm - XML grep

For a long time I've wanted to be able to do an "XML grep" on XML data, where I see just the nodes I care about in an XML file. After recently hitting this problem again, I found out about xmlstarlet and after a _lot_ of work I managed to get what I wanted. So I figured I'd write it down, for both of us:

xmlstarlet sel -I -t \
  -m '/updates/update' \
  -i 'pkglist/collection/package[@name="raydium"]' \
  -c . \
  /var/cache/yum/x86_64/15/updates/gen/updateinfo.xml


...I'll explain each line of the above:

Tags: ,

May. 19th, 2011

02:02 pm - A few things you might not know about RHEL-6.1+ yum

Time to look at a few features of yum in RHEL-6.1 now that it's released

Jun. 11th, 2010

04:34 pm - Yum "update" from F-11 to F-13, with some help from distro-sync

Here is my experience of updating a machine from F-11 to F-13, on 2010-05-30, with plain yum over ssh. I got all the info. from "yum history", and had a little help from "distro-sync" which is only in rawhide's yum atm. Read more...Collapse )

Jan. 22nd, 2010

08:42 pm - Explaining: "Warning: RPMDB altered outside of yum."

What does it mean?

The yum message "Warning: RPMDB altered outside of yum." or, as the yum message said for a few months, "Warning: RPMDB has been altered since the last yum transaction." means some application has altered the rpm database (installed or removed a package) without going through the Yum APIs. This is almost always due to someone using rpm directly (Ie. rpm -ivh blah.rpm), but another possibility is an application built on top of the rpm APIs (Ie. smart, apt, zypp). While it's possible that someone has hacked your machine and altered the rpmdb maliciously, it would have to be done poorly to trigger this warning.

Read more...Collapse )

Oct. 8th, 2009

05:15 pm - Multiple problems with multiple versions

I've now seen a few requests for yum which can be generalized as "work better with multiple versions of packages". So I decided to write this, instead of replying N times to all the different requests.

Read more...Collapse )

Tags: , ,
Current Mood: pensivepensive

Jul. 31st, 2009

02:47 pm - Lies, damn lies, and benchmarks

Or why I hate "quick benchmarks"...

Recently I've started to see a lot more of what I'd call "quick benchmarks", often it's to do with yum but mainly I think that's because those tend to get sent to me by multiple methods. So I thought I'd try and write down why I react so negatively/dismissively to them, how people can spot the underlying problems that annoy me and even better some advise on how you can go about doing some real benchmarks if that kind of thing interests you (but it's much more work than quick benchmarks).

The summary of the problem is that quick software benchmarking often involves taking a huge amount of differences between two applications and have a single number result. Then you compare just the numbers, and come to a conclusion. So X gets 3 and Y gets 5 for problem ABCD ... therefore Y is 66% worse than X at ABCD. Except that might be a highly misleading (or worse) conclusion, for a number of reasons:

Read more...Collapse )

Apr. 29th, 2009

06:57 pm - BugZilla feature of the year -- recent (commented) history

Something I've wanted for a long time is "show me the BugZilla tickets which I've looked at "recently" (last day, week, etc.). Like almost everyone else I speak to I get by saving all my bugzilla email and then doing seartches in evolution.

However today ajaxxx found/used advanced bugzilla search options to give a page which has the recent most history of comments you've done. This isn't quite the same as being able to see everything that you've looked at, but it's pretty close.

The url and the saved search

The search works due to two "advanced features: 1. Selecting yourself as the commentator: <field0-1-0=commenter>, <type0-1-0=equals>, and <value0-1-0=%user%> and 2. Selecting comment changes that happened after 8 days ago <field0-0-0=longdesc>, <type0-0-0=changedafter>, and <value0-0-0=8d>. The "8d" part can obviously be changed to reflect different history. To experience the feature a full working URL is: here

I also created a saved search called Commented in last 8 days. You may also want to change your column layout to include the changed time (alas. I don't know of any way to create a custom view for just a single search, *sigh*).

Bonus: search for bad attachment types

Another problem I hit a lot is that python code tracebacks in plain text, but users often leave the "crash" as the default application/octet-stream ... which means it can't be viewed. Really I'd like BugZilla to notice this, and fix it. But after seeing the above search I created: YUM* weird attachments, which searches for any BZ (belonging to the yum group) that has an attachment of type application-octet/stream that isn't obsoleted. Then it's a simple matter of manually fixing the problem bugs.

Update: 2009-04-30 --

Thanks to mcepl, I've now fixed the "shared" links so the should work for everyone != me :).

Apr. 3rd, 2009

06:37 pm - Why trusted third party repos. will always be a bad idea

Why not make third party repos. first class

Every now and again, someone takes a look at apt/yum/zypper/smart/PK/whatever and decides that although they have support for third party repos. it's "too annoying" for third parties to get users or for users to use them and so this is a problem which needs to be fixed. Another way this is presented is that the package managers should support "One Click Install". I will hopefully explain (once and for all) why this isn't a problem, and what third parties can do to get what they actually want (to make their users lives easier).

Read more...Collapse )

Sep. 2nd, 2008

10:06 pm - A quick explanation of package sizes in yum and rpm

It's pretty common to think that a specific thing always has a specific size, and people tend to think of an "rpm package" as a single object thus. the it's common to ask what is "the size of an rpm". However if you have a 1MB text file, and gzip compresses it to 50KB which you then upload to a HTTP server you now have at least 3 different sizes: text size; compressed size and upload size (includes HTTP headers etc.) and asking for the size. So it is with rpm packages, and their many sizes.

The three common sizes of an rpm package

I'm going to use the yum package object notation to explain the common different sizes, as those are the easiest to see/use (see my previous post on how to simply get package objects from yum):

How are those values calculated?

rpm calculates the RPMTAG_SIZE value as the simple summation of the sizes of all the files within the rpm. rpm calculates the RPMTAG_ARCHIVESIZE value as the value of the cpio archive within the rpm, after decompression. These values are often very close. As I said above the pkg.packagesize value for .rpm files is just that value returned by stat(2).

So, what is pkg.size and why does it change?

Within yum there is a pkg.size, which maps to pkg.packagesize, which is used in all UI code that just wants to know "the size" of a package. This value has the property that the value you get for "need to download X bytes to install" and "will free up X bytes on removal" is correct, which is what most people want to see most of the time. However using this value does mean that the "the size of the rpm package" changes after you install an rpm, so it can be confusing if you try and compare pkg.size values between installed and available packages (either via. yum info, or looking at the values presented when installing a new kernel and removing an old one, say).

So, what's the best way to compare the size of an rpm package?

As you can see above, archivesize is the same for an available package and an installed one. So if you install the yum-lsit-data plugin, you can use "yum --showduplicates info-archive-sizes <pkgs>". Also you can always compare with just the available packages (and not installed ones), for instance "repoquery --show-duplicates --qf '%{nevra} %{archivesize} %{size}\n' <pkgs>"

Tags: , ,

Aug. 29th, 2008

08:49 pm - Programming with Yum in 5 minutes, or so

There are a lot of lines of code in yum, and it can be somewhat intimidating at first glace. However a significant amount of effort has been made to make simple things easy, and the hard things not so hard. The start of any code using yum, will almost certainly have these four lines (and always the first and last one :).

    1 #! /usr/bin/python -tt
    2 
    3 import os
    4 import sys
    5 import yum

Those lines just tell python, you'd you'd like to be able to use the yum code, and some stuff for the OS. Next the first bit of real code, and something which is also in almost every piece of code using yum:

    7 yb = yum.YumBase()

This creates a yum instance, that you can work with. Then one more piece, that is very useful:

    9 yb.conf.cache = os.geteuid() != 0

This just tells the yum instance not to try and update any of it's data, as the caller of the script probably hasn't got the permissions to do so.

Read more...Collapse )

Navigate: (Previous 10 Entries)