Skip to content

Commit

Permalink
docs: fix tutorial on how to create a package slice for chisel (canon…
Browse files Browse the repository at this point in the history
…ical#648)

* fix(docs/how-to/code/create-slice/openssl.yaml): updated tutorial openssl.yaml from chisel-releases to fix missing slice

* fix(docs/how-to/chisel/create-slice.rst): updated tutorial create-slice.rst to reflect new example openssl.yaml

* Update docs/how-to/chisel/create-slice.rst

Co-authored-by: Cristovao Cordeiro <[email protected]>

* fix(docs/how-to/chisel/create-slice.rst): suggestion broke line limit in linter

---------

Co-authored-by: Cristovao Cordeiro <[email protected]>
  • Loading branch information
clay-lake and cjdcordeiro authored Jul 23, 2024
1 parent 513ff8b commit 6259339
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 23 deletions.
21 changes: 14 additions & 7 deletions docs/how-to/chisel/create-slice.rst
Original file line number Diff line number Diff line change
Expand Up @@ -129,13 +129,17 @@ Create a new YAML file named ``openssl.yaml``, with the following content:
.. literalinclude:: ../code/create-slice/openssl.yaml
:language: yaml

Notice the unforeseen new slice ``config``. Because your OpenSSL binaries depend
on the OpenSSL configuration files, and those were not yet present anywhere in
the Chisel releases upstream, you also need to create that slice! You may also
ask **"why not put those configuration files inside the "bins" slice"**? You
could! But we recommend, as a best practice, to separate and group contents
according to their nature, as you may tomorrow need to create a new slice
definition that only needs the OpenSSL configurations and not the binaries.
Notice the additional new slices ``config``, ``data`` and ``copyright``. The
OpenSSL package includes files other than binaries, some of these files may be
required depending on the specific use of OpenSSL. It is beneficial to separate
and group the contents of a package according to their nature, allowing
developers to select only the files they require. For example, one developer may
require the ``bins`` and ``config`` slices of a package, while another only
requires the ``config`` slice as a dependency of another package. Our
`contribution guidelines`_ provides more details on best practices for creating
new slices.



And that's it. This is your brand new slice definitions file, which will allow
Chisel to install **just** the OpenSSL binaries (and their dependencies) into
Expand All @@ -148,3 +152,6 @@ publish it upstream for others to use, please check the following guides.
https://github.com/canonical/chisel-releases/blob/ubuntu-22.04/slices/libc6.yaml
.. _libssl3:
https://github.com/canonical/chisel-releases/blob/ubuntu-22.04/slices/libssl3.yaml
.. _contribution guidelines:
https://github.com/canonical/chisel-releases/blob/main/CONTRIBUTING.md

45 changes: 29 additions & 16 deletions docs/how-to/code/create-slice/openssl.yaml
Original file line number Diff line number Diff line change
@@ -1,19 +1,32 @@
package: openssl

essential:
- openssl_copyright

slices:
bins:
essential:
- libc6_libs
- libc6_config
- libssl3_libs
- openssl_config
contents:
/usr/bin/c_rehash:
/usr/bin/openssl:
bins:
essential:
- libc6_config
- libc6_libs
- libssl3_libs
- openssl_config
contents:
/usr/bin/c_rehash:
/usr/bin/openssl:

config:
contents:
/etc/ssl/certs/:
/etc/ssl/openssl.cnf:
/etc/ssl/private/:
/usr/lib/ssl/certs:
/usr/lib/ssl/openssl.cnf:
/usr/lib/ssl/private:

data:
contents:
/usr/lib/ssl/cert.pem: {symlink: /etc/ssl/certs/ca-certificates.crt}

config:
contents:
/etc/ssl/private/:
/etc/ssl/openssl.cnf:
/usr/lib/ssl/certs:
/usr/lib/ssl/openssl.cnf:
/usr/lib/ssl/private:
copyright:
contents:
/usr/share/doc/openssl/copyright:

0 comments on commit 6259339

Please sign in to comment.