summaryrefslogtreecommitdiffstats
path: root/documentation/dev-manual/upgrading-recipes.rst
diff options
context:
space:
mode:
authorMichael Opdenacker <michael.opdenacker@bootlin.com>2022-11-24 17:50:52 +0100
committerRichard Purdie <richard.purdie@linuxfoundation.org>2022-12-01 19:20:29 +0000
commit945c669138a76be18c6b4da4f8f907d2a5cfd83f (patch)
treecebff3cae5021d4fcceb5aa51fce1c2aead97ed2 /documentation/dev-manual/upgrading-recipes.rst
parent6fe3143800925463279d0664fc7f3372b53c6c52 (diff)
downloadpoky-945c669138a76be18c6b4da4f8f907d2a5cfd83f.tar.gz
manuals: split dev-manual/common-tasks.rst
A 500 KB source file is always harder to manage, and can have section title conflicts. So, the "Common Tasks" document is gone and all its constituents are moved up one level. You now have 40 chapters in the Development Tasks Manual. (From yocto-docs rev: 8a45bc469411410020b8e688c137395fcaf3761b) Signed-off-by: Michael Opdenacker <michael.opdenacker@bootlin.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'documentation/dev-manual/upgrading-recipes.rst')
-rw-r--r--documentation/dev-manual/upgrading-recipes.rst400
1 files changed, 400 insertions, 0 deletions
diff --git a/documentation/dev-manual/upgrading-recipes.rst b/documentation/dev-manual/upgrading-recipes.rst
new file mode 100644
index 0000000000..a0856f43da
--- /dev/null
+++ b/documentation/dev-manual/upgrading-recipes.rst
@@ -0,0 +1,400 @@
1.. SPDX-License-Identifier: CC-BY-SA-2.0-UK
2
3Upgrading Recipes
4*****************
5
6Over time, upstream developers publish new versions for software built
7by layer recipes. It is recommended to keep recipes up-to-date with
8upstream version releases.
9
10While there are several methods to upgrade a recipe, you might
11consider checking on the upgrade status of a recipe first. You can do so
12using the ``devtool check-upgrade-status`` command. See the
13":ref:`devtool-checking-on-the-upgrade-status-of-a-recipe`"
14section in the Yocto Project Reference Manual for more information.
15
16The remainder of this section describes three ways you can upgrade a
17recipe. You can use the Automated Upgrade Helper (AUH) to set up
18automatic version upgrades. Alternatively, you can use
19``devtool upgrade`` to set up semi-automatic version upgrades. Finally,
20you can manually upgrade a recipe by editing the recipe itself.
21
22Using the Auto Upgrade Helper (AUH)
23===================================
24
25The AUH utility works in conjunction with the OpenEmbedded build system
26in order to automatically generate upgrades for recipes based on new
27versions being published upstream. Use AUH when you want to create a
28service that performs the upgrades automatically and optionally sends
29you an email with the results.
30
31AUH allows you to update several recipes with a single use. You can also
32optionally perform build and integration tests using images with the
33results saved to your hard drive and emails of results optionally sent
34to recipe maintainers. Finally, AUH creates Git commits with appropriate
35commit messages in the layer's tree for the changes made to recipes.
36
37.. note::
38
39 In some conditions, you should not use AUH to upgrade recipes
40 and should instead use either ``devtool upgrade`` or upgrade your
41 recipes manually:
42
43 - When AUH cannot complete the upgrade sequence. This situation
44 usually results because custom patches carried by the recipe
45 cannot be automatically rebased to the new version. In this case,
46 ``devtool upgrade`` allows you to manually resolve conflicts.
47
48 - When for any reason you want fuller control over the upgrade
49 process. For example, when you want special arrangements for
50 testing.
51
52The following steps describe how to set up the AUH utility:
53
541. *Be Sure the Development Host is Set Up:* You need to be sure that
55 your development host is set up to use the Yocto Project. For
56 information on how to set up your host, see the
57 ":ref:`dev-manual/start:Preparing the Build Host`" section.
58
592. *Make Sure Git is Configured:* The AUH utility requires Git to be
60 configured because AUH uses Git to save upgrades. Thus, you must have
61 Git user and email configured. The following command shows your
62 configurations::
63
64 $ git config --list
65
66 If you do not have the user and
67 email configured, you can use the following commands to do so::
68
69 $ git config --global user.name some_name
70 $ git config --global user.email username@domain.com
71
723. *Clone the AUH Repository:* To use AUH, you must clone the repository
73 onto your development host. The following command uses Git to create
74 a local copy of the repository on your system::
75
76 $ git clone git://git.yoctoproject.org/auto-upgrade-helper
77 Cloning into 'auto-upgrade-helper'... remote: Counting objects: 768, done.
78 remote: Compressing objects: 100% (300/300), done.
79 remote: Total 768 (delta 499), reused 703 (delta 434)
80 Receiving objects: 100% (768/768), 191.47 KiB | 98.00 KiB/s, done.
81 Resolving deltas: 100% (499/499), done.
82 Checking connectivity... done.
83
84 AUH is not part of the :term:`OpenEmbedded-Core (OE-Core)` or
85 :term:`Poky` repositories.
86
874. *Create a Dedicated Build Directory:* Run the :ref:`structure-core-script`
88 script to create a fresh :term:`Build Directory` that you use exclusively
89 for running the AUH utility::
90
91 $ cd poky
92 $ source oe-init-build-env your_AUH_build_directory
93
94 Re-using an existing :term:`Build Directory` and its configurations is not
95 recommended as existing settings could cause AUH to fail or behave
96 undesirably.
97
985. *Make Configurations in Your Local Configuration File:* Several
99 settings are needed in the ``local.conf`` file in the build
100 directory you just created for AUH. Make these following
101 configurations:
102
103 - If you want to enable :ref:`Build
104 History <dev-manual/build-quality:maintaining build output quality>`,
105 which is optional, you need the following lines in the
106 ``conf/local.conf`` file::
107
108 INHERIT =+ "buildhistory"
109 BUILDHISTORY_COMMIT = "1"
110
111 With this configuration and a successful
112 upgrade, a build history "diff" file appears in the
113 ``upgrade-helper/work/recipe/buildhistory-diff.txt`` file found in
114 your :term:`Build Directory`.
115
116 - If you want to enable testing through the
117 :ref:`testimage <ref-classes-testimage>`
118 class, which is optional, you need to have the following set in
119 your ``conf/local.conf`` file::
120
121 INHERIT += "testimage"
122
123 .. note::
124
125 If your distro does not enable by default ptest, which Poky
126 does, you need the following in your ``local.conf`` file::
127
128 DISTRO_FEATURES:append = " ptest"
129
130
1316. *Optionally Start a vncserver:* If you are running in a server
132 without an X11 session, you need to start a vncserver::
133
134 $ vncserver :1
135 $ export DISPLAY=:1
136
1377. *Create and Edit an AUH Configuration File:* You need to have the
138 ``upgrade-helper/upgrade-helper.conf`` configuration file in your
139 :term:`Build Directory`. You can find a sample configuration file in the
140 :yocto_git:`AUH source repository </auto-upgrade-helper/tree/>`.
141
142 Read through the sample file and make configurations as needed. For
143 example, if you enabled build history in your ``local.conf`` as
144 described earlier, you must enable it in ``upgrade-helper.conf``.
145
146 Also, if you are using the default ``maintainers.inc`` file supplied
147 with Poky and located in ``meta-yocto`` and you do not set a
148 "maintainers_whitelist" or "global_maintainer_override" in the
149 ``upgrade-helper.conf`` configuration, and you specify "-e all" on
150 the AUH command-line, the utility automatically sends out emails to
151 all the default maintainers. Please avoid this.
152
153This next set of examples describes how to use the AUH:
154
155- *Upgrading a Specific Recipe:* To upgrade a specific recipe, use the
156 following form::
157
158 $ upgrade-helper.py recipe_name
159
160 For example, this command upgrades the ``xmodmap`` recipe::
161
162 $ upgrade-helper.py xmodmap
163
164- *Upgrading a Specific Recipe to a Particular Version:* To upgrade a
165 specific recipe to a particular version, use the following form::
166
167 $ upgrade-helper.py recipe_name -t version
168
169 For example, this command upgrades the ``xmodmap`` recipe to version 1.2.3::
170
171 $ upgrade-helper.py xmodmap -t 1.2.3
172
173- *Upgrading all Recipes to the Latest Versions and Suppressing Email
174 Notifications:* To upgrade all recipes to their most recent versions
175 and suppress the email notifications, use the following command::
176
177 $ upgrade-helper.py all
178
179- *Upgrading all Recipes to the Latest Versions and Send Email
180 Notifications:* To upgrade all recipes to their most recent versions
181 and send email messages to maintainers for each attempted recipe as
182 well as a status email, use the following command::
183
184 $ upgrade-helper.py -e all
185
186Once you have run the AUH utility, you can find the results in the AUH
187:term:`Build Directory`::
188
189 ${BUILDDIR}/upgrade-helper/timestamp
190
191The AUH utility
192also creates recipe update commits from successful upgrade attempts in
193the layer tree.
194
195You can easily set up to run the AUH utility on a regular basis by using
196a cron job. See the
197:yocto_git:`weeklyjob.sh </auto-upgrade-helper/tree/weeklyjob.sh>`
198file distributed with the utility for an example.
199
200Using ``devtool upgrade``
201=========================
202
203As mentioned earlier, an alternative method for upgrading recipes to
204newer versions is to use
205:doc:`devtool upgrade </ref-manual/devtool-reference>`.
206You can read about ``devtool upgrade`` in general in the
207":ref:`sdk-manual/extensible:use \`\`devtool upgrade\`\` to create a version of the recipe that supports a newer version of the software`"
208section in the Yocto Project Application Development and the Extensible
209Software Development Kit (eSDK) Manual.
210
211To see all the command-line options available with ``devtool upgrade``,
212use the following help command::
213
214 $ devtool upgrade -h
215
216If you want to find out what version a recipe is currently at upstream
217without any attempt to upgrade your local version of the recipe, you can
218use the following command::
219
220 $ devtool latest-version recipe_name
221
222As mentioned in the previous section describing AUH, ``devtool upgrade``
223works in a less-automated manner than AUH. Specifically,
224``devtool upgrade`` only works on a single recipe that you name on the
225command line, cannot perform build and integration testing using images,
226and does not automatically generate commits for changes in the source
227tree. Despite all these "limitations", ``devtool upgrade`` updates the
228recipe file to the new upstream version and attempts to rebase custom
229patches contained by the recipe as needed.
230
231.. note::
232
233 AUH uses much of ``devtool upgrade`` behind the scenes making AUH somewhat
234 of a "wrapper" application for ``devtool upgrade``.
235
236A typical scenario involves having used Git to clone an upstream
237repository that you use during build operations. Because you have built the
238recipe in the past, the layer is likely added to your
239configuration already. If for some reason, the layer is not added, you
240could add it easily using the
241":ref:`bitbake-layers <bsp-guide/bsp:creating a new bsp layer using the \`\`bitbake-layers\`\` script>`"
242script. For example, suppose you use the ``nano.bb`` recipe from the
243``meta-oe`` layer in the ``meta-openembedded`` repository. For this
244example, assume that the layer has been cloned into following area::
245
246 /home/scottrif/meta-openembedded
247
248The following command from your :term:`Build Directory` adds the layer to
249your build configuration (i.e. ``${BUILDDIR}/conf/bblayers.conf``)::
250
251 $ bitbake-layers add-layer /home/scottrif/meta-openembedded/meta-oe
252 NOTE: Starting bitbake server...
253 Parsing recipes: 100% |##########################################| Time: 0:00:55
254 Parsing of 1431 .bb files complete (0 cached, 1431 parsed). 2040 targets, 56 skipped, 0 masked, 0 errors.
255 Removing 12 recipes from the x86_64 sysroot: 100% |##############| Time: 0:00:00
256 Removing 1 recipes from the x86_64_i586 sysroot: 100% |##########| Time: 0:00:00
257 Removing 5 recipes from the i586 sysroot: 100% |#################| Time: 0:00:00
258 Removing 5 recipes from the qemux86 sysroot: 100% |##############| Time: 0:00:00
259
260For this example, assume that the ``nano.bb`` recipe that
261is upstream has a 2.9.3 version number. However, the version in the
262local repository is 2.7.4. The following command from your build
263directory automatically upgrades the recipe for you:
264
265.. note::
266
267 Using the ``-V`` option is not necessary. Omitting the version number causes
268 ``devtool upgrade`` to upgrade the recipe to the most recent version.
269
270::
271
272 $ devtool upgrade nano -V 2.9.3
273 NOTE: Starting bitbake server...
274 NOTE: Creating workspace layer in /home/scottrif/poky/build/workspace
275 Parsing recipes: 100% |##########################################| Time: 0:00:46
276 Parsing of 1431 .bb files complete (0 cached, 1431 parsed). 2040 targets, 56 skipped, 0 masked, 0 errors.
277 NOTE: Extracting current version source...
278 NOTE: Resolving any missing task queue dependencies
279 .
280 .
281 .
282 NOTE: Executing SetScene Tasks
283 NOTE: Executing RunQueue Tasks
284 NOTE: Tasks Summary: Attempted 74 tasks of which 72 didn't need to be rerun and all succeeded.
285 Adding changed files: 100% |#####################################| Time: 0:00:00
286 NOTE: Upgraded source extracted to /home/scottrif/poky/build/workspace/sources/nano
287 NOTE: New recipe is /home/scottrif/poky/build/workspace/recipes/nano/nano_2.9.3.bb
288
289Continuing with this example, you can use ``devtool build`` to build the
290newly upgraded recipe::
291
292 $ devtool build nano
293 NOTE: Starting bitbake server...
294 Loading cache: 100% |################################################################################################| Time: 0:00:01
295 Loaded 2040 entries from dependency cache.
296 Parsing recipes: 100% |##############################################################################################| Time: 0:00:00
297 Parsing of 1432 .bb files complete (1431 cached, 1 parsed). 2041 targets, 56 skipped, 0 masked, 0 errors.
298 NOTE: Resolving any missing task queue dependencies
299 .
300 .
301 .
302 NOTE: Executing SetScene Tasks
303 NOTE: Executing RunQueue Tasks
304 NOTE: nano: compiling from external source tree /home/scottrif/poky/build/workspace/sources/nano
305 NOTE: Tasks Summary: Attempted 520 tasks of which 304 didn't need to be rerun and all succeeded.
306
307Within the ``devtool upgrade`` workflow, you can
308deploy and test your rebuilt software. For this example,
309however, running ``devtool finish`` cleans up the workspace once the
310source in your workspace is clean. This usually means using Git to stage
311and submit commits for the changes generated by the upgrade process.
312
313Once the tree is clean, you can clean things up in this example with the
314following command from the ``${BUILDDIR}/workspace/sources/nano``
315directory::
316
317 $ devtool finish nano meta-oe
318 NOTE: Starting bitbake server...
319 Loading cache: 100% |################################################################################################| Time: 0:00:00
320 Loaded 2040 entries from dependency cache.
321 Parsing recipes: 100% |##############################################################################################| Time: 0:00:01
322 Parsing of 1432 .bb files complete (1431 cached, 1 parsed). 2041 targets, 56 skipped, 0 masked, 0 errors.
323 NOTE: Adding new patch 0001-nano.bb-Stuff-I-changed-when-upgrading-nano.bb.patch
324 NOTE: Updating recipe nano_2.9.3.bb
325 NOTE: Removing file /home/scottrif/meta-openembedded/meta-oe/recipes-support/nano/nano_2.7.4.bb
326 NOTE: Moving recipe file to /home/scottrif/meta-openembedded/meta-oe/recipes-support/nano
327 NOTE: Leaving source tree /home/scottrif/poky/build/workspace/sources/nano as-is; if you no longer need it then please delete it manually
328
329
330Using the ``devtool finish`` command cleans up the workspace and creates a patch
331file based on your commits. The tool puts all patch files back into the
332source directory in a sub-directory named ``nano`` in this case.
333
334Manually Upgrading a Recipe
335===========================
336
337If for some reason you choose not to upgrade recipes using
338:ref:`dev-manual/upgrading-recipes:Using the Auto Upgrade Helper (AUH)` or
339by :ref:`dev-manual/upgrading-recipes:Using \`\`devtool upgrade\`\``,
340you can manually edit the recipe files to upgrade the versions.
341
342.. note::
343
344 Manually updating multiple recipes scales poorly and involves many
345 steps. The recommendation to upgrade recipe versions is through AUH
346 or ``devtool upgrade``, both of which automate some steps and provide
347 guidance for others needed for the manual process.
348
349To manually upgrade recipe versions, follow these general steps:
350
3511. *Change the Version:* Rename the recipe such that the version (i.e.
352 the :term:`PV` part of the recipe name)
353 changes appropriately. If the version is not part of the recipe name,
354 change the value as it is set for :term:`PV` within the recipe itself.
355
3562. *Update* :term:`SRCREV` *if Needed*: If the source code your recipe builds
357 is fetched from Git or some other version control system, update
358 :term:`SRCREV` to point to the
359 commit hash that matches the new version.
360
3613. *Build the Software:* Try to build the recipe using BitBake. Typical
362 build failures include the following:
363
364 - License statements were updated for the new version. For this
365 case, you need to review any changes to the license and update the
366 values of :term:`LICENSE` and
367 :term:`LIC_FILES_CHKSUM`
368 as needed.
369
370 .. note::
371
372 License changes are often inconsequential. For example, the
373 license text's copyright year might have changed.
374
375 - Custom patches carried by the older version of the recipe might
376 fail to apply to the new version. For these cases, you need to
377 review the failures. Patches might not be necessary for the new
378 version of the software if the upgraded version has fixed those
379 issues. If a patch is necessary and failing, you need to rebase it
380 into the new version.
381
3824. *Optionally Attempt to Build for Several Architectures:* Once you
383 successfully build the new software for a given architecture, you
384 could test the build for other architectures by changing the
385 :term:`MACHINE` variable and
386 rebuilding the software. This optional step is especially important
387 if the recipe is to be released publicly.
388
3895. *Check the Upstream Change Log or Release Notes:* Checking both these
390 reveals if there are new features that could break
391 backwards-compatibility. If so, you need to take steps to mitigate or
392 eliminate that situation.
393
3946. *Optionally Create a Bootable Image and Test:* If you want, you can
395 test the new software by booting it onto actual hardware.
396
3977. *Create a Commit with the Change in the Layer Repository:* After all
398 builds work and any testing is successful, you can create commits for
399 any changes in the layer holding your upgraded recipe.
400