Monday, December 22, 2008

Gettext Variables

Recently i had trouble getting my zypper to talk in Slovak despite the correct locale set (using export LANG=sk_SK.utf8). I was so desperate after some time of searching for the cause that i even filed a bug report.

Well, it turned out that i forgot about one more variable, the LANGUAGE. This defines a language preference list and takes higher priority that LANG, or LC_* variables. Mine was set to en_US (i don't know why, though) :O(

So the fix for me was either to unset the LANGUAGE variable, or include sk in its value. Read more about this variable here.

Tuesday, December 9, 2008

RIS Specification Updated

I filled some missing parts in the Repository Index Service specification, mainly regarding client handling the repository index. I would consider it done already, but there are still a few things i would like to see done in the future:
  1. The distro_target attribute should be turned into some standard distribution identifier to make it really useful. The CPE looks like a good candidate.
  2. The spec does not say how to handle repositories of type unknown to the client. They should be ignored, but the type attribute of <repo> is currently optional so the type does not need to be known when refreshing the service. One solution could be to make the type attribute required, another could be to require that the client removes any repositories comming from a service that are of unknown type. The latter seems to be cumbersome, i would go for the former.
  3. It might be worth to add the examples from this Duncan's post to the page (they're much better than those of mine :O).
  4. The specification should not be kept solely as a wiki (should not be editable by broad public; version control is problematic, etc.). Any suggestion where it should be instead?
Feel free to drop a comment about the specification, or the concept, etc.

Some TODOs for libzypp:
todo: sync repo URI with the repoindex, if changed
todo: ignore repos with unknown type when refreshing service

Sunday, November 9, 2008

Zypper 1.0.0

We're closing to the release of openSUSE 11.1 and SUSE Linux Enterprise 11. Since zypper's releases are tightly tied to those of openSUSE, this is also an important milestone for zypper. Thus, the next release of zypper will have version 1.0.0. This marks more than two years of zypper's development and the outset of implementation of new nice features.

So what's next?

Several ideas and problems appeared so far. Some need to be implemented in libzypp itself, some are purely zypper's. Here is a list of the most important things for zypper 2.
  • Configuration file (.zypperrc).
  • Nice overall install progress.
  • Much improved install summary (options to view version/vendor/arch changes, changelog, ...).
  • More options to handle patterns (remove, install suggested, ...).
  • Advanced media error handling with options like eject DVD drive, select DVD drive, edit failed URI, enable/disable medium specific options.
  • Fixed or removed zypper shell (can it be useful enough to be worth to maintain it?)
  • Interface to new libzypp functionality like 'download only'.
  • and more...
First there will be some bug fixes during the beta phase of SLE 11, mainly with respect to compatibility with SLE 10 version of rug. These (and all following releses for SLE) will be versioned 1.0.x and will eventually get also to openSUSE 11.1 via online update. After that we're ready to work on zypper 2.

Stay tuned on, this TODO file, this blog and blogs of other ZYpp hackers (see my links).

Saturday, November 8, 2008

Zypper Command Reference

I needed an overview of all zypper's commands and options, so i created this little script that prints all the help texts. It can be used to search for options through all commands, or to create a reference sheet for printing like this:

$ ./zypper-help-all | fold -s | a2ps -rjB --columns 3 -o

todo: fix some inconsistencies in option names (see this thread for discussion)

todo: wrap the help texts at 79th column, bug #423007 (no more need for 'fold -s' in the command above)

Thursday, September 4, 2008

Convenient setters in C++?

Libzypp's RepoInfo class was originaly written with property setters returning a RepoInfo & reference to the modified object. This pattern is common in higher OO languages like Java and is convenient as it saves typing when setting serveral properties at once (i'm not sure how it is performance-wise).

RepoInfo repo;

// you write
.setName("Foo Project Repository")

// instead of
repo.setName("Foo Project Repository");

Unless the class is part of a class hierarchy, everything's OK. But after splitting RepoInfo to RepoInfoBase and a derived RepoInfo the dark side of C++ has shown up.

