pkcon list-install foo.package-list

In newer versions of gnome-packagekit there’s a tool called gpk-service-pack:

Service Pack Creator
Service Pack Creator

This tool I’ve explained in the past, and there is now lots of information and diagrams in the help file about how it all works and what the point of the tool is. Anyway, the point of this blog post isn’t to promote service packs; it’s to scratch an itch that I see coming up when Fedora 10 is released.

The tool exposed one detail to the user: a package list.

This is a simple text file such as hughsie-laptop-f9.package-list. This file allows tools to operate on other similar computers with different packages installed. It’s really just a simple list of all the packages installed. It’s contents and format are unimportant for now as it lets you do some cool stuff.

My personal situation, right now: I’m running a F9/F10/rawhide-ish laptop that I’ve been running for a few months, installing packages using yum, rpm and PackageKit, and have now got all the packages I need for building all my stuff, and all the programs I need on a day-to-day basis.
When F10 comes out, I normally nuke / and reinstall from the live CD as I’ve got so much cruft and brokenness from the months of a rawhide development cycle. On the first boot, I run:

yum -Y install <paste long list of packages from a tomboy note that's got bigger over the years>

Now, what I need is an admin tools that says:

  1. Capture all the package names on my old system
  2. Show me all the differences between what I had then, and what I have now
  3. Use the old package list to install all my normal stuff, not specifying versions

So, two hours of hacking later:

  1. pkcon list-create hughsie-laptop-f9.package-list
  2. pkcon list-diff hughsie-laptop-f9.package-list
  3. pkcon list-install hughsie-laptop-f9.package-list

I know I can do some of step 3 using a custom kickstart if I wanted, but I normally don’t know what I install manually. Maybe it’s only me that’ll find this useful. Code is in git. itch2scratch–;

gnome-power-manager and DeviceKit-power

DeviceKit-power is a system activated service I’ll be writing about in detail in a blog post in the near future. It’s a bit like HAL, but makes common API calls easy for applications (is battery power low?) and also moves the battery profiling down to the system layer from the session so it works for all users and more importantly from the GDM login screen. It’s very lightweight and low on resource usage when it’s active.

Here are some screenshots from gnome-power-manager trunk (compile with –enable-devkit-power).

Statistics profile for my battery
Statistics profile for my battery
History for my Watts Up Pro
History for my Watts Up Pro

The monitor device is a Watts Up Pro device. As you plug it in, DeviceKit-power opens the device, and starts reading data. I’m using it here to monitor my power strip with my laptop and all the power-warts attached. I’ll be converting gnome-power-manager to use DeviceKit-power rather than HAL during the next release cycle. Hopefully, I’ll maintain both HAL and DeviceKit-power backends, although this isn’t making the number of #ifdefs any smaller, which sucks from a readability point of view.

The GUI’s are pretty raw, so suggestions and criticisms are welcome.

DeviceKit-power latency control

We all know controlling latency is the best way to control power consumption and still have a usable system. Putting the processor into deeper sleep states saves power, but it takes longer to come back to running. On pretty much all devices it’s all a trade off between time and power.

org.freedesktop.DeviceKit.Power.Latency is a DBus interface implemented by DeviceKit-power. It allows applications to request target latencies, for example a couple of seconds CPU-DMA latency for an IM application, or a few hundred microseconds of network latency for a multiplayer game. The lowest value of each latency type is used for the userspace->kernel interface, and then what do do is left for the kernel drivers themselves.

Use cases:

  • I want my IM application to request 0.5s latency for messages
  • I’m running an OpenGL simulation and want maximum performance, even on battery
  • I’m running an SQL server for a credit card company, and want the server to request low latency CPU and network as any delay costs money
  • I’m an admin, and want to change the power consumption vs. latency from cron scripts so it uses high latency during the night for maximum power saving, and low latency during business hours.
  • I want high throughput when copying files, but want low throughput for downloading updates in the background.
  • I want my power manager to set all latencies to lowest when on AC power
  • I don’t want my users messing with latency settings
  • I’m and admin and I want to be able to override all latency settings on my machines

Now, I want to build a system-activated service to manage this, so people that don’t care don’t have an extra process running. We can use PolicyKit to control all the authentication, and build up a service for applications and admins to use. This will be suitable for system services and desktop applications.

