2013/06/24

pkg 1.1

After almost a year of development pkg 1.1 has reached the ports tree, actually pkg 1.1.1 has 1.1 was too buggy :(

What happened in 1 year of development (I'll focus on use visible features)

multi-repository

The multi-repository support was experimental in pkg 1.0 and to be honest it was not really usable. With pkg 1.1 the support has been greatly improved and it is now the default behaviour (you can't deactivate).

To define repository you just have to create a simple configuration file in /usr/local/etc/pkg/repos/myrepo.conf

myrepo:
  url: http://myurl
  pubkey: /usr/local/etc/pkg/repos/myrepo.key
  mirror_type: SRV

Meaning you can provide a package to autosetup a repository creating a package containing like this one:

$ tar tf myrepo-1.0.txz
+MANIFEST
/usr/local/etc/pkg/repos/myrepo.conf
/usr/local/etc/pkg/repo/myrepo.key

Host this file somewhere and say to the use to do the following

$ pkg add http://yourhost/myrepo-1.0.txz

Now you can see that the repository is configured properly pkg -vv should show you in the last lines:

Repositories:
  packagesite:
                    url: http://private.etoilebsd.net/91-default-server
                    key:
                enabled: yes
            mirror_type:
  myrepo:
                    url: http://myurl
                    key: /usr/local/etc/pkg/repos/myrepo.key
                enabled: yes
            mirror_type: SRV

The user can also choose to make sure a given package will always be updated from 'myrepo'

$ pkg install -r myrepo mypackage
$ pkg annotate -A mypackage reposiroty myrepo

Now the package 'mypackage' will only be updated from 'myrepo'

pkg lock/unlock

If a use want to prevent a package from being updated anyway he can just lock it:

$ pkg lock mypackage

To unlock it just update use the following command:

$ pkg unlock mypackage

ssh transport

If your server has pkg 1.1+ installed then you do not need so set up a HTTP server or a FTP server, pkg can now use ssh to share the packages

packagesite: ssh://user@host:/path

Or in the repository configuration:

url: ssh://user@host:/path

Do not forget to restrict on the server the directory where files can be retrieved by adding the following line on the server pkg.conf:

SSH_RESTRICT_DIR: /path

annotate

This allows to add any key/value annotation to a given package once installed, if you recreate the package after that, the annotation will be added to the manifest and then a new reinstallation will keep the annotation.

plugins

pkg now supports 2 kind of plugins: commands (to add new subcommand to pkg) and hooks (which will be executed in the middle of any process of pkg).

I'll write another post dedicated to plugins later.

explained reinstallation

As pkg is able to determine that a package needs to be reinstalled because the remote one has been compiled with new options or the required shared libraries for the package has changed, pkg now explains why a package will be reinstalled.

misc

We have stabilized the public API, so now bindings, and program using libpkg are more than welcome :) Lots of cleanup has occurred in the code, and lots of code optimisation. New pkg_printf(3) function to help printing a preparing strings with pkg informations. We are more and more adding some regressions test using the ATF framework. The catalog has changed and is now a simple yaml files which gives us more flexibility and allow simples incremental update. pkg audit can now directly read the vuxml native format.

Way more things but I'll let you discover :)

Thanks to all people that has been involved in the new release (coders, testers, doc writers, etc.)

Tim wrote on 2013/07/05 :

In the man page for pkg.conf, I see a line that says "To use multiple repositories, specify the primary repository as shown above". I do not, however see anything "above" telling me how to do so.

How do I specify the primary repository in a multi-repo setup? Also, does the pkg.conf file stay in the default location?

TIA for your help and information.


bapt wrote on 2013/07/08 :

I will fix the man page thanks for reporting.

The main repository is the packagesite from pkg.conf if defined.

If not defined it will be the first found in /usr/local/etc/pkg/repos/*.conf


Tim wrote on 2013/07/13 :

Thanks for your responsiveness. I also found that within the *.conf files mentioned above, indenting of lines other than the first one (which contains the name of the repository as it will appear in the list of available repo's). Failure to do so apparently causes them not to appear in the list.


I found this out through experimentation, and am not sure whether this is by design (e.g., required by YAML), or a bug.


Bapt wrote on 2013/07/13 :

From my understanding it is by design (required by YAML)


Name :
URL (optional) :
Write here: "ETOOMUCHSPAM"
Comments :