packages.rst 48 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798991001011021031041051061071081091101111121131141151161171181191201211221231241251261271281291301311321331341351361371381391401411421431441451461471481491501511521531541551561571581591601611621631641651661671681691701711721731741751761771781791801811821831841851861871881891901911921931941951961971981992002012022032042052062072082092102112122132142152162172182192202212222232242252262272282292302312322332342352362372382392402412422432442452462472482492502512522532542552562572582592602612622632642652662672682692702712722732742752762772782792802812822832842852862872882892902912922932942952962972982993003013023033043053063073083093103113123133143153163173183193203213223233243253263273283293303313323333343353363373383393403413423433443453463473483493503513523533543553563573583593603613623633643653663673683693703713723733743753763773783793803813823833843853863873883893903913923933943953963973983994004014024034044054064074084094104114124134144154164174184194204214224234244254264274284294304314324334344354364374384394404414424434444454464474484494504514524534544554564574584594604614624634644654664674684694704714724734744754764774784794804814824834844854864874884894904914924934944954964974984995005015025035045055065075085095105115125135145155165175185195205215225235245255265275285295305315325335345355365375385395405415425435445455465475485495505515525535545555565575585595605615625635645655665675685695705715725735745755765775785795805815825835845855865875885895905915925935945955965975985996006016026036046056066076086096106116126136146156166176186196206216226236246256266276286296306316326336346356366376386396406416426436446456466476486496506516526536546556566576586596606616626636646656666676686696706716726736746756766776786796806816826836846856866876886896906916926936946956966976986997007017027037047057067077087097107117127137147157167177187197207217227237247257267277287297307317327337347357367377387397407417427437447457467477487497507517527537547557567577587597607617627637647657667677687697707717727737747757767777787797807817827837847857867877887897907917927937947957967977987998008018028038048058068078088098108118128138148158168178188198208218228238248258268278288298308318328338348358368378388398408418428438448458468478488498508518528538548558568578588598608618628638648658668678688698708718728738748758768778788798808818828838848858868878888898908918928938948958968978988999009019029039049059069079089099109119129139149159169179189199209219229239249259269279289299309319329339349359369379389399409419429439449459469479489499509519529539549559569579589599609619629639649659669679689699709719729739749759769779789799809819829839849859869879889899909919929939949959969979989991000100110021003100410051006100710081009101010111012101310141015101610171018101910201021102210231024102510261027102810291030103110321033103410351036103710381039104010411042104310441045104610471048104910501051105210531054105510561057105810591060106110621063106410651066106710681069107010711072107310741075107610771078107910801081108210831084108510861087108810891090109110921093109410951096109710981099110011011102110311041105110611071108110911101111111211131114111511161117111811191120112111221123112411251126112711281129113011311132113311341135113611371138113911401141114211431144114511461147114811491150115111521153115411551156115711581159116011611162116311641165116611671168116911701171117211731174117511761177117811791180118111821183118411851186118711881189119011911192119311941195119611971198119912001201120212031204120512061207120812091210121112121213121412151216121712181219122012211222122312241225122612271228122912301231123212331234123512361237123812391240124112421243124412451246124712481249125012511252
  1. .. SPDX-License-Identifier: CC-BY-SA-2.0-UK
  2. Working with Packages
  3. *********************
  4. This section describes a few tasks that involve packages:
  5. - :ref:`dev-manual/packages:excluding packages from an image`
  6. - :ref:`dev-manual/packages:incrementing a package version`
  7. - :ref:`dev-manual/packages:handling optional module packaging`
  8. - :ref:`dev-manual/packages:using runtime package management`
  9. - :ref:`dev-manual/packages:generating and using signed packages`
  10. - :ref:`Setting up and running package test
  11. (ptest) <dev-manual/packages:testing packages with ptest>`
  12. - :ref:`dev-manual/packages:creating node package manager (npm) packages`
  13. - :ref:`dev-manual/packages:adding custom metadata to packages`
  14. Excluding Packages from an Image
  15. ================================
  16. You might find it necessary to prevent specific packages from being
  17. installed into an image. If so, you can use several variables to direct
  18. the build system to essentially ignore installing recommended packages
  19. or to not install a package at all.
  20. The following list introduces variables you can use to prevent packages
  21. from being installed into your image. Each of these variables only works
  22. with IPK and RPM package types, not for Debian packages.
  23. Also, you can use these variables from your ``local.conf`` file
  24. or attach them to a specific image recipe by using a recipe name
  25. override. For more detail on the variables, see the descriptions in the
  26. Yocto Project Reference Manual's glossary chapter.
  27. - :term:`BAD_RECOMMENDATIONS`:
  28. Use this variable to specify "recommended-only" packages that you do
  29. not want installed.
  30. - :term:`NO_RECOMMENDATIONS`:
  31. Use this variable to prevent all "recommended-only" packages from
  32. being installed.
  33. - :term:`PACKAGE_EXCLUDE`:
  34. Use this variable to prevent specific packages from being installed
  35. regardless of whether they are "recommended-only" or not. You need to
  36. realize that the build process could fail with an error when you
  37. prevent the installation of a package whose presence is required by
  38. an installed package.
  39. Incrementing a Package Version
  40. ==============================
  41. This section provides some background on how binary package versioning
  42. is accomplished and presents some of the services, variables, and
  43. terminology involved.
  44. In order to understand binary package versioning, you need to consider
  45. the following:
  46. - Binary Package: The binary package that is eventually built and
  47. installed into an image.
  48. - Binary Package Version: The binary package version is composed of two
  49. components --- a version and a revision.
  50. .. note::
  51. Technically, a third component, the "epoch" (i.e. :term:`PE`) is involved
  52. but this discussion for the most part ignores :term:`PE`.
  53. The version and revision are taken from the
  54. :term:`PV` and
  55. :term:`PR` variables, respectively.
  56. - :term:`PV`: The recipe version. :term:`PV` represents the version of the
  57. software being packaged. Do not confuse :term:`PV` with the binary
  58. package version.
  59. - :term:`PR`: The recipe revision.
  60. - :term:`SRCPV`: The OpenEmbedded
  61. build system uses this string to help define the value of :term:`PV` when
  62. the source code revision needs to be included in it.
  63. - :yocto_wiki:`PR Service </PR_Service>`: A
  64. network-based service that helps automate keeping package feeds
  65. compatible with existing package manager applications such as RPM,
  66. APT, and OPKG.
  67. Whenever the binary package content changes, the binary package version
  68. must change. Changing the binary package version is accomplished by
  69. changing or "bumping" the :term:`PR` and/or :term:`PV` values. Increasing these
  70. values occurs one of two ways:
  71. - Automatically using a Package Revision Service (PR Service).
  72. - Manually incrementing the :term:`PR` and/or :term:`PV` variables.
  73. Given a primary challenge of any build system and its users is how to
  74. maintain a package feed that is compatible with existing package manager
  75. applications such as RPM, APT, and OPKG, using an automated system is
  76. much preferred over a manual system. In either system, the main
  77. requirement is that binary package version numbering increases in a
  78. linear fashion and that there is a number of version components that
  79. support that linear progression. For information on how to ensure
  80. package revisioning remains linear, see the
  81. ":ref:`dev-manual/packages:automatically incrementing a package version number`"
  82. section.
  83. The following three sections provide related information on the PR
  84. Service, the manual method for "bumping" :term:`PR` and/or :term:`PV`, and on
  85. how to ensure binary package revisioning remains linear.
  86. Working With a PR Service
  87. -------------------------
  88. As mentioned, attempting to maintain revision numbers in the
  89. :term:`Metadata` is error prone, inaccurate,
  90. and causes problems for people submitting recipes. Conversely, the PR
  91. Service automatically generates increasing numbers, particularly the
  92. revision field, which removes the human element.
  93. .. note::
  94. For additional information on using a PR Service, you can see the
  95. :yocto_wiki:`PR Service </PR_Service>` wiki page.
  96. The Yocto Project uses variables in order of decreasing priority to
  97. facilitate revision numbering (i.e.
  98. :term:`PE`,
  99. :term:`PV`, and
  100. :term:`PR` for epoch, version, and
  101. revision, respectively). The values are highly dependent on the policies
  102. and procedures of a given distribution and package feed.
  103. Because the OpenEmbedded build system uses
  104. ":ref:`signatures <overview-manual/concepts:checksums (signatures)>`", which are
  105. unique to a given build, the build system knows when to rebuild
  106. packages. All the inputs into a given task are represented by a
  107. signature, which can trigger a rebuild when different. Thus, the build
  108. system itself does not rely on the :term:`PR`, :term:`PV`, and :term:`PE` numbers to
  109. trigger a rebuild. The signatures, however, can be used to generate
  110. these values.
  111. The PR Service works with both ``OEBasic`` and ``OEBasicHash``
  112. generators. The value of :term:`PR` bumps when the checksum changes and the
  113. different generator mechanisms change signatures under different
  114. circumstances.
  115. As implemented, the build system includes values from the PR Service
  116. into the :term:`PR` field as an addition using the form "``.x``" so ``r0``
  117. becomes ``r0.1``, ``r0.2`` and so forth. This scheme allows existing
  118. :term:`PR` values to be used for whatever reasons, which include manual
  119. :term:`PR` bumps, should it be necessary.
  120. By default, the PR Service is not enabled or running. Thus, the packages
  121. generated are just "self consistent". The build system adds and removes
  122. packages and there are no guarantees about upgrade paths but images will
  123. be consistent and correct with the latest changes.
  124. The simplest form for a PR Service is for a single host development system
  125. that builds the package feed (building system). For this scenario, you can
  126. enable a local PR Service by setting :term:`PRSERV_HOST` in your
  127. ``local.conf`` file in the :term:`Build Directory`::
  128. PRSERV_HOST = "localhost:0"
  129. Once the service is started, packages will automatically
  130. get increasing :term:`PR` values and BitBake takes care of starting and
  131. stopping the server.
  132. If you have a more complex setup where multiple host development systems
  133. work against a common, shared package feed, you have a single PR Service
  134. running and it is connected to each building system. For this scenario,
  135. you need to start the PR Service using the ``bitbake-prserv`` command::
  136. bitbake-prserv --host ip --port port --start
  137. In addition to
  138. hand-starting the service, you need to update the ``local.conf`` file of
  139. each building system as described earlier so each system points to the
  140. server and port.
  141. It is also recommended you use build history, which adds some sanity
  142. checks to binary package versions, in conjunction with the server that
  143. is running the PR Service. To enable build history, add the following to
  144. each building system's ``local.conf`` file::
  145. # It is recommended to activate "buildhistory" for testing the PR service
  146. INHERIT += "buildhistory"
  147. BUILDHISTORY_COMMIT = "1"
  148. For information on build
  149. history, see the
  150. ":ref:`dev-manual/build-quality:maintaining build output quality`" section.
  151. .. note::
  152. The OpenEmbedded build system does not maintain :term:`PR` information as
  153. part of the shared state (sstate) packages. If you maintain an sstate
  154. feed, it's expected that either all your building systems that
  155. contribute to the sstate feed use a shared PR Service, or you do not
  156. run a PR Service on any of your building systems. Having some systems
  157. use a PR Service while others do not leads to obvious problems.
  158. For more information on shared state, see the
  159. ":ref:`overview-manual/concepts:shared state cache`"
  160. section in the Yocto Project Overview and Concepts Manual.
  161. Manually Bumping PR
  162. -------------------
  163. The alternative to setting up a PR Service is to manually "bump" the
  164. :term:`PR` variable.
  165. If a committed change results in changing the package output, then the
  166. value of the PR variable needs to be increased (or "bumped") as part of
  167. that commit. For new recipes you should add the :term:`PR` variable and set
  168. its initial value equal to "r0", which is the default. Even though the
  169. default value is "r0", the practice of adding it to a new recipe makes
  170. it harder to forget to bump the variable when you make changes to the
  171. recipe in future.
  172. If you are sharing a common ``.inc`` file with multiple recipes, you can
  173. also use the :term:`INC_PR` variable to ensure that the recipes sharing the
  174. ``.inc`` file are rebuilt when the ``.inc`` file itself is changed. The
  175. ``.inc`` file must set :term:`INC_PR` (initially to "r0"), and all recipes
  176. referring to it should set :term:`PR` to "${INC_PR}.0" initially,
  177. incrementing the last number when the recipe is changed. If the ``.inc``
  178. file is changed then its :term:`INC_PR` should be incremented.
  179. When upgrading the version of a binary package, assuming the :term:`PV`
  180. changes, the :term:`PR` variable should be reset to "r0" (or "${INC_PR}.0"
  181. if you are using :term:`INC_PR`).
  182. Usually, version increases occur only to binary packages. However, if
  183. for some reason :term:`PV` changes but does not increase, you can increase
  184. the :term:`PE` variable (Package Epoch). The :term:`PE` variable defaults to
  185. "0".
  186. Binary package version numbering strives to follow the `Debian Version
  187. Field Policy
  188. Guidelines <https://www.debian.org/doc/debian-policy/ch-controlfields.html>`__.
  189. These guidelines define how versions are compared and what "increasing"
  190. a version means.
  191. Automatically Incrementing a Package Version Number
  192. ---------------------------------------------------
  193. When fetching a repository, BitBake uses the
  194. :term:`SRCREV` variable to determine
  195. the specific source code revision from which to build. You set the
  196. :term:`SRCREV` variable to
  197. :term:`AUTOREV` to cause the
  198. OpenEmbedded build system to automatically use the latest revision of
  199. the software::
  200. SRCREV = "${AUTOREV}"
  201. Furthermore, you need to reference :term:`SRCPV` in :term:`PV` in order to
  202. automatically update the version whenever the revision of the source
  203. code changes. Here is an example::
  204. PV = "1.0+git${SRCPV}"
  205. The OpenEmbedded build system substitutes :term:`SRCPV` with the following:
  206. .. code-block:: none
  207. AUTOINC+source_code_revision
  208. The build system replaces the ``AUTOINC``
  209. with a number. The number used depends on the state of the PR Service:
  210. - If PR Service is enabled, the build system increments the number,
  211. which is similar to the behavior of
  212. :term:`PR`. This behavior results in
  213. linearly increasing package versions, which is desirable. Here is an
  214. example:
  215. .. code-block:: none
  216. hello-world-git_0.0+git0+b6558dd387-r0.0_armv7a-neon.ipk
  217. hello-world-git_0.0+git1+dd2f5c3565-r0.0_armv7a-neon.ipk
  218. - If PR Service is not enabled, the build system replaces the
  219. ``AUTOINC`` placeholder with zero (i.e. "0"). This results in
  220. changing the package version since the source revision is included.
  221. However, package versions are not increased linearly. Here is an
  222. example:
  223. .. code-block:: none
  224. hello-world-git_0.0+git0+b6558dd387-r0.0_armv7a-neon.ipk
  225. hello-world-git_0.0+git0+dd2f5c3565-r0.0_armv7a-neon.ipk
  226. In summary, the OpenEmbedded build system does not track the history of
  227. binary package versions for this purpose. ``AUTOINC``, in this case, is
  228. comparable to :term:`PR`. If PR server is not enabled, ``AUTOINC`` in the
  229. package version is simply replaced by "0". If PR server is enabled, the
  230. build system keeps track of the package versions and bumps the number
  231. when the package revision changes.
  232. Handling Optional Module Packaging
  233. ==================================
  234. Many pieces of software split functionality into optional modules (or
  235. plugins) and the plugins that are built might depend on configuration
  236. options. To avoid having to duplicate the logic that determines what
  237. modules are available in your recipe or to avoid having to package each
  238. module by hand, the OpenEmbedded build system provides functionality to
  239. handle module packaging dynamically.
  240. To handle optional module packaging, you need to do two things:
  241. - Ensure the module packaging is actually done.
  242. - Ensure that any dependencies on optional modules from other recipes
  243. are satisfied by your recipe.
  244. Making Sure the Packaging is Done
  245. ---------------------------------
  246. To ensure the module packaging actually gets done, you use the
  247. ``do_split_packages`` function within the ``populate_packages`` Python
  248. function in your recipe. The ``do_split_packages`` function searches for
  249. a pattern of files or directories under a specified path and creates a
  250. package for each one it finds by appending to the
  251. :term:`PACKAGES` variable and
  252. setting the appropriate values for ``FILES:packagename``,
  253. ``RDEPENDS:packagename``, ``DESCRIPTION:packagename``, and so forth.
  254. Here is an example from the ``lighttpd`` recipe::
  255. python populate_packages:prepend () {
  256. lighttpd_libdir = d.expand('${libdir}')
  257. do_split_packages(d, lighttpd_libdir, '^mod_(.*).so$',
  258. 'lighttpd-module-%s', 'Lighttpd module for %s',
  259. extra_depends='')
  260. }
  261. The previous example specifies a number of things in the call to
  262. ``do_split_packages``.
  263. - A directory within the files installed by your recipe through
  264. :ref:`ref-tasks-install` in which to search.
  265. - A regular expression used to match module files in that directory. In
  266. the example, note the parentheses () that mark the part of the
  267. expression from which the module name should be derived.
  268. - A pattern to use for the package names.
  269. - A description for each package.
  270. - An empty string for ``extra_depends``, which disables the default
  271. dependency on the main ``lighttpd`` package. Thus, if a file in
  272. ``${libdir}`` called ``mod_alias.so`` is found, a package called
  273. ``lighttpd-module-alias`` is created for it and the
  274. :term:`DESCRIPTION` is set to
  275. "Lighttpd module for alias".
  276. Often, packaging modules is as simple as the previous example. However,
  277. there are more advanced options that you can use within
  278. ``do_split_packages`` to modify its behavior. And, if you need to, you
  279. can add more logic by specifying a hook function that is called for each
  280. package. It is also perfectly acceptable to call ``do_split_packages``
  281. multiple times if you have more than one set of modules to package.
  282. For more examples that show how to use ``do_split_packages``, see the
  283. ``connman.inc`` file in the ``meta/recipes-connectivity/connman/``
  284. directory of the ``poky`` :ref:`source repository <overview-manual/development-environment:yocto project source repositories>`. You can
  285. also find examples in ``meta/classes-recipe/kernel.bbclass``.
  286. Following is a reference that shows ``do_split_packages`` mandatory and
  287. optional arguments::
  288. Mandatory arguments
  289. root
  290. The path in which to search
  291. file_regex
  292. Regular expression to match searched files.
  293. Use parentheses () to mark the part of this
  294. expression that should be used to derive the
  295. module name (to be substituted where %s is
  296. used in other function arguments as noted below)
  297. output_pattern
  298. Pattern to use for the package names. Must
  299. include %s.
  300. description
  301. Description to set for each package. Must
  302. include %s.
  303. Optional arguments
  304. postinst
  305. Postinstall script to use for all packages
  306. (as a string)
  307. recursive
  308. True to perform a recursive search --- default
  309. False
  310. hook
  311. A hook function to be called for every match.
  312. The function will be called with the following
  313. arguments (in the order listed):
  314. f
  315. Full path to the file/directory match
  316. pkg
  317. The package name
  318. file_regex
  319. As above
  320. output_pattern
  321. As above
  322. modulename
  323. The module name derived using file_regex
  324. extra_depends
  325. Extra runtime dependencies (RDEPENDS) to be
  326. set for all packages. The default value of None
  327. causes a dependency on the main package
  328. (${PN}) --- if you do not want this, pass empty
  329. string '' for this parameter.
  330. aux_files_pattern
  331. Extra item(s) to be added to FILES for each
  332. package. Can be a single string item or a list
  333. of strings for multiple items. Must include %s.
  334. postrm
  335. postrm script to use for all packages (as a
  336. string)
  337. allow_dirs
  338. True to allow directories to be matched -
  339. default False
  340. prepend
  341. If True, prepend created packages to PACKAGES
  342. instead of the default False which appends them
  343. match_path
  344. match file_regex on the whole relative path to
  345. the root rather than just the filename
  346. aux_files_pattern_verbatim
  347. Extra item(s) to be added to FILES for each
  348. package, using the actual derived module name
  349. rather than converting it to something legal
  350. for a package name. Can be a single string item
  351. or a list of strings for multiple items. Must
  352. include %s.
  353. allow_links
  354. True to allow symlinks to be matched --- default
  355. False
  356. summary
  357. Summary to set for each package. Must include %s;
  358. defaults to description if not set.
  359. Satisfying Dependencies
  360. -----------------------
  361. The second part for handling optional module packaging is to ensure that
  362. any dependencies on optional modules from other recipes are satisfied by
  363. your recipe. You can be sure these dependencies are satisfied by using
  364. the :term:`PACKAGES_DYNAMIC`
  365. variable. Here is an example that continues with the ``lighttpd`` recipe
  366. shown earlier::
  367. PACKAGES_DYNAMIC = "lighttpd-module-.*"
  368. The name
  369. specified in the regular expression can of course be anything. In this
  370. example, it is ``lighttpd-module-`` and is specified as the prefix to
  371. ensure that any :term:`RDEPENDS` and
  372. :term:`RRECOMMENDS` on a package
  373. name starting with the prefix are satisfied during build time. If you
  374. are using ``do_split_packages`` as described in the previous section,
  375. the value you put in :term:`PACKAGES_DYNAMIC` should correspond to the name
  376. pattern specified in the call to ``do_split_packages``.
  377. Using Runtime Package Management
  378. ================================
  379. During a build, BitBake always transforms a recipe into one or more
  380. packages. For example, BitBake takes the ``bash`` recipe and produces a
  381. number of packages (e.g. ``bash``, ``bash-bashbug``,
  382. ``bash-completion``, ``bash-completion-dbg``, ``bash-completion-dev``,
  383. ``bash-completion-extra``, ``bash-dbg``, and so forth). Not all
  384. generated packages are included in an image.
  385. In several situations, you might need to update, add, remove, or query
  386. the packages on a target device at runtime (i.e. without having to
  387. generate a new image). Examples of such situations include:
  388. - You want to provide in-the-field updates to deployed devices (e.g.
  389. security updates).
  390. - You want to have a fast turn-around development cycle for one or more
  391. applications that run on your device.
  392. - You want to temporarily install the "debug" packages of various
  393. applications on your device so that debugging can be greatly improved
  394. by allowing access to symbols and source debugging.
  395. - You want to deploy a more minimal package selection of your device
  396. but allow in-the-field updates to add a larger selection for
  397. customization.
  398. In all these situations, you have something similar to a more
  399. traditional Linux distribution in that in-field devices are able to
  400. receive pre-compiled packages from a server for installation or update.
  401. Being able to install these packages on a running, in-field device is
  402. what is termed "runtime package management".
  403. In order to use runtime package management, you need a host or server
  404. machine that serves up the pre-compiled packages plus the required
  405. metadata. You also need package manipulation tools on the target. The
  406. build machine is a likely candidate to act as the server. However, that
  407. machine does not necessarily have to be the package server. The build
  408. machine could push its artifacts to another machine that acts as the
  409. server (e.g. Internet-facing). In fact, doing so is advantageous for a
  410. production environment as getting the packages away from the development
  411. system's :term:`Build Directory` prevents accidental overwrites.
  412. A simple build that targets just one device produces more than one
  413. package database. In other words, the packages produced by a build are
  414. separated out into a couple of different package groupings based on
  415. criteria such as the target's CPU architecture, the target board, or the
  416. C library used on the target. For example, a build targeting the
  417. ``qemux86`` device produces the following three package databases:
  418. ``noarch``, ``i586``, and ``qemux86``. If you wanted your ``qemux86``
  419. device to be aware of all the packages that were available to it, you
  420. would need to point it to each of these databases individually. In a
  421. similar way, a traditional Linux distribution usually is configured to
  422. be aware of a number of software repositories from which it retrieves
  423. packages.
  424. Using runtime package management is completely optional and not required
  425. for a successful build or deployment in any way. But if you want to make
  426. use of runtime package management, you need to do a couple things above
  427. and beyond the basics. The remainder of this section describes what you
  428. need to do.
  429. Build Considerations
  430. --------------------
  431. This section describes build considerations of which you need to be
  432. aware in order to provide support for runtime package management.
  433. When BitBake generates packages, it needs to know what format or formats
  434. to use. In your configuration, you use the
  435. :term:`PACKAGE_CLASSES`
  436. variable to specify the format:
  437. 1. Open the ``local.conf`` file inside your :term:`Build Directory` (e.g.
  438. ``poky/build/conf/local.conf``).
  439. 2. Select the desired package format as follows::
  440. PACKAGE_CLASSES ?= "package_packageformat"
  441. where packageformat can be "ipk", "rpm",
  442. "deb", or "tar" which are the supported package formats.
  443. .. note::
  444. Because the Yocto Project supports four different package formats,
  445. you can set the variable with more than one argument. However, the
  446. OpenEmbedded build system only uses the first argument when
  447. creating an image or Software Development Kit (SDK).
  448. If you would like your image to start off with a basic package database
  449. containing the packages in your current build as well as to have the
  450. relevant tools available on the target for runtime package management,
  451. you can include "package-management" in the
  452. :term:`IMAGE_FEATURES`
  453. variable. Including "package-management" in this configuration variable
  454. ensures that when the image is assembled for your target, the image
  455. includes the currently-known package databases as well as the
  456. target-specific tools required for runtime package management to be
  457. performed on the target. However, this is not strictly necessary. You
  458. could start your image off without any databases but only include the
  459. required on-target package tool(s). As an example, you could include
  460. "opkg" in your
  461. :term:`IMAGE_INSTALL` variable
  462. if you are using the IPK package format. You can then initialize your
  463. target's package database(s) later once your image is up and running.
  464. Whenever you perform any sort of build step that can potentially
  465. generate a package or modify existing package, it is always a good idea
  466. to re-generate the package index after the build by using the following
  467. command::
  468. $ bitbake package-index
  469. It might be tempting to build the
  470. package and the package index at the same time with a command such as
  471. the following::
  472. $ bitbake some-package package-index
  473. Do not do this as
  474. BitBake does not schedule the package index for after the completion of
  475. the package you are building. Consequently, you cannot be sure of the
  476. package index including information for the package you just built.
  477. Thus, be sure to run the package update step separately after building
  478. any packages.
  479. You can use the
  480. :term:`PACKAGE_FEED_ARCHS`,
  481. :term:`PACKAGE_FEED_BASE_PATHS`,
  482. and
  483. :term:`PACKAGE_FEED_URIS`
  484. variables to pre-configure target images to use a package feed. If you
  485. do not define these variables, then manual steps as described in the
  486. subsequent sections are necessary to configure the target. You should
  487. set these variables before building the image in order to produce a
  488. correctly configured image.
  489. When your build is complete, your packages reside in the
  490. ``${TMPDIR}/deploy/packageformat`` directory. For example, if
  491. ``${``\ :term:`TMPDIR`\ ``}`` is
  492. ``tmp`` and your selected package type is RPM, then your RPM packages
  493. are available in ``tmp/deploy/rpm``.
  494. Host or Server Machine Setup
  495. ----------------------------
  496. Although other protocols are possible, a server using HTTP typically
  497. serves packages. If you want to use HTTP, then set up and configure a
  498. web server such as Apache 2, lighttpd, or Python web server on the
  499. machine serving the packages.
  500. To keep things simple, this section describes how to set up a
  501. Python web server to share package feeds from the developer's
  502. machine. Although this server might not be the best for a production
  503. environment, the setup is simple and straight forward. Should you want
  504. to use a different server more suited for production (e.g. Apache 2,
  505. Lighttpd, or Nginx), take the appropriate steps to do so.
  506. From within the :term:`Build Directory` where you have built an image based on
  507. your packaging choice (i.e. the :term:`PACKAGE_CLASSES` setting), simply start
  508. the server. The following example assumes a :term:`Build Directory` of ``poky/build``
  509. and a :term:`PACKAGE_CLASSES` setting of
  510. ":ref:`package_rpm <ref-classes-package_rpm>`"::
  511. $ cd poky/build/tmp/deploy/rpm
  512. $ python3 -m http.server
  513. Target Setup
  514. ------------
  515. Setting up the target differs depending on the package management
  516. system. This section provides information for RPM, IPK, and DEB.
  517. Using RPM
  518. ~~~~~~~~~
  519. The :wikipedia:`Dandified Packaging <DNF_(software)>` (DNF) performs
  520. runtime package management of RPM packages. In order to use DNF for
  521. runtime package management, you must perform an initial setup on the
  522. target machine for cases where the ``PACKAGE_FEED_*`` variables were not
  523. set as part of the image that is running on the target. This means if
  524. you built your image and did not use these variables as part of the
  525. build and your image is now running on the target, you need to perform
  526. the steps in this section if you want to use runtime package management.
  527. .. note::
  528. For information on the ``PACKAGE_FEED_*`` variables, see
  529. :term:`PACKAGE_FEED_ARCHS`, :term:`PACKAGE_FEED_BASE_PATHS`, and
  530. :term:`PACKAGE_FEED_URIS` in the Yocto Project Reference Manual variables
  531. glossary.
  532. On the target, you must inform DNF that package databases are available.
  533. You do this by creating a file named
  534. ``/etc/yum.repos.d/oe-packages.repo`` and defining the ``oe-packages``.
  535. As an example, assume the target is able to use the following package
  536. databases: ``all``, ``i586``, and ``qemux86`` from a server named
  537. ``my.server``. The specifics for setting up the web server are up to
  538. you. The critical requirement is that the URIs in the target repository
  539. configuration point to the correct remote location for the feeds.
  540. .. note::
  541. For development purposes, you can point the web server to the build
  542. system's ``deploy`` directory. However, for production use, it is better to
  543. copy the package directories to a location outside of the build area and use
  544. that location. Doing so avoids situations where the build system
  545. overwrites or changes the ``deploy`` directory.
  546. When telling DNF where to look for the package databases, you must
  547. declare individual locations per architecture or a single location used
  548. for all architectures. You cannot do both:
  549. - *Create an Explicit List of Architectures:* Define individual base
  550. URLs to identify where each package database is located:
  551. .. code-block:: none
  552. [oe-packages]
  553. baseurl=http://my.server/rpm/i586 http://my.server/rpm/qemux86 http://my.server/rpm/all
  554. This example
  555. informs DNF about individual package databases for all three
  556. architectures.
  557. - *Create a Single (Full) Package Index:* Define a single base URL that
  558. identifies where a full package database is located::
  559. [oe-packages]
  560. baseurl=http://my.server/rpm
  561. This example informs DNF about a single
  562. package database that contains all the package index information for
  563. all supported architectures.
  564. Once you have informed DNF where to find the package databases, you need
  565. to fetch them:
  566. .. code-block:: none
  567. # dnf makecache
  568. DNF is now able to find, install, and
  569. upgrade packages from the specified repository or repositories.
  570. .. note::
  571. See the `DNF documentation <https://dnf.readthedocs.io/en/latest/>`__ for
  572. additional information.
  573. Using IPK
  574. ~~~~~~~~~
  575. The ``opkg`` application performs runtime package management of IPK
  576. packages. You must perform an initial setup for ``opkg`` on the target
  577. machine if the
  578. :term:`PACKAGE_FEED_ARCHS`,
  579. :term:`PACKAGE_FEED_BASE_PATHS`,
  580. and
  581. :term:`PACKAGE_FEED_URIS`
  582. variables have not been set or the target image was built before the
  583. variables were set.
  584. The ``opkg`` application uses configuration files to find available
  585. package databases. Thus, you need to create a configuration file inside
  586. the ``/etc/opkg/`` directory, which informs ``opkg`` of any repository
  587. you want to use.
  588. As an example, suppose you are serving packages from a ``ipk/``
  589. directory containing the ``i586``, ``all``, and ``qemux86`` databases
  590. through an HTTP server named ``my.server``. On the target, create a
  591. configuration file (e.g. ``my_repo.conf``) inside the ``/etc/opkg/``
  592. directory containing the following:
  593. .. code-block:: none
  594. src/gz all http://my.server/ipk/all
  595. src/gz i586 http://my.server/ipk/i586
  596. src/gz qemux86 http://my.server/ipk/qemux86
  597. Next, instruct ``opkg`` to fetch the
  598. repository information:
  599. .. code-block:: none
  600. # opkg update
  601. The ``opkg`` application is now able to find, install, and upgrade packages
  602. from the specified repository.
  603. Using DEB
  604. ~~~~~~~~~
  605. The ``apt`` application performs runtime package management of DEB
  606. packages. This application uses a source list file to find available
  607. package databases. You must perform an initial setup for ``apt`` on the
  608. target machine if the
  609. :term:`PACKAGE_FEED_ARCHS`,
  610. :term:`PACKAGE_FEED_BASE_PATHS`,
  611. and
  612. :term:`PACKAGE_FEED_URIS`
  613. variables have not been set or the target image was built before the
  614. variables were set.
  615. To inform ``apt`` of the repository you want to use, you might create a
  616. list file (e.g. ``my_repo.list``) inside the
  617. ``/etc/apt/sources.list.d/`` directory. As an example, suppose you are
  618. serving packages from a ``deb/`` directory containing the ``i586``,
  619. ``all``, and ``qemux86`` databases through an HTTP server named
  620. ``my.server``. The list file should contain:
  621. .. code-block:: none
  622. deb http://my.server/deb/all ./
  623. deb http://my.server/deb/i586 ./
  624. deb http://my.server/deb/qemux86 ./
  625. Next, instruct the ``apt`` application
  626. to fetch the repository information:
  627. .. code-block:: none
  628. $ sudo apt update
  629. After this step,
  630. ``apt`` is able to find, install, and upgrade packages from the
  631. specified repository.
  632. Generating and Using Signed Packages
  633. ====================================
  634. In order to add security to RPM packages used during a build, you can
  635. take steps to securely sign them. Once a signature is verified, the
  636. OpenEmbedded build system can use the package in the build. If security
  637. fails for a signed package, the build system stops the build.
  638. This section describes how to sign RPM packages during a build and how
  639. to use signed package feeds (repositories) when doing a build.
  640. Signing RPM Packages
  641. --------------------
  642. To enable signing RPM packages, you must set up the following
  643. configurations in either your ``local.config`` or ``distro.config``
  644. file::
  645. # Inherit sign_rpm.bbclass to enable signing functionality
  646. INHERIT += " sign_rpm"
  647. # Define the GPG key that will be used for signing.
  648. RPM_GPG_NAME = "key_name"
  649. # Provide passphrase for the key
  650. RPM_GPG_PASSPHRASE = "passphrase"
  651. .. note::
  652. Be sure to supply appropriate values for both `key_name` and
  653. `passphrase`.
  654. Aside from the ``RPM_GPG_NAME`` and ``RPM_GPG_PASSPHRASE`` variables in
  655. the previous example, two optional variables related to signing are available:
  656. - *GPG_BIN:* Specifies a ``gpg`` binary/wrapper that is executed
  657. when the package is signed.
  658. - *GPG_PATH:* Specifies the ``gpg`` home directory used when the
  659. package is signed.
  660. Processing Package Feeds
  661. ------------------------
  662. In addition to being able to sign RPM packages, you can also enable
  663. signed package feeds for IPK and RPM packages.
  664. The steps you need to take to enable signed package feed use are similar
  665. to the steps used to sign RPM packages. You must define the following in
  666. your ``local.config`` or ``distro.config`` file::
  667. INHERIT += "sign_package_feed"
  668. PACKAGE_FEED_GPG_NAME = "key_name"
  669. PACKAGE_FEED_GPG_PASSPHRASE_FILE = "path_to_file_containing_passphrase"
  670. For signed package feeds, the passphrase must be specified in a separate file,
  671. which is pointed to by the ``PACKAGE_FEED_GPG_PASSPHRASE_FILE``
  672. variable. Regarding security, keeping a plain text passphrase out of the
  673. configuration is more secure.
  674. Aside from the ``PACKAGE_FEED_GPG_NAME`` and
  675. ``PACKAGE_FEED_GPG_PASSPHRASE_FILE`` variables, three optional variables
  676. related to signed package feeds are available:
  677. - *GPG_BIN* Specifies a ``gpg`` binary/wrapper that is executed
  678. when the package is signed.
  679. - *GPG_PATH:* Specifies the ``gpg`` home directory used when the
  680. package is signed.
  681. - *PACKAGE_FEED_GPG_SIGNATURE_TYPE:* Specifies the type of ``gpg``
  682. signature. This variable applies only to RPM and IPK package feeds.
  683. Allowable values for the ``PACKAGE_FEED_GPG_SIGNATURE_TYPE`` are
  684. "ASC", which is the default and specifies ascii armored, and "BIN",
  685. which specifies binary.
  686. Testing Packages With ptest
  687. ===========================
  688. A Package Test (ptest) runs tests against packages built by the
  689. OpenEmbedded build system on the target machine. A ptest contains at
  690. least two items: the actual test, and a shell script (``run-ptest``)
  691. that starts the test. The shell script that starts the test must not
  692. contain the actual test --- the script only starts the test. On the other
  693. hand, the test can be anything from a simple shell script that runs a
  694. binary and checks the output to an elaborate system of test binaries and
  695. data files.
  696. The test generates output in the format used by Automake::
  697. result: testname
  698. where the result can be ``PASS``, ``FAIL``, or ``SKIP``, and
  699. the testname can be any identifying string.
  700. For a list of Yocto Project recipes that are already enabled with ptest,
  701. see the :yocto_wiki:`Ptest </Ptest>` wiki page.
  702. .. note::
  703. A recipe is "ptest-enabled" if it inherits the
  704. :ref:`ptest <ref-classes-ptest>` class.
  705. Adding ptest to Your Build
  706. --------------------------
  707. To add package testing to your build, add the :term:`DISTRO_FEATURES` and
  708. :term:`EXTRA_IMAGE_FEATURES` variables to your ``local.conf`` file, which
  709. is found in the :term:`Build Directory`::
  710. DISTRO_FEATURES:append = " ptest"
  711. EXTRA_IMAGE_FEATURES += "ptest-pkgs"
  712. Once your build is complete, the ptest files are installed into the
  713. ``/usr/lib/package/ptest`` directory within the image, where ``package``
  714. is the name of the package.
  715. Running ptest
  716. -------------
  717. The ``ptest-runner`` package installs a shell script that loops through
  718. all installed ptest test suites and runs them in sequence. Consequently,
  719. you might want to add this package to your image.
  720. Getting Your Package Ready
  721. --------------------------
  722. In order to enable a recipe to run installed ptests on target hardware,
  723. you need to prepare the recipes that build the packages you want to
  724. test. Here is what you have to do for each recipe:
  725. - *Be sure the recipe inherits the* :ref:`ptest <ref-classes-ptest>` *class:*
  726. Include the following line in each recipe::
  727. inherit ptest
  728. - *Create run-ptest:* This script starts your test. Locate the
  729. script where you will refer to it using
  730. :term:`SRC_URI`. Here is an
  731. example that starts a test for ``dbus``::
  732. #!/bin/sh
  733. cd test
  734. make -k runtest-TESTS
  735. - *Ensure dependencies are met:* If the test adds build or runtime
  736. dependencies that normally do not exist for the package (such as
  737. requiring "make" to run the test suite), use the
  738. :term:`DEPENDS` and
  739. :term:`RDEPENDS` variables in
  740. your recipe in order for the package to meet the dependencies. Here
  741. is an example where the package has a runtime dependency on "make"::
  742. RDEPENDS:${PN}-ptest += "make"
  743. - *Add a function to build the test suite:* Not many packages support
  744. cross-compilation of their test suites. Consequently, you usually
  745. need to add a cross-compilation function to the package.
  746. Many packages based on Automake compile and run the test suite by
  747. using a single command such as ``make check``. However, the host
  748. ``make check`` builds and runs on the same computer, while
  749. cross-compiling requires that the package is built on the host but
  750. executed for the target architecture (though often, as in the case
  751. for ptest, the execution occurs on the host). The built version of
  752. Automake that ships with the Yocto Project includes a patch that
  753. separates building and execution. Consequently, packages that use the
  754. unaltered, patched version of ``make check`` automatically
  755. cross-compiles.
  756. Regardless, you still must add a ``do_compile_ptest`` function to
  757. build the test suite. Add a function similar to the following to your
  758. recipe::
  759. do_compile_ptest() {
  760. oe_runmake buildtest-TESTS
  761. }
  762. - *Ensure special configurations are set:* If the package requires
  763. special configurations prior to compiling the test code, you must
  764. insert a ``do_configure_ptest`` function into the recipe.
  765. - *Install the test suite:* The :ref:`ptest <ref-classes-ptest>` class
  766. automatically copies the file ``run-ptest`` to the target and then runs make
  767. ``install-ptest`` to run the tests. If this is not enough, you need
  768. to create a ``do_install_ptest`` function and make sure it gets
  769. called after the "make install-ptest" completes.
  770. Creating Node Package Manager (NPM) Packages
  771. ============================================
  772. :wikipedia:`NPM <Npm_(software)>` is a package
  773. manager for the JavaScript programming language. The Yocto Project
  774. supports the NPM :ref:`fetcher <bitbake:bitbake-user-manual/bitbake-user-manual-fetching:fetchers>`. You can
  775. use this fetcher in combination with
  776. :doc:`devtool </ref-manual/devtool-reference>` to create
  777. recipes that produce NPM packages.
  778. There are two workflows that allow you to create NPM packages using
  779. ``devtool``: the NPM registry modules method and the NPM project code
  780. method.
  781. .. note::
  782. While it is possible to create NPM recipes manually, using
  783. ``devtool`` is far simpler.
  784. Additionally, some requirements and caveats exist.
  785. Requirements and Caveats
  786. ------------------------
  787. You need to be aware of the following before using ``devtool`` to create
  788. NPM packages:
  789. - Of the two methods that you can use ``devtool`` to create NPM
  790. packages, the registry approach is slightly simpler. However, you
  791. might consider the project approach because you do not have to
  792. publish your module in the `NPM registry <https://docs.npmjs.com/misc/registry>`__,
  793. which is NPM's public registry.
  794. - Be familiar with
  795. :doc:`devtool </ref-manual/devtool-reference>`.
  796. - The NPM host tools need the native ``nodejs-npm`` package, which is
  797. part of the OpenEmbedded environment. You need to get the package by
  798. cloning the :oe_git:`meta-openembedded </meta-openembedded>`
  799. repository. Be sure to add the path to your local copy
  800. to your ``bblayers.conf`` file.
  801. - ``devtool`` cannot detect native libraries in module dependencies.
  802. Consequently, you must manually add packages to your recipe.
  803. - While deploying NPM packages, ``devtool`` cannot determine which
  804. dependent packages are missing on the target (e.g. the node runtime
  805. ``nodejs``). Consequently, you need to find out what files are
  806. missing and be sure they are on the target.
  807. - Although you might not need NPM to run your node package, it is
  808. useful to have NPM on your target. The NPM package name is
  809. ``nodejs-npm``.
  810. Using the Registry Modules Method
  811. ---------------------------------
  812. This section presents an example that uses the ``cute-files`` module,
  813. which is a file browser web application.
  814. .. note::
  815. You must know the ``cute-files`` module version.
  816. The first thing you need to do is use ``devtool`` and the NPM fetcher to
  817. create the recipe::
  818. $ devtool add "npm://registry.npmjs.org;package=cute-files;version=1.0.2"
  819. The
  820. ``devtool add`` command runs ``recipetool create`` and uses the same
  821. fetch URI to download each dependency and capture license details where
  822. possible. The result is a generated recipe.
  823. After running for quite a long time, in particular building the
  824. ``nodejs-native`` package, the command should end as follows::
  825. INFO: Recipe /home/.../build/workspace/recipes/cute-files/cute-files_1.0.2.bb has been automatically created; further editing may be required to make it fully functional
  826. The recipe file is fairly simple and contains every license that
  827. ``recipetool`` finds and includes the licenses in the recipe's
  828. :term:`LIC_FILES_CHKSUM`
  829. variables. You need to examine the variables and look for those with
  830. "unknown" in the :term:`LICENSE`
  831. field. You need to track down the license information for "unknown"
  832. modules and manually add the information to the recipe.
  833. ``recipetool`` creates a "shrinkwrap" file for your recipe. Shrinkwrap
  834. files capture the version of all dependent modules. Many packages do not
  835. provide shrinkwrap files but ``recipetool`` will create a shrinkwrap file as it
  836. runs.
  837. .. note::
  838. A package is created for each sub-module. This policy is the only
  839. practical way to have the licenses for all of the dependencies
  840. represented in the license manifest of the image.
  841. The ``devtool edit-recipe`` command lets you take a look at the recipe::
  842. $ devtool edit-recipe cute-files
  843. # Recipe created by recipetool
  844. # This is the basis of a recipe and may need further editing in order to be fully functional.
  845. # (Feel free to remove these comments when editing.)
  846. SUMMARY = "Turn any folder on your computer into a cute file browser, available on the local network."
  847. # WARNING: the following LICENSE and LIC_FILES_CHKSUM values are best guesses - it is
  848. # your responsibility to verify that the values are complete and correct.
  849. #
  850. # NOTE: multiple licenses have been detected; they have been separated with &
  851. # in the LICENSE value for now since it is a reasonable assumption that all
  852. # of the licenses apply. If instead there is a choice between the multiple
  853. # licenses then you should change the value to separate the licenses with |
  854. # instead of &. If there is any doubt, check the accompanying documentation
  855. # to determine which situation is applicable.
  856. SUMMARY = "Turn any folder on your computer into a cute file browser, available on the local network."
  857. LICENSE = "BSD-3-Clause & ISC & MIT"
  858. LIC_FILES_CHKSUM = "file://LICENSE;md5=71d98c0a1db42956787b1909c74a86ca \
  859. file://node_modules/accepts/LICENSE;md5=bf1f9ad1e2e1d507aef4883fff7103de \
  860. file://node_modules/array-flatten/LICENSE;md5=44088ba57cb871a58add36ce51b8de08 \
  861. ...
  862. file://node_modules/cookie-signature/Readme.md;md5=57ae8b42de3dd0c1f22d5f4cf191e15a"
  863. SRC_URI = " \
  864. npm://registry.npmjs.org/;package=cute-files;version=${PV} \
  865. npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \
  866. "
  867. S = "${WORKDIR}/npm"
  868. inherit npm
  869. LICENSE:${PN} = "MIT"
  870. LICENSE:${PN}-accepts = "MIT"
  871. LICENSE:${PN}-array-flatten = "MIT"
  872. ...
  873. LICENSE:${PN}-vary = "MIT"
  874. Here are three key points in the previous example:
  875. - :term:`SRC_URI` uses the NPM
  876. scheme so that the NPM fetcher is used.
  877. - ``recipetool`` collects all the license information. If a
  878. sub-module's license is unavailable, the sub-module's name appears in
  879. the comments.
  880. - The ``inherit npm`` statement causes the
  881. :ref:`npm <ref-classes-npm>` class to package
  882. up all the modules.
  883. You can run the following command to build the ``cute-files`` package::
  884. $ devtool build cute-files
  885. Remember that ``nodejs`` must be installed on
  886. the target before your package.
  887. Assuming 192.168.7.2 for the target's IP address, use the following
  888. command to deploy your package::
  889. $ devtool deploy-target -s cute-files root@192.168.7.2
  890. Once the package is installed on the target, you can
  891. test the application to show the contents of any directory::
  892. $ cd /usr/lib/node_modules/cute-files
  893. $ cute-files
  894. On a browser,
  895. go to ``http://192.168.7.2:3000`` and you see the following:
  896. .. image:: figures/cute-files-npm-example.png
  897. :width: 100%
  898. You can find the recipe in ``workspace/recipes/cute-files``. You can use
  899. the recipe in any layer you choose.
  900. Using the NPM Projects Code Method
  901. ----------------------------------
  902. Although it is useful to package modules already in the NPM registry,
  903. adding ``node.js`` projects under development is a more common developer
  904. use case.
  905. This section covers the NPM projects code method, which is very similar
  906. to the "registry" approach described in the previous section. In the NPM
  907. projects method, you provide ``devtool`` with an URL that points to the
  908. source files.
  909. Replicating the same example, (i.e. ``cute-files``) use the following
  910. command::
  911. $ devtool add https://github.com/martinaglv/cute-files.git
  912. The recipe this command generates is very similar to the recipe created in
  913. the previous section. However, the :term:`SRC_URI` looks like the following::
  914. SRC_URI = " \
  915. git://github.com/martinaglv/cute-files.git;protocol=https;branch=master \
  916. npmsw://${THISDIR}/${BPN}/npm-shrinkwrap.json \
  917. "
  918. In this example,
  919. the main module is taken from the Git repository and dependencies are
  920. taken from the NPM registry. Other than those differences, the recipe is
  921. basically the same between the two methods. You can build and deploy the
  922. package exactly as described in the previous section that uses the
  923. registry modules method.
  924. Adding custom metadata to packages
  925. ==================================
  926. The variable
  927. :term:`PACKAGE_ADD_METADATA`
  928. can be used to add additional metadata to packages. This is reflected in
  929. the package control/spec file. To take the ipk format for example, the
  930. CONTROL file stored inside would contain the additional metadata as
  931. additional lines.
  932. The variable can be used in multiple ways, including using suffixes to
  933. set it for a specific package type and/or package. Note that the order
  934. of precedence is the same as this list:
  935. - ``PACKAGE_ADD_METADATA_<PKGTYPE>:<PN>``
  936. - ``PACKAGE_ADD_METADATA_<PKGTYPE>``
  937. - ``PACKAGE_ADD_METADATA:<PN>``
  938. - :term:`PACKAGE_ADD_METADATA`
  939. `<PKGTYPE>` is a parameter and expected to be a distinct name of specific
  940. package type:
  941. - IPK for .ipk packages
  942. - DEB for .deb packages
  943. - RPM for .rpm packages
  944. `<PN>` is a parameter and expected to be a package name.
  945. The variable can contain multiple [one-line] metadata fields separated
  946. by the literal sequence '\\n'. The separator can be redefined using the
  947. variable flag ``separator``.
  948. Here is an example that adds two custom fields for ipk
  949. packages::
  950. PACKAGE_ADD_METADATA_IPK = "Vendor: CustomIpk\nGroup:Applications/Spreadsheets"