Commit Graph

1389 Commits

Author SHA1 Message Date
Anuj Mittal
b7b203d8ea wic/engine: improve error reporting when using rm with wic
When trying to delete something from an ext partition using debugfs, we
don't show any error to the user when that operation fails.

Change this behavior to show the error generated by debugfs. Also,
fallback to use rmdir in case we are trying to delete a directory. However,
unlike mdeltree that is used for a FAT partition, there's no easy way to
delete a non empty directory. Show an error instead when that happens so
user can take appropriate action.

(From OE-Core rev: a405383e63c35d7b56108f192ca74755b122a639)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-26 13:16:40 +01:00
Chen Qi
869e501544 logging: use warning instead warn
The warn method is deprecated. We should use the documented warning instead.

Quoting from the python's official doc:
"""
Note: There is an obsolete method warn which is functionally identical to warning.
      As warn is deprecated, please do not use it - use warning instead.
"""

(From OE-Core rev: f467fd277eb77336097cfc0f5f329bdc8d0f70cb)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-26 13:16:40 +01:00
Anuj Mittal
bf7ed1d046 wic/engine: use up all free space when expanding partitions
Currently we just divide up the free space by the number of partitions
that need to be re-sized. This leads to problems when a user has
explicitly specified a subset of partitions (but not all) that need
to re-sized along with the sizes. As an example, for an image with 3
partitions, if we use:

wic write image.wic /dev/sdb --expand 1:10G

This would lead to paritions 2 and 3 each being re-sized to one thirds
of the free space instead of half.

Change the behavior to use up all the free space.

(From OE-Core rev: a88f1b5d88dbc5fb28be24b9787d73b9e0cdf183)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-18 10:18:42 +01:00
Anuj Mittal
82756dcac0 wic/engine: fix errors when expanding partitions
The UEFI spec implies that GPT partitions should be assumed to be on a 2048
sector boundary (for a 512 byte sector) and the current logic just
divides the free sectors available by the number of partitions that need
re-sizing, which may or may not align and the final result might
overshoot the limits imposed after alignment.

Since we are expanding already aligned partitions, just divide up the
free space in multiples of 2048. Also use the exec_cmd wrapper instead
of the subprocess call directly.

Fixes [YOCTO #12840]

(From OE-Core rev: 5eef63f5afdfbab8e30748cb1bf42bf2e6524759)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-18 10:18:42 +01:00
Christopher Larson
c9812c91fe recipetool: add 'edit' subcommand
This edits the recipe and any bbappends for the specified target.

(From OE-Core rev: 7aece42c6b4744c54a8eb05ff90bd3bf4fbb14a3)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-07-04 00:02:16 +01:00
Ioan-Adrian Ratiu
870fbbd5c0 wic: isoimage-isohybrid: debloat image of redundant rootfs
There's no reason to have that rootfs.img filesystem in the image:
it's not used for anything because both the EFI and legacy boot paths
use the /initrd which contains the same contents as the rootfs.img,
only compressed. It was probably forgotten in there :)

My iso went down from 224 to 94 mb.

Tested using UEFI/legacy boots on CD-roms, usb dongle and qemu VM's.

