Greetings,

The following webrev contains fixes for the following issues:

  11522 pkg should require publisher prefix to match repository information
  7156 client image api needs image creation interface
  12744 update_publisher over-zealously testing publisher validity
  14203 image-create usage doesn't mention mirror / origin options

webrev:
http://cr.opensolaris.org/~swalker/pkg-11522/

======================================================================
Overview
======================================================================
The pkg(1) command and the pkg.client.api now validate publisher information provided by users against that (if available) provided by publisher origin(s) (repositories).

In addition, users are no longer required to provide the publisher prefix, only the repository URI when adding new publishers or creating an image.

Note that this change does constitute somewhat of a flag day as repository administrators that have not properly configured their repositories may cause problems for their end-users.

Finally, validation is not enforced for existing publishers except when adding new origins.

======================
pkg.client.api changes
======================
Version 32:
Incompatible with clients using versions 0-31.

    The ImageInterface class has changed as follows:
        * The add_publisher and update_publisher methods now validate
          the image's publisher configuration against the origins of
          the publisher.  If any of the origins are found to not match,
          an UnknownRepositoryPublishers exception will be raised.

    The pkg.client.api module has changed as follows:
        * A new method named image_create has been added.  See 'pydoc
          pkg.client.api' for details.

    The pkg.client.api_errors modules has changed as follows:
        * UnknownRepositoryPublishers, RepoPubConfigUnavailable, and
          UnknownErrors expections have been added for use by the
          pkg.client.api.  API consumers are reminded that they should
          catch all ApiException class exceptions, although catching
          specific exception subclasses for case-by-case handling in
          addition to that is acceptable.

===================
pkg(1) image-create
===================
The image-create -p option now accepts either <prefix>=<uri> or <uri>.

If no prefix is provided, all publishers known to the provided repository (indicated by the URI) will be added to the image during creation along with description, origins, mirrors, alias, etc.

For example:

$ pfexec pkg image-create -p http://pkg.opensolaris.org/dev /path/to/image

...would create an image with a publisher that has the following information:

    {
      "alias": "",
      "name": "opensolaris.org",
      "packages": [],
      "repositories": [
        {
          "collection_type": "core",
"description": "This repository serves the currently in-development release\nof OpenSolaris. For production-quality release bits, see\n<a href=\"http://pkg.opensolaris.org/release\";>the Release repository</a>.\n<p>\nTo switch your system to the in-development release of OpenSolaris\n(the \"dev\" release), you can issue the following commands:\n<pre>\n$ pfexec pkg set-publisher -O http://pkg.opensolaris.org/dev opensolaris.org\n$ pfexec pkg image-update\n</pre>\n<p>\nFor more about OpenSolaris:\n<ul>\n<li>Visit <a href=\"http://www.opensolaris.com\";>opensolaris.com</a>\n<li>Visit <a href=\"http://www.opensolaris.org\";>opensolaris.org</a>\n<li><a href=\"http://www.opensolaris.com/get/index.jsp\";>Download ISO Images</a>\n</ul>\n<p>Note that when you see a link in a list of packages like this:\n<blockquote>\n<a class=\"p5i\"\ntitle=\"Launch the Package Manager and install this package\"\nhref=\"../p5i/0/gcc-dev.p5i\">Install gcc-dev</a>\n</blockquote>\nyou can click it (if you are on an OpenSolaris 2009.06 or later system)\nto launch the package manager and install the package.\n</p>",
          "legal_uris": [
            "http://www.opensolaris.org/os/copyrights/";,
            "http://www.opensolaris.org/os/tou/";,
            "http://www.opensolaris.org/os/trademark/";
          ],
          "mirrors": [],
          "name": "OpenSolaris Development Release Packaging Repository",
          "origins": [
            "http://pkg.opensolaris.org/dev/";
          ],
          "refresh_seconds": 14400,
          "registration_uri": "",
          "related_uris": [
            "http://pkg.opensolaris.org/contrib";
          ]
        }
      ]
    }


If a prefix is provided, it will be required to match the repository's publisher configuration information. As an example, if the user attempted this:

$ pfexec pkg image-create -p dev=http://pkg.opensolaris.org/dev /path/to/image

...the user would receive this error:

pkg image-create:
The repository at the location listed below does not contain
package data for dev; only opensolaris.org:

http://pkg.opensolaris.org/dev

This is either because the repository location that was provided
is not valid, or because the provided publisher information does
not match that known by the repository.

====================
pkg(1) set-publisher
====================
The set-publisher subcommand now validates publisher configuration as image-create does above when adding publishers, or adding new origin(s) to an existing publisher.

The set-publisher subcommand has a new -p option that accepts a repository URI that can be used for auto-configuration of publishers. It works the same as the image-create -p option, with the exception that existing publishers found in the retrieved publisher configuration information will be updated if the provided URI is already listed in their origins.

When adding new publishers using -p, the set-publisher command will tell the user what publishers were added and updated:

$ pfexec pkg set-publisher -p http://pkg.opensolaris.org/dev --all
pkg set-publisher:
  Added publisher(s): opensolaris.org

or

$ pfexec pkg set-publisher -p http://pkg.opensolaris.org/dev opensolaris.org
pkg set-publisher:
  Added publisher(s): opensolaris.org

If a user wanted to update the 'opensolaris.org' publisher with the newest available configuration information (origins and mirrors), they would execute the same command:

$ pfexec pkg set-publisher -p http://pkg.opensolaris.org/dev --all
pkg set-publisher:
  Updated publisher(s): opensolaris.org

or

$ pfexec pkg set-publisher -p http://pkg.opensolaris.org/dev opensolaris.org
pkg set-publisher:
  Updated publisher(s): opensolaris.org

This would *add* any new origins or mirrors found, but would not remove any that already exist. It will also update the client's copy of the repository's description, refresh_seconds, legal_uris, collection_type, registration_uri, and related_uris. Finally, it will set the 'alias' for the publisher if the user has not configured one already.

Cheers,
--
Shawn Walker
_______________________________________________
pkg-discuss mailing list
[email protected]
http://mail.opensolaris.org/mailman/listinfo/pkg-discuss

Reply via email to