Why don’t applications use the PMQoS interface directly? Well, by providing a framework we can override requests by admin policy, and also control requests. You also can’t set latencies unless you’re the root user, which is not suitable for the desktop use case.

I’ve put an interface file up here.

Comments? Suggestions? Thanks.

QPackageKit into PackageKit

A C++ QT library for PackageKit has just been merged into PackageKit git master. It was written by Adrien Bustany, and it being used by KPackageKit.

The QT library is being built with cmake, but the PackageKit project uses autotools. I want to keep the cmake bit in lib/libpackagekit-qt and just get automake to run cmake for me to generate the makefile.

Worst case scenario, we just have to built the library using some futzing in the distro spec file, but this isn’t ideal.

Has anyone got any experience or pointers for this?

Thanks.

Software Log Viewer

PackageKit has always had a log viewer, but I would be the first to admit that it looked shite, and wasn’t really useful for anybody.

I’ve spent a couple of hours, adding more columns and adding a filter facility so that you can narrow down the results to something useful.


Use cases for this tool:

  • Something in yesterdays automatic update broke firefox. What was updated?
  • Did I update firefox last week?
  • (for backends that support rollback) Take me to the snapshot before I installed XFCE

Comments welcome.

Service Pack GUI?

As part of GSoC 2008, Shishir Goel added Service Pack functionality to PackageKit. To explain what a service pack is, it’s best to show a few use-cases.

  1. You have seven desktops you’ve just installed with Fedora 9. Each one needs to have 204Mb of updates installed.
  2. You have a laptop that needs network drivers before it can download updates, and you have a similar up to date laptop with internet access nearby. The network drivers require a ton of dependencies, and other packages to be upgraded before they will install.
  3. You frequently install Linux on other peoples computers. You carry around a live-cd and a pendrive with a single 204Mb file “Fedora-updates-SP1.servicepack” which contains all the updates since last week.

Now, you may or may not know, that you have been able to install .servicepack files since PackageKit 0.3.2 — but creating them has always been tricky. Yesterday I spent a few hours rewriting some of the client code, and making the pkgenpack command line options more sane.

The pkgenpack is a command line tool for creating service pack files. You can find out more information about how it works by reading the man page.
Yes, I know the man page formatting sucks, suggestions on how to fix (and patches!) welcome.

Internally, the pack file is just an uncompressed tarball, with the packages and a single metadata.conf file inside. The metadata file is just the distro_id (name, version, arch, etc) and the time of creation. This ensures you don’t try installing a fedora-9-i386 service pack on a ubuntu-intrepid-ppc machine. In this case you also get a nice error message telling you what you did wrong.

Now, command line tools are all the rage these days, but what about a GUI? I mocked this up in glade yesterday, and wouldn’t take too long to turn into an actual program.

Comments?

PackageKit self checks

PackageKit is quite a complicated code base. As with all my projects, there is a substantial self check framework that’s designed to catch bugs and regressions before we push releases. This was something enforced by my previous employer, but I’m sure it’s a good idea for any non-trivial code base, and it’s something I’ll continue to do.

Self check example
Self check example

The number of tests currently:

daemon: 216
libpackagekit: 202
gnome-packagekit: 75

The tests are all injecting valid and invalid input and then testing if the code does the right thing. This works really well for the daemon and the library, but does not work well for the GUI applications that need a full GUI framework.

I’ve tried dogtail, but I’m finding it hard to use, and really wanted something I could integrate with my existing system in C. Do any of you hackers recommend anything in particular or should I persist with dogtail? So far it’s looking best of the bunch.

PackageKit Collections

From PackageKit 0.3.3 onwards, a new type of package is supported called a collection.

 What gpk-application looks like with collection support

A collection is a metapackage that can represent a group, where the package mapping is done inside the backend. It is not like a catalog where an external file provides a meta-group. This enables the “group install” and “group remove” functionality people have been requesting since version 0.1.0, without get another abstract group mapping or extra API to support.

I’ve made a few changes in the daemon to properly support this new type, and in the yum backend Tim Lauridsen has added support using the comps group mapping. Mike Langlie has drawn us some great icons, and Anders F Björklund implemented collections for smart, and helped us with the design process. The extra type should be trivial to add to other backends too.

We added the feature in just a few hours of hacking, as everyone was working together. I’m amazed at how people work together so well all over the globe, in different timezones and with different work priorities – thanks guys.

Comments, as always, appreciated