aboutsummaryrefslogtreecommitdiff
path: root/docs/cpt.org
diff options
context:
space:
mode:
Diffstat (limited to 'docs/cpt.org')
-rw-r--r--docs/cpt.org81
1 files changed, 77 insertions, 4 deletions
diff --git a/docs/cpt.org b/docs/cpt.org
index 8f96981..caa35c9 100644
--- a/docs/cpt.org
+++ b/docs/cpt.org
@@ -481,6 +481,21 @@ the following =depends= file:
zlib
#+END_EXAMPLE
+** meta
+
+=meta= is a non-mandatory package file that can be used to provide information
+otherwise non-relevant to the functions of the package manager. This file can
+later be queried with the [[=pkg_query_meta()=][pkg_query_meta()]] function. The file has a simple
+markup format, it must adhere to the =KEY: VAL= format. An example for the =cpt=
+package would be as follows:
+
+#+begin_example
+description: Carbs Packaging Tools
+license: MIT
+maintainer: Linux User <linux-user@example.com>
+#+end_example
+
+
** post-install
:PROPERTIES:
:DESCRIPTION: The post-installation script
@@ -956,6 +971,8 @@ create_cache
pkg_build cpt
#+end_src
+*** TODO =pkg_depends()=
+
*** =pkg_owner()=
:PROPERTIES:
:DESCRIPTION: Check which package owns the given file
@@ -1025,13 +1042,69 @@ pkg_find 'cpt*' all
SEARCH_PATH=$PATH pkg_find 'cpt-*' all -x
#+end_src
-*** TODO =pkg_get_base()=
+*** =pkg_get_base()=
+:PROPERTIES:
+:DESCRIPTION: List system base packages
+:END:
-This function returns the base packages as defined in =/etc/cpt-base=.
+This function returns the base packages as defined in =/etc/cpt-base=. If an
+optional argument is present, it will print all package names in a single line.
+If it is not given any arguments, it will return one package per line. See [[CPT
+Base]] for more information on base packages.
-*** TODO =pkg_gentree=
+*** =pkg_gentree()=
:PROPERTIES:
:DESCRIPTION: Generate a dependency tree for the given package
:END:
-Keep in mind /etc/cpt-base
+This function generates a dependency tree for the given package. The output and
+the dependency generation can be configured through a series of keys given as
+the second argument. Those keys are:
+
+- =b= :: Include the base packages to the dependency tree.
+- =f= :: Include the given package itself to the generated tree.
+- =x= :: Do not include make dependencies of the package.
+- =r= :: Print the generated tree in reverse order.
+- =n= :: Print all packages in a single line instead of a package per line.
+
+**** Examples
+:PROPERTIES:
+:DESCRIPTION: Example usage for the =pkg_gentree= function
+:END:
+
+This example uses the =cpt= package for Carbs Linux. The package itself is
+listed to depend on =curl= and =rsync=. Here is the output of calling the
+function for cpt directly:
+
+#+begin_example
+$ pkg_gentree cpt
+bearssl
+ca-certificates
+zlib
+curl
+rsync
+#+end_example
+
+The example above shows that even though =cpt= itself only depends on =curl= and
+=rsync=, we also indirectly need =zlib=, =bearssl= (for =curl=), and
+=ca-certificates= (for =bearssl=).
+
+#+begin_src sh
+# Print the dependency tree reverse sorted in a single line:
+$ pkg_gentree cpt rn
+rsync curl zlib ca-certificates bearssl
+#+end_src
+
+*** =pkg_query_meta()=
+
+This function is used to query the [[meta][meta file]] inside package directories. It can
+be used to retrieve information on a package that is otherwise irrelevant to the
+package manager itself. It takes two arguments, first being the package and the
+second being the key to be retrieved. If the package does not have a =meta=
+file or the file does not contain the requested key, the function will return
+with 1.
+
+#+begin_src sh
+$ pkg_query_meta cpt description
+Carbs Packaging Tools
+#+end_src