diff options
| author | Robert Danitz <robert@advancedtelematic.com> | 2017-06-14 11:54:58 +0200 |
|---|---|---|
| committer | Robert Danitz <robert@advancedtelematic.com> | 2017-06-14 11:54:58 +0200 |
| commit | 266f988344d7abbe1a1921caaa813061fc56aa0e (patch) | |
| tree | 45e0dae9999a1be3d2b4fd2b35bdcbadd9e85a13 | |
| parent | 5b7cf9b286ed81458ce8940c44643cf082000133 (diff) | |
| download | meta-updater-266f988344d7abbe1a1921caaa813061fc56aa0e.tar.gz | |
adds two versions of a random, seeded big file
| -rw-r--r-- | recipes-test/big-update/big-update_1.0.bb | 11 | ||||
| -rw-r--r-- | recipes-test/big-update/big-update_2.0.bb | 11 | ||||
| -rw-r--r-- | recipes-test/big-update/files/rand_file.py | 16 |
3 files changed, 38 insertions, 0 deletions
diff --git a/recipes-test/big-update/big-update_1.0.bb b/recipes-test/big-update/big-update_1.0.bb new file mode 100644 index 0000000..78852a9 --- /dev/null +++ b/recipes-test/big-update/big-update_1.0.bb | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | DESCRIPTION = "Example Package with 10MB of random, seeded content" | ||
| 2 | LICENSE = "CLOSED" | ||
| 3 | |||
| 4 | SRC_URI = "file://rand_file.py" | ||
| 5 | |||
| 6 | FILES_${PN} = "/usr/lib/big-update" | ||
| 7 | |||
| 8 | do_install() { | ||
| 9 | install -d ${D}/usr/lib/big-update | ||
| 10 | python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 10M) | ||
| 11 | } | ||
diff --git a/recipes-test/big-update/big-update_2.0.bb b/recipes-test/big-update/big-update_2.0.bb new file mode 100644 index 0000000..6d32557 --- /dev/null +++ b/recipes-test/big-update/big-update_2.0.bb | |||
| @@ -0,0 +1,11 @@ | |||
| 1 | DESCRIPTION = "Example Package with 12MB of random, seeded content" | ||
| 2 | LICENSE = "CLOSED" | ||
| 3 | |||
| 4 | SRC_URI = "file://rand_file.py" | ||
| 5 | |||
| 6 | FILES_${PN} = "/usr/lib/big-update" | ||
| 7 | |||
| 8 | do_install() { | ||
| 9 | install -d ${D}/usr/lib/big-update | ||
| 10 | python ${S}/../rand_file.py ${D}/usr/lib/big-update/a-big-file $(numfmt --from=iec 12M) | ||
| 11 | } | ||
diff --git a/recipes-test/big-update/files/rand_file.py b/recipes-test/big-update/files/rand_file.py new file mode 100644 index 0000000..0f4f16e --- /dev/null +++ b/recipes-test/big-update/files/rand_file.py | |||
| @@ -0,0 +1,16 @@ | |||
| 1 | import sys | ||
| 2 | from random import seed, randint | ||
| 3 | |||
| 4 | def main(): | ||
| 5 | n = int(sys.argv[2]) | ||
| 6 | ba = bytearray(n) | ||
| 7 | |||
| 8 | seed(42) | ||
| 9 | for i in range(0, n): | ||
| 10 | ba[i] = randint(0, 255) | ||
| 11 | |||
| 12 | with open(sys.argv[1], 'wb') as f: | ||
| 13 | f.write(bytes(ba)) | ||
| 14 | |||
| 15 | if __name__ == "__main__": | ||
| 16 | main() | ||