(From OE-Core rev: 4c784379524cb12807ef87a02ef1514ed45c1cc3)

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-29 11:07:45 +01:00
Ioan-Adrian Ratiu
b591fb889b wic: isoimage-isohybrid: fix UEFI spec breakage
It's really good that OE supports multiple EFI_PROVIDERs and that
commit 9a1709278de87 ("wic: isoimage-isohybrid: use grub-efi from
deploy dir") makes re-use of the grub-efi built image, but we should
still respect the standard otherwise the ISO will not boot, so install
grub images as boot[x64|ia32].efi not ${PN}-boot[x64|ia32].efi.

(From OE-Core rev: 1608129692d92c239b5fb9244b649a32b9009254)

Signed-off-by: Ioan-Adrian Ratiu <adrian.ratiu@ni.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-29 11:07:44 +01:00
Christopher Larson
2fe9a05666 oe.scriptutils.run_editor: ditch the error-prone argument quoting
Rather than trying to construct a string by quoting the files in an
error-prone way, parse $EDITOR to pass a list to subprocess rather than
a string.

(From OE-Core rev: c9fdf3d046606a0becb2e6b566a481c483b9021a)

Signed-off-by: Christopher Larson <chris_larson@mentor.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-27 13:55:21 +01:00
Anuj Mittal
5d9d5b869d wic/bootimg-efi.py: recognize initrd when using grub
Make sure that we're able to use the initrd value specified in the wks
file when using grub-efi bootloader with bootimg-efi wic plugin.

Fixes [YOCTO #12689]

(From OE-Core rev: f1d5bb1f21e11714357aff4ae7e52421e3756c5a)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-04 15:15:00 +01:00
Anuj Mittal
ccd8044f33 wic/engine.py: improve error message when required tools are missing
Instead of showing that command 'None' was found, show the name of
actual command that wasn't found on the host machine or at the native
sysroot path provided by user.

(From OE-Core rev: 3157ebb131e01e74689b1f87a35278350f315e7d)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-04 15:15:00 +01:00
Anuj Mittal
9481289419 qemux86-directdisk.wks: remove uvesafb.mode_option
Let this be dictated by the module parameter value being set by qemu
machine configuration.

(From OE-Core rev: c40b241e8d40c8bc1c9e6065b12e260662f5bba4)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-06-04 15:15:00 +01:00
Ricardo Ribalda Delgado
5f6bfdbff5 wic: Fix partition files UIDs on multi rootfs images
When a wks makes reference to multiple rootfs, libspeudo data is not
properly chossen. This results in filesystems with invalid UIDs for all
the files.

This can be tested with this .wks file:
part / --source rootfs --fstype=ext4 --rootfs-dir=core-image-base
part /mnt/data1/ --fstype=ext4 --source rootfs --rootfs-dir=core-image-minimal
part /mnt/data2/ --fstype=ext4 --source rootfs --rootfs-dir=core-image-minimal

And this script

$bitbake core-image-minimal core-image-base syslinux
$losetup --partscan --find --read-only --show test*direct
$sudo mount /dev/loop0p1 /mnt
$ls -lan /mnt
otal 40
drwxr-xr-x 18    0    0  1024 May 11 16:11 .
drwxr-xr-x 25    0    0  4096 May  6 06:31 ..
drwxr-xr-x  2 1000 1000  3072 May 11 15:51 bin
drwxr-xr-x  2 1000 1000  1024 May 11 13:59 boot
drwxr-xr-x  2 1000 1000  1024 May 11 13:59 dev
drwxr-xr-x 25 1000 1000  3072 May 11 15:51 etc
drwxr-xr-x  3 1000 1000  1024 May 11 13:59 home
drwxr-xr-x  6 1000 1000  3072 May 11 15:51 lib
drwx------  2    0    0 12288 May 11 16:11 lost+found
drwxr-xr-x  2 1000 1000  1024 May 11 13:59 media
drwxr-xr-x  3 1000 1000  1024 May 11 15:50 mnt
drwxr-xr-x  2 1000 1000  1024 May 11 13:59 proc
drwxr-xr-x  2 1000 1000  1024 May 11 15:51 run
drwxr-xr-x  2 1000 1000  3072 May 11 15:51 sbin
drwxr-xr-x  2 1000 1000  1024 May 11 13:59 sys
drwxr-xr-t  2 1000 1000  1024 May 11 13:59 tmp
drwxr-xr-x 10 1000 1000  1024 May 11 14:54 usr
drwxr-xr-x  8 1000 1000  1024 May 11 14:55 var
$sudo losetup -d /dev/loop0

(From OE-Core rev: 450335ba5e73a375eb9932b4c4cf37979640dbfc)

Signed-off-by: Ricardo Ribalda Delgado <ricardo.ribalda@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-22 13:13:32 +01:00
Chen Qi
a6abac49bd devtool/upgrade: fix the order of license checksum representation
In most recipes in OE, beginline and endline are before md5 checksum.
We should obey this tradition in devtool's upgrade. Otherwise, we might
see meaningless change just because of the order change.

e.g.
-LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=7765a3d787cb4fed3ccc3c9cee030af9 \
-                    file://plugins/sudoers/redblack.c;beginline=1;endline=41;md5=805782a8466975716f8376b2be9aedde \
-                    file://lib/util/reallocarray.c;beginline=3;endline=16;md5=85b0905b795d4d58bf2e00635649eec6 \
-                    file://lib/util/fnmatch.c;beginline=3;endline=27;md5=67f83ee9bd456557397082f8f1be0efd \
-                    file://lib/util/getcwd.c;beginline=5;endline=27;md5=449af4cc57fc7d46f42090608ba3e681 \
-                    file://lib/util/glob.c;beginline=6;endline=31;md5=5872733146b9eb0deb79e1f664815b85 \
-                    file://lib/util/snprintf.c;beginline=6;endline=34;md5=c82c1b3a5c32e08545c9ec5d71e41e50 \
-                    file://include/sudo_queue.h;beginline=5;endline=27;md5=449af4cc57fc7d46f42090608ba3e681 \
-                    file://lib/util/inet_pton.c;beginline=3;endline=17;md5=3970ab0518ab79cbd0bafb697f10b33a"
+LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=cc4bf2366b059c9598e3947f885931ec \
+                    file://plugins/sudoers/redblack.c;md5=805782a8466975716f8376b2be9aedde;beginline=1;endline=41 \
+                    file://lib/util/reallocarray.c;md5=85b0905b795d4d58bf2e00635649eec6;beginline=3;endline=16 \
+                    file://lib/util/fnmatch.c;md5=67f83ee9bd456557397082f8f1be0efd;beginline=3;endline=27 \
+                    file://lib/util/getcwd.c;md5=449af4cc57fc7d46f42090608ba3e681;beginline=5;endline=27 \
+                    file://lib/util/glob.c;md5=5872733146b9eb0deb79e1f664815b85;beginline=6;endline=31 \
+                    file://lib/util/snprintf.c;md5=c82c1b3a5c32e08545c9ec5d71e41e50;beginline=6;endline=34 \
+                    file://include/sudo_queue.h;md5=449af4cc57fc7d46f42090608ba3e681;beginline=5;endline=27 \
+                    file://lib/util/inet_pton.c;md5=3970ab0518ab79cbd0bafb697f10b33a;beginline=3;endline=17 \
+                    "

After this change, it becomes:
-LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=7765a3d787cb4fed3ccc3c9cee030af9 \
+LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=cc4bf2366b059c9598e3947f885931ec \
                     file://plugins/sudoers/redblack.c;beginline=1;endline=41;md5=805782a8466975716f8376b2be9aedde \
                     file://lib/util/reallocarray.c;beginline=3;endline=16;md5=85b0905b795d4d58bf2e00635649eec6 \
                     file://lib/util/fnmatch.c;beginline=3;endline=27;md5=67f83ee9bd456557397082f8f1be0efd \
@@ -12,7 +12,8 @@ LIC_FILES_CHKSUM = "file://doc/LICENSE;md5=7765a3d787cb4fed3ccc3c9cee030af9 \
                     file://lib/util/glob.c;beginline=6;endline=31;md5=5872733146b9eb0deb79e1f664815b85 \
                     file://lib/util/snprintf.c;beginline=6;endline=34;md5=c82c1b3a5c32e08545c9ec5d71e41e50 \
                     file://include/sudo_queue.h;beginline=5;endline=27;md5=449af4cc57fc7d46f42090608ba3e681 \
-                    file://lib/util/inet_pton.c;beginline=3;endline=17;md5=3970ab0518ab79cbd0bafb697f10b33a"
+                    file://lib/util/inet_pton.c;beginline=3;endline=17;md5=3970ab0518ab79cbd0bafb697f10b33a \
+                    "

(From OE-Core rev: 6c5cc1b298be6aa1e9d378bc8349e11cbf17d300)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-15 10:56:50 +01:00
Chen Qi
c5d7bd3ee9 devtool/sdk.py: error out in case of downloading file failure
It's possible that downloading file from updateserver fails. In
this case, we should error out instead of continue.

We have users reporting unexpected behavior of 'devtool sdk-update'.
When an invalid url is supplied, e.g., `devtool sdk-update http://invalid',
the program reports 'Note: Already up-to-date'.

This is obviously not expected. We should error out in such case.

(From OE-Core rev: 449564783dfb162536a2f772b3a8704973221e0f)

Signed-off-by: Chen Qi <Qi.Chen@windriver.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-15 10:56:48 +01:00
Ross Burton
4d2b500a08 oe-buildperf-report: highlight large changes in the HTML report
If the relative difference is greater than 2%, make the text bold to highlight
it.

(From OE-Core rev: 500e28311248713d4772480b81b10777390da909)

Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-11 07:49:38 +01:00
Sarah Marsh
d845b9960b recipetool: fixed uncaught NameError exception
When packaging a node application, a `NameError` can be thrown in create_npm.py if an optional npm dependency does not
support Linux.

(From OE-Core rev: 8293201d98d368d6322eaa960fb3e7cee2ba9368)

Signed-off-by: Sarah Marsh <sarah.marsh@arm.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-05-04 13:28:01 +01:00
Richard Purdie
b71709b0e2 wic/imager/direct: Ensure correct ROOTFS_DIR is shown
This changes the output of "wic create mkefidisk -e core-image-sato" from:

The following build artifacts were used to create the image(s):
  ROOTFS_DIR:                   /media/build1/poky/build/tmp.wic.ybraavmb/rootfs_copy

to:

The following build artifacts were used to create the image(s):
  ROOTFS_DIR:                   /media/build1/poky/build/tmp/work/qemux86_64-poky-linux/core-image-sato/1.0-r0/rootfs

which s much less confusing for the user.

[YOCTO #12564]

(From OE-Core rev: a4941af2d3624aecc5dcd7ff54b7ea8c9e9dee8b)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-20 08:19:46 +01:00
Alexander Kanavin
003e908865 yocto-check-layer: add a test for correct setting of LAYERSERIES_COMPAT_collection
[YOCTO #12661]

(From OE-Core rev: 13a80b22f28b81a0082d181674295a0f96111f6b)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-10 09:10:36 +01:00
Ming Liu
6c951c5a5e recipetool: create: fix port number parsing issue
A flaw was found when I run:
$ recipetool create "ssh://git@xxx.xxx:7999/xxx.git"

the url turned out to be: "git://git@xxx.xxx/7999/xxx.git;protocol=ssh"
after parsing, the port number was parsed as part of the path, this is
definitely wrong and lead to fetching failures.

This issue could be fixed in reformat_git_uri, by filtering out port
numbers when formatting ":".

(From OE-Core rev: 4290e04b69360b5e1da9f37166015e30f66cb335)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-04-03 23:53:20 +01:00
Anuj Mittal
c37053857d checklayer: remove reference to undefined class
LayerError doesn't exist and will lead to an error when this failure
code path is hit.

(From OE-Core rev: 7780482772d005c77825dc3e99e63f00911156bf)

Signed-off-by: Anuj Mittal <anuj.mittal@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-20 09:59:31 +00:00
Alexander Kanavin
8cec60990e devtool: add --force-patch-refresh to 'modify' and 'finish' commands
This is very useful for updating patch context so that any fuzz is eliminated.
Simply issue:

devtool modify <recipe>
devtool finish --force-patch-refresh <recipe> <layer_path>

Without this flag, devtool will not deem the commits in the workspace
different to patches in the layer, even if the commits have different,
up-to-date context line in them.

(From OE-Core rev: 7e1d1887be8faaaab9996fca9a3fd750aeb7b62f)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-11 06:27:00 -07:00
California Sullivan
46bb764616 wic: add wks file to make use of exclude-path functionality
Using --exclude-path and a wks.in file we can create an image that takes
the /boot/ directory for the boot partition, has an empty /boot/
directory in the rootfs partition. The boot partition gets mounted to
/boot/ after startup.

(From OE-Core rev: db904053e8ee80fb6930c5e7e22287927e0f25e2)

Signed-off-by: California Sullivan <california.l.sullivan@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-06 06:35:42 -08:00
Paulo Neves
2327e0f585 wic: Set a miniumum FAT16 volume size.
Set a miniumum FAT16 volume size because images are
not valid to parted if this minimum value is not respected.

The value set is determined experimentally forr a logical
sector size of 512. This fixed my local problem but, there
may be better solutions.

(From OE-Core rev: f7dfb4d43247d3c13a4e0a3853007d63b9512b83)

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:35:40 +00:00
Paulo Neves
5796b037d5 wic: partition plugin wrongly assumes it is rootfs
The partition plugin is used as the base for other plugins.
One of the methods the plugins use, is the prepare_rootfs
method.

The prepare_rootfs method wrongly assumes that the value
ROOTFS_SIZE from bitbake datastore is relevant to every
invocation of prepare_rootfs, which it clearly is not, for
example in the bootimg-partition case.

This commit adds an optional argument to prepare_rootfs
where a caller can tell prepare_rootfs if it is an actual
rootfs and whether related rootfs information retrieved from
bitbake is valid. The default behavior of this optional
argument is to assume that the invocation is an actual
rootfs, to maintain compatibility with previous
implementations.

(From OE-Core rev: 654d72d55194ec41bc1aacfcc6b2c8c9a305b042)

Signed-off-by: Paulo Neves <ptsneves@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:35:40 +00:00
Parthiban Nallathambi
8eb7e66246 wic: Add post operation hook for SourcePlugin
do_post_partition hook is needed if some operations like security signing
the parition needs to be done. source plugins can make use of this to implement
post operatiosn in do_post_partition. do_post_partition is called after
do_prepare_partition if present.

(From OE-Core rev: 5055489b9ab3fda32a285d0d165d080d11a4d432)

Signed-off-by: Parthiban Nallathambi <pn@denx.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-04 11:35:40 +00:00
Paul Eggleton
80feb637a4 devtool: search: tweak help text
* We now match on more than just target recipes, so don't specify that
  only target recipes are searched.
* We're printing the SUMMARY value in addition to the name, so mention
  that so it's clear where that text is coming from.
* Remind users that they should use quotes around the keyword to avoid
  shell expansion when using regular expressions.

(From OE-Core rev: cc68971557fe065e59ff47657f650051eb85db3c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:13:56 +00:00
Paul Eggleton
e8c7c36c60 devtool: search: also look in recipe cache
If pkgdata isn't present or is incomplete, then you get either a
traceback or you don't see the results you were hoping for. The recipe
cache that bitbake collects during startup contains some useful
information for each recipe that we could search through as well, and
we can access it easily using tinfoil's all_recipes() API function,
so add some code that does that. (We still show a warning if pkgdata
isn't present, as there are certain dynamic packages that are generated
at packaging time that won't show up in the cache).

One side-effect of this is that we will start showing non-target
recipes - that's actually a good thing, since seeing those is useful,
however we exclude nativesdk recipes when in the eSDK to avoid confusion
since nativesdk isn't directly applicable there.

Fixes [YOCTO #12356].

(From OE-Core rev: b8406383886d09a80a9a002150dcf364fa9902d7)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:13:56 +00:00
Paul Eggleton
3bb00af9ab devtool: deploy-target: don't specify ssh/scp port unless user does
If the user doesn't specify a port then we should avoid specifying one
on the ssh/scp command line in case the user has configured one for the
host they are connecting to, which was being overridden unnecessarily.

Fixes [YOCTO #12381].

(From OE-Core rev: f1020eef09fada7ef2231d5528576553f3f6bfe1)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:13:56 +00:00
Paul Eggleton
0465558e83 devtool: finish: fix erroneously creating bbappend for relative paths
After OE-Core rev 5e3fe00a0233d563781849a44f53885b4e924a9c we call
os.path.abspath() on the original layer path, but we later compare that
to the destination layer path. If that layer path isn't absolute but is
effectively the same path, it should be writing to the original recipe
but because we weren't making it absolute we were writing a bbappend
instead. Call os.path.abspath() on the destination path as well to avoid
that.

(From OE-Core rev: a85a78dcf226d160e9b504bfa67b306a9175ac29)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:13:56 +00:00
Paul Eggleton
e295135ba1 devtool: reset: delete bbappend file if _check_preserve() doesn't
If the .devtool_md5 file doesn't contain a reference to the bbappend
file (e.g. because devtool was interrupted before it could write that
out) then _check_preserve() won't delete it, so we need to delete it
separately because otherwise the recipe won't actually be reset.

(From OE-Core rev: 751d27600a3df18d96baaa48696acf33ee964bec)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:13:56 +00:00
Paul Eggleton
2f40a87424 devtool: fix poor handling of upgraded BBCLASSEXTENDed recipes
Fix two aspects of handling BBCLASSEXTENDed targets (e.g.
openssl-native) that have been run through "devtool upgrade":

* Fix recipe name not showing up in "devtool status"
* Fix "devtool reset" not deleting empty directories under the recipe
  directory within the workspace, which may lead to problems if you
  subsequently run "devtool upgrade" on the same target again

(From OE-Core rev: 56e04260d64de9c5b83893d97cf41b7ea9a45878)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-03-01 22:13:56 +00:00
Paul Eggleton
a1179425a9 devtool: set up git repos so that singletask.lock is ignored
singletask.lock is written out while certain tasks execute for recipes
that have externalsrc.bbclass enabled - this includes recipes in
devtool's workspace. It appears that there's a race where
singletask.lock will be there one minute and then when we try to get the
file checksum of it (since we want to know if anything in the source
tree has changed) it will be gone, and git chokes. To fix that, add
singletask.lock to .git/info/exclude in the repository, regardless of
whether we created the repository or not. In any case singletask.lock
should never be tracked by git, so this is a good thing to be doing for
that reason as well.

This fixes oe-selftest failures in test_devtool_modify that we've seen
on the Yocto Project autobuilder:

bb.data_smart.ExpansionError: Failure expanding variable
do_compile[file-checksums], expression was ${@srctree_hash_files(d)}
which triggered exception CalledProcessError: Command
'['git', 'add', '-A', '.']' returned non-zero exit status 128.

Note that this only fixes this issue for devtool; if you are using
externalsrc independently of devtool there's a chance this will still
be an issue unless you add singletask.lock to your .gitignore.

(From OE-Core rev: 334ba846c795fc0d8c73ce05a1b0882739c86650)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-02-06 11:06:27 +00:00
Alexander Kanavin
c1058ac4f2 devtool: rename the suggested license change tag to 'License-Update:'
(From OE-Core rev: 3905ae20330f204f3c8997e2d5aaf15dcf5a860c)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-18 12:50:37 +00:00
Dogukan Ergun
bab3b2e939 wic: if we can't get from ioctl, try from os.stat()
Under some conditions, ioctl FIGETBSZ can't return real value.
We can try to use fallback via os.stat() to get block size.

Source of patch:
17365f4fe9

(From OE-Core rev: d8f7cf2d38934c248be91101236f7537d0d31ea7)

Signed-off-by: Dogukan Ergun <dogukan.ergun@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-14 09:11:57 +00:00
Adrian Fiergolski
faae2df397 wic: Fix a path to a psuedo state directory (PSEUDO_LOCALSTATEDIR).
In case of 'new_rootfs' the psuedo directory is not copied. Thus
PSEUDO_LOCALSTATEDIR should still point to the dsa
'native_sysroot'/../pseudo. Otherwise PSEUDO_LOCALSTATEDIR points to a not
existing director ('new_rootfs'/../pseudo) and UID and GUID attributes are not
applied to files of the image.

(From OE-Core rev: 19642e2d6e015072e4a413f4f57aee65df757cb9)

Signed-off-by: Adrian Fiergolski <adrian.fiergolski@cern.ch>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2018-01-02 17:24:37 +00:00
Tom Rini
9ebc830196 wic: Introduce --fsuuid and have --use-uuid make use of UUID too
First, allow for wic to be given a filesystem UUID to be used when
creating a filesystem.  When not provided, wic will generate the UUID to
be used.  Next, when --use-uuid is passed, we update the fstab to mount
things via UUID (and if not found, then use PARTUUID) as UUID is more
portable.

(From OE-Core rev: 9256b8799495634ee8aee5d16ff71bd6e6e25ed4)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:58 +00:00
Tom Rini
20748d8ddc wic: partition.py: Update comments slightly
First, we support squashfs as root, so mention that.  Second, the btrfs
rootfs creation function had a copy/paste of the previous function
comment, remove the irrelevant line.

(From OE-Core rev: 7cdd4034b3e6ff4e13d491dfba24906afe495e2d)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:58 +00:00
Tom Rini
cce54f6a19 wic: kparser.py: Check for SquashFS and use-uuid
The SquashFS filesystem does not support UUIDs so make this combination
be an error.

(From OE-Core rev: 2fbdcf4e59c835af0f4041bc34243decb42321ef)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:58 +00:00
Alexander Kanavin
2de2a19a00 devtool: add license checksum change handling to 'devtool upgrade'
Specifically, 'devtool upgrade' will now do these things:

1) determine if any of the license checksums need updating; if so,
write the new checksums into the LIC_FILES_CHKSUM value in the recipe
that is written to the workspace;

2) print a notice to the standard output:

NOTE: New recipe is /home/ak/development/poky/build/workspace/recipes/puzzles/puzzles_git.bb
NOTE: License checksums have been updated in the new recipe; please refer to it for the difference between the old and the new license texts.

3) and the cool part: devtool will create a diff of the old and new licenses,
and write the diff into the workspace recipe as a comment, like this:

======
 FIXME: the LIC_FILES_CHKSUM values have been updated by 'devtool upgrade'.
 The following is the difference between the old and the new license text.
 Please update the LICENSE value if needed, and summarize the changes in
 the commit message via 'License-checksum-change:' tag.
 (example: 'License-checksum-change: copyright years updated.')

 The changes:

 --- LICENCE
 +++ LICENCE
 @@ -1,8 +1,9 @@
  This software is copyright (c) 2004-2014 Simon Tatham.

  Portions copyright Richard Boulton, James Harvey, Mike Pinna, Jonas
 -Klker, Dariusz Olszewski, Michael Schierl, Lambros Lambrou, Bernd
 -Schmidt, Steffen Bauer, Lennard Sprong and Rogier Goossens.
 +Kölker, Dariusz Olszewski, Michael Schierl, Lambros Lambrou, Bernd
 +Schmidt, Steffen Bauer, Lennard Sprong, Rogier Goossens and Michael
 +Quevillon.

  Permission is hereby granted, free of charge, to any person
  obtaining a copy of this software and associated documentation files

======

(From OE-Core rev: ccb37f9e81eb78ed0eb2a238d7c3e196db9b2f72)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:58 +00:00
Alexander Kanavin
b52a9cf310 devtool: provide useful defaults for version/commit when upgrading recipes
Specifically, 'devtool upgrade' will use the latest upstream release if available
or latest commit if upstream never makes releases.

(From OE-Core rev: 45b4242b105ad36e94ae15a96d588a58b917b8e8)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:57 +00:00
Alexander Kanavin
5b61268fca devtool: add a 'latest-version' command
This command queries the upstream server for what the latest release is and prints
the output; it is a much neater way to find out these things than fumbling with distrodata,
'bitbake -c checkpkg' and awkward to read csv output in a file.

Examples:

python3 (tarballs):
NOTE: Current version: 3.5.3
NOTE: Latest version: 3.6.3

rpm (git):
NOTE: Current version: 4.13.90
NOTE: Latest version: 4.14.0
NOTE: Latest version's commit: da3720f62e57648fb1dc2a632744d38866139971

puzzles (git without version tags):
NOTE: Latest commit: ee8ea9b9785964694cb2b3ad77c3fb2460f49510

(From OE-Core rev: e8f5b5cc25ce7a9882f21473cefc47edcebf77d4)

Signed-off-by: Alexander Kanavin <alexander.kanavin@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:57 +00:00
Chang Rebecca Swee Fun
05bcd72f9f recipetool: create: fix conflict between SRCREV and tag
If you specify 'tag=' for a git URL and passed to recipetool create, you
will get into Bitbake expansion error shown below:

----- snip -----
$ devtool add --version 2.4.2 mbedtls "git://github.com/ARMmbed/mbedtls;tag=mbedtls-2.4.2"
...
bb.data_smart.ExpansionError: Failure expanding variable SRCPV, expression was ${@bb.fetch2.get_srcrev(d)} which triggered exception FetchError: Fetcher failure: Conflicting revisions (abeccb9dbd7e19ae91ac50e1edd3803111c5f9b6 from SRCREV and mbedtls-2.4.2 from the url) found, please specify one valid value
----- snip -----

Assuming the tag is valid, we should get the tag commit hash and
drop the usage of 'tag=' from SRC_URI. By using a commit hash
corresponding to the tag will prevent bitbake from accessing
remote repository in order to expand SRCPV.

(From OE-Core rev: 53f8effa3eb07dc7035ff9933e7918318f242579)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-18 18:03:57 +00:00
Martin Hundebøll
23825ed16a wic: support filesystem label for rawcopy
The '--label' argument should work for '--source rawcopy' as it does for
'--source rootfs', so add a method in RawCopyPlugin to update the label
on the temporary filesystem images.

(From OE-Core rev: 303d6ca5ae986acd2e633b0dc5e386ee7771f8ab)

Signed-off-by: Martin Hundebøll <mnhu@prevas.dk>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-12-10 22:45:19 +00:00
Paul Eggleton
d6829f4f6c recipetool: create: fix failure handling included dicts
If a setup dict in a python setup.py file pulled in the contents of
another dict (e.g.  **otherdict), then we got an error when mapping
the keys because the key is None in that case. Skip those keys to avoid
the error (we pick up the values directly in any case).

A quick reproducer for this issue:

recipetool create https://files.pythonhosted.org/packages/source/p/pyqtgraph/pyqtgraph-0.10.0.tar.gz

(From OE-Core rev: ae62a9953e219df5147ed4a5ae3f4163d51cff28)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-21 13:06:12 +00:00
Paul Eggleton
125e0b72b7 devtool: implement conditional patch handling
If you have a recipe that uses overrides to conditionally extend
SRC_URI to add additional patches, then you will often need to update
those patches if you're making other changes to the source tree (for
example if you're upgrading the underlying source). Make this possible
with devtool by creating devtool-override-* branches for each override
that conditionally appends/prepends SRC_URI, and have devtool
update-recipe / finish check each branch out in turn and update the
corresponding patches.

A current example of a recipe that does this is the quota recipe - it
applies an additional patch if musl is the selected C library (i.e.
libc-musl is in OVERRIDES).

Note that use of this functionality does require some care - in
particular, updates to patches that appear on the main branch (named
"devtool" by default) should be made there and not only on one of the
specific devtool-override-* branches that are created for each override.
The recommended procedure is to make the changes you want to make to the
main branch first, then check out and rebase each devtool-override-*
branch, testing each one by activating the corresponding configuration,
and then finally run devtool finish.

Fixes [YOCTO #11516].

(From OE-Core rev: aa87603d1ffd695027847f4df75c0406cf4e14d8)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
9a80078e4b devtool: finish: add dry-run option
If you're not sure what changes devtool finish is going to make, or
you're not sure you're finished with your modifications, it is useful to
be able to see what devtool finish is going to do beforehand, so add
a -N/--dry-run option to make that possible.

(It's also very useful for debugging devtool finish itself.)

(From OE-Core rev: 05f2d5d2ce00c53825ccea5cd9c2262f9d27a638)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
d906d7cea8 devtool: finish: improve reporting for removed files
If a file is going to be effectively removed from the destination by
devtool finish, we should report that rather than just reporting that
we're removing files from the workspace. This is a little tricky because
the way we actually operate when finishing is to:
 (1) remove all original files (as recorded by devtool upgrade, if that
     was used)
 (2) as part of updating the recipe file, remove the files from next to
     the new recipe (i.e. in the workspace for an upgrade, real recipe
     otherwise) corresponding to commits not in the git tree
 (3) copy over remaining files from the workspace to the destination

To report the files removed with respect to what was originally there,
we need to swap steps 1 and 2 so we can see what no longer exists after
the deletion, and suppress the reporting currently done in step 2 -
however, we still want to report removal in step 2 for the non-upgrade
case, so the latter is conditional.

(From OE-Core rev: db1d663507509cac9d97d7c96ac8590478767ba2)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
541b7e2ce0 devtool: show a better error message if meta-files aren't found
If the files that the devtool-source class is supposed to create in the
source tree aren't found in the temporary directory then we know that
the class hasn't worked properly - say that explicitly.

(From OE-Core rev: 4621152509c037532b133e5e6d5b73bda7ddb602)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
46a3662d4e devtool: upgrade: reformat --no-patch warning message
* Only log one warning message instead of one per line
* Be a bit more verbose
* "if list" is more pythonic than "if len(list)"

(From OE-Core rev: 2d11e9e6e73648c1cb514c0c10111c7886acae78)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
fcb84383ce devtool: upgrade: automatically handle changes to source subdirectory
If the directory where the source code extracts to changes (for
example, when upgrading iucode-tool from 1.5 to 2.1.1, the subdirectory
in the tarball changed from "iucode_tool-${PV}" to "iucode-tool-${PV}")
then handle this automatically. Also handle when it changes to match the
default S value (i.e. "${WORKDIR}/${BP}") in which case we just drop
setting S in the recipe.

Fixes [YOCTO #10939].

(From OE-Core rev: d29881a652bf03627d257a1eac5f02ec17315b8b)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
f6e21d1bfc devtool: upgrade: show messages before source extraction steps
Give the user a little more insight into what's being done.

(From OE-Core rev: 9cf2089bd22b9fc4eb0eec8d4924e44519412dad)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
89ac9a6b8b recipetool: create: show a warning for github archive URLs
github archive URLs are not guaranteed to be stable [1] and thus we
should show a warning if a user specifies one to recipetool create (or
devtool add).

[1] http://lists.openembedded.org/pipermail/openembedded-core/2017-September/142519.html

(From OE-Core rev: 7e84a777aa924a237b4e604120ebf8a4b3ba53b2)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
941902d6bb recipetool: create: drop debug print
This looks like some debug printing that was left in by accident.

(From OE-Core rev: b0bfa1b1f4377270af9e7f19949cc1781a4e3b9d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
b5c72fe584 devtool: upgrade: handle recipes that use named SRC_URI checksums
devtool upgrade did not properly handle setting SRC_URI checksums for
recipes that use named SRC_URI entries and also use those names in the
SRC_URI checksums. A further complication was where the name contained
an expression that changed with the version e.g. ${PV} (probably quite
rare, but the dnsmasq recipe in meta-networking is currently one such
recipe.) All of these are now handled properly.

Additionally, drop the _get_checksums() function that wasn't being
called from anywhere in the code.

Note that this now turns nowrap_vars in recipeutils.py to be a list of
regexes, hence things such as [ and ] need to be appropriately escaped.

(From OE-Core rev: c914a5e1ad6d96e316746222e5d42f2ba9110060)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
ff1efda2af devtool: finish: fix "layer not in bblayers.conf" warning when path specified
devtool finish will check if the destination layer is part of
bblayers.conf so that we avoid the user getting confused about the
recipe vanishing from their configuration if it isn't. devtool finish
also accepts a path underneath a layer so that you have a bit
more control over where it ends up. However if you used a path
underneath a layer then it wasn't converting this to the base of the
layer before checking it against BBLAYERS, thus the warning was being
shown erroneously in that case.

(From OE-Core rev: ab1b8d55e551fea3e8656aab7a786d1bfec62d0f)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
fe85a2a8b4 devtool: finish: ensure repository is clean before proceeding
If the git repository for a recipe in the workspace has uncommitted
changes in it then it's possible that the user has forgotten to commit
something, so check and exit if there are any. Provide a -f/--force
option to continue in the case where the uncommitted changes aren't
needed.

Separately, if the repository is in the middle of a rebase or git am /
apply then error out (without the opportunity to force) since the user
really needs to sort this out before finishing.

(From OE-Core rev: bfebd18982c0c82ef2da63ec8f22175c93b2e308)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
d5ffd41a93 devtool: reset: print source tree base path
If S points to a subdirectory of the source rather than the "base" of
the source tree then print that rather than the subdirectory path when
telling the user they need to remove the source tree, since that is the
directory that they will need to remove.

(From OE-Core rev: 9e8808099046478e98c6cf1903dc6787d69132fc)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
73a25acd20 devtool: make find-recipe and edit-recipe always work with any recipe
After some reconsideration I think it's a bit annoying for users to be
forced to use an option to work with recipes where the file isn't in the
workspace, so let's just have these commands check the workspace first
for the recipe, and if it isn't there then load the cache and get it
that way.

(From OE-Core rev: 46683c61069a386658676a79d797062404bf1140)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
624a07a766 devtool: show some warnings for upgrade versions
* Show a warning in devtool upgrade if the version is less than the
  current version suggesting that the user may need to bump PE in the
  recipe
* Show a warning in devtool add and devtool upgrade if the version looks
  like a pre-release version suggesting using a version number that
  won't mess up the progression when you come to upgrade to the final
  release version.

(From OE-Core rev: 92c4d9be9ed365c449ea1ac5a18ddb15e4a36b2d)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
1d31cee42d devtool: fix handling of oe-local-files when source is in a subdirectory
If S points to a subdirectory of the source rather than the "base" of
the source tree then we weren't handling the oe-local-files directory
properly - it got extracted to the base of the tree but devtool
update-recipe and devtool finish assumed it would be under S which would
be the subdirectory, thus it would be missing and devtool would assume
the files had been deleted and remove them from the recipe. Record the
base of the source tree in the bbappend and read it into the in-memory
workspace so we can use that to find out where oe-local-files should be
found.

(From OE-Core rev: 30d2ea67b2c4727e23d06a35745b1afa64b130cc)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
7bab0de6cb devtool: upgrade: improve performance and show progress when adding files
When devtool upgrade is upgrading to a new version where the source is
fetched as an archive (e.g. a tarball), we create a single commit in the
git repository that is the upgrade from the old version to the new. We
do this by extracting the old source, committing it, deleting all files,
copying in the new files, running git add on each new/changed/deleted
file, and then committing the result. When a lot of files have changed
in an upgrade (such as QEMU 2.8.1.1 -> 2.10.0) the penultimate step of
running git add it can take quite a long time; in order to reduce this
and show some feedback to the user, run git add with batches of 100
files at once and also show a progress bar. In a local test with the
aforementioned QEMU upgrade it took the time down from over 7 minutes
down to about 13 seconds.

Fixes [YOCTO #11948].

(From OE-Core rev: 8b184f6c874b60324ee107af53853687173d3434)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:27 +00:00
Paul Eggleton
7b59e0b877 devtool: upgrade: fix not committing deleted files with older git versions
With versions of git older than 2.0, "git add" on a deleted file (i.e.
in this case a file that was removed between versions) will not add the
delete to be committed by default, with the result that the rebase of
patches on top of the new branch will fail. We need to use the -A
option in order to force that for older git versions.

(From OE-Core rev: c7f4c9f050c11c0de7fcf5badcc19a8fbc6428cf)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:26 +00:00
Paul Eggleton
eda77b320d devtool: upgrade: fix accidentally swapped parameters
It appears that when fixing the signature unlocking in OE-Core commit
4e9a0be32fc30fb87d65da7cd1a4015c99533aff I swapped the parameters here
and did not test it within the eSDK (it does nothing outside of the
eSDK) resulting in a TypeError when devtool upgrade was used in the
eSDK. Swap the parameters around to the correct ordering.

Fixes [YOCTO #12285].

(From OE-Core rev: 05e2c4ada7083f40866846a21fe76c852f1dfefe)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:26 +00:00
Paul Eggleton
e9bb56067a recipetool: ignore incidental kernel module source
If the source tree happens to contain a kernel module as an example, a
test or under a "contrib" directory then we shouldn't be picking it up
and making the determination that the entire thing is a kernel module.

An example that triggered this is zstd, which ships a kernel module
under contrib/linux-kernel:

  https://github.com/facebook/zstd

(From OE-Core rev: c2b3154158d4bb0855daa56477393341139d4cf9)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:26 +00:00
Paul Eggleton
05d1e69956 recipetool: pass absolute source tree path to plugins
We shouldn't be passing a relative path to the plugins if that's what's
been specified on the recipetool command line.

(From OE-Core rev: 949067384c5166058ebc76f931cc492dad1db645)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-11 12:14:26 +00:00
Tom Rini
5ae92b6dd3 wic: Update canned-wks for systemd to use UUID everywhere
With systemd, the mounting of the swap partition is handled via systemd
and will mount it, regardless of if PARTUUID is parsed or not.  systemd
has a runtime dependency on util-linux-mount so PARTUUID for regular
mount points will be handled correctly.  Make all partitions that we add
to the image make use of UUIDs for maximum portability.

(From OE-Core rev: 497467262d501b94061338b4ce826c6f2f9b97b4)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-08 22:24:04 +00:00
Tom Rini
7707961e9f wic: When using --use-uuid make sure that we update the fstab with PARTUUID
When we have been told to use the UUID we should also update the fstab
to make use of PARTUUID instead of hard-coding the device in question.
This will make the resulting image much more portable.

(From OE-Core rev: e7443e7cf876d9bbe326033ac5eee0b98ce5d37f)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-08 22:24:04 +00:00
Artur Mądrzak
6f3b0a48ac wic: add 'part-name' argument for naming GPT partitions
The WIC's 'part' can now give a name for GPT partition in WKS file.
It's similar to '--label', but is naming partintions instead file systems.
It's required by some bootloaders to partitions have specified names.

(From OE-Core rev: 9b60e3466ed7cff0cea10815851eb1304002eb52)

Signed-off-by: Artur Mądrzak <artur@madrzak.eu>
Signed-off-by: Nicolas Dechesne <nicolas.dechesne@linaro.org>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-07 13:25:31 +00:00
Joshua Lock
58ef101032 scripts/lib/bsp: delete, all users have been removed
With the removal of yocto-bsp and yocto-kernel there are no longer any users
of this library, therefore delete it.

(From meta-yocto rev: 0d44e59bfaa95162cf2133df1d08f6419314bb8e)

Signed-off-by: Joshua Lock <joshua.g.lock@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-05 22:33:24 +00:00
Saul Wold
e0521d4b12 wic: misc.py: Use mmd from mtools instead of syslinux
mtools already provides a suite of msdos utilities, switch to this
one also.  This could allow for future changes to reduce wic's
dependecies.

(From OE-Core rev: 13851100b81ce901069ef167d6b9b0faedb3f466)

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-05 22:33:23 +00:00
Saul Wold
d0bb833ec7 wic: misc.py: Added more mtools binaries
This fixes the issue that if you don't have mtools installed on the host
thus causing host contamination, that the correct binaries would be selected
from the native sysroot.

[YOCTO #12173]

(From OE-Core rev: dca43c557449d3765fec9f8d159d5c9e4ea8b0cb)

Signed-off-by: Saul Wold <sgw@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-11-05 22:33:23 +00:00
Peter Kjellerstedt
ede79dea7c devtool: standard: Expand SRCREV before using it in _update_recipe_srcrev
If SRCREV contains a variable reference, any devtool command that
would try to update it would fail. E.g., if SRCREV = "R${PV}", then
devtool finish without having committed any changes would fail with:

  oe.patch.CmdError: Command Error: 'sh -c 'git format-patch R${PV} -o
  /tmp/oepatchb_doareb -- .'' exited with 0 Output:
  fatal: bad revision 'R'

(From OE-Core rev: 094499c819722ad698ccb64ec65dd439b211c31c)

Signed-off-by: Peter Kjellerstedt <peter.kjellerstedt@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-10-16 23:52:44 +01:00
Fabio Berton
5c98f20f5c wic: Add option to not change fstab
Create an option to wic doesn't change fstab file, the final
fstab file will be same that in rootfs and wic doesn't update
file, e.g adding a new mount point.

Users can control the fstab file content in base-files recipe.
This is useful if you want to only create an partition but not
add fstab mount point or add new mount point using label e.g:

LABEL=recovery /recovery auto defaults 0  1

(From OE-Core rev: 00420ec42140c1b752132bda190dede85756d157)

Signed-off-by: Fabio Berton <fabio.berton@ossystems.com.br>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-26 11:05:01 +01:00
Ming Liu
5c67faff20 scripts: drop True option to getVar calls
Search made with the following regex: getVar ?\((.*), True\).

(From OE-Core rev: b848c3cb495905605283c57c79f2ed8ca17758db)

Signed-off-by: Ming Liu <liu.ming50@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-26 11:05:01 +01:00
Enrico Scholz
edcf39820f wic: allow multiple /boot partitions with different content
It can be useful to have multiple partitions with '--source bootimg-partition'
but different content.

E.g. for TI AM335x, one boot partition can contain an first stage
bootloader ("MLO"), while the real bootloader and kernel plus devicetree
are in another one.

Patch allows to specify multiple IMAGE_BOOT_FILES with optional "_label-XXX"
or "_uuid-XXX" overrides.

E.g. with this patch, a .wks file with

| part --source bootimg-partition ... --label=mlo --active
| part --source bootimg-partition ... --label=boot0
| part --source bootimg-partition ... --label=boot1

and a recipe with

| IMAGE_BOOT_FILES_label-mlo = "\
|   MLO-${MACHINE}.img;MLO \
| "
|
| IMAGE_BOOT_FILES_label-boot0 = "\
|   u-boot-${MACHINE}.img;u-boot.img \
|   zImage \
| "
|
| IMAGE_BOOT_FILES_label-boot1 = "${IMAGE_BOOT_FILES_label-boot0}"
|
| WICVARS += " \
|   IMAGE_BOOT_FILES_label-mlo \
|   IMAGE_BOOT_FILES_label-boot0 \
|   IMAGE_BOOT_FILES_label-boot1 \
| "

is possible.  It will create one partition with the MLO and two redundant
ones with the uboot + kernel.

(From OE-Core rev: 8c1dec627e9735260516fe8f0b2bfdb0ee70172b)

Signed-off-by: Enrico Scholz <enrico.scholz@ensc.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-25 14:14:16 +01:00
Paul Eggleton
b32174e58e scripts: rename yocto-compat-layer to remove "compatible" nomenclature
"Yocto Project Compatible" [1] is a programme which requires you meet
specific criteria including going through an application process - it is
not sufficient simply to run the script we have created here and have it
produce no warnings/errors. To avoid people being confused by the fact
that this script uses the term "compatible" or variations thereof,
substitute usage of that word with "check" instead. The functionality of
the script is unchanged.

[1] https://www.yoctoproject.org/ecosystem/yocto-project-branding-program

(From OE-Core rev: 2a6126a115f10750ea89f95629d3699ad41c5665)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-21 11:34:19 +01:00
Markus Lehtonen
6c222a5c11 scripts/oe-build-perf-report: show recipe version changes in html report
If buildstats are available (for a certain measurement), show recipe
version changes between the two builds that are being compared. The
information shown includes new and dropped recipes as well as changes in
recipe version, revision or epoch.

[YOCTO #11382]

(From OE-Core rev: 46eb839b51bb1466a9feeb09c9c437d6d45576cc)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:30 +01:00
Markus Lehtonen
a80f5e761c scripts/buildstats-diff: move more code to lib/buildstats.py
More refactoring of buildstats-diff script. Move recipe version
comparison functionality to scripts/lib/buildstats.py. This patch also
compasses some wording changes, i.e. changing 'package' to 'recipe'.

[YOCTO #11382]

(From OE-Core rev: 2f8942d6830258fcbe1925f12ba1516def32d132)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:30 +01:00
Markus Lehtonen
81aef784fd scripts/oe-build-perf-report: summary of task resource usage
Utilize buildstats, if available, and show a summary of the resource
usage of bitbake tasks in the html report. The details provided are:
- total number of tasks
- top 5 resource-hungry tasks (cputime)
- top 5 increase in resource usage (cputime)
- top 5 decrease in resource usage (cputime)

[YOCTO #11381]

(From OE-Core rev: ddd9443cb2432af2c15b358bfda708393fa3c417)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:30 +01:00
Markus Lehtonen
b5fb3dd904 scripts/buildstats-diff: move code to lib/buildstats.py
Move over code from buildstats-diff to new scripts/lib/buildstats.py
module in order to share code related to buildstats processing.  Also,
refactor the code, introducing new classes to make the code readable,
maintainable and easier to debug.

[YOCTO #11381]

(From OE-Core rev: 8a2cd9afc95919737d8e75234e78bbc52e1494a1)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:30 +01:00
Markus Lehtonen
873707489f scripts/oe-build-perf-report: tidy up html syntax
Fix some problems in the html syntax of the generated report:
- prevent empty rows in the summary table
- add one missing column in the results table

(From OE-Core rev: 10883bb49ad2f5309883fd352cf320b2e1648615)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:30 +01:00
Markus Lehtonen
062bdb044c scripts/oe-build-perf-report: add AggregateTestData class
Making the code a bit more readable.

(From OE-Core rev: 25351c7cac167b1a3e8b531e2cdf708192c6fa1f)

Signed-off-by: Markus Lehtonen <markus.lehtonen@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:30 +01:00
Paul Eggleton
3fde63363a devtool: ensure recipes devtool is working on are unlocked within the eSDK
Alongside reworking the way devtool extracts source, we now need to
ensure that within the extensible SDK where task signatures are locked,
the signatures of the tasks for the recipes being worked on get unlocked
at the right time or otherwise we'll now get taskhash mismatches when
running devtool modify on a recipe that was included in the eSDK such as
the kernel (due to a separate bug). The existing mechanism for
auto-unlocking recipes was a little weak and was happening too late, so
I've reimplemented it so that:
(a) it gets triggered immediately when the recipe/append is created
(b) we avoid writing to the unlocked signatures file unnecessarily
    (since it's a global configuration file) and
(c) within the eSDK configuration we whitelist SIGGEN_UNLOCKED_RECIPES
    to avoid unnecessary reparses every time we perform one of the
    devtool operations that does need to change this list.

Fixes [YOCTO #11883] (not the underlying cause, but this manifestation
of the issue).

(From OE-Core rev: 4e9a0be32fc30fb87d65da7cd1a4015c99533aff)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:29 +01:00
Paul Eggleton
10af6d86b3 devtool: rework source extraction so that dependencies are handled
Since it was first implemented, devtool's source extraction (as used by
the devtool modify, extract and upgrade subcommands) ignored other recipe
dependencies - so for example if you ran devtool modify on a recipe that
fetches from svn or is compressed using xz then it would fail if those
dependencies hadn't been built first. Now that we can execute tasks in
the normal way (i.e. tinfoil.build_targets()) then we can rework it to
use that. This is slightly tricky in that the source extraction needs to
insert some logic in between tasks; luckily we can use a helper class
that conditionally adds prefuncs to make that possible.

Some side-effects / aspects of this change worth noting:
* Operations are a little slower because we have to go through the task
  dependency graph generation and other startup processing. There's not
  really any way to avoid this though.
* devtool extract didn't used to require a workspace, now it does
  because it needs to create a temporary bbappend for the recipe. (As
  with other commands the workspace be created on the fly if it doesn't
  already exist.)
* I want any existing sysroot files and stamps to be left alone during
  extraction since we are running the tasks off to the side, and
  especially devtool extract should be able to be used without touching
  these. However, this was hampered by the automatic removal process in
  sstate.bbclass triggered by bb.event.ReachableStamps when the task
  signatures change, thus I had to introduce a way to disable this
  removal on a per-recipe basis (we still want it to function for any
  dependencies that we aren't working on). To implement this I elected
  to use a file written to tmp/sstate-control which gets deleted
  automatically after reading so that there's less chance of stale files
  affecting future sessions. I could have used a variable but this would
  have needed to be whitelisted and I'd have to have poked its value in
  using the setVariable command.

Fixes [YOCTO #11198].

(From OE-Core rev: 830dbd66992cbb9e731b48d56fddf8f220349666)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:29 +01:00
Enrico Scholz
7324bc16a2 wic: accept '-' in bitbake variables
'-' is valid and common in bitbake variables (e.g. 'FOO_pn-bar'). Accept
it and other characters when reading the .env file.

Also, allow variables to be empty.

(From OE-Core rev: e688ac8e92d2bc451d8b2d437596f630bedccd2c)

(From OE-Core rev: 2a69250abf61e51f633033ddb672e8f459191899)

Signed-off-by: Enrico Scholz <enrico.scholz@ensc.de>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-18 11:07:29 +01:00
Juan M Cruz Alcaraz
688e0894aa devtool/standard: set a preferred provider when adding a new recipe with devtool
A recipe added with "devtool add" requires to be able to take precedence on recipes
previously defined with PREFERRED_PROVIDER.

By adding the parameter "--provides" to "devtool add" it is possible to specify
an element to be provided by the recipe. A devtool recipe can override a previous
PREFERRED_PROVIDER using the layer configuration file in the workspace.

E.g.
    devtool add my-libgl git@git://my-libgl-repository --provides virtual/libgl

[YOCTO #10415]

(From OE-Core rev: adeea2fe6895898a5e6006e798898f0f5dabd890)

Signed-off-by: Juan M Cruz Alcaraz <juan.m.cruz.alcaraz@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-13 22:07:42 +01:00
Paul Eggleton
6426136655 devtool: upgrade: check that user has configured git properly
If user.name or user.email haven't been set then git rebase can't really
work properly. Check that the user has set these and error out if not.
(Elsewhere we are relying on OE's git patch functionality which forces
a dummy OE value - that's OK there as it's completely under OE's control
and therefore it's OK for a dummy OE user to be the committer, but here
the rebase may require intervention so it's reasonable to have the
user's actual name and email on the operation.)

Fixes [YOCTO #11947].

(From OE-Core rev: 129a3be07e272013be2db17552c13b4d8cc2cf6e)

(From OE-Core rev: 802829f1c38d8c5eee11ba1d9ddd37cf02597f6e)

Signed-off-by: paul <paul@peggleto-mobl.ger.corp.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:30 +01:00
Ed Bartosh
cef80d0dfe wic: run bmaptool with native Python3
Modified wic code to run bmaptool using native Python3
from wic-tools native sysroot.

[YOCTO #11891]

(From OE-Core rev: 7fca44e03130c0860cc5df2093902773f426c774)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:29 +01:00
Ed Bartosh
387adfb09e wic: update help content
Added ext* partitions to the description of 'wic ls',
'wic cp' and 'wic rm' commands.

(From OE-Core rev: fcff05d666e55a017f11851aa4aad6c3ba9d4ff0)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:29 +01:00
Ed Bartosh
2c16117dce wic: implement ext fs support for 'wic rm'
Implemented removing files or directories from the ext
partition using debugfs tool.

(From OE-Core rev: be530b7c7beae6f9fc95eed245cb37066d56581e)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:28 +01:00
Ed Bartosh
9f90956967 wic: implement ext fs support for 'wic cp'
Implemented copying files to the ext partition
using debugfs tool.

(From OE-Core rev: 1a2bc70e6f85f414e7af48489e24c09ff335486d)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:28 +01:00
Ed Bartosh
798f696623 wic: implement ext fs support for 'wic ls'
Implemented listing directory contents for ext file
system using debugfs tool.

(From OE-Core rev: b591ba6f4d684aef3d7666bbdc678954e3255df5)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:28 +01:00
Ola x Nilsson
9bf6b1127a devtool: status: Sort entries before printing
Sorted entries are easier to read.

(From OE-Core rev: d0a123ec564f6d36977e472f8bc63f9c050ee616)

Signed-off-by: Ola x Nilsson <olani@axis.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-09-11 17:30:28 +01:00
Leonardo Sandoval
15eac6befb linux-yocto: add linux-yocto 4.12 bbappends
This allows the yocto-bsp script to pick the 4.12 kernel version when
creating a custom BSP.

[YOCTO #11995]

(From meta-yocto rev: 897c6121404055c4dcb2d9f43f1214d8c99480ea)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:37:10 +01:00
Paul Eggleton
cd683ca41d scriptutils: fix fetch_url() to use lowercase dummy recipe name
recipetool create (and hence devtool add) and devtool upgrade use
fetch_url() which creates a dummy recipe in order to fetch source.
Previously the random part of the name was using uppercase characters,
and this triggers a QA warning after OE-Core commit
4713f8b2c4f2c74239d284adcf1e59e61aa66576, so use lowercase instead as I
really should have in the first place.

(From OE-Core rev: b48c48b00e82491d1c69e4d89a79c6242361abec)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:03 +01:00
Paul Eggleton
ab846047bc recipetool: create: detect Eclipse licenses
Add detection of EPL 1.0 and EDL 1.0 license files.

(From OE-Core rev: 41e7580991f8ad77a57eb7fd292e39f1583109f6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
e4b09c6e91 recipetool: create: suppress npm shrinkwrap/lockdown warnings again
Since OE-Core revision 9a47a6690052ef943c0d4760630ee630fb012153 the
mechanism we were using to suppress the warnings about
NPM_LOCKDOWN and NPM_SHRINKWRAP not being set on the first fetch of the
source is no longer available since we are using the normal fetch/unpack
tasks to do the job. Use the newly added noverify parameter to suppress
the warnings again.

(From OE-Core rev: cb083b6f5f6e909b7c85548bcb1a92ca34d0c18a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
4b202e0720 recipetool: create: fix SRCPV prefix for non-git SCMs
If you're fetching from an SCM other than git (for example subversion or
mercurial) then we need to use a different prefix for the SRCPV in PV
instead of +git.

(From OE-Core rev: ad1200c8729f21b325d347649f9dd5e5598de93e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
9c6a125462 recipetool: create: make recently added branch/tag handling git specific
The branch and tag handling code that was recently added in OE-Core revs
ecca596b75cfda2f798a0bdde75f4f774e23a95b and
3afdcbdc9a3e65bc925ec61717784ffec67d529d is specific to git, so only
apply it when we're fetching from a git URL.

(From OE-Core rev: 5d4bfe6cf788ce971a2e9419bc13492153023681)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
e97cd0017b devtool: add: add explicit srcrev/branch options
At the moment when fetching source from a git repository you have to
know that you can specify the revision and branch in the URL with
';rev=' and ';branch=' respectively, and you can also get thrown off by
the shell splitting on the ; character if you forget to surround the URL
in quotes. Add explicit -S/--srcrev and -B/--srcbranch options
(consistent with devtool upgrade) to make this easier for the user to
discover and use. (The rev and branch URL parameters will continue to
work, however.)

(From OE-Core rev: 2d86cac853d6daa496c0315a5cb0662ebf1165b0)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
dd5ceaefc0 devtool: edit-recipe: fix regression
OE-Core commit 5a16b3c804c5eca331a1c08a7ce31a54909af105 attempted to use
the same function to get the path to a recipe as the new "find-recipe"
command it implemented, except that cannot work because (a) it didn't
return anything and (b) event if it had tried, a command function can
only return an exit code and we don't want that for find-recipe if it
succeeded. Split out a separate reusable function for both commands.

(From OE-Core rev: d5191840212adbf480961ba6fc68e1ab17e5a77a)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
69d50eb9ec devtool: upgrade: workaround for recipes which apply patches conditional upon class
If we're upgrading a recipe that appends additional patches for, say,
class-native, and we're just upgrading the target variant, then when we
copied the recipe into the workspace we skipped copying the additional patches
for the native variant. This caused warnings because the workspace
recipe is preferred. Look at SRC_URI for all variants when copying files
to work around this.

More work is needed to make it easier to work with recipes that use
BBCLASSEXTEND where you need to build more than one variant at once, but
this at least fixes the immediate ugliness.

(From OE-Core rev: 56bf5e93358187e31160d7893f57906bb3dc7ad7)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
34580ac287 devtool: upgrade: fix handling of non-absolute paths
If your BBLAYERS has non-absolute paths in it (e.g.
"${COREBASE}/../something") then none of the paths matched in
copy_recipe_files() with the result that no files got copied and you
ended up with an error later on because the recipe file couldn't be
found at the destination. Fix this as well as adding an explicit check
to see if no files got copied - error out earlier if so.

Fixes [YOCTO #10981].

(From OE-Core rev: 3861486ad06f90c8644ebab119bbc5ddb9e693ca)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Paul Eggleton
24cfac5263 devtool: update-recipe: ensure patches get deleted in srcrev mode
Patches that we identify as having been "deleted" (i.e. patches in
SRC_URI that no longer appear in the git tree) need to be dropped even
if we're updating in srcrev mode. This fixes the case where HEAD of the
git tree is valid upstream (i.e. no extra commits), but there are
patches left over in the recipe, e.g. when we do devtool upgrade and
then all of the commits rebased on top of the new branch get skipped.

Fixes [YOCTO #11972].

(From OE-Core rev: 350f83dc1e317aeb93539f13966caca6d894f569)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-31 23:30:02 +01:00
Tobias Hagelborn
cd26fc143b devtool: deploy-target: Support stripped libs and execs
New devtool deploy-target option --strip which enables deploying
stripped binaries, saving some space on target.

* Copies the files of ${D} into a new directory and strips them in place
* Used oe.package.strip_execs for stripping directory
* Added devtool.conf option "strip" for changing default behavior

Config example:
[Deploy]
strip = true

[YOCTO #11227]

(From OE-Core rev: 7f10c5118793da6ded59ae6e60e796152dbd7ca3)

Signed-off-by: Tobias Hagelborn <tobiasha@axis.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:32:00 +01:00
Ed Bartosh
7724e6fff7 wic: always read image partitions
Got rid of lazy evaluation of self.partitions property.
It's not needed because partitions of the source image should
be always read.

(From OE-Core rev: 1186fd8fd4a4789dc7c60feb86cc9fdd03fee7b3)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Ed Bartosh
cdef76e424 wic: implement 'wic write' command
This command writes image to the media or another file with
the possibility to expand partitions to fill free target space.

[YOCTO #11278]

(From OE-Core rev: ac5fc0d691aad66ac01a5cde34c331c928e9e25a)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Ed Bartosh
cee58f1d41 wic: extend list of used tools
Added sfdisk, e2fsck, mkswap, resize2fs, mkdosfs to the
list of used tools in Disk class. They're going to be used
in 'wic write' implementation.

Added dependency to util-linux to wic-tools to ensure that
sfdisk and mkswap are available from wic-tools native sysroot.

(From OE-Core rev: 1add68e4d6150e3038609d8ce7e3cff28fe8fbb8)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Ed Bartosh
bb1f418a61 wic: added 'fstypes' parameter to Disk.__init__
This parameter specifies list of supported filesystems.
So far only 'fat' is supported, but 'wic write' is going
to support at least 'fat', 'ext' and 'swap'.

(From OE-Core rev: 7cffcdcfdf4f8934d212740a6d7cf136911ebdac)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Ed Bartosh
0ad7e3d1ea wic: convert partition number to int
Converted partition number to int in order to use
it as an index in the list of partitions.

(From OE-Core rev: f901f23eb05cd6b86a49ef1b6ec7efaf72f6d685)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Ed Bartosh
60efc91d2b wic: get more info from the 'parted print' output
Got partition type and sector sizes from the output
of 'parted print'. This info may be used in the implementation
of 'wic write' command.

(From OE-Core rev: 5c0926d8efa468177b7cb43a5f06b35058255644)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Ed Bartosh
ff0bbdafa4 wic: reimplement getting paths of used tools
So far every used tool have to have separate property and
private attribute in the Disk class. This is too verbose,
considering that there will be much more tools used.

Reimplemented getting tools paths using custom __getattr__
method. This is much more compact and readable.

(From OE-Core rev: d1a831a9870bc31e936eb480485b28f1ffc13080)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-27 22:30:07 +01:00
Paul Eggleton
58057d8749 recipetool: create: fix npm license code regression
OE-Core commit 1df60b09f7a60427795ec828c9c7180e4e52f98c caused a
regression in npm handling since it still expected to be able to get the
results of the license handling, but this no longer happens until after
the npm plugin is called. Thus, call the license handling function
ourselves here (which will record this as having been handled so it
doesn't get done again later).

(From OE-Core rev: 3e408aadaea85b6f192b34d37d508cbaf3cd7164)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 13:48:50 +01:00
Paul Eggleton
433aa81f92 recipetool: create: fix broken import in npm module
With "import oe" in create_npm.py you get "AttributeError: module 'oe'
has no attribute 'package'" when it tries to call
oe.package.npm_split_package_dirs().

(From OE-Core rev: 1261900aeac725e5712e0180600753a9d4c67e60)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 13:48:50 +01:00
Richard Purdie
ccb73e60c2 linux-yocto: Drop 4.1 kernel appends
(From meta-yocto rev: ecde92624c27ebe511696b5bcfc83b21efec17d0)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 12:07:09 +01:00
Paul Eggleton
b1f237ebd0 recipetool: allow plugins to set LICENSE and LIC_FILES_CHKSUM
We were being a bit prescriptive in setting LICENSE and
LIC_FILES_CHKSUM. We can't always trust what's in the metadata
accompanying some source which plugins will almost always be pulling
from, however we do want to allow plugins to set the LICENSE and
LIC_FILES_CHKSUM values. Merge what we find in our license file scan
with what the plugin sends back.

Additionally, plugins can now add a "license" item to the handled list
in order to inhibit the normal LICENSE / LIC_FILES_CHKSUM handling if
they have already taken care of it completely.

Thanks to Mark Horn <mark.d.horn@intel.com> for prompting, testing and
fixing this patch.

(From OE-Core rev: 1df60b09f7a60427795ec828c9c7180e4e52f98c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Paul Eggleton
a7baa47c87 recipetool: allow plugins to set PN / PV more easily
Previously if we were able to auto-determine the name from the URL, that
took precedence over any name that might be set in extravalues by a
plugin. Some plugins might be able to get a better idea of the name and
thus we should move defaulting of the name further down after the
plugins have had a chance to set it.

(From OE-Core rev: 3bb979c13463705c4db6c59034661c4cd8100756)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Leonardo Sandoval
e798b4e980 devtool: import: new plugin to import the devtool workspace
Takes a tar archive created by 'devtool export' and imports (untars) it
into the workspace. Currently the whole tar archive is imported, there
is no way to limit what is imported.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10510

[YOCTO #10510]

(From OE-Core rev: 2de8ba89ef10fefcc97246dfeb4b8d1e48ee8232)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Leonardo Sandoval
ee21e81cff devtool: append md5sum only if not already present
In case the proposed md5sum to be appended to the .devtool_md5 file
is already present, do not append it.

(From OE-Core rev: f958c5cba3b0d24ca696b2b707857009c9a7b5b8)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Leonardo Sandoval
42a5894a3c devtool: export: new plugin to export the devtool workspace
By default, exports the whole workspace (all recipes) including the source code.
User can also limit what is exported with --included/--excluded flags. As
a result of this operation, a tar archive containing only workspace metadata
and its corresponding source code is created, which can be properly imported
with 'devtool import'.

https://bugzilla.yoctoproject.org/show_bug.cgi?id=10510

[YOCTO #10510]

(From OE-Core rev: f9bc3b5101b554a72298266519dbdd1497f262a6)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Chang Rebecca Swee Fun
b47a7b848b devtool: upgrade: enable branch checking when revision is provided
When devtool upgrade is run on a recipe with revision specified
that is not on master branch, and branch isn't set by --srcbranch or -B,
then we should get the correct branch and append the branch to the URL.

If the revision was found on multiple branches, we will display error
to inform user to provide a correct branch and exit.

[YOCTO #11484]

(From OE-Core rev: 29ced7387a92aed17b7fe93b1654790a981734c1)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Stanley Phoong
439a6f1d68 recipetool: create: replacing PV in SRCURI
During recipe creation, it seems that the automation for replacing
${PV} at the SRCURI for tag, (e.g mbed-tls-${PV}) is causing some
issue due to PV assuming it's a git source. A fix is implemented in
this patch to resolve this issue.

(From OE-Core rev: 9d3ec76c1b7dd75d904f5ff47297de0fb65b21c2)

Signed-off-by: Stanley Phoong <stanley.cheong.kwan.phoong@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Stanley Phoong
fe62cedd4b recipetool: create: handle git URLs specifying only a tag
If a git URL is passed to recipetool create with a tag=, recipetool
should handle it assuming that the tag is valid.

[YOCTO #11393]

(From OE-Core rev: 3afdcbdc9a3e65bc925ec61717784ffec67d529d)

Signed-off-by: Stanley Phoong <stanley.cheong.kwan.phoong@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Chang Rebecca Swee Fun
62d5035ffc recipetool: create: being able to set branch when revision is provided
This change is to improve the buildability of the recipe created by
recipetool and devtool.

When recipetool create is run on a git URL and a revision specified
that is not on master, and "branch=" isn't already in the URL, then
we should get the correct branch and append the branch to the URL.

If the revision was found on multiple branches and 'master' is not
in the list, we will display error to inform user to provide a
correct branch and exit.

[YOCTO #11389]

(From OE-Core rev: ecca596b75cfda2f798a0bdde75f4f774e23a95b)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Chang Rebecca Swee Fun
e09b9d4543 recipetool: create: disable PREMIRRORS and MIRRORS by default
When creating new recipes, we are almost certainly fetching a new
source rather that something that has already been fetched. I have
disable PREMIRRORS and MIRRORS settings in the recipe that created
by devtool while leaving an option for users to enable them manually
if needed. Since devtool already has this options, we need to ensure
that recipetool is able to handle the options passed from devtool.

(From OE-Core rev: 091cee2bdc2378a3425a4ef8558d03e6f9c021ff)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-23 08:47:02 +01:00
Paul Eggleton
14f3d4e58a recipetool: create: fix incorrect URL variable usage
We have two variables here, srcuri and fetchuri. srcuri is what
eventually ends up in the recipe, whereas fetchuri is what we actually
pass to the fetcher when we fetch the source within recipetool -
sometimes these need to be different particularly for an upcoming patch
to handle automatically setting the branch parameter. In OE-Core
revision 9a47a6690052ef943c0d4760630ee630fb012153 I erroneously changed
the call to scriptutils.fetch_url() to pass srcuri instead of fetchuri -
this likely didn't have any ill effect, but change it back to passing
fetchuri to match the original intent.

(From OE-Core rev: b66b73bcf5ee7e4488970576fdc31dfa25b35f5e)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-17 00:21:14 +01:00
Andrea Galbusera
6346d12d8d devtool: sdk-update: fix pulling updates from git
Commit 4657bc9d165e51981e034e73e7b92552e873eef7 replaced the git pull logic with
the git fetch + git reset --hard combo, but resetting to HEAD does not really
pull in new commits from remote... Replace with resetting to the upstream branch
instead.

(From OE-Core rev: 0dcdb146f59a184419bffd4f24cdf8343a43c0ea)

Signed-off-by: Andrea Galbusera <gizero@gmail.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09 09:24:16 +01:00
Paul Eggleton
1cce7f885c devtool: fix handling of errors during task execution
* If an error is logged while executing a task, we need to ensure we
  exit instead of assuming everything went OK.
* If we receive CookerExit, the server is shutting down and we need to
  stop waiting for events and probably exit (knotty does this). This
  will occur if an exception or bb.fatal() happens during an event
  handler.

This fixes a couple of issues highlighted when using devtool upgrade or
modify on a non-supported recipe with intel-iot-refkit together with
bitbake master, but I'd be very surprised if it were hard to reproduce
in other scenarios.

(From OE-Core rev: 65e644368fc9c294af96906528ee0cf30305e0a6)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-09 09:24:15 +01:00
Jonathan Liu
843a74d708 wic: improve generating disk system identifier
This should reduce the chance of generating 0xffffffff as the disk
system identifier.

(From OE-Core rev: 5619e72facbc9228d3cf8f844f198e03b536ac8c)

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-08-03 11:14:13 +01:00
Tom Rini
03d5daf1ae wic: Switch to using --use-uuid by default
The most portable way to specifiy a root device in a disk image that we
create is to use PARTUUID rather than /dev/sda2.  As background, both
GPT and MBR tables provide valid UUID values for each partition and the
Linux Kernel contains the logic to parse this value.  With this change
we can now boot the default disk images when used as any valid block
device that the included kernel uses.  This for example means that
VirtualBox can be used to run vmdk without changes as it uses IDE for
the virtual disk controller.

Cc: Matt Porter <mporter@konsulko.com>
(From OE-Core rev: 8a58e9bb3e76a9962f1d14a8bdd3f7de675c3492)

Signed-off-by: Tom Rini <trini@konsulko.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:20 +01:00
Jonathan Liu
408c65613a wic: ensure generated disk system identifier is non-zero
Zero may be interpreted as no MBR signature present and another
partitioning program might install a new MBR signature.

(From OE-Core rev: f53b5555d6eaa171bc5882cfee807cf62576862d)

Signed-off-by: Jonathan Liu <net147@gmail.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:20 +01:00
Ed Bartosh
ae4ee4d511 wic: add /boot mount point to fstab by default
wic avoided adding /boot to fstab for no reason.
This exception was hardcoded in the wic code.

There is no need for this as mountpoint in .wks file is an optional
field. It can be used only if user wants to have partitions
automatically mounted on system boot.

[YOCTO #11662]

(From OE-Core rev: 2376b05512ddb8c4ec3aaf1df11071f536a76bd9)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:19 +01:00
Ed Bartosh
092f4fafaa wic: rootfs: make copied rootfs unique
Used unique suffix (line number from .wks file) for the
copied rootfs directory to avoid possible conflicts.

(From OE-Core rev: 01efc234a8caab67ed3138ab2de9bbd82ce97b44)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:19 +01:00
Ed Bartosh
d4e60fe6a4 wic: rootfs: fix rootfs path reporting
wic gets rootfs paths from partition object property
'rootfs_dir' and shows them in final report.

rootfs plugin sets this property to the temporary path,
which causes temporary paths appearing in the report.

Changed the code to prevent storing temporary rootfs path
in part.rootfs_dir. This should fix the report.

(From OE-Core rev: 28d2d7d6f79df08431187c7debaab2a3fa516671)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:19 +01:00
Ed Bartosh
5541191b99 wic: use absolute paths in rootfs plugin
Using relative paths can cause copyhardlinktree API to fail as
it changes current directory when working. Converted all paths
to absolute paths using os.path.realpath.

(From OE-Core rev: a1c83cebe986e211dfc31be5cbd748f53fc298df)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:19 +01:00
Ed Bartosh
c4f9d8151f wic: copy rootfs directory before changing fstab
wic updates /etc/fstab on root partition if there are
valid mount points in .wks

When wic runs from bitbake this can cause incorrect results
or even breakage of other tasks working with the same rootfs
directory in parallel with do_image_wic.

Implemented copying rootfs directory to a temporary location
using copyhardlinktree before updating fstab to avoid conflicts with
other tasks working with the same rootfs directory.

(From OE-Core rev: 92e1c7d47e695eb4ce1a863cd0f6c49dca1c2339)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:46:19 +01:00
Leonardo Sandoval
c147d7753f bsp/help: include a warning showing deprecation of create-layer plugin
This plugin will be removed starting 2.5 development in favour
of using 'bitbake-layers create-layer' script/plugin, offering a single
script to manage layers.

(From meta-yocto rev: 76dd79e345d8edb22fc7aefd31f2a1f150916718)

Signed-off-by: Leonardo Sandoval <leonardo.sandoval.gonzalez@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-30 08:43:36 +01:00
Ed Bartosh
7a2730fe7a wic: add description of --mkfs-extraopts
Updated help contents with the description of new
wks option --mkfs-extraopts

(From OE-Core rev: 69c95f74013d0d8b199abc38ba0d6f3ff952eed3)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:38 +01:00
Ed Bartosh
9f481f5ac9 wic: implement wks option --mkfs-extraopts
This option specifies extra options to pass to mkfs.<fstype> utilities.

[YOCTO #11709]

(From OE-Core rev: 67b7c67edba305fbd31967baa10d27c2e603ec77)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:38 +01:00
Chang Rebecca Swee Fun
c2318ef416 devtool: standard: enable options for PREMIRRORS and MIRRORS
Since we have provide an option to manually enable PREMIRRORS and MIRRORS
in recipetool, we need to make sure devtool is having the same options
as devtool uses recipetool in creating new recipes.

(From OE-Core rev: 198bddeb928a318c3ad168bcb4f83b5cd9a604fb)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:37 +01:00
Chang Rebecca Swee Fun
819179d775 devtool: find-recipe: enable new subcommand for devtool
devtool find-recipe will prints out the path to the recipe
in a workspace.

This subcommand can also help to find recipe outside of
current workspace using "-a" or "--any-recipe" option.

This enhancement helps developer to get the recipe path
when working with devtool.

[YOCTO #11434]

(From OE-Core rev: 5a16b3c804c5eca331a1c08a7ce31a54909af105)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:37 +01:00
Chang Rebecca Swee Fun
5778e35378 scriptutils: pass in logger as parameter
logger was not defined in scriptutils.py based on the
observation in python traceback.

Traceback (most recent call last):
  File "/workdir/poky/scripts/devtool", line 351, in <module>
    ret = main()
  File "/workdir/poky/scripts/devtool", line 338, in main
    ret = args.func(args, config, basepath, workspace)
  File "/workdir/poky/scripts/lib/devtool/utilcmds.py", line 55, in
edit_recipe
    return scriptutils.run_editor(find_recipe(args, config, basepath,
workspace))
  File "/workdir/poky/scripts/lib/scriptutils.py", line 141, in
run_editor
    logger.error("Execution of '%s' failed: %s" % (editor, exc))
NameError: name 'logger' is not defined

We pass in logger as parameter to run_editor() from where it has
been called (devtool/utilcmds.py and recipetool/newappend.py),
which both modules already has logger setup.

(From OE-Core rev: 21f04b61973dd9029f0e6bff5445e31cd762bf32)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:37 +01:00
Chang Rebecca Swee Fun
2c035b266f scriptutils: exit politely when no text editor available
devtool edit-recipe now has ugly tracebacks if executed without an
editor available. This happens in the build containers whenever no
text editor is available.

subprocess.check_call will run text editing command with recipe path
provided. It will wait for command to complete. If the return code
was zero then return, otherwise raise CalledProcessError exception.

This enhancement will suppress the traceback by catching the exception
and prompt the error messages in a proper manner shown below:

pokyuser@59c99c507238:/workdir/docker-dbg$ devtool edit-recipe ifupdown
/bin/sh: 1: vi: not found
ERROR: Execution of 'vi' failed: Command 'vi
"/workdir/docker-dbg/workspace/recipes/ifupdown/ifupdown_0.8.16.bb"'
returned non-zero exit status 127

[YOCTO #11434]

(From OE-Core rev: c536ccfd162fc8871838fa229012c562e3f8e0d9)

Signed-off-by: Chang Rebecca Swee Fun <rebecca.swee.fun.chang@intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:37 +01:00
Ed Bartosh
8fb8a21b7d wic: fix calculation of partition number
Total number of partitions should be taken into account when calculating
real partition number for msdos partition table. The number can be
different for the 4th partition: it can be 4 if there are 4 partitions in
the table and 5 if there are more than 4 partitions in the table. In the
latter case number 4 is occupied by extended partition.

[YOCTO #11790]

(From OE-Core rev: 5689139b3cd862e2df49f6b21171f513e8a46c60)

Signed-off-by: Ed Bartosh <ed.bartosh@linux.intel.com>
Signed-off-by: Ross Burton <ross.burton@intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 22:51:37 +01:00
Aníbal Limón
3aa299d51b argparse_oe: Add int_positive type
Sometimes only expect positive values from cmdline so it's better
to filter at parsing cmdline step instead of validate later.

(From OE-Core rev: 3ef5b518febd047bf90a0955fa2b9fb78ba6dde5)

Signed-off-by: Aníbal Limón <anibal.limon@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:44:25 +01:00
Richard Purdie
821cb0b819 devtool: Setup logging before calling prepare
This avoids test failures like:

INFO - ======================================================================
INFO - FAIL [1.755s]: test_devtool_layer_plugins (devtool.DevtoolTests)
INFO - ----------------------------------------------------------------------
INFO - Traceback (most recent call last):
  File "/media/build1/poky/meta/lib/oeqa/core/decorator/__init__.py", line 32, in wrapped_f
    return func(*args, **kwargs)
  File "/media/build1/poky/meta/lib/oeqa/selftest/cases/devtool.py", line 1354, in test_devtool_layer_plugins
    self.assertEqual(result.output, s[::-1])
AssertionError: "NOTE: Starting bitbake server...\noY senu[36 chars]rciM" != "oY senuZ s'enoynA morF tiforP oN edaM tfosorciM"
- NOTE: Starting bitbake server...
  oY senuZ s'enoynA morF tiforP oN edaM tfosorciM
INFO - ----------------------------------------------------------------------

since there is corruption in the output. Setting the logging up before
calling tinfoil.prepare() resolves this.

(From OE-Core rev: 3c479fb17ae4d3e7e5f0889af0f68257ef66475c)

Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:44:25 +01:00
Paul Eggleton
0d72748e81 recipetool: create: refactor code for ensuring npm is available
Across devtool and recipetool we had an ugly set of code for ensuring
that we can call an npm binary, and much of that ugliness was a result
of not being able to run build tasks when tinfoil was active - if
recipetool found that npm was required and we didn't know beforehand
(e.g. we're fetching from a plain git repository as opposed to an npm://
URL where it's obvious) then it had to exit and return a special result
code, so that devtool knew it needed to build nodejs-native and then
call recipetool again. Now that we are using real build tasks to fetch
and unpack, we can drop most of this and move the code to the one place
where it's still needed (i.e. create_npm where we potentially have to
deal with node.js code in a plain source repository).

(From OE-Core rev: 8450de16ddb02d863204b411a94c6d84e0f88817)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:44:25 +01:00
Paul Eggleton
e4346e8be5 recipetool: create: reimplement fetching with normal fetch/unpack tasks
Now that we have the ability to run the tasks in a more standard context
through tinfoil, change recipetool's fetching code to use that to fetch
files using it. This has the major advantage that any dependencies of
do_fetch and do_unpack (e.g. for subversion or npm) will be handled
automatically. This also has the beneficial side-effect of fixing a
recent regression that prevented this fetch operation from working with
memory resident bitbake.

Also fix devtool's usage of fetch_uri() at the same time so that we can
completely replace it.

Fixes [YOCTO #11710].

(From OE-Core rev: 9a47a6690052ef943c0d4760630ee630fb012153)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:44:25 +01:00
Paul Eggleton
7d474e27bc recipetool: create: eliminate second fetch for packages
When dealing with package files (.rpm, .ipk etc.) we need to unpack them
ourselves to get the metadata, which is thrown away when the fetcher
unpacks them. However, since we've already fetched the file once, I'm
not sure as to why I thought I needed to fetch it again - we can just
get the local path and then unpack it directly.

(From OE-Core rev: be45e9b17e9dbc8c2594d3a939be377ab0720a7c)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:44:25 +01:00
Paul Eggleton
047d37633b recipetool: create: ensure meaningful error for malformed tarballs
If you pointed recipetool at a URL that should be a tarball e.g.
https://tls.mbed.org/download/start/mbedtls-2.4.2-apache.tgz but instead
it returns an HTML page, we try to unpack it, gzip complains but the
operation doesn't seem to fail - instead we just get back an empty
source tree. Change the checks to account for this - if the source tree
is empty, check if the downloaded file in DL_DIR looks like an HTML file
and error accordingly if it is. If it's not, error out anyway because
no source was unpacked and it should have been (otherwise we just
blindly set up EXTERNALSRC for this which is pointless).

Fixes an aspect of [YOCTO #11407].

(From OE-Core rev: 8496113b63d5a5d1f99056610c0fdb972a6200d4)

Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
2017-07-21 08:44:25 +01:00