Wednesday, January 18, 2012

Portable proplib: Vala bindings

We are investigating the Vala bindings for XBPS, but to make it fully work Portable proplib must be supported first. I started playing with `vala-gen-introspect` that created the .gi file required to create the final .vapi file with the Vala bindings; but after making the resulting vapi file couldn't compile a test code...

After some time I decided to modify the generated .vapi file manually, started reading the Vala Tutorial, and *et voilĂ *! the human modified vapi file works enough for simple test code.

This is the test code I used (please don't laugh, I've just started playing with Vala). This code just prints the value of the "pkgver" string object from plist file specified in argv[1]. The .vapi files is what specifies how to transform the Vala code into C code. The Vala bindings for the portable proplib can be found on:

using PropLib;

int main(string[] args) {
    unowned PDict pkgd;
    string val = null;

    pkgd = prop_dictionary_internalize_from_zfile(args[1]);   
    if (prop_dictionary_get_cstring_nocopy(pkgd, "pkgver", out val) == false) {
        stderr.printf("Missing pkgver obj\n");
        return 1;
    stdout.printf("%s\n", val);
    return 0;
To compile the source code use the following command (make sure that you have portable proplib installed with pkgconfig support):

$ valac --pkg proplib --vapidir=. test.vala
 If you've built successfully it should print something like:

$ ./test /var/db/xbps/metadata/kernel/props.plist


Wednesday, December 21, 2011

XBPS-0.11 released

After 2 months of active development a new major release of XBPS has been released: say hello to the 0.11 version. Here's the list of changes:

  • xbps-bin(8): it is possible now to reinstall a package even if it's installed with the '-f' option. If reinstalling the same package version, only unexistent files or files not matching its hash will be extracted.
  • While unpacking a binary package, always check that file to be extracted exists on filesystem, if true and its hash is matched, skip extraction.
  • While installing a package always preserve configuration files if they exist, but if hash don't match rename configuration files to filename.old.
  • New shared configuration file via libconfuse that replaces the plist configuration files: xbps.conf. That means that libxbps now requires confuse >=2.7 available at
  • Support for syslog logging common operations, such as install, update, remove and purge via LOG_NOTICE, and errors with LOG_ERR. By default it's always enabled, can be disabled thru the conf file.
  • xbps-repo(8): new target: pkg-list index?. This target will list all packages from repository with index index?. If optional argument index? (decimal) not set, all repositories will be used.
  • libxbps: when registering new packages, existing entries in requiredby matching the same pkgname/version touple are now simply skipped.
  • Repositories with missing index file are now simply ignored. It's expected that user executes 'xbps-repo sync' to fetch the index for all remote repositories specified in configuration file.
  • Faster binary package unpacking. Only files and symlinks are now extracted from binary packages, thus directories are not extracted anymore. The package builder is responsible to create required directories where appropiate and set correct permissions. While being here, some stuff is skipped now if a package uses the "preserve" keyword or package is being installed, resulting in a faster operation.
  • Implemented "New repository scheme and configuration file" from  issue 16 . The plist index file has been renamed to "index.plist", version bumped to 1.3. The configuration file (repositories.plist) now expect the full path to the directory storing the index.plist file. This will allow us to use other directories (such as non-free, or alike) for such purpose.
  • libxbps: improve xbps_purge_pkg() in case that the process was unexpectedly interrupted, do not error out unless the unregister phase returns an error value.
  • libxbps: when unpacking a package that replaced another package due to virtual packages, preserve its configuration files if they already existed.
  • xbps-bin(8)/xbps-repo(8): new flag '-o' (option). This can be used in the 'show' target to print only a set of objects stored in package's properties dictionary, example:
  •         $ xbps-bin -olicense show xbps
            Simplified BSD
            $ xbps-bin -oversion,build_date show xbps
            Wednesday 26 October, 2011, 14:37:31 UTC
  • libxbpps: when fetching new pkg-index.plist from a repository, make sure that it's a plist file and can be internalized; otherwise remove downloaded file and return error.
  • xbps-bin(8): new test for the 'check' target to fix missing entries in requiredby array, i.e reverse dependencies in the package database plist.
  • xbps-bin(8): the 'check' target now works virtual packages.
  • libxbps: failed to properly match installed virtualpkgs that were dependencies in a transaction, therefore resulting in real packages being reinstalled and replacing installed virtual packages. 
 Please visit for more information.

Wednesday, October 26, 2011

XBPS 0.10.1 released

A new (minor) version has been released with the following changes:

  • libxbps: fixed multiple free(3) calls in error paths (via closedir(3)) when some virtualpkg plist file couldn't be internalized.
  • xbps-bin(8): 'remove' with recursive flag (-R) now removes first the specified packages and puts its automatic dependencies at the tail of the array.
  • libxbps: xbps_pkgpattern_{name,version} now return expected pkgname/version if pattern is a shell wildcard pattern (fnmatch(3)).
  • libxbps: removed csh alternate code from the NetBSD's match code. We weren't using this code anyway and this only slowed down xbps_pkgpattern_match().
Please visit for more information.

Saturday, October 22, 2011

XBPS 0.10.0 released

After 3 months of active development, a new major release of XBPS has been released: say hello to the 0.10.0 version. Here's the list of changes:

  • Fixed issue 11 "xbps-bin fails to update properly some pkgs".
  • xbps-bin(8): the 'check' target now is able to detect if a package  was installed  manually and other packages are currently depending  on it and change its mode to "automatic", i.e as dependency of those  packages.
  • xbps-bin(8), xbps-repo(8): the -C flag now expects a path to a directory where the configuration files (conf.plist and repositories.plist) are stored.
  • New configuration scheme for virtual packages as defined in issue 12.XBPS now reads all plist files in PREFIX/etc/xbps/virtualpkg.d.wants directory with settings for the wanted virtual packages.
  • New configuration scheme as defined in issue 12: a directory to store XBPS configuration files is now used, by default set to PREFIX/etc/xbps. Configuration options are now set via conf.plist, and repositories in repositories.plist.
  • It is possible now to reinstall packages that provide virtual packages and put it back the original package, such as jpeg/libjpeg-turbo multiple times, without loosing important objects set when the original package was installed, i.e reverse dependencies and automatic installation. This is a requisite to really make a system that can be fully customizable and restored back to its original   state with the virtual packages feature.
  • Fixed issue 10 "HTTP repositories in non standard HTTP port currently segfault". You can now use any HTTP server in non standard ports, such as:        http://yourhost:8080/your/repo
  • xbps-bin(8): the 'check' target now detects broken symlinks and marks them as critical errors.
  • libxbps: when updating packages, only files that have been modified (compared to current installed file) are now unpacked. This should save some writes to storage and make the process a bit smoother as well.
  • Moved install transaction code to libxbps. The API has been extended with xbps_transaction_commit() which expects the transaction dictionary as its argument. This function will execute transaction tasks, like removing, updating, installing and configuring packages as defined in the transaction dictionary.
  • The 'cachedir' option in configuration file now can be changed to be relative to the rootdir if the first character is not '/'. The -c flag in xbps-bin(8) still expects a full path and if set, overrides the setting in configuration file.
  • xbps-bin(8): the 'show', 'show-deps' and 'show-revdeps' targets now work with virtual packages.
  • libxbps: fixed NetBSD's dewey matching code to properly identify that a version X.Y.Z should be greater than X.Y_Z.
  • libxbps: revamped virtual package handling. The public API find functions (xbps_find_pkg_*) don't know anything about virtual packages. To find virtual packages the xbps_find_virtualpkg_* functions must be used instead of the "classic" ones.
  • libxbps: the xbps_find_foo_in_array functions have been renamed to xbps_match_foo_in_array because its task is only matching against the provided package name, package pattern or string.

Please visit for more information.

Friday, May 27, 2011

XBPS 0.8.1 released

A new (minor) version has been released with the following changes:

  • xbps-bin(8)/xbps-repo(8): more meaningful messages when a package couldn't be found in the show, show-deps and show-files targets, rather than exiting silently with only the error return value.
  • Added three new objects for the package props.plist metadata file to specify homepage, license and build date.
  • Minor improvements to the generation of API documentation. 
Please visit for more information.

Tuesday, May 24, 2011

XBPS 0.8.0 released

After 4 months of active development, a new major release of XBPS has been released: say hello to the 0.8.0 version. Here's the list of changes:

  • xbps-bin(8): added -A and -M options, for setting package install reason to automatic or manual. Obviously both cannot be used togeter.
  • xbps-{bin,repo}(8): -c (cachedir) argument now is an absolute path and   not relative to the root directory.
  • Fixed a bug that made all registered repositories to fail when the first one couldn't be internalized in xbps_repository_pool_init().
  •  Moved the "replaces" handling logic into the API. But instead of removing any package, the packages that should be replaced are added into the transaction dictionary and marked as "remove". The frontend is responsible to install, update, configure and remove all packages by using the properties set in the transaction dictionary.
  • xbps-dgraph: now parses the "provides" object in the package properties  metadata plist file for packages providing virtual packages.
  • xbps-bin(8): added -R option for the "remove" target, to recursively remove packages that were installed automatically by the package(s) that we want to remove, and no other package currently depends on. This is much like the remove and autoremove targets together, i.e "xbps-bin -yp remove foo && xbps-bin -yp autoremove".
  • xbps-bin(8): added -D option to only show the URLs to download the binary packages required by the "install", "update" and "autoupdate" targets.
  • xbps-bin(8): make the list target (without arguments) only show packages that are fully installed. Previously packages in unpacked state were also shown.
  • Added support for virtual packages. A virtual package is one that doesn't exist in the repository, but other packages can provide it. A new array in the package properties dictionary has been added to specify which virtual packages the package supports. As an example, the `rsyslog' package provides the virtual package `syslog-daemon-0'. Other packages can depend in `syslog-daemon>=0' and `rsyslog' will satisfy the dependency.
  • Merged the `progress_callback' branch that makes possible to specify a   function callback to update progress while unpacking binary packages  and while fetching files. xbps-bin(8) now lists current extract files with its size in bytes if -v flag is set.
  • Improved package dependency resolution in repositories by using a new function, xbps_repository_pool_find_pkg() that returns a package dictionary found in the first repository registered in the pool. It can also be used to find the newest version found in all registered repositories.
  • Improved package dependency sorting algorithm that uses less memory, it is 60% faster approximately and as bonus sorts all packages in the way  they should be (previously the sorting was a bit different for packages with no run-time dependencies).
  • Many structural changes in the API. Made some stuff private and changed some function arguments in the API, the ABI is not compatible anymore with previous versions... anyway you shouldn't be using libxbps just yet. The API documentation has been modified to stay in sync with reality.
And some more changes I'm probably missing. You can see the full list here:

Enjoy and happy hacking!

Sunday, January 16, 2011

Portable proplib 0.5.1 released

A new version was released with the following changes:

  • Added pkg-config support and install a proplib.pc file.
  • Merged stuff from old subversion repo, that re-added the change to emit base 10 rather than base 16 for unsigned numbers contributed by Adam Hoka.
Please see for more information.

XBPS 0.7.3 released

 A new version has been released with the following changes:
  • Fixed a bug that made libxbps fail to detect properly configuration files. This made all updates in configuration files to be lost.
  • It is now possible to properly build against an external portable proplib (with pkg-config support) and libfetch.
  • Enabled a bunch of compiler warnings in the configure script (if supported by the compiler), and made symbol visibility dependent of configure tests.
  • Added --silent argument to the configure script, hiding compilation details in the build process (disabled by default). 

Please see for more information.