diff options
author | Ross Burton <ross.burton@arm.com> | 2024-10-10 17:06:20 +0100 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2024-10-11 12:17:03 +0100 |
commit | 68e5aa9b92c37c0eaa32f42a78df86940c33858c (patch) | |
tree | fe08f11590c73b92b8aabf37bf78db4cb0898899 | |
parent | 827716ac0aa2de296f64db5d950ae5b31dd2dcc8 (diff) | |
download | poky-68e5aa9b92c37c0eaa32f42a78df86940c33858c.tar.gz |
insane: micro-optimise the sweep of pkgfiles
Don't actively do more work:
- Exit early if there are no packages being generated
- Don't iterate repeatedly when removing CONTROL and DEBIAN
- Extend a list with another list instead of appending item by item
- Remove unused variables
(From OE-Core rev: 79ffb8896d570dd935d3aea9d28ee20b52e1674a)
Signed-off-by: Ross Burton <ross.burton@arm.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
-rw-r--r-- | meta/classes-global/insane.bbclass | 27 |
1 files changed, 11 insertions, 16 deletions
diff --git a/meta/classes-global/insane.bbclass b/meta/classes-global/insane.bbclass index b165f111ce..05b8538940 100644 --- a/meta/classes-global/insane.bbclass +++ b/meta/classes-global/insane.bbclass | |||
@@ -1084,13 +1084,8 @@ parse_test_matrix[vardepsexclude] = "ERROR_QA WARN_QA" | |||
1084 | 1084 | ||
1085 | # The PACKAGE FUNC to scan each package | 1085 | # The PACKAGE FUNC to scan each package |
1086 | python do_package_qa () { | 1086 | python do_package_qa () { |
1087 | import subprocess | ||
1088 | import oe.packagedata | 1087 | import oe.packagedata |
1089 | 1088 | ||
1090 | bb.note("DO PACKAGE QA") | ||
1091 | |||
1092 | main_lic = d.getVar('LICENSE') | ||
1093 | |||
1094 | # Check for obsolete license references in main LICENSE (packages are checked below for any changes) | 1089 | # Check for obsolete license references in main LICENSE (packages are checked below for any changes) |
1095 | main_licenses = oe.license.list_licenses(d.getVar('LICENSE')) | 1090 | main_licenses = oe.license.list_licenses(d.getVar('LICENSE')) |
1096 | obsolete = set(oe.license.obsolete_license_list()) & main_licenses | 1091 | obsolete = set(oe.license.obsolete_license_list()) & main_licenses |
@@ -1106,27 +1101,27 @@ python do_package_qa () { | |||
1106 | pn = d.getVar('PN') | 1101 | pn = d.getVar('PN') |
1107 | 1102 | ||
1108 | # Scan the packages... | 1103 | # Scan the packages... |
1109 | pkgdest = d.getVar('PKGDEST') | ||
1110 | packages = set((d.getVar('PACKAGES') or '').split()) | 1104 | packages = set((d.getVar('PACKAGES') or '').split()) |
1105 | # no packages should be scanned | ||
1106 | if not packages: | ||
1107 | return | ||
1111 | 1108 | ||
1112 | global pkgfiles | 1109 | global pkgfiles |
1113 | pkgfiles = {} | 1110 | pkgfiles = {} |
1111 | pkgdest = d.getVar('PKGDEST') | ||
1114 | for pkg in packages: | 1112 | for pkg in packages: |
1115 | pkgfiles[pkg] = [] | ||
1116 | pkgdir = os.path.join(pkgdest, pkg) | 1113 | pkgdir = os.path.join(pkgdest, pkg) |
1114 | pkgfiles[pkg] = [] | ||
1117 | for walkroot, dirs, files in os.walk(pkgdir): | 1115 | for walkroot, dirs, files in os.walk(pkgdir): |
1118 | # Don't walk into top-level CONTROL or DEBIAN directories as these | 1116 | # Don't walk into top-level CONTROL or DEBIAN directories as these |
1119 | # are temporary directories created by do_package. | 1117 | # are temporary directories created by do_package. |
1120 | if walkroot == pkgdir: | 1118 | if walkroot == pkgdir: |
1121 | for control in ("CONTROL", "DEBIAN"): | 1119 | for removedir in ("CONTROL", "DEBIAN"): |
1122 | if control in dirs: | 1120 | try: |
1123 | dirs.remove(control) | 1121 | dirs.remove(removedir) |
1124 | for file in files: | 1122 | except ValueError: |
1125 | pkgfiles[pkg].append(os.path.join(walkroot, file)) | 1123 | pass |
1126 | 1124 | pkgfiles[pkg].extend((os.path.join(walkroot, f) for f in files)) | |
1127 | # no packages should be scanned | ||
1128 | if not packages: | ||
1129 | return | ||
1130 | 1125 | ||
1131 | import re | 1126 | import re |
1132 | # The package name matches the [a-z0-9.+-]+ regular expression | 1127 | # The package name matches the [a-z0-9.+-]+ regular expression |