summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual/packages.rst
diff options
context:
space:
mode:
Diffstat (limited to 'documentation/dev-manual/packages.rst')
-rw-r--r--documentation/dev-manual/packages.rst143
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
259Furthermore, you need to reference :term:`SRCPV` in :term:`PV` in order to 255Furthermore, you need to include a ``+`` sign in :term:`PV` in order to
260automatically update the version whenever the revision of the source 256automatically update the version whenever the revision of the source
261code changes. Here is an example:: 257code changes. Here is an example::
262 258
263 PV = "1.0+git${SRCPV}" 259 PV = "1.0+git"
264
265The OpenEmbedded build system substitutes :term:`SRCPV` with the following:
266 260
267.. code-block:: none 261The OpenEmbedded build system will automatically add the source control
262information 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.
824Signing RPM Packages 819Signing RPM Packages
825-------------------- 820--------------------
826 821
827To enable signing RPM packages, you must set up the following 822To enable signing RPM packages, you must modify the ``rpm``
828configurations in either your ``local.config`` or ``distro.config`` 823recipe configuration to include support for OpenPGP signing.
829file:: 824That may be done either in a ``.bbappend`` for the ``rpm`` recipe::
825
826 PACKAGECONFIG:append = " sequoia"
827
828or in a :term:`Configuration File`::
829
830 PACKAGECONFIG:append:pn-rpm-native = " sequoia"
831 PACKAGECONFIG:append:pn-rpm = " sequoia"
832
833You 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:
887Testing Packages With ptest 892Testing Packages With ptest
888=========================== 893===========================
889 894
890A Package Test (ptest) runs tests against packages built by the 895See the :ref:`test-manual/ptest:Testing Packages With ptest` section of the
891OpenEmbedded build system on the target machine. A ptest contains at 896Yocto Project Test Environment Manual.
892least two items: the actual test, and a shell script (``run-ptest``)
893that starts the test. The shell script that starts the test must not
894contain the actual test --- the script only starts the test. On the other
895hand, the test can be anything from a simple shell script that runs a
896binary and checks the output to an elaborate system of test binaries and
897data files.
898
899The test generates output in the format used by Automake::
900
901 result: testname
902
903where the result can be ``PASS``, ``FAIL``, or ``SKIP``, and
904the testname can be any identifying string.
905
906For a list of Yocto Project recipes that are already enabled with ptest,
907see 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
914Adding ptest to Your Build
915--------------------------
916
917To add package testing to your build, add the :term:`DISTRO_FEATURES` and
918:term:`EXTRA_IMAGE_FEATURES` variables to your ``local.conf`` file, which
919is found in the :term:`Build Directory`::
920
921 DISTRO_FEATURES:append = " ptest"
922 EXTRA_IMAGE_FEATURES += "ptest-pkgs"
923
924Once your build is complete, the ptest files are installed into the
925``/usr/lib/package/ptest`` directory within the image, where ``package``
926is the name of the package.
927
928Running ptest
929-------------
930
931The ``ptest-runner`` package installs a shell script that loops through
932all installed ptest test suites and runs them in sequence. Consequently,
933you might want to add this package to your image.
934
935Getting Your Package Ready
936--------------------------
937
938In order to enable a recipe to run installed ptests on target hardware,
939you need to prepare the recipes that build the packages you want to
940test. 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
999Creating Node Package Manager (NPM) Packages 898Creating 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