You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

120 lines
4.0KB

  1. The Package Catalog
  2. ###################
  3. ``dds`` stores a catalog of available packages, along with their dependency
  4. statements and information about how a source distribution thereof may be
  5. maintained.
  6. Viewing Catalog Contents
  7. ************************
  8. The default catalog database is stored in a user-local location, and the
  9. package IDs available can be listed with ``dds catalog list``. This will only
  10. list the IDs of the packages, but none of the additional metadata about them.
  11. .. _catalog.adding:
  12. Adding Packages to the Catalog
  13. ******************************
  14. There are two primary ways to add entries to the package catalog.
  15. Adding Individual Packages
  16. ==========================
  17. A single package can be added to the catalog with the ``dds catalog add``
  18. command:
  19. .. code-block:: text
  20. dds catalog add <package-id>
  21. [--depends <requirement> [--depends <requirement> [...]]]
  22. [--git-url <url> --git-ref <ref>]
  23. [--auto-lib <namespace>/<name>]
  24. The ``<package-id>`` positional arguments is the ``name@version`` package ID
  25. that will be added to the catalog. The following options are supported:
  26. ``--depends <requirement>``
  27. This argument, which can be specified multiple times to represent multiple
  28. dependencies, sets the dependencies of the package within the catalog. If
  29. the obtained package root contains a ``package.json5``, then the
  30. dependencies listed here must be identical to those listed in
  31. ``package.json5``, or dependency resolution may yield unexpected results.
  32. ``--git-url <url>``
  33. Specify a Git URL to clone from to obtain the package. The root of the
  34. cloned repository must be a package root, but does not necessarily need to
  35. have the ``package.json5`` and ``library.json5`` files if relying on the
  36. ``--auto-lib`` parameter.
  37. ``--git-ref`` **must** be passed with ``--git-url``.
  38. ``--git-ref <ref>``
  39. Specify a Git ref to clone. The remote must support cloning by the ref that
  40. is specified here. Most usually this should be a Git tag.
  41. ``dds`` will perform a shallow clone of the package at the specified
  42. Git reference.
  43. ``--auto-lib``
  44. This option must be provided if the upstream does not already contain the
  45. ``dds`` files that are necessary to export the library information. This
  46. can only be specified for packages that contain a single library root at
  47. the package root.
  48. The form of the argument is that of ``<namespace>/<name>``, where
  49. ``namespace`` and ``name`` are the usage requirement keys that should be
  50. generated for the library.
  51. Bulk Imports via JSON
  52. =====================
  53. The ``dds catalog import`` supports a ``--json`` flag that specifies a JSON
  54. file from which catalog entries will be generated.
  55. .. note::
  56. The ``--json`` flag can be passed more than once to import multiple JSON
  57. files at once.
  58. The JSON file has the following structure:
  59. .. code-block:: javascript
  60. {
  61. // Import version spec.
  62. "version": 1,
  63. // Packages section
  64. "packages": {
  65. // Subkeys are package names
  66. "acme-gadgets": {
  67. // Keys within the package names are the versions that are
  68. // available for each package.
  69. "0.4.2": {
  70. // `depends` is an object of dependencies for this
  71. // particular version of the package. (Optional)
  72. "depends": {
  73. // A mapping of package names to version ranges
  74. "acme-widgets": "^1.4.1"
  75. },
  76. // `description` is an attribute to give a string to describe
  77. // the package. (Optional)
  78. "description": "A collection of useful gadgets.",
  79. // Specify the Git remote information
  80. "git": {
  81. // `url` and `ref` are required.
  82. "url": "http://example.com/git/repo/acme-gadgets.git",
  83. "ref": "v0.4.2-stable",
  84. // The `auto-lib` is optional, to specify an automatic
  85. // library name/namespace pair to generate for the
  86. // root library
  87. "auto-lib": "Acme/Gadgets"
  88. }
  89. }
  90. }
  91. }
  92. }