RepoInfo repo;
.setAlias("foo") // RepoInfoBase setter
.setEnabled(true) // RepoInfoBase setter
.setPriority(50); // RepoInfo setter - this won't compile becase setEnabled() returned
// a RepoInfoBase &, and C++ does not bother with figuring out that the
// object is also a RepoInfo.

In order to make this work in this setup, you have to redefine each setter from the base class in the derived class and make it return the reference to the derived class:

class RepoInfoBase
RepoInfoBase & setAlias( ... ) { _pimpl->alias = ...; return *this; }

class RepoInfo : public RepoInfoBase
RepoInfo & setAlias( ... )
{ RepoInfoBase::setAlias(...); return *this; }

but by doing this the RepoInfo class looses some of the advantages of being derived from RepoInfoBase.

So, is it best to stick with setters returning void, or is there a better way to do this?

Tuesday, June 24, 2008

zypper's wiki updated

openSUSE 11.0 is out so i synced zypper's usage page with it. This changes page may be of particular interest for those already familiar with zypper. I also took a while to reorganize the main page a bit.

If there is something wrong or something you'd like to see in those pages, let me know (or just add/change it). Feedback and help is welcome.

(Writing docs is quite some work, it took me whole week to update those pages and the man page (which still has some glitches). Didn't i already tell to myself that i must make sure to update them as soon as any change happens? Well, but that's one week less for development... :O) oh...)

Wednesday, May 7, 2008

More options to modifyrepo

In 10.3, zypper modifyrepo (mr) only allowed you to enable/disable one repository and enable/disable autorefresh for it. In 11.0 the options have grown in number a bit. Did i mention the nice help texts?

$ zypper help mr
modifyrepo (mr) <options> <alias|#|uri>
modifyrepo (mr) <options> <--all|--remote|--local|--medium-type>

Modify properties of repositories specified by alias, number or URI
or by the '--all, --remote, --local, --medium-type' aggregate options.

Command options:
-d, --disable Disable the repository (but don't remove it).
-e, --enable Enable a disabled repository.
-r, --refresh Enable auto-refresh of the repository.
-R, --no-refresh Disable auto-refresh of the repository.
-n, --name Set a descriptive name for the repository.
-p, --priority <1-99> Set priority of the repository.
-k, --keep-packages Enable RPM files caching.
-K, --no-keep-packages Disable RPM files caching.
-a, --all Apply changes to all repositories.
-l, --local Apply changes to all local repositories.
-t, --remote Apply changes to all remote repositories.
-m, --medium-type <type> Apply changes to repositories of specified type.

This is what you will see in zypper 0.11.3. The aggregate options (and the -k options) were added just recently by our new colleague Josef Reidinger. Those familiar with 10.3 zypper, note that the --enable-autorefresh/-a and --disable-autorefresh options are now deprecated (-a shorthand even had to be removed because of conflict with --all) in favor of --refresh and --no-refresh options. This change was introduced for the sake of consistency with other commands' options. All the options will be described in more detail in the man page soon.

Few examples

To disable autorefresh for all repositories, do:

$ zypper mr -Ra
Nothing to change for repository 'openSUSE-DVD 11.0'.
Autorefresh has been disabled for repository 'fate'.
Nothing to change for repository 'factory'.
Nothing to change for repository 'packman'.
Autorefresh has been disabled for repository 'factory-nonoss'.
Autorefresh has been disabled for repository 'factory-debug'.
Nothing to change for repository 'vbox'.
Autorefresh has been disabled for repository 'zypp:svn'.

To disable all cd/dvd repositories, do:

$ zypper mr -d -m cd -m dvd
Repository 'openSUSE-DVD 11.0' has been sucessfully disabled.

To enable RPM caching of RPM files for all remote (http/https/ftp) repositories, do:

$ zypper mr -kt
Nothing to change for repository 'factory'.
RPM files caching has been enabled for repository 'factory-debug'.
RPM files caching has been enabled for repository 'factory-nonoss'.
RPM files caching has been enabled for repository 'fate'.
Nothing to change for repository 'packman'.
RPM files caching has been enabled for repository 'vbox'.
RPM files caching has been enabled for repository 'zypp:svn'.

Of course don't forget to use zypper clean when you run out of free disk space then :O)

Missing history and bookmarks in Firefox 3?

In case you just updated to Firefox 3 (openSUSE 11.0 beta2 includes Firefox 2.9.95 (Firefox 3 beta 5) and you wondered why are your bookmarks and history not working, here is the probable cause & solution. Firefox 3 uses sqlite back-end for history, bookmarks and other stuff. So doing zypper in libsqlite3-0 and restarting firefox should make them work again.

Monday, May 5, 2008

zypper search is back

I said i would write about zypper's XML output almost two months ago. Hm... obviously other stuff gained higher priority (i will get back to the XML output later). In the openSUSE Updater applets, the focus has shifted from the zypp back-end to PackageKit and i focused on other zypper/libzypp features and fixes. I will write about them in the following few posts.

Just recently i re-enabled all the original zypper search functionality (except --match-all which will be hopefully comming soon). Apart from the original features, there is one frequently requested change in the presenation of the search results (and thanx to the zypp and sat-solver guys it is also fast :O).

The old zypper listed all available instances of a matching package, all versions from all repositories. But people are more often interested in what the package is about than what versions are available from each respository. Hence, since 0.11.1 you will see a list of packages grouped by their names and types with a summary column instead of repository and version column:

$ zypper search browser
Reading installed packages...

S | Name | Summary | Type
i | kim-browser | CIM Browser for CIM-XML Protocol | package
| mysql-query-browser | A Graphical MySQL Query Shell | package
| tvbrowser | digital TV guide | package

This output caught a few users unprepared. I hope learning that --details/-s can turn on a detailed list similar to the old one satisfied most of them:

$ zypper search -s browser
Reading installed packages...

S | Name | Type | Version | Arch | Repository
i | kim-browser | package | 0.3-208 | x86_64 | factory
v | kim-browser | package | 0.3-208 | i586 | factory
| mysql-query-browser | package | 5.0r12-183 | x86_64 | factory
| mysql-query-browser | package | 5.0r12-183 | i586 | factory
| tvbrowser | package | 2.6.3-22 | noarch | factory

Since zypper 0.11.2 the summaries will be abbreviated as needed to fit the width of your console screen. This is how it looks on an 80 character wide console:

$ search music
Reading installed packages...

S | Name | Summary | Type
| asc-music | Music for Advanced Strategic Command--> | package
| libmusicbrainz | Library That Provides Access to the M-> | srcpackage
| libmusicbrainz-devel | Include Files and Libraries Mandatory-> | package
| libmusicbrainz3 | Library That Provides Access to the M-> | srcpackage
| libmusicbrainz3-6 | Library That Provides Access to the M-> | package
| libmusicbrainz3-devel | Library That Provides Access to the M-> | package
i | libmusicbrainz4 | Library That Provides Access to the M-> | package
| texlive-bin-musictex | MusiXTeX and MusicTeX | package
| texlive-musictex | MusiXTeX and MusicTeX | package

Of course you can use --no-abbrev/-A global option to turn the abbreviation off - the output will be messy, but you can read the whole summaries. Another way to obtain this info is to use zypper info.

...and don't forget to try zypper help search, zypper has nice help texts :O) I'll be fixing zypper update and writing a lot of documentation in the meantime.

Thursday, March 6, 2008

bash completion for zypper

Version 0.10.3 of zypper will include a bash completion script written by Marek Stopka during Hack Week 2. The script uses zypper help [command] output to retrieve the list of commands and command options in order to feed it to the command line. Given the growing number of zypper's commands and options i believe this will be a pleasant help for many users.

Thanx to Marek for doing this!

Currently the script provides completion of commands and command options. This can be extended in the future to include package name completion for the install, remove and info commands, or even repository aliases for the repo handling commands and the --repo option.
Hi! In this blog i will write about my work on zypper or eventually libzypp and related stuff, plans, ideas... A few words about zypper's XML output, it's implementation and possibilities coming soon.