diff options
author | Alberto Pianon <alberto@pianon.eu> | 2023-08-24 15:00:32 +0000 |
---|---|---|
committer | Alberto Pianon <alberto@pianon.eu> | 2023-08-24 15:01:04 +0000 |
commit | 43707aefb22c59a6508af04c02219423f42806ba (patch) | |
tree | 035da02bc9f8f85bef65c29705d7870685a7a878 | |
parent | 3b746b4510b9f9385c7e6759a7a5d996173e77ed (diff) | |
download | bitbake-contrib-alpianon/srctrace3.tar.gz |
fetch2: Add tests for upstream source tracingalpianon/srctrace3
This patch adds test data and test cases for TraceUnpack.
Test data consists of expected output json files for a set of
real-world recipes presenting one or more peculiarities that
need to be correctly handled.
Signed-off-by: Alberto Pianon <alberto@pianon.eu>
13 files changed, 1596 insertions, 0 deletions
diff --git a/bin/bitbake-selftest b/bin/bitbake-selftest index 6d60a5d2b..139debe1e 100755 --- a/bin/bitbake-selftest +++ b/bin/bitbake-selftest @@ -32,6 +32,7 @@ tests = ["bb.tests.codeparser", "bb.tests.siggen", "bb.tests.utils", "bb.tests.trace_base", + "bb.tests.trace", "bb.tests.compression", "hashserv.tests", "layerindexlib.tests.layerindexobj", diff --git a/lib/bb/tests/trace-testdata/bzip2-1.0.8.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/bzip2-1.0.8.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..9e32119d3 --- /dev/null +++ b/lib/bb/tests/trace-testdata/bzip2-1.0.8.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/gettext-minimal-native-0.21.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/gettext-minimal-native-0.21.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..bfcaa6836 --- /dev/null +++ b/lib/bb/tests/trace-testdata/gettext-minimal-native-0.21.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/gosu-1.14.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/gosu-1.14.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..801601c02 --- /dev/null +++ b/lib/bb/tests/trace-testdata/gosu-1.14.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/npm-shrinkwrap-newfmt-test.json b/lib/bb/tests/trace-testdata/npm-shrinkwrap-newfmt-test.json new file mode 100644 index 000000000..343db5bcb --- /dev/null +++ b/lib/bb/tests/trace-testdata/npm-shrinkwrap-newfmt-test.json @@ -0,0 +1,718 @@ +{ + "name": "test_npm2", + "version": "1.0.0", + "lockfileVersion": 3, + "requires": true, + "packages": { + "": { + "name": "test_npm2", + "version": "1.0.0", + "license": "ISC", + "dependencies": { + "file-renamer": "^0.1.0", + "shelljs": "^0.8.5" + } + }, + "node_modules/file-renamer": { + "version": "0.1.0", + "resolved": "https://registry.npmjs.org/file-renamer/-/file-renamer-0.1.0.tgz", + "integrity": "sha512-0X5vOIV03HCVcgDvxdKuh83AW6jhkhrh5QH6jMXA++r3Fo4B4gAiOJ39Fk/1nJ5DLLBzEglDMAxewo8xOhON4Q==", + "dependencies": { + "fs": "latest", + "glob": "latest", + "optimist": "latest", + "path": "latest" + }, + "bin": { + "file-renamer": "app.js" + } + }, + "node_modules/file-renamer/node_modules/fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, + "node_modules/file-renamer/node_modules/glob": { + "version": "10.3.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.3.3.tgz", + "integrity": "sha512-92vPiMb/iqpmEgsOoIDvTjc50wf9CCCvMzsi6W0JLPeUKE8TWP1a73PgqSrqy7iAZxaSD1YdzU7QZR5LF51MJw==", + "dependencies": { + "foreground-child": "^3.1.0", + "jackspeak": "^2.0.3", + "minimatch": "^9.0.1", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0", + "path-scurry": "^1.10.1" + }, + "bin": { + "glob": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/foreground-child/-/foreground-child-3.1.1.tgz", + "integrity": "sha512-TMKDUnIte6bfb5nWv7V/caI169OHgvwjb7V4WkeUvbQQdjr5rWKqHFiKWb/fcOwB+CzBT+qbWjvj+DVwRskpIg==", + "dependencies": { + "cross-spawn": "^7.0.0", + "signal-exit": "^4.0.1" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/cross-spawn": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-7.0.3.tgz", + "integrity": "sha512-iRDPJKUPVEND7dHPO8rkbOnPpyDygcDFtWjpeWNCgy8WP2rXcxXL8TskReQl6OrB2G7+UJrags1q15Fudc7G6w==", + "dependencies": { + "path-key": "^3.1.0", + "shebang-command": "^2.0.0", + "which": "^2.0.1" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/cross-spawn/node_modules/path-key": { + "version": "3.1.1", + "resolved": "https://registry.npmjs.org/path-key/-/path-key-3.1.1.tgz", + "integrity": "sha512-ojmeN0qd+y0jszEtoY48r0Peq5dwMEkIlCOu6Q5f41lfkswXuKtYrhgoTpLnyIcHm24Uhqx+5Tqm2InSwLhE6Q==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/cross-spawn/node_modules/shebang-command": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-2.0.0.tgz", + "integrity": "sha512-kHxr2zZpYtdmrN1qDjrrX/Z1rR1kG8Dx+gkpK1G4eXmvXswmcE1hTWBWYUzlraYw1/yZp6YuDY77YtvbN0dmDA==", + "dependencies": { + "shebang-regex": "^3.0.0" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/cross-spawn/node_modules/shebang-command/node_modules/shebang-regex": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/shebang-regex/-/shebang-regex-3.0.0.tgz", + "integrity": "sha512-7++dFhtcx3353uBaq8DDR4NuxBetBzC7ZQOhmTQInHEd6bSrXdiEyzCvG07Z44UYdLShWUyXt5M/yhz8ekcb1A==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/cross-spawn/node_modules/which": { + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/which/-/which-2.0.2.tgz", + "integrity": "sha512-BLI3Tl1TW3Pvl70l3yq3Y64i+awpwXqsGBYWkkqMtnbXgrMD+yj7rhW0kuEDxzJaYXGjEW5ogapKNMEKNMjibA==", + "dependencies": { + "isexe": "^2.0.0" + }, + "bin": { + "node-which": "bin/node-which" + }, + "engines": { + "node": ">= 8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/cross-spawn/node_modules/which/node_modules/isexe": { + "version": "2.0.0", + "resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz", + "integrity": "sha512-RHxMLp9lnKHGHRng9QFhRCMbYAcVpn69smSGcq3f36xjgVVWThj4qqLbTLlq7Ssj8B+fIQ1EuCEGI2lKsyQeIw==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/foreground-child/node_modules/signal-exit": { + "version": "4.1.0", + "resolved": "https://registry.npmjs.org/signal-exit/-/signal-exit-4.1.0.tgz", + "integrity": "sha512-bzyZ1e88w9O1iNJbKnOlvYTrWPDl46O1bG0D3XInv+9tkPrxrN8jUUTiFlDkkmKWgn1M6CfIA13SuGqOa9Korw==", + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak": { + "version": "2.3.0", + "resolved": "https://registry.npmjs.org/jackspeak/-/jackspeak-2.3.0.tgz", + "integrity": "sha512-uKmsITSsF4rUWQHzqaRUuyAir3fZfW3f202Ee34lz/gZCi970CPZwyQXLGNgWJvvZbvFyzeyGq0+4fcG/mBKZg==", + "dependencies": { + "@isaacs/cliui": "^8.0.2" + }, + "engines": { + "node": ">=14" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + }, + "optionalDependencies": { + "@pkgjs/parseargs": "^0.11.0" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui": { + "version": "8.0.2", + "resolved": "https://registry.npmjs.org/@isaacs/cliui/-/cliui-8.0.2.tgz", + "integrity": "sha512-O8jcjabXaleOG9DQ0+ARXWZBTfnP4WNAqzuiJK7ll44AmxGKv/J2M4TPjxjY3znBCfvBXFzucm1twdyFybFqEA==", + "dependencies": { + "string-width": "^5.1.2", + "string-width-cjs": "npm:string-width@^4.2.0", + "strip-ansi": "^7.0.1", + "strip-ansi-cjs": "npm:strip-ansi@^6.0.1", + "wrap-ansi": "^8.1.0", + "wrap-ansi-cjs": "npm:wrap-ansi@^7.0.0" + }, + "engines": { + "node": ">=12" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width": { + "version": "5.1.2", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-5.1.2.tgz", + "integrity": "sha512-HnLOCR3vjcY8beoNLtcjZ5/nxn2afmME6lhrDrebokqMap+XbeW8n9TXpPDOqdGK5qcI3oT0GKTW6wC7EMiVqA==", + "dependencies": { + "eastasianwidth": "^0.2.0", + "emoji-regex": "^9.2.2", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/sponsors/sindresorhus" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width-cjs": { + "name": "string-width", + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width-cjs/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width-cjs/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width-cjs/node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width/node_modules/eastasianwidth": { + "version": "0.2.0", + "resolved": "https://registry.npmjs.org/eastasianwidth/-/eastasianwidth-0.2.0.tgz", + "integrity": "sha512-I88TYZWc9XiYHRQ4/3c5rjjfgkjhLyW2luGIheGERbNQ6OY7yTybanSpDXZa8y7VUP9YmDcYa+eyq4ca7iLqWA==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/string-width/node_modules/emoji-regex": { + "version": "9.2.2", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-9.2.2.tgz", + "integrity": "sha512-L18DaJsXSUk2+42pv8mLs5jJT2hqFkFE4j21wOmgbUqsZ2hL72NsUU785g9RXgo3s0ZNgVl42TiHp3ZtOv/Vyg==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/strip-ansi": { + "version": "7.1.0", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-7.1.0.tgz", + "integrity": "sha512-iq6eVVI64nQQTRYq2KtEg2d2uU7LElhTJwsH4YzIHZshxlgZms/wIc4VoDQTlG/IvVIrBKG06CrZnp0qv7hkcQ==", + "dependencies": { + "ansi-regex": "^6.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/strip-ansi?sponsor=1" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/strip-ansi-cjs": { + "name": "strip-ansi", + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/strip-ansi-cjs/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-6.0.1.tgz", + "integrity": "sha512-n5M855fKb2SsfMIiFFoVrABHJC8QtHwVx+mHWP3QcEqBHYienj5dHSgjbxtC0WEZXYt4wcD6zrQElDPhFuZgfA==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-regex?sponsor=1" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi": { + "version": "8.1.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-8.1.0.tgz", + "integrity": "sha512-si7QWI6zUMq56bESFvagtmzMdGOtoxfR+Sez11Mobfc7tm+VkUckk9bW2UeffTGVUbOksxmSw0AA2gs8g71NCQ==", + "dependencies": { + "ansi-styles": "^6.1.0", + "string-width": "^5.0.1", + "strip-ansi": "^7.0.1" + }, + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs": { + "name": "wrap-ansi", + "version": "7.0.0", + "resolved": "https://registry.npmjs.org/wrap-ansi/-/wrap-ansi-7.0.0.tgz", + "integrity": "sha512-YVGIj2kamLSTxw6NsZjoBxfSwsn0ycdesmc4p+Q21c5zPuZ1pl+NfxVdxPtdHvmNVOQ6XSYG4AUtyt/Fi7D16Q==", + "dependencies": { + "ansi-styles": "^4.0.0", + "string-width": "^4.1.0", + "strip-ansi": "^6.0.0" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/chalk/wrap-ansi?sponsor=1" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/ansi-styles": { + "version": "4.3.0", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-4.3.0.tgz", + "integrity": "sha512-zbB9rCJAT1rbjiVDb2hqKFHNYLxgtk8NURxZ3IZwD3F6NtxbXZQCnnSi1Lkx+IDohdPlFp222wVALIheZJQSEg==", + "dependencies": { + "color-convert": "^2.0.1" + }, + "engines": { + "node": ">=8" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/node_modules/color-convert": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/color-convert/-/color-convert-2.0.1.tgz", + "integrity": "sha512-RRECPsj7iu/xb5oKYcsFHSppFNnsj/52OVTRKb4zP5onXwVF3zVmmToNcOfGC+CRDpfK/U584fMg38ZHCaElKQ==", + "dependencies": { + "color-name": "~1.1.4" + }, + "engines": { + "node": ">=7.0.0" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/ansi-styles/node_modules/color-convert/node_modules/color-name": { + "version": "1.1.4", + "resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.4.tgz", + "integrity": "sha512-dOy+3AuW3a2wNbZHIuMZpTcgjGuLU/uBL/ubcZF9OXbDo8ff4O8yVp5Bf0efS8uEoYo5q4Fx7dY9OgQGXgAsQA==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/string-width": { + "version": "4.2.3", + "resolved": "https://registry.npmjs.org/string-width/-/string-width-4.2.3.tgz", + "integrity": "sha512-wKyQRQpjJ0sIp62ErSZdGsjMJWsap5oRNihHhu6G7JVO/9jIB6UyevL+tXuOqrng8j/cxKTWyWUwvSTriiZz/g==", + "dependencies": { + "emoji-regex": "^8.0.0", + "is-fullwidth-code-point": "^3.0.0", + "strip-ansi": "^6.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/string-width/node_modules/emoji-regex": { + "version": "8.0.0", + "resolved": "https://registry.npmjs.org/emoji-regex/-/emoji-regex-8.0.0.tgz", + "integrity": "sha512-MSjYzcWNOA0ewAHpz0MxpYFvwg6yjy1NG3xteoqz644VCo/RPgnr1/GGt+ic3iJTzQ8Eu3TdM14SawnVUmGE6A==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/string-width/node_modules/is-fullwidth-code-point": { + "version": "3.0.0", + "resolved": "https://registry.npmjs.org/is-fullwidth-code-point/-/is-fullwidth-code-point-3.0.0.tgz", + "integrity": "sha512-zymm5+u+sCsSWyD9qNaejV3DFvhCKclKdizYaJUuHA83RLjb7nSuGnddCHGv0hk+KY7BMAlsWeK4Ueg6EV6XQg==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/strip-ansi": { + "version": "6.0.1", + "resolved": "https://registry.npmjs.org/strip-ansi/-/strip-ansi-6.0.1.tgz", + "integrity": "sha512-Y38VPSHcqkFrCpFnQ9vuSXmquuv5oXOKpGeT6aGrr3o3Gc9AlVa6JBfUSOCnbxGGZF+/0ooI7KrPuUSztUdU5A==", + "dependencies": { + "ansi-regex": "^5.0.1" + }, + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi-cjs/node_modules/strip-ansi/node_modules/ansi-regex": { + "version": "5.0.1", + "resolved": "https://registry.npmjs.org/ansi-regex/-/ansi-regex-5.0.1.tgz", + "integrity": "sha512-quJQXlTSUGL2LH9SUXo8VwsY4soanhgo6LNSm84E1LBcE8s3O0wpdiRzyR9z/ZZJMlMWv37qOOb9pdJlMUEKFQ==", + "engines": { + "node": ">=8" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@isaacs/cliui/node_modules/wrap-ansi/node_modules/ansi-styles": { + "version": "6.2.1", + "resolved": "https://registry.npmjs.org/ansi-styles/-/ansi-styles-6.2.1.tgz", + "integrity": "sha512-bN798gFfQX+viw3R7yrGWRqnrN2oRkEkUjjl4JNn4E8GxxbjtG3FbrEIIY3l8/hrwUwIeCZvi4QuOTP4MErVug==", + "engines": { + "node": ">=12" + }, + "funding": { + "url": "https://github.com/chalk/ansi-styles?sponsor=1" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/jackspeak/node_modules/@pkgjs/parseargs": { + "version": "0.11.0", + "resolved": "https://registry.npmjs.org/@pkgjs/parseargs/-/parseargs-0.11.0.tgz", + "integrity": "sha512-+1VkjdD0QBLPodGrJUeqarH8VAIvQODIbwh9XpP5Syisf7YoQgsJKPNFoqqLQlu+VQ/tVSshMR6loPMn8U+dPg==", + "optional": true, + "engines": { + "node": ">=14" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/minimatch": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.3.tgz", + "integrity": "sha512-RHiac9mvaRw0x3AYRgDC1CxAP7HTcNrrECeA8YYJeWnpo+2Q5CegtZjaotWTWxDG3UeGA1coE05iH1mPjT/2mg==", + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/file-renamer/node_modules/glob/node_modules/minipass": { + "version": "7.0.3", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-7.0.3.tgz", + "integrity": "sha512-LhbbwCfz3vsb12j/WkWQPZfKTsgqIe1Nf/ti1pKjYESGLHIVjWU96G9/ljLH4F9mWNVhlQOm0VySdAWzf05dpg==", + "engines": { + "node": ">=16 || 14 >=14.17" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/path-scurry": { + "version": "1.10.1", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.10.1.tgz", + "integrity": "sha512-MkhCqzzBEpPvxxQ71Md0b1Kk51W01lrYvlMzSUaIzNsODdd7mqhiimSZlr+VegAz5Z6Vzt9Xg2ttE//XBhH3EQ==", + "dependencies": { + "lru-cache": "^9.1.1 || ^10.0.0", + "minipass": "^5.0.0 || ^6.0.2 || ^7.0.0" + }, + "engines": { + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/file-renamer/node_modules/glob/node_modules/path-scurry/node_modules/lru-cache": { + "version": "10.0.1", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-10.0.1.tgz", + "integrity": "sha512-IJ4uwUTi2qCccrioU6g9g/5rvvVl13bsdczUUcqbciD9iLr095yj8DQKdObriEvuNSx325N1rV1O0sJFszx75g==", + "engines": { + "node": "14 || >=16.14" + } + }, + "node_modules/file-renamer/node_modules/optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", + "dependencies": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + } + }, + "node_modules/file-renamer/node_modules/optimist/node_modules/minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==" + }, + "node_modules/file-renamer/node_modules/optimist/node_modules/wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==", + "engines": { + "node": ">=0.4.0" + } + }, + "node_modules/file-renamer/node_modules/path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "dependencies": { + "process": "^0.11.1", + "util": "^0.10.3" + } + }, + "node_modules/file-renamer/node_modules/path/node_modules/process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==", + "engines": { + "node": ">= 0.6.0" + } + }, + "node_modules/file-renamer/node_modules/path/node_modules/util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "dependencies": { + "inherits": "2.0.3" + } + }, + "node_modules/file-renamer/node_modules/path/node_modules/util/node_modules/inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + }, + "node_modules/shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "dependencies": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "bin": { + "shjs": "bin/shjs" + }, + "engines": { + "node": ">=4" + } + }, + "node_modules/shelljs/node_modules/glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "dependencies": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "engines": { + "node": "*" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/shelljs/node_modules/glob/node_modules/fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "node_modules/shelljs/node_modules/glob/node_modules/inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "dependencies": { + "once": "^1.3.0", + "wrappy": "1" + } + }, + "node_modules/shelljs/node_modules/glob/node_modules/inflight/node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/shelljs/node_modules/glob/node_modules/inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "node_modules/shelljs/node_modules/glob/node_modules/minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "dependencies": { + "brace-expansion": "^1.1.7" + }, + "engines": { + "node": "*" + } + }, + "node_modules/shelljs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "dependencies": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + } + }, + "node_modules/shelljs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "node_modules/shelljs/node_modules/glob/node_modules/minimatch/node_modules/brace-expansion/node_modules/concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + }, + "node_modules/shelljs/node_modules/glob/node_modules/once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "dependencies": { + "wrappy": "1" + } + }, + "node_modules/shelljs/node_modules/glob/node_modules/once/node_modules/wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + }, + "node_modules/shelljs/node_modules/glob/node_modules/path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==", + "engines": { + "node": ">=0.10.0" + } + }, + "node_modules/shelljs/node_modules/interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==", + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shelljs/node_modules/rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "dependencies": { + "resolve": "^1.1.6" + }, + "engines": { + "node": ">= 0.10" + } + }, + "node_modules/shelljs/node_modules/rechoir/node_modules/resolve": { + "version": "1.22.4", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.4.tgz", + "integrity": "sha512-PXNdCiPqDqeUou+w1C2eTQbNfxKSuMxqTCuvlmmMsk1NWHL5fRrhY6Pl0qEYYc6+QqGClco1Qj8XnjPego4wfg==", + "dependencies": { + "is-core-module": "^2.13.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "bin": { + "resolve": "bin/resolve" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shelljs/node_modules/rechoir/node_modules/resolve/node_modules/is-core-module": { + "version": "2.13.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.13.0.tgz", + "integrity": "sha512-Z7dk6Qo8pOCp3l4tsX2C5ZVas4V+UxwQodwZhLopL91TX8UyyHEXafPcyoeeWuLrwzHcr3igO78wNLwHJHsMCQ==", + "dependencies": { + "has": "^1.0.3" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + }, + "node_modules/shelljs/node_modules/rechoir/node_modules/resolve/node_modules/is-core-module/node_modules/has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "dependencies": { + "function-bind": "^1.1.1" + }, + "engines": { + "node": ">= 0.4.0" + } + }, + "node_modules/shelljs/node_modules/rechoir/node_modules/resolve/node_modules/is-core-module/node_modules/has/node_modules/function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + }, + "node_modules/shelljs/node_modules/rechoir/node_modules/resolve/node_modules/path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "node_modules/shelljs/node_modules/rechoir/node_modules/resolve/node_modules/supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==", + "engines": { + "node": ">= 0.4" + }, + "funding": { + "url": "https://github.com/sponsors/ljharb" + } + } + } +} diff --git a/lib/bb/tests/trace-testdata/npm-shrinkwrap-test.json b/lib/bb/tests/trace-testdata/npm-shrinkwrap-test.json new file mode 100644 index 000000000..59a1042d5 --- /dev/null +++ b/lib/bb/tests/trace-testdata/npm-shrinkwrap-test.json @@ -0,0 +1,307 @@ +{ + "name": "test_npm", + "version": "1.0.0", + "lockfileVersion": 1, + "requires": true, + "dependencies": { + "file-renamer": { + "version": "git+https://github.com/pbarabolkin/node-file-renamer.git#ac02bfa928658ad7c9c9f13452e7884eb4564542", + "from": "git+https://github.com/pbarabolkin/node-file-renamer.git#ac02bfa928658ad7c9c9f13452e7884eb4564542", + "requires": { + "fs": "^0.0.1-security", + "glob": "^10.1.0", + "optimist": "^0.6.1", + "path": "^0.12.7" + }, + "dependencies": { + "fs": { + "version": "0.0.1-security", + "resolved": "https://registry.npmjs.org/fs/-/fs-0.0.1-security.tgz", + "integrity": "sha512-3XY9e1pP0CVEUCdj5BmfIZxRBTSDycnbqhIOGec9QYtmVH2fbLpj86CFWkrNOkt/Fvty4KZG5lTglL9j/gJ87w==" + }, + "glob": { + "version": "10.1.0", + "resolved": "https://registry.npmjs.org/glob/-/glob-10.1.0.tgz", + "integrity": "sha512-daGobsYuT0G4hng24B5LbeLNvwKZYRhWyDl3RvqqAGZjJnCopWWK6PWnAGBY1M/vdA63QE+jddhZcYp+74Bq6Q==", + "requires": { + "fs.realpath": "^1.0.0", + "minimatch": "^9.0.0", + "minipass": "^5.0.0", + "path-scurry": "^1.7.0" + }, + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "minimatch": { + "version": "9.0.0", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.0.tgz", + "integrity": "sha512-0jJj8AvgKqWN05mrwuqi8QYKx1WmYSUoKSxu5Qhs9prezTz10sxAHGNZe9J9cqIJzta8DWsleh2KaVaLl6Ru2w==", + "requires": { + "brace-expansion": "^2.0.1" + }, + "dependencies": { + "brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "requires": { + "balanced-match": "^1.0.0" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + } + } + } + } + }, + "minipass": { + "version": "5.0.0", + "resolved": "https://registry.npmjs.org/minipass/-/minipass-5.0.0.tgz", + "integrity": "sha512-3FnjYuehv9k6ovOEbyOswadCDPX1piCfhV8ncmYtHOjuPwylVWsghTLo7rabjC3Rx5xD4HDx8Wm1xnMF7S5qFQ==" + }, + "path-scurry": { + "version": "1.7.0", + "resolved": "https://registry.npmjs.org/path-scurry/-/path-scurry-1.7.0.tgz", + "integrity": "sha512-UkZUeDjczjYRE495+9thsgcVgsaCPkaw80slmfVFgllxY+IO8ubTsOpFVjDPROBqJdHfVPUFRHPBV/WciOVfWg==", + "requires": { + "lru-cache": "^9.0.0", + "minipass": "^5.0.0" + }, + "dependencies": { + "lru-cache": { + "version": "9.0.3", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-9.0.3.tgz", + "integrity": "sha512-cyjNRew29d4kbgnz1sjDqxg7qg8NW4s+HQzCGjeon7DV5T2yDije16W9HaUFV1dhVEMh+SjrOcK0TomBmf3Egg==" + } + } + } + } + }, + "optimist": { + "version": "0.6.1", + "resolved": "https://registry.npmjs.org/optimist/-/optimist-0.6.1.tgz", + "integrity": "sha512-snN4O4TkigujZphWLN0E//nQmm7790RYaE53DdL7ZYwee2D8DDo9/EyYiKUfN3rneWUjhJnueija3G9I2i0h3g==", + "requires": { + "minimist": "~0.0.1", + "wordwrap": "~0.0.2" + }, + "dependencies": { + "minimist": { + "version": "0.0.10", + "resolved": "https://registry.npmjs.org/minimist/-/minimist-0.0.10.tgz", + "integrity": "sha512-iotkTvxc+TwOm5Ieim8VnSNvCDjCK9S8G3scJ50ZthspSxa7jx50jkhYduuAtAjvfDUwSgOwf8+If99AlOEhyw==" + }, + "wordwrap": { + "version": "0.0.3", + "resolved": "https://registry.npmjs.org/wordwrap/-/wordwrap-0.0.3.tgz", + "integrity": "sha512-1tMA907+V4QmxV7dbRvb4/8MaRALK6q9Abid3ndMYnbyo8piisCmeONVqVSXqQA3KaP4SLt5b7ud6E2sqP8TFw==" + } + } + }, + "path": { + "version": "0.12.7", + "resolved": "https://registry.npmjs.org/path/-/path-0.12.7.tgz", + "integrity": "sha512-aXXC6s+1w7otVF9UletFkFcDsJeO7lSZBPUQhtb5O0xJe8LtYhj/GxldoL09bBj9+ZmE2hNoHqQSFMN5fikh4Q==", + "requires": { + "process": "^0.11.1", + "util": "^0.10.3" + }, + "dependencies": { + "process": { + "version": "0.11.10", + "resolved": "https://registry.npmjs.org/process/-/process-0.11.10.tgz", + "integrity": "sha512-cdGef/drWFoydD1JsMzuFf8100nZl+GT+yacc2bEced5f9Rjk4z+WtFUTBu9PhOi9j/jfmBPu0mMEY4wIdAF8A==" + }, + "util": { + "version": "0.10.4", + "resolved": "https://registry.npmjs.org/util/-/util-0.10.4.tgz", + "integrity": "sha512-0Pm9hTQ3se5ll1XihRic3FDIku70C+iHUdT/W926rSgHV5QgXsYbKZN8MSC3tJtSkhuROzvsQjAaFENRXr+19A==", + "requires": { + "inherits": "2.0.3" + }, + "dependencies": { + "inherits": { + "version": "2.0.3", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.3.tgz", + "integrity": "sha512-x00IRNXNy63jwGkJmzPigoySHbaqpNuzKbBOmzK+g2OdZpQ9w+sxCN+VSB3ja7IAge2OP2qpfxTjeNcyjmW1uw==" + } + } + } + } + } + } + }, + "shelljs": { + "version": "0.8.5", + "resolved": "https://registry.npmjs.org/shelljs/-/shelljs-0.8.5.tgz", + "integrity": "sha512-TiwcRcrkhHvbrZbnRcFYMLl30Dfov3HKqzp5tO5b4pt6G/SezKcYhmDg15zXVBswHmctSAQKznqNW2LO5tTDow==", + "requires": { + "glob": "^7.0.0", + "interpret": "^1.0.0", + "rechoir": "^0.6.2" + }, + "dependencies": { + "glob": { + "version": "7.2.3", + "resolved": "https://registry.npmjs.org/glob/-/glob-7.2.3.tgz", + "integrity": "sha512-nFR0zLpU2YCaRxwoCJvL6UvCH2JFyFVIvwTLsIf21AuHlMskA1hhTdk+LlYJtOlYt9v6dvszD2BGRqBL+iQK9Q==", + "requires": { + "fs.realpath": "^1.0.0", + "inflight": "^1.0.4", + "inherits": "2", + "minimatch": "^3.1.1", + "once": "^1.3.0", + "path-is-absolute": "^1.0.0" + }, + "dependencies": { + "fs.realpath": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/fs.realpath/-/fs.realpath-1.0.0.tgz", + "integrity": "sha512-OO0pH2lK6a0hZnAdau5ItzHPI6pUlvI7jMVnxUQRtw4owF2wk8lOSabtGDCTP4Ggrg2MbGnWO9X8K1t4+fGMDw==" + }, + "inflight": { + "version": "1.0.6", + "resolved": "https://registry.npmjs.org/inflight/-/inflight-1.0.6.tgz", + "integrity": "sha512-k92I/b08q4wvFscXCLvqfsHCrjrF7yiXsQuIVvVE7N82W3+aqpzuUdBbfhWcy/FZR3/4IgflMgKLOsvPDrGCJA==", + "requires": { + "once": "^1.3.0", + "wrappy": "1" + }, + "dependencies": { + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } + }, + "inherits": { + "version": "2.0.4", + "resolved": "https://registry.npmjs.org/inherits/-/inherits-2.0.4.tgz", + "integrity": "sha512-k/vGaX4/Yla3WzyMCvTQOXYeIHvqOKtnqBduzTHpzpQZzAskKMhZ2K+EnBiSM9zGSoIFeMpXKxa4dYeZIQqewQ==" + }, + "minimatch": { + "version": "3.1.2", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.1.2.tgz", + "integrity": "sha512-J7p63hRiAjw1NDEww1W7i37+ByIrOWO5XQQAzZ3VOcL0PNybwpfmV/N05zFAzwQ9USyEcX6t3UO+K5aqBQOIHw==", + "requires": { + "brace-expansion": "^1.1.7" + }, + "dependencies": { + "brace-expansion": { + "version": "1.1.11", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-1.1.11.tgz", + "integrity": "sha512-iCuPHDFgrHX7H2vEI/5xpz07zSHB00TpugqhmYtVmMO6518mCuRMoOYFldEBl0g187ufozdaHgWKcYFb61qGiA==", + "requires": { + "balanced-match": "^1.0.0", + "concat-map": "0.0.1" + }, + "dependencies": { + "balanced-match": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/balanced-match/-/balanced-match-1.0.2.tgz", + "integrity": "sha512-3oSeUO0TMV67hN1AmbXsK4yaqU7tjiHlbxRDZOpH0KW9+CeX4bRAaX0Anxt0tx2MrpRpWwQaPwIlISEJhYU5Pw==" + }, + "concat-map": { + "version": "0.0.1", + "resolved": "https://registry.npmjs.org/concat-map/-/concat-map-0.0.1.tgz", + "integrity": "sha512-/Srv4dswyQNBfohGpz9o6Yb3Gz3SrUDqBH5rTuhGR7ahtlbYKnVxw2bCFMRljaA7EXHaXZ8wsHdodFvbkhKmqg==" + } + } + } + } + }, + "once": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/once/-/once-1.4.0.tgz", + "integrity": "sha512-lNaJgI+2Q5URQBkccEKHTQOPaXdUxnZZElQTZY0MFUAuaEqe1E+Nyvgdz/aIyNi6Z9MzO5dv1H8n58/GELp3+w==", + "requires": { + "wrappy": "1" + }, + "dependencies": { + "wrappy": { + "version": "1.0.2", + "resolved": "https://registry.npmjs.org/wrappy/-/wrappy-1.0.2.tgz", + "integrity": "sha512-l4Sp/DRseor9wL6EvV2+TuQn63dMkPjZ/sp9XkghTEbV9KlPS1xUsZ3u7/IQO4wxtcFB4bgpQPRcR3QCvezPcQ==" + } + } + }, + "path-is-absolute": { + "version": "1.0.1", + "resolved": "https://registry.npmjs.org/path-is-absolute/-/path-is-absolute-1.0.1.tgz", + "integrity": "sha512-AVbw3UJ2e9bq64vSaS9Am0fje1Pa8pbGqTTsmXfaIiMpnr5DlDhfJOuLj9Sf95ZPVDAUerDfEk88MPmPe7UCQg==" + } + } + }, + "interpret": { + "version": "1.4.0", + "resolved": "https://registry.npmjs.org/interpret/-/interpret-1.4.0.tgz", + "integrity": "sha512-agE4QfB2Lkp9uICn7BAqoscw4SZP9kTE2hxiFI3jBPmXJfdqiahTbUuKGsMoN2GtqL9AxhYioAcVvgsb1HvRbA==" + }, + "rechoir": { + "version": "0.6.2", + "resolved": "https://registry.npmjs.org/rechoir/-/rechoir-0.6.2.tgz", + "integrity": "sha512-HFM8rkZ+i3zrV+4LQjwQ0W+ez98pApMGM3HUrN04j3CqzPOzl9nmP15Y8YXNm8QHGv/eacOVEjqhmWpkRV0NAw==", + "requires": { + "resolve": "^1.1.6" + }, + "dependencies": { + "resolve": { + "version": "1.22.3", + "resolved": "https://registry.npmjs.org/resolve/-/resolve-1.22.3.tgz", + "integrity": "sha512-P8ur/gp/AmbEzjr729bZnLjXK5Z+4P0zhIJgBgzqRih7hL7BOukHGtSTA3ACMY467GRFz3duQsi0bDZdR7DKdw==", + "requires": { + "is-core-module": "^2.12.0", + "path-parse": "^1.0.7", + "supports-preserve-symlinks-flag": "^1.0.0" + }, + "dependencies": { + "is-core-module": { + "version": "2.12.0", + "resolved": "https://registry.npmjs.org/is-core-module/-/is-core-module-2.12.0.tgz", + "integrity": "sha512-RECHCBCd/viahWmwj6enj19sKbHfJrddi/6cBDsNTKbNq0f7VeaUkBo60BqzvPqo/W54ChS62Z5qyun7cfOMqQ==", + "requires": { + "has": "^1.0.3" + }, + "dependencies": { + "has": { + "version": "1.0.3", + "resolved": "https://registry.npmjs.org/has/-/has-1.0.3.tgz", + "integrity": "sha512-f2dvO0VU6Oej7RkWJGrehjbzMAjFp5/VKPp5tTpWIV4JHHZK1/BxbFRtf/siA2SWTe09caDmVtYYzWEIbBS4zw==", + "requires": { + "function-bind": "^1.1.1" + }, + "dependencies": { + "function-bind": { + "version": "1.1.1", + "resolved": "https://registry.npmjs.org/function-bind/-/function-bind-1.1.1.tgz", + "integrity": "sha512-yIovAzMX49sF8Yl58fSCWJ5svSLuaibPxXQJFLmBObTuCr0Mf1KiPopGM9NiFjiYBCbfaa2Fh6breQ6ANVTI0A==" + } + } + } + } + }, + "path-parse": { + "version": "1.0.7", + "resolved": "https://registry.npmjs.org/path-parse/-/path-parse-1.0.7.tgz", + "integrity": "sha512-LDJzPVEEEPR+y48z93A0Ed0yXb8pAByGWo/k5YYdYgpY2/2EsOsksJrq7lOHxryrVOn1ejG6oAp8ahvOIQD8sw==" + }, + "supports-preserve-symlinks-flag": { + "version": "1.0.0", + "resolved": "https://registry.npmjs.org/supports-preserve-symlinks-flag/-/supports-preserve-symlinks-flag-1.0.0.tgz", + "integrity": "sha512-ot0WnXS9fgdkgIcePe6RHNk1WA8+muPa6cSjeR3V8K27q9BB1rTE3R1p7Hv0z1ZyAc8s6Vvv8DIyWf681MAt0w==" + } + } + } + } + } + } + } + } + } diff --git a/lib/bb/tests/trace-testdata/ot-br-posix-0.3.0+git083fb6921903441bf44f46c263c123eb4af6e4a9.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/ot-br-posix-0.3.0+git083fb6921903441bf44f46c263c123eb4af6e4a9.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..284d1b94f --- /dev/null +++ b/lib/bb/tests/trace-testdata/ot-br-posix-0.3.0+git083fb6921903441bf44f46c263c123eb4af6e4a9.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/python3-cryptography-37.0.4.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/python3-cryptography-37.0.4.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..066093c29 --- /dev/null +++ b/lib/bb/tests/trace-testdata/python3-cryptography-37.0.4.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/snappy-1.1.9.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/snappy-1.1.9.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..1c78bd0c7 --- /dev/null +++ b/lib/bb/tests/trace-testdata/snappy-1.1.9.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/systemd-251.8.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/systemd-251.8.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..bc99b12d4 --- /dev/null +++ b/lib/bb/tests/trace-testdata/systemd-251.8.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/test_npm-1.0.0.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/test_npm-1.0.0.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..3c8b15249 --- /dev/null +++ b/lib/bb/tests/trace-testdata/test_npm-1.0.0.unpack.trace.json.zst diff --git a/lib/bb/tests/trace-testdata/test_npm2-1.0.0.unpack.trace.json.zst b/lib/bb/tests/trace-testdata/test_npm2-1.0.0.unpack.trace.json.zst Binary files differnew file mode 100644 index 000000000..864f57d15 --- /dev/null +++ b/lib/bb/tests/trace-testdata/test_npm2-1.0.0.unpack.trace.json.zst diff --git a/lib/bb/tests/trace.py b/lib/bb/tests/trace.py new file mode 100644 index 000000000..f6526e588 --- /dev/null +++ b/lib/bb/tests/trace.py @@ -0,0 +1,570 @@ + +# Copyright (C) 2023 Alberto Pianon <pianon@array.eu> +# +# SPDX-License-Identifier: GPL-2.0-only +# + +import os +import re +import json +import shutil +import unittest +import tempfile +from pathlib import Path +import subprocess + +import bb + +from bb.tests.trace_base import create_file + +def skipIfNoNetwork(): + if os.environ.get("BB_SKIP_NETTESTS") == "yes": + return unittest.skip("network test") + return lambda f: f + +class SplitVarValueTest(unittest.TestCase): + + def test_split_var_value_with_items_without_spaces(self): + items_without_spaces = [ + "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}", + "${SRC_URI_MUSL}", + "file://0001-Adjust-for-musl-headers.patch" + ] + var_value = " ".join(items_without_spaces) + self.assertEqual( + bb.fetch2.trace.split_var_value(var_value, False), items_without_spaces) + + def test_split_var_value_with_items_with_spaces(self): + items_with_spaces = [ + "https://github.com/shadow-maint/shadow/releases/download/v${PV}/${BP}.tar.gz", + "${@bb.utils.contains('PACKAGECONFIG', 'pam', '${PAM_SRC_URI}', '', d)}", + "file://shadow-relaxed-usernames.patch", + ] + var_value = " ".join(items_with_spaces) + self.assertEqual( + bb.fetch2.trace.split_var_value(var_value, False), items_with_spaces) + + +class GetUnexpSrcUriTest(unittest.TestCase): + + def test_get_unexp_src_uri(self): + d = bb.data.init() + d.setVar("SRCBRANCH", "main") + d.setVar("SRC_URI", """ + git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} + file://0001-Adjust-for-musl-headers.patch + """) + src_uri = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=main" + unexp_src_uri = "git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH}" + self.assertEqual( + bb.fetch2.trace.get_unexp_src_uri(src_uri, d), unexp_src_uri) + + def test_get_unexp_src_uri_that_expands_to_multiple_items(self): + d = bb.data.init() + d.setVar("SRC_URI_MUSL", """ + file://0003-missing_type.h-add-comparison_fn_t.patch + file://0004-add-fallback-parse_printf_format-implementation.patch + file://0005-src-basic-missing.h-check-for-missing-strndupa.patch + """) + d.setVar("SRC_URI", """ + git://github.com/systemd/systemd-stable.git;protocol=https;branch=main + ${SRC_URI_MUSL} + file://0001-Adjust-for-musl-headers.patch + """) + src_uris = [ + "file://0003-missing_type.h-add-comparison_fn_t.patch", + "file://0004-add-fallback-parse_printf_format-implementation.patch", + "file://0005-src-basic-missing.h-check-for-missing-strndupa.patch", + ] + unexp_src_uri = "${SRC_URI_MUSL}" + for src_uri in src_uris: + self.assertEqual( + bb.fetch2.trace.get_unexp_src_uri(src_uri, d), unexp_src_uri) + + +class GetCleanSrcUriTest(unittest.TestCase): + + def test_get_clean_src_uri_from_src_uri_with_abs_path_in_param(self): + src_uris = { + "git://git.example.com/foo/foo-plugin1.git;destsuffix=/home/user/poky/build/tmp/work/core2-64-poky-linux/foo/0.0.1/foo-0.0.1/plugins/1;name=plugin1;protocol=https" : + "git://git.example.com/foo/foo-plugin1.git;destsuffix=<local-path>;name=plugin1;protocol=https", + "git://git.example.com/foo/foo-plugin1.git;name=plugin1;protocol=https;destsuffix=/home/user/poky/build/tmp/work/core2-64-poky-linux/foo/0.0.1/foo-0.0.1/plugins/1" : + "git://git.example.com/foo/foo-plugin1.git;name=plugin1;protocol=https;destsuffix=<local-path>" + } + for src_uri, clean_src_uri in src_uris.items(): + self.assertEqual( + bb.fetch2.trace.get_clean_src_uri(src_uri), clean_src_uri) + + def test_get_clean_src_uri_from_src_uri_with_abs_path_in_url_path(self): + src_uris = { + "file:///home/user/meta-foo/foo/foo_fix.patch;subdir=foo": + "file://<local-path>;subdir=foo", + "npmsw:///home/user/meta-example/npm-shrinkwrap.json": + "npmsw://<local-path>" + } + for src_uri, clean_src_uri in src_uris.items(): + self.assertEqual( + bb.fetch2.trace.get_clean_src_uri(src_uri), clean_src_uri) + +class GetDownloadLocationAndRelpathTest(unittest.TestCase): + + # TODO add test with a git remote pointing to repo tool manifest + + def test_get_dl_loc_for_dir_in_git_repo(self): + with tempfile.TemporaryDirectory() as tmpdir: + tmpdir = Path(tmpdir) + + create_file(tmpdir / "repo/README", "hello") + create_file(tmpdir / "repo/doc/help.txt", "help") + git_dir = tmpdir/"repo" + subprocess.check_output(["git", "init"], cwd=git_dir) + subprocess.check_output(["git", "add", "-A"], cwd=git_dir) + subprocess.check_output(["git", "commit", "-m", "'initial commit'"], cwd=git_dir) + head = subprocess.check_output(["git", "rev-parse", "HEAD"], cwd=git_dir).decode().strip("\n") + download_location, relpath = bb.fetch2.trace.get_dl_loc(tmpdir/"repo/doc") + self.assertEqual((download_location, relpath), (None, None)) # no origin + + os.rename(tmpdir/"repo/.git", tmpdir/"repo.git") + subprocess.check_output(["rm", "-Rf", "repo"], cwd=tmpdir) + subprocess.check_output(["git", "clone", "repo.git"], cwd=tmpdir, stderr=subprocess.DEVNULL) + download_location, relpath = bb.fetch2.trace.get_dl_loc(tmpdir/"repo/doc") + self.assertEqual(download_location, "git+%s@%s" % (tmpdir/"repo.git", head)) + self.assertEqual(relpath, "doc") + + download_location, relpath = bb.fetch2.trace.get_dl_loc(git_dir) + self.assertEqual(download_location, "git+%s@%s" % (tmpdir/"repo.git", head)) + self.assertEqual(relpath, "") + + create_file(tmpdir/"repo/LICENSE", "CC-0") + subprocess.check_output(["git", "add", "LICENSE"], cwd=git_dir) + subprocess.check_output(["git", "commit", "-m", "'add license'"], cwd=git_dir) + download_location, relpath = bb.fetch2.trace.get_dl_loc(git_dir) + self.assertEqual((download_location, relpath), (None, None)) + + def test_get_dl_loc_on_file_with_no_git_repo(self): + with tempfile.TemporaryDirectory() as tmpdir: + tmpdir = Path(tmpdir) + create_file(tmpdir/"README", "hello") + download_location, relpath = bb.fetch2.trace.get_dl_loc(tmpdir) + self.assertEqual((download_location, relpath), (None, None)) + + +class IsInCurrentBranchTest(unittest.TestCase): + + def get_untracked_new_and_modified_files(self): + with tempfile.TemporaryDirectory() as tmpdir: + tmpdir = Path(tmpdir) + create_file(tmpdir / "repo/README", "hello") + create_file(tmpdir / "repo/doc/help.txt", "help") + git_dir = tmpdir/"repo" + subprocess.check_output(["git", "init"], cwd=git_dir) + subprocess.check_output(["git", "add", "-A"], cwd=git_dir) + subprocess.check_output(["git", "commit", "-m", "'initial commit'"], cwd=git_dir) + + # modified + create_file(tmpdir / "repo/README", "hello there") + # untracked + create_file(tmpdir / "repo/test/test.txt", "test") + # staged, uncommitted + create_file(tmpdir / "repo/test/test2.txt", "test2") + subprocess.check_output(["git", "add", "test/test2.txt"], cwd=git_dir) + + untracked_new_and_modified_files = bb.fetch2.trace.get_get_untracked_new_and_modified_files(git_dir) + + self.assertFalse("doc/help.txt" in untracked_new_and_modified_files) + self.assertTrue("README" in untracked_new_and_modified_files) + self.assertTrue("test/test.txt" in untracked_new_and_modified_files) + self.assertTrue("test/test2.txt" in untracked_new_and_modified_files) + + +class TraceUnpackIntegrationTest(unittest.TestCase): + + meta_repos = [( + "git://git.yoctoproject.org/poky", + "langdale", + "yocto-4.1.3", + "2023-03-05" + ),( + "git://git.openembedded.org/meta-openembedded", + "langdale", + "b5b732876da1885ecbab2aa45f80d7a3086c5262", + "" + )] + + @classmethod + @skipIfNoNetwork() + def setUpClass(cls): + cls.meta_tempdir = tempfile.mkdtemp(prefix="meta-") + for repo, branch, commit, shallow_since in cls.meta_repos: + cmd = "git clone" + if shallow_since: + cmd += " --shallow-since %s" % shallow_since + cmd += " --branch %s --single-branch %s" % (branch, repo) + bb.process.run(cmd, cwd=cls.meta_tempdir) + basename = re.sub(r"\.git$", "", os.path.basename(repo)) + git_dir = os.path.join(cls.meta_tempdir, basename) + bb.process.run("git checkout %s" % commit, cwd=git_dir) + cls.tempdir = tempfile.mkdtemp(prefix="bitbake-trace-") + cls.dldir = os.path.join(cls.tempdir, "download") + os.mkdir(cls.dldir) + + @classmethod + @skipIfNoNetwork() + def tearDownClass(cls): + if os.environ.get("BB_TMPDIR_NOCLEAN") == "yes": + print("Not cleaning up %s. Please remove manually." % cls.meta_tempdir) + print("Not cleaning up %s. Please remove manually." % cls.tempdir) + else: + bb.process.run('chmod u+rw -R %s' % cls.meta_tempdir) + bb.utils.prunedir(cls.meta_tempdir) + bb.process.run('chmod u+rw -R %s' % cls.tempdir) + bb.utils.prunedir(cls.tempdir) + + def run_do_unpack(self, var, var_flags, is_go=False): + self.d = bb.data.init() + self.d.setVar("DL_DIR", self.dldir) + for var_name, value in var.items(): + self.d.setVar(var_name, value) + for var_name, flags in var_flags.items(): + for flag_name, flag_value in flags.items(): + self.d.setVarFlag(var_name, flag_name, flag_value) + bb.utils.mkdirhier(self.d.getVar("S")) + bb.utils.mkdirhier(self.d.getVar("WORKDIR") + "/temp") + fetcher = bb.fetch2.Fetch(None, self.d) + fetcher.download() + if is_go: # simulate go_do_unpack + for url in fetcher.urls: + if fetcher.ud[url].type == 'git': + if fetcher.ud[url].parm.get('destsuffix') is None: + s_dirname = os.path.basename(self.d.getVar('S')) + fetcher.ud[url].parm['destsuffix'] = os.path.join( + s_dirname, 'src', self.d.getVar('GO_IMPORT')) + '/' + fetcher.unpack(self.d.getVar("WORKDIR")) + + def get_trace_data_and_expected_trace_data(self): + json_file = "%s-%s.unpack.trace.json.zst" % (self.d.getVar("PN"), self.d.getVar("PV")) + path = os.path.join(self.d.getVar("WORKDIR"), "temp", json_file) + with bb.compress.zstd.open(path, "rt", encoding="utf-8", num_threads=1) as f: + td = json.load(f) + this_dir = os.path.dirname(os.path.abspath(__file__)) + testdata_path = os.path.join(this_dir, "trace-testdata", json_file) + with bb.compress.zstd.open(testdata_path, "rt", encoding="utf-8", num_threads=1) as f: + expected_td = json.load(f) + return td, expected_td + + @skipIfNoNetwork() + def test_bzip2_case(self): + """ 1) check if https, git and file src uris are correctly traced + 2) local files configure.ac and Makefile.am from poky/meta layer are + added to bzip2 source dir (${WORKDIR}/bzip2-1.0.8/) through + file:// src uris with subdir param: check if their real upstream + source is correctly identified + 3) SRC_URI contains variables to be expanded: check if the + unexpanded src uris are correctly identified + """ + var = { + "PN": "bzip2", + "BPN": "bzip2", + "PV": "1.0.8", + "BP": "${BPN}-${PV}", + "SRC_URI": """https://sourceware.org/pub/${BPN}/${BPN}-${PV}.tar.gz + git://sourceware.org/git/bzip2-tests.git;name=bzip2-tests;branch=master + file://configure.ac;subdir=${BP} + file://Makefile.am;subdir=${BP} + file://run-ptest + """, + "SRCREV_bzip2-tests": "f9061c030a25de5b6829e1abf373057309c734c0", + "FILE": self.meta_tempdir+"/poky/meta/recipes-extended/bzip2/bzip2_1.0.8.bb", + "FILE_DIRNAME": "${@os.path.dirname(d.getVar('FILE', False))}", + "FILESPATH": '${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files', + "WORKDIR": self.tempdir+"/work/core2-64-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/${BP}", + "BBLAYERS": self.meta_tempdir+"/poky/meta", + } + var_flags = { + "SRC_URI": { + "md5sum": "67e051268d0c475ea773822f7500d0e5", + "sha256sum": "ab5a03176ee106d3f0fa90e381da478ddae405918153cca248e682cd0c4a2269" + } + } + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_gettext_minimal_native_case(self): + """ check if file src uri pointing to a directory (aclocal/) is + correctly handled""" + var = { + "PN": "gettext-minimal-native", + "PV": "0.21", + "BPN": "gettext-minimal", + "BP": "${BPN}-${PV}", + "SRC_URI": """file://aclocal/ + file://config.rpath + file://Makefile.in.in + file://remove-potcdate.sin + file://COPYING + """, + "FILE": self.meta_tempdir+"/poky/meta/recipes-core/gettext/gettext-minimal-native_0.21.1.bb", + "FILE_DIRNAME": "${@os.path.dirname(d.getVar('FILE', False))}", + "FILESPATH": '${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files', + "WORKDIR": self.tempdir+"/work/x86_64-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}", + "BBLAYERS": self.meta_tempdir+"/poky/meta", + } + var_flags = {} + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_python_cryptography_case(self): + """ 1) check if crate:// src_uris are handled correctly (download + location should be the corresponding https download url) + 2) check if package checksum data is handled correctly (we have + multiple SRC_URI entries supporting checksums here, but the + checksum var flag set in the recipe refers only to the first + found entry) + """ + var = { + "PN": "python3-cryptography", + "PV": "37.0.4", + "BPN": "python3-cryptography", + "BP": "${BPN}-${PV}", + "PYPI_SRC_URI": "https://files.pythonhosted.org/packages/source/c/cryptography/cryptography-37.0.4.tar.gz", + "SRC_URI": """ + ${PYPI_SRC_URI} + file://run-ptest + file://check-memfree.py + file://0001-Cargo.toml-specify-pem-version.patch + file://0002-Cargo.toml-edition-2018-2021.patch + file://0001-pyproject.toml-remove-benchmark-disable-option.patch + crate://crates.io/Inflector/0.11.4 + crate://crates.io/aliasable/0.1.3 + crate://crates.io/asn1/0.8.7 + crate://crates.io/asn1_derive/0.8.7 + crate://crates.io/autocfg/1.1.0 + crate://crates.io/base64/0.13.0 + crate://crates.io/bitflags/1.3.2 + crate://crates.io/cfg-if/1.0.0 + crate://crates.io/chrono/0.4.19 + crate://crates.io/indoc-impl/0.3.6 + crate://crates.io/indoc/0.3.6 + crate://crates.io/instant/0.1.12 + crate://crates.io/lazy_static/1.4.0 + crate://crates.io/libc/0.2.124 + crate://crates.io/lock_api/0.4.7 + crate://crates.io/num-integer/0.1.44 + crate://crates.io/num-traits/0.2.14 + crate://crates.io/once_cell/1.10.0 + crate://crates.io/ouroboros/0.15.0 + crate://crates.io/ouroboros_macro/0.15.0 + crate://crates.io/parking_lot/0.11.2 + crate://crates.io/parking_lot_core/0.8.5 + crate://crates.io/paste-impl/0.1.18 + crate://crates.io/paste/0.1.18 + crate://crates.io/pem/1.0.2 + crate://crates.io/proc-macro-error-attr/1.0.4 + crate://crates.io/proc-macro-error/1.0.4 + crate://crates.io/proc-macro-hack/0.5.19 + crate://crates.io/proc-macro2/1.0.37 + crate://crates.io/pyo3-build-config/0.15.2 + crate://crates.io/pyo3-macros-backend/0.15.2 + crate://crates.io/pyo3-macros/0.15.2 + crate://crates.io/pyo3/0.15.2 + crate://crates.io/quote/1.0.18 + crate://crates.io/redox_syscall/0.2.13 + crate://crates.io/scopeguard/1.1.0 + crate://crates.io/smallvec/1.8.0 + crate://crates.io/stable_deref_trait/1.2.0 + crate://crates.io/syn/1.0.91 + crate://crates.io/unicode-xid/0.2.2 + crate://crates.io/unindent/0.1.8 + crate://crates.io/version_check/0.9.4 + crate://crates.io/winapi-i686-pc-windows-gnu/0.4.0 + crate://crates.io/winapi-x86_64-pc-windows-gnu/0.4.0 + crate://crates.io/winapi/0.3.9 + """, + "FILE": self.meta_tempdir+"/poky/meta/recipes-devtools/python/python3-cryptography_37.0.4.bb", + "FILE_DIRNAME": "${@os.path.dirname(d.getVar('FILE', False))}", + "FILESPATH": '${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files', + "WORKDIR": self.tempdir+"/work/core2-64-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/${BP}", + "BBLAYERS": self.meta_tempdir+"/poky/meta", + } + var_flags = { + "SRC_URI": { + "sha256sum": "63f9c17c0e2474ccbebc9302ce2f07b55b3b3fcb211ded18a42d5764f5c10a82", + } + } + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_snappy_case(self): + """check if gitsm src uri is handled correctly""" + var = { + "PN": "snappy", + "PV": "1.1.9", + "BPN": "snappy", + "BP": "${BPN}-${PV}", + "SRC_URI": """ + gitsm://github.com/google/snappy.git;protocol=https;branch=main + file://0001-Add-inline-with-SNAPPY_ATTRIBUTE_ALWAYS_INLINE.patch + """, + "SRCREV": "2b63814b15a2aaae54b7943f0cd935892fae628f", + "FILE": self.meta_tempdir+"/meta-openembedded/meta-oe/recipes-extended/snappy/snappy_1.1.9.bb", + "FILE_DIRNAME": "${@os.path.dirname(d.getVar('FILE', False))}", + "FILESPATH": '${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files', + "WORKDIR": self.tempdir+"/work/core2-64-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/git", + "BBLAYERS": self.meta_tempdir+"/meta-openembedded/meta-oe", + } + var_flags = {} + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_ot_br_posix_case(self): + """check if nested git submodules are handled correctly""" + var = { + "PN": "ot-br-posix", + "PV": "0.3.0+git083fb6921903441bf44f46c263c123eb4af6e4a9", + "BPN": "ot-br-posix", + "BP": "${BPN}-${PV}", + "SRC_URI": "gitsm://github.com/openthread/ot-br-posix.git;protocol=https;branch=main", + "SRCREV": "083fb6921903441bf44f46c263c123eb4af6e4a9", + "WORKDIR": self.tempdir+"/work/core2-64-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/git", + "BBLAYERS": self.meta_tempdir+"/meta-openembedded/meta-networking", + } + var_flags = {} + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_gosu_case(self): + """ 1) test if src uris pointing to go code are handled correctly + (mocking go_do_unpack) + 2) test if SRC_URI entries with local absolute path destsuffix param + are handled correctly + 3) test if symlinks in sources are handled correctly + """ + var = { + "PN": "gosu", + "PV": "1.14", + "BPN": "gosu", + "BP": "${BPN}-${PV}", + "FILE": self.meta_tempdir+"/meta-openembedded/meta-oe/recipes-support/gosu/gosu_1.14.bb", + "WORKDIR": self.tempdir+"/work/core2-64-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/${BP}", + "GO_IMPORT": "github.com/tianon/gosu", + "SRC_URI": """ + git://${GO_IMPORT}.git;branch=master;protocol=https + git://github.com/opencontainers/runc;name=runc;destsuffix=${S}/src/github.com/opencontainers/runc;branch=main;protocol=https + """, + "SRCREV": "9f7cd138a1ebc0684d43ef6046bf723978e8741f", + "SRCREV_runc": "d7f7b22a85a2387557bdcda125710c2506f8d5c5", + "BBLAYERS": self.meta_tempdir+"/meta-openembedded/meta-oe", + } + var_flags = {} + self.run_do_unpack(var, var_flags, is_go=True) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_systemd_case(self): + """check if SRC_URI containing expressions are handled correctly""" + var = { + "PN": "systemd", + "PV": "251.8", + "BPN": "systemd", + "BP": "${BPN}-${PV}", + "SRCBRANCH": "v251-stable", + "SRCREV": "ae8b249af4acb055f920134f2ac584c4cbc86e3b", + "SRC_URI": """ + git://github.com/systemd/systemd-stable.git;protocol=https;branch=${SRCBRANCH} + file://touchscreen.rules + file://00-create-volatile.conf + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://org.freedesktop.hostname1_no_polkit.conf', '', d)} + ${@bb.utils.contains('PACKAGECONFIG', 'polkit_hostnamed_fallback', 'file://00-hostnamed-network-user.conf', '', d)} + file://init + file://99-default.preset + file://systemd-pager.sh + file://0001-binfmt-Don-t-install-dependency-links-at-install-tim.patch + file://0003-implment-systemd-sysv-install-for-OE.patch + file://0001-Move-sysusers.d-sysctl.d-binfmt.d-modules-load.d-to-.patch + """, + "FILE": self.meta_tempdir+"/poky/meta/recipes-core/systemd/systemd_251.8.bb", + "FILE_DIRNAME": "${@os.path.dirname(d.getVar('FILE', False))}", + "FILESPATH": '${FILE_DIRNAME}/${BP}:${FILE_DIRNAME}/${BPN}:${FILE_DIRNAME}/files', + "WORKDIR": self.tempdir+"/work/core2-64-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/git", + "BBLAYERS": self.meta_tempdir+"/poky/meta", + } + var_flags = {} + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_npmsw(self): + """ 1) test npmsw fetcher using a small made-up npm-shrinkwrap.json + file; check if nested non-dedup dependencies are handled + correctly (some upstream files are replicated in multiple + paths in workdir); check if "git" package versions are + handled correctly + 2) test if files added to existing layer local repos are handled + correctly (finding local provenance and not upstream provenance) + """ + this_dir = os.path.dirname(os.path.abspath(__file__)) + npmsw_file = this_dir+"/trace-testdata/npm-shrinkwrap-test.json" + shutil.copy2(npmsw_file, self.meta_tempdir+"/poky/meta") + var = { + "PN": "test_npm", + "PV": "1.0.0", + "BPN": "test_npm", + "BP": "${BPN}-${PV}", + "NPMSW_PATH": self.meta_tempdir+"/poky/meta", + "SRC_URI": "npmsw://${NPMSW_PATH}/npm-shrinkwrap-test.json", + "WORKDIR": self.tempdir+"/work/all-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/${BP}", + "BBLAYERS": self.meta_tempdir+"/poky/meta", + } + var_flags = {} + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + @skipIfNoNetwork() + def test_npmsw_new_format(self): + """ 1) test new npm-shrinkwrap.json format + 2) test tracing deps works also with scoped package names, like + @foo/bar + """ + this_dir = os.path.dirname(os.path.abspath(__file__)) + npmsw_file = this_dir+"/trace-testdata/npm-shrinkwrap-newfmt-test.json" + shutil.copy2(npmsw_file, self.meta_tempdir+"/poky/meta") + var = { + "PN": "test_npm2", + "PV": "1.0.0", + "BPN": "test_npm2", + "BP": "${BPN}-${PV}", + "NPMSW_PATH": self.meta_tempdir+"/poky/meta", + "SRC_URI": "npmsw://${NPMSW_PATH}/npm-shrinkwrap-newfmt-test.json", + "WORKDIR": self.tempdir+"/work/all-poky-linux/${PN}/${PV}-r0", + "S": "${WORKDIR}/${BP}", + "BBLAYERS": self.meta_tempdir+"/poky/meta", + } + var_flags = {} + self.run_do_unpack(var, var_flags) + td, expected_td = self.get_trace_data_and_expected_trace_data() + self.assertEqual(td, expected_td) + + +if __name__ == '__main__': + unittest.main()
\ No newline at end of file |