diff options
Diffstat (limited to 'documentation/dev-manual/packages.rst')
-rw-r--r-- | documentation/dev-manual/packages.rst | 143 |
1 files changed, 21 insertions, 122 deletions
diff --git a/documentation/dev-manual/packages.rst b/documentation/dev-manual/packages.rst index e5028fffdc..8bd48c8e8f 100644 --- a/documentation/dev-manual/packages.rst +++ b/documentation/dev-manual/packages.rst | |||
@@ -16,7 +16,7 @@ This section describes a few tasks that involve packages: | |||
16 | - :ref:`dev-manual/packages:generating and using signed packages` | 16 | - :ref:`dev-manual/packages:generating and using signed packages` |
17 | 17 | ||
18 | - :ref:`Setting up and running package test | 18 | - :ref:`Setting up and running package test |
19 | (ptest) <dev-manual/packages:testing packages with ptest>` | 19 | (ptest) <test-manual/ptest:testing packages with ptest>` |
20 | 20 | ||
21 | - :ref:`dev-manual/packages:creating node package manager (npm) packages` | 21 | - :ref:`dev-manual/packages:creating node package manager (npm) packages` |
22 | 22 | ||
@@ -84,10 +84,6 @@ the following: | |||
84 | 84 | ||
85 | - :term:`PR`: The recipe revision. | 85 | - :term:`PR`: The recipe revision. |
86 | 86 | ||
87 | - :term:`SRCPV`: The OpenEmbedded | ||
88 | build system uses this string to help define the value of :term:`PV` when | ||
89 | the source code revision needs to be included in it. | ||
90 | |||
91 | - :yocto_wiki:`PR Service </PR_Service>`: A | 87 | - :yocto_wiki:`PR Service </PR_Service>`: A |
92 | network-based service that helps automate keeping package feeds | 88 | network-based service that helps automate keeping package feeds |
93 | compatible with existing package manager applications such as RPM, | 89 | compatible with existing package manager applications such as RPM, |
@@ -256,15 +252,14 @@ the software:: | |||
256 | 252 | ||
257 | SRCREV = "${AUTOREV}" | 253 | SRCREV = "${AUTOREV}" |
258 | 254 | ||
259 | Furthermore, you need to reference :term:`SRCPV` in :term:`PV` in order to | 255 | Furthermore, you need to include a ``+`` sign in :term:`PV` in order to |
260 | automatically update the version whenever the revision of the source | 256 | automatically update the version whenever the revision of the source |
261 | code changes. Here is an example:: | 257 | code changes. Here is an example:: |
262 | 258 | ||
263 | PV = "1.0+git${SRCPV}" | 259 | PV = "1.0+git" |
264 | |||
265 | The OpenEmbedded build system substitutes :term:`SRCPV` with the following: | ||
266 | 260 | ||
267 | .. code-block:: none | 261 | The OpenEmbedded build system will automatically add the source control |
262 | information to the end of the variable :term:`PKGV`, in this format:: | ||
268 | 263 | ||
269 | AUTOINC+source_code_revision | 264 | AUTOINC+source_code_revision |
270 | 265 | ||
@@ -824,9 +819,19 @@ to use signed package feeds (repositories) when doing a build. | |||
824 | Signing RPM Packages | 819 | Signing RPM Packages |
825 | -------------------- | 820 | -------------------- |
826 | 821 | ||
827 | To enable signing RPM packages, you must set up the following | 822 | To enable signing RPM packages, you must modify the ``rpm`` |
828 | configurations in either your ``local.config`` or ``distro.config`` | 823 | recipe configuration to include support for OpenPGP signing. |
829 | file:: | 824 | That may be done either in a ``.bbappend`` for the ``rpm`` recipe:: |
825 | |||
826 | PACKAGECONFIG:append = " sequoia" | ||
827 | |||
828 | or in a :term:`Configuration File`:: | ||
829 | |||
830 | PACKAGECONFIG:append:pn-rpm-native = " sequoia" | ||
831 | PACKAGECONFIG:append:pn-rpm = " sequoia" | ||
832 | |||
833 | You must also set up the following settings in a | ||
834 | :term:`Configuration File`:: | ||
830 | 835 | ||
831 | # Inherit sign_rpm.bbclass to enable signing functionality | 836 | # Inherit sign_rpm.bbclass to enable signing functionality |
832 | INHERIT += " sign_rpm" | 837 | INHERIT += " sign_rpm" |
@@ -887,114 +892,8 @@ related to signed package feeds are available: | |||
887 | Testing Packages With ptest | 892 | Testing Packages With ptest |
888 | =========================== | 893 | =========================== |
889 | 894 | ||
890 | A Package Test (ptest) runs tests against packages built by the | 895 | See the :ref:`test-manual/ptest:Testing Packages With ptest` section of the |
891 | OpenEmbedded build system on the target machine. A ptest contains at | 896 | Yocto Project Test Environment Manual. |
892 | least two items: the actual test, and a shell script (``run-ptest``) | ||
893 | that starts the test. The shell script that starts the test must not | ||
894 | contain the actual test --- the script only starts the test. On the other | ||
895 | hand, the test can be anything from a simple shell script that runs a | ||
896 | binary and checks the output to an elaborate system of test binaries and | ||
897 | data files. | ||
898 | |||
899 | The test generates output in the format used by Automake:: | ||
900 | |||
901 | result: testname | ||
902 | |||
903 | where the result can be ``PASS``, ``FAIL``, or ``SKIP``, and | ||
904 | the testname can be any identifying string. | ||
905 | |||
906 | For a list of Yocto Project recipes that are already enabled with ptest, | ||
907 | see the :yocto_wiki:`Ptest </Ptest>` wiki page. | ||
908 | |||
909 | .. note:: | ||
910 | |||
911 | A recipe is "ptest-enabled" if it inherits the :ref:`ref-classes-ptest` | ||
912 | class. | ||
913 | |||
914 | Adding ptest to Your Build | ||
915 | -------------------------- | ||
916 | |||
917 | To add package testing to your build, add the :term:`DISTRO_FEATURES` and | ||
918 | :term:`EXTRA_IMAGE_FEATURES` variables to your ``local.conf`` file, which | ||
919 | is found in the :term:`Build Directory`:: | ||
920 | |||
921 | DISTRO_FEATURES:append = " ptest" | ||
922 | EXTRA_IMAGE_FEATURES += "ptest-pkgs" | ||
923 | |||
924 | Once your build is complete, the ptest files are installed into the | ||
925 | ``/usr/lib/package/ptest`` directory within the image, where ``package`` | ||
926 | is the name of the package. | ||
927 | |||
928 | Running ptest | ||
929 | ------------- | ||
930 | |||
931 | The ``ptest-runner`` package installs a shell script that loops through | ||
932 | all installed ptest test suites and runs them in sequence. Consequently, | ||
933 | you might want to add this package to your image. | ||
934 | |||
935 | Getting Your Package Ready | ||
936 | -------------------------- | ||
937 | |||
938 | In order to enable a recipe to run installed ptests on target hardware, | ||
939 | you need to prepare the recipes that build the packages you want to | ||
940 | test. Here is what you have to do for each recipe: | ||
941 | |||
942 | - *Be sure the recipe inherits the* :ref:`ref-classes-ptest` *class:* | ||
943 | Include the following line in each recipe:: | ||
944 | |||
945 | inherit ptest | ||
946 | |||
947 | - *Create run-ptest:* This script starts your test. Locate the | ||
948 | script where you will refer to it using | ||
949 | :term:`SRC_URI`. Here is an | ||
950 | example that starts a test for ``dbus``:: | ||
951 | |||
952 | #!/bin/sh | ||
953 | cd test | ||
954 | make -k runtest-TESTS | ||
955 | |||
956 | - *Ensure dependencies are met:* If the test adds build or runtime | ||
957 | dependencies that normally do not exist for the package (such as | ||
958 | requiring "make" to run the test suite), use the | ||
959 | :term:`DEPENDS` and | ||
960 | :term:`RDEPENDS` variables in | ||
961 | your recipe in order for the package to meet the dependencies. Here | ||
962 | is an example where the package has a runtime dependency on "make":: | ||
963 | |||
964 | RDEPENDS:${PN}-ptest += "make" | ||
965 | |||
966 | - *Add a function to build the test suite:* Not many packages support | ||
967 | cross-compilation of their test suites. Consequently, you usually | ||
968 | need to add a cross-compilation function to the package. | ||
969 | |||
970 | Many packages based on Automake compile and run the test suite by | ||
971 | using a single command such as ``make check``. However, the host | ||
972 | ``make check`` builds and runs on the same computer, while | ||
973 | cross-compiling requires that the package is built on the host but | ||
974 | executed for the target architecture (though often, as in the case | ||
975 | for ptest, the execution occurs on the host). The built version of | ||
976 | Automake that ships with the Yocto Project includes a patch that | ||
977 | separates building and execution. Consequently, packages that use the | ||
978 | unaltered, patched version of ``make check`` automatically | ||
979 | cross-compiles. | ||
980 | |||
981 | Regardless, you still must add a ``do_compile_ptest`` function to | ||
982 | build the test suite. Add a function similar to the following to your | ||
983 | recipe:: | ||
984 | |||
985 | do_compile_ptest() { | ||
986 | oe_runmake buildtest-TESTS | ||
987 | } | ||
988 | |||
989 | - *Ensure special configurations are set:* If the package requires | ||
990 | special configurations prior to compiling the test code, you must | ||
991 | insert a ``do_configure_ptest`` function into the recipe. | ||
992 | |||
993 | - *Install the test suite:* The :ref:`ref-classes-ptest` class | ||
994 | automatically copies the file ``run-ptest`` to the target and then runs make | ||
995 | ``install-ptest`` to run the tests. If this is not enough, you need | ||
996 | to create a ``do_install_ptest`` function and make sure it gets | ||
997 | called after the "make install-ptest" completes. | ||
998 | 897 | ||
999 | Creating Node Package Manager (NPM) Packages | 898 | Creating Node Package Manager (NPM) Packages |
1000 | ============================================ | 899 | ============================================ |
@@ -1125,7 +1024,7 @@ The ``devtool edit-recipe`` command lets you take a look at the recipe:: | |||
1125 | npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ | 1024 | npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \ |
1126 | " | 1025 | " |
1127 | 1026 | ||
1128 | S = "${WORKDIR}/npm" | 1027 | S = "${UNPACKDIR}/npm" |
1129 | 1028 | ||
1130 | inherit npm | 1029 | inherit npm |
1131 | 1030 | ||