diff options
Diffstat (limited to 'scripts')
-rwxr-xr-x | scripts/gen-site-config | 43 | ||||
-rw-r--r-- | scripts/lib/build_perf/html/measurement_chart.html | 140 | ||||
-rw-r--r-- | scripts/lib/build_perf/html/report.html | 124 | ||||
-rw-r--r-- | scripts/lib/build_perf/report.py | 5 | ||||
-rwxr-xr-x | scripts/lib/devtool/ide_sdk.py | 2 | ||||
-rw-r--r-- | scripts/lib/devtool/standard.py | 231 | ||||
-rw-r--r-- | scripts/lib/devtool/upgrade.py | 2 | ||||
-rw-r--r-- | scripts/lib/recipetool/append.py | 6 | ||||
-rw-r--r-- | scripts/lib/recipetool/create.py | 2 | ||||
-rw-r--r-- | scripts/lib/scriptutils.py | 15 | ||||
-rw-r--r-- | scripts/lib/wic/engine.py | 2 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/bootimg-efi.py | 4 | ||||
-rw-r--r-- | scripts/lib/wic/plugins/source/rootfs.py | 2 | ||||
-rwxr-xr-x | scripts/oe-build-perf-report | 8 | ||||
-rwxr-xr-x | scripts/oe-debuginfod | 17 | ||||
-rwxr-xr-x | scripts/oe-setup-build | 11 |
16 files changed, 320 insertions, 294 deletions
diff --git a/scripts/gen-site-config b/scripts/gen-site-config deleted file mode 100755 index 727b809c0f..0000000000 --- a/scripts/gen-site-config +++ /dev/null | |||
@@ -1,43 +0,0 @@ | |||
1 | #! /bin/sh | ||
2 | # Copyright (c) 2005-2008 Wind River Systems, Inc. | ||
3 | # | ||
4 | # SPDX-License-Identifier: GPL-2.0-only | ||
5 | # | ||
6 | |||
7 | cat << EOF | ||
8 | AC_PREREQ(2.57) | ||
9 | AC_INIT([site_wide],[1.0.0]) | ||
10 | |||
11 | EOF | ||
12 | |||
13 | # Disable as endian is set in the default config | ||
14 | #echo AC_C_BIGENDIAN | ||
15 | #echo | ||
16 | |||
17 | if [ -e $1/types ] ; then | ||
18 | while read type ; do | ||
19 | echo "AC_CHECK_SIZEOF([$type])" | ||
20 | done < $1/types | ||
21 | |||
22 | echo | ||
23 | fi | ||
24 | |||
25 | if [ -e $1/funcs ]; then | ||
26 | while read func ; do | ||
27 | echo "AC_CHECK_FUNCS([$func])" | ||
28 | done < $1/funcs | ||
29 | |||
30 | echo | ||
31 | fi | ||
32 | |||
33 | if [ -e $1/headers ]; then | ||
34 | while read header ; do | ||
35 | echo "AC_CHECK_HEADERS([$header])" | ||
36 | done < $1/headers | ||
37 | |||
38 | echo | ||
39 | fi | ||
40 | |||
41 | cat << EOF | ||
42 | AC_OUTPUT | ||
43 | EOF | ||
diff --git a/scripts/lib/build_perf/html/measurement_chart.html b/scripts/lib/build_perf/html/measurement_chart.html index 65f1a227ad..05bd84e6ce 100644 --- a/scripts/lib/build_perf/html/measurement_chart.html +++ b/scripts/lib/build_perf/html/measurement_chart.html | |||
@@ -1,50 +1,100 @@ | |||
1 | <script type="text/javascript"> | 1 | <script type="module"> |
2 | chartsDrawing += 1; | 2 | // Get raw data |
3 | google.charts.setOnLoadCallback(drawChart_{{ chart_elem_id }}); | 3 | const rawData = [ |
4 | function drawChart_{{ chart_elem_id }}() { | 4 | {% for sample in measurement.samples %} |
5 | var data = new google.visualization.DataTable(); | 5 | [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}, {{ sample.start_time }}, '{{sample.commit}}'], |
6 | {% endfor %} | ||
7 | ]; | ||
6 | 8 | ||
7 | // Chart options | 9 | const convertToMinute = (time) => { |
8 | var options = { | 10 | return time[0]*60 + time[1] + time[2]/60 + time[3]/3600; |
9 | theme : 'material', | 11 | } |
10 | legend: 'none', | ||
11 | hAxis: { format: '', title: 'Commit number', | ||
12 | minValue: {{ chart_opts.haxis.min }}, | ||
13 | maxValue: {{ chart_opts.haxis.max }} }, | ||
14 | {% if measurement.type == 'time' %} | ||
15 | vAxis: { format: 'h:mm:ss' }, | ||
16 | {% else %} | ||
17 | vAxis: { format: '' }, | ||
18 | {% endif %} | ||
19 | pointSize: 5, | ||
20 | chartArea: { left: 80, right: 15 }, | ||
21 | }; | ||
22 | 12 | ||
23 | // Define data columns | 13 | // Update value format to either minutes or leave as size value |
24 | data.addColumn('number', 'Commit'); | 14 | const updateValue = (value) => { |
25 | data.addColumn('{{ measurement.value_type.gv_data_type }}', | 15 | // Assuming the array values are duration in the format [hours, minutes, seconds, milliseconds] |
26 | '{{ measurement.value_type.quantity }}'); | 16 | return Array.isArray(value) ? convertToMinute(value) : value |
27 | // Add data rows | 17 | } |
28 | data.addRows([ | ||
29 | {% for sample in measurement.samples %} | ||
30 | [{{ sample.commit_num }}, {{ sample.mean.gv_value() }}], | ||
31 | {% endfor %} | ||
32 | ]); | ||
33 | 18 | ||
34 | // Finally, draw the chart | 19 | // Convert raw data to the format: [time, value] |
35 | chart_div = document.getElementById('{{ chart_elem_id }}'); | 20 | const data = rawData.map(([commit, value, time]) => { |
36 | var chart = new google.visualization.LineChart(chart_div); | 21 | return [ |
37 | google.visualization.events.addListener(chart, 'ready', function () { | 22 | // The Date object takes values in milliseconds rather than seconds. So to use a Unix timestamp we have to multiply it by 1000. |
38 | //chart_div = document.getElementById('{{ chart_elem_id }}'); | 23 | new Date(time * 1000).getTime(), |
39 | //chart_div.innerHTML = '<img src="' + chart.getImageURI() + '">'; | 24 | // Assuming the array values are duration in the format [hours, minutes, seconds, milliseconds] |
40 | png_div = document.getElementById('{{ chart_elem_id }}_png'); | 25 | updateValue(value) |
41 | png_div.outerHTML = '<a id="{{ chart_elem_id }}_png" href="' + chart.getImageURI() + '">PNG</a>'; | 26 | ] |
42 | console.log("CHART READY: {{ chart_elem_id }}"); | 27 | }); |
43 | chartsDrawing -= 1; | 28 | |
44 | if (chartsDrawing == 0) | 29 | // Set chart options |
45 | console.log("ALL CHARTS READY"); | 30 | const option = { |
31 | tooltip: { | ||
32 | trigger: 'axis', | ||
33 | enterable: true, | ||
34 | position: function (point, params, dom, rect, size) { | ||
35 | return [point[0]-150, '10%']; | ||
36 | }, | ||
37 | formatter: function (param) { | ||
38 | const value = param[0].value[1] | ||
39 | const sample = rawData.filter(([commit, dataValue]) => updateValue(dataValue) === value) | ||
40 | // Add commit hash to the tooltip as a link | ||
41 | const commitLink = `https://git.yoctoproject.org/poky/commit/?id=${sample[0][3]}` | ||
42 | if ('{{ measurement.value_type.quantity }}' == 'time') { | ||
43 | const hours = Math.floor(value/60) | ||
44 | const minutes = Math.floor(value % 60) | ||
45 | const seconds = Math.floor((value * 60) % 60) | ||
46 | return `<strong>Duration:</strong> ${hours}:${minutes}:${seconds}, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>` | ||
47 | } | ||
48 | return `<strong>Size:</strong> ${value.toFixed(2)} MB, <br/> <strong>Commit number:</strong> <a href="${commitLink}" target="_blank" rel="noreferrer noopener">${sample[0][0]}</a>` | ||
49 | ;} | ||
50 | }, | ||
51 | xAxis: { | ||
52 | type: 'time', | ||
53 | }, | ||
54 | yAxis: { | ||
55 | name: '{{ measurement.value_type.quantity }}' == 'time' ? 'Duration in minutes' : 'Disk size in MB', | ||
56 | type: 'value', | ||
57 | min: function(value) { | ||
58 | return Math.round(value.min - 0.5); | ||
59 | }, | ||
60 | max: function(value) { | ||
61 | return Math.round(value.max + 0.5); | ||
62 | } | ||
63 | }, | ||
64 | dataZoom: [ | ||
65 | { | ||
66 | type: 'slider', | ||
67 | xAxisIndex: 0, | ||
68 | filterMode: 'none' | ||
69 | }, | ||
70 | ], | ||
71 | series: [ | ||
72 | { | ||
73 | name: '{{ measurement.value_type.quantity }}', | ||
74 | type: 'line', | ||
75 | step: 'start', | ||
76 | symbol: 'none', | ||
77 | data: data | ||
78 | } | ||
79 | ] | ||
80 | }; | ||
81 | |||
82 | // Draw chart | ||
83 | const chart_div = document.getElementById('{{ chart_elem_id }}'); | ||
84 | // Set dark mode | ||
85 | let measurement_chart | ||
86 | if (window.matchMedia('(prefers-color-scheme: dark)').matches) { | ||
87 | measurement_chart= echarts.init(chart_div, 'dark', { | ||
88 | height: 320 | ||
46 | }); | 89 | }); |
47 | chart.draw(data, options); | 90 | } else { |
48 | } | 91 | measurement_chart= echarts.init(chart_div, null, { |
92 | height: 320 | ||
93 | }); | ||
94 | } | ||
95 | // Change chart size with browser resize | ||
96 | window.addEventListener('resize', function() { | ||
97 | measurement_chart.resize(); | ||
98 | }); | ||
99 | measurement_chart.setOption(option); | ||
49 | </script> | 100 | </script> |
50 | |||
diff --git a/scripts/lib/build_perf/html/report.html b/scripts/lib/build_perf/html/report.html index d1ba6f2578..537ed3ee52 100644 --- a/scripts/lib/build_perf/html/report.html +++ b/scripts/lib/build_perf/html/report.html | |||
@@ -3,11 +3,7 @@ | |||
3 | <head> | 3 | <head> |
4 | {# Scripts, for visualization#} | 4 | {# Scripts, for visualization#} |
5 | <!--START-OF-SCRIPTS--> | 5 | <!--START-OF-SCRIPTS--> |
6 | <script type="text/javascript" src="https://www.gstatic.com/charts/loader.js"></script> | 6 | <script src=" https://cdn.jsdelivr.net/npm/echarts@5.5.0/dist/echarts.min.js "></script> |
7 | <script type="text/javascript"> | ||
8 | google.charts.load('current', {'packages':['corechart']}); | ||
9 | var chartsDrawing = 0; | ||
10 | </script> | ||
11 | 7 | ||
12 | {# Render measurement result charts #} | 8 | {# Render measurement result charts #} |
13 | {% for test in test_data %} | 9 | {% for test in test_data %} |
@@ -23,28 +19,29 @@ var chartsDrawing = 0; | |||
23 | 19 | ||
24 | {# Styles #} | 20 | {# Styles #} |
25 | <style> | 21 | <style> |
22 | :root { | ||
23 | --text: #000; | ||
24 | --bg: #fff; | ||
25 | --h2heading: #707070; | ||
26 | --link: #0000EE; | ||
27 | --trtopborder: #9ca3af; | ||
28 | --trborder: #e5e7eb; | ||
29 | --chartborder: #f0f0f0; | ||
30 | } | ||
26 | .meta-table { | 31 | .meta-table { |
27 | font-size: 14px; | 32 | font-size: 14px; |
28 | text-align: left; | 33 | text-align: left; |
29 | border-collapse: collapse; | 34 | border-collapse: collapse; |
30 | } | 35 | } |
31 | .meta-table tr:nth-child(even){background-color: #f2f2f2} | ||
32 | meta-table th, .meta-table td { | ||
33 | padding: 4px; | ||
34 | } | ||
35 | .summary { | 36 | .summary { |
36 | margin: 0; | ||
37 | font-size: 14px; | 37 | font-size: 14px; |
38 | text-align: left; | 38 | text-align: left; |
39 | border-collapse: collapse; | 39 | border-collapse: collapse; |
40 | } | 40 | } |
41 | summary th, .meta-table td { | ||
42 | padding: 4px; | ||
43 | } | ||
44 | .measurement { | 41 | .measurement { |
45 | padding: 8px 0px 8px 8px; | 42 | padding: 8px 0px 8px 8px; |
46 | border: 2px solid #f0f0f0; | 43 | border: 2px solid var(--chartborder); |
47 | margin-bottom: 10px; | 44 | margin: 1.5rem 0; |
48 | } | 45 | } |
49 | .details { | 46 | .details { |
50 | margin: 0; | 47 | margin: 0; |
@@ -64,18 +61,71 @@ summary th, .meta-table td { | |||
64 | background-color: #f0f0f0; | 61 | background-color: #f0f0f0; |
65 | margin-left: 10px; | 62 | margin-left: 10px; |
66 | } | 63 | } |
67 | hr { | 64 | .card-container { |
68 | color: #f0f0f0; | 65 | border-bottom-width: 1px; |
66 | padding: 1.25rem 3rem; | ||
67 | box-shadow: 0 1px 3px 0 rgb(0 0 0 / 0.1), 0 1px 2px -1px rgb(0 0 0 / 0.1); | ||
68 | border-radius: 0.25rem; | ||
69 | } | ||
70 | body { | ||
71 | font-family: 'Helvetica', sans-serif; | ||
72 | margin: 3rem 8rem; | ||
73 | background-color: var(--bg); | ||
74 | color: var(--text); | ||
75 | } | ||
76 | h1 { | ||
77 | text-align: center; | ||
69 | } | 78 | } |
70 | h2 { | 79 | h2 { |
71 | font-size: 20px; | 80 | font-size: 1.5rem; |
72 | margin-bottom: 0px; | 81 | margin-bottom: 0px; |
73 | color: #707070; | 82 | color: var(--h2heading); |
83 | padding-top: 1.5rem; | ||
74 | } | 84 | } |
75 | h3 { | 85 | h3 { |
76 | font-size: 16px; | 86 | font-size: 1.3rem; |
77 | margin: 0px; | 87 | margin: 0px; |
78 | color: #707070; | 88 | color: var(--h2heading); |
89 | padding: 1.5rem 0; | ||
90 | } | ||
91 | h4 { | ||
92 | font-size: 14px; | ||
93 | font-weight: lighter; | ||
94 | line-height: 1.2rem; | ||
95 | margin: auto; | ||
96 | padding-top: 1rem; | ||
97 | } | ||
98 | table { | ||
99 | margin-top: 1.5rem; | ||
100 | line-height: 2rem; | ||
101 | } | ||
102 | tr { | ||
103 | border-bottom: 1px solid var(--trborder); | ||
104 | } | ||
105 | tr:first-child { | ||
106 | border-bottom: 1px solid var(--trtopborder); | ||
107 | } | ||
108 | tr:last-child { | ||
109 | border-bottom: none; | ||
110 | } | ||
111 | a { | ||
112 | text-decoration: none; | ||
113 | font-weight: bold; | ||
114 | color: var(--link); | ||
115 | } | ||
116 | a:hover { | ||
117 | color: #8080ff; | ||
118 | } | ||
119 | @media (prefers-color-scheme: dark) { | ||
120 | :root { | ||
121 | --text: #e9e8fa; | ||
122 | --bg: #0F0C28; | ||
123 | --h2heading: #B8B7CB; | ||
124 | --link: #87cefa; | ||
125 | --trtopborder: #394150; | ||
126 | --trborder: #212936; | ||
127 | --chartborder: #b1b0bf; | ||
128 | } | ||
79 | } | 129 | } |
80 | </style> | 130 | </style> |
81 | 131 | ||
@@ -83,13 +133,14 @@ h3 { | |||
83 | </head> | 133 | </head> |
84 | 134 | ||
85 | {% macro poky_link(commit) -%} | 135 | {% macro poky_link(commit) -%} |
86 | <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a> | 136 | <a href="http://git.yoctoproject.org/cgit/cgit.cgi/poky/log/?id={{ commit }}">{{ commit[0:11] }}</a> |
87 | {%- endmacro %} | 137 | {%- endmacro %} |
88 | 138 | ||
89 | <body><div style="width: 700px"> | 139 | <body><div> |
140 | <h1 style="text-align: center;">Performance Test Report</h1> | ||
90 | {# Test metadata #} | 141 | {# Test metadata #} |
91 | <h2>General</h2> | 142 | <h2>General</h2> |
92 | <hr> | 143 | <h4>The table provides an overview of the comparison between two selected commits from the same branch.</h4> |
93 | <table class="meta-table" style="width: 100%"> | 144 | <table class="meta-table" style="width: 100%"> |
94 | <tr> | 145 | <tr> |
95 | <th></th> | 146 | <th></th> |
@@ -112,19 +163,21 @@ h3 { | |||
112 | 163 | ||
113 | {# Test result summary #} | 164 | {# Test result summary #} |
114 | <h2>Test result summary</h2> | 165 | <h2>Test result summary</h2> |
115 | <hr> | 166 | <h4>The test summary presents a thorough breakdown of each test conducted on the branch, including details such as build time and disk space consumption. Additionally, it gives insights into the average time taken for test execution, along with absolute and relative values for a better understanding.</h4> |
116 | <table class="summary" style="width: 100%"> | 167 | <table class="summary" style="width: 100%"> |
168 | <tr> | ||
169 | <th>Test name</th> | ||
170 | <th>Measurement description</th> | ||
171 | <th>Mean value</th> | ||
172 | <th>Absolute difference</th> | ||
173 | <th>Relative difference</th> | ||
174 | </tr> | ||
117 | {% for test in test_data %} | 175 | {% for test in test_data %} |
118 | {% if loop.index is even %} | ||
119 | {% set row_style = 'style="background-color: #f2f2f2"' %} | ||
120 | {% else %} | ||
121 | {% set row_style = 'style="background-color: #ffffff"' %} | ||
122 | {% endif %} | ||
123 | {% if test.status == 'SUCCESS' %} | 176 | {% if test.status == 'SUCCESS' %} |
124 | {% for measurement in test.measurements %} | 177 | {% for measurement in test.measurements %} |
125 | <tr {{ row_style }}> | 178 | <tr {{ row_style }}> |
126 | {% if loop.index == 1 %} | 179 | {% if loop.index == 1 %} |
127 | <td>{{ test.name }}: {{ test.description }}</td> | 180 | <td><a href=#{{test.name}}>{{ test.name }}: {{ test.description }}</a></td> |
128 | {% else %} | 181 | {% else %} |
129 | {# add empty cell in place of the test name#} | 182 | {# add empty cell in place of the test name#} |
130 | <td></td> | 183 | <td></td> |
@@ -153,10 +206,12 @@ h3 { | |||
153 | </table> | 206 | </table> |
154 | 207 | ||
155 | {# Detailed test results #} | 208 | {# Detailed test results #} |
209 | <h2>Test details</h2> | ||
210 | <h4>The following section provides details of each test, accompanied by charts representing build time and disk usage over time or by commit number.</h4> | ||
156 | {% for test in test_data %} | 211 | {% for test in test_data %} |
157 | <h2>{{ test.name }}: {{ test.description }}</h2> | 212 | <h3 style="color: #000;" id={{test.name}}>{{ test.name }}: {{ test.description }}</h3> |
158 | <hr> | ||
159 | {% if test.status == 'SUCCESS' %} | 213 | {% if test.status == 'SUCCESS' %} |
214 | <div class="card-container"> | ||
160 | {% for measurement in test.measurements %} | 215 | {% for measurement in test.measurements %} |
161 | <div class="measurement"> | 216 | <div class="measurement"> |
162 | <h3>{{ measurement.description }}</h3> | 217 | <h3>{{ measurement.description }}</h3> |
@@ -275,7 +330,8 @@ h3 { | |||
275 | {% endif %} | 330 | {% endif %} |
276 | {% endif %} | 331 | {% endif %} |
277 | </div> | 332 | </div> |
278 | {% endfor %} | 333 | {% endfor %} |
334 | </div> | ||
279 | {# Unsuccessful test #} | 335 | {# Unsuccessful test #} |
280 | {% else %} | 336 | {% else %} |
281 | <span style="font-size: 150%; font-weight: bold; color: red;">{{ test.status }} | 337 | <span style="font-size: 150%; font-weight: bold; color: red;">{{ test.status }} |
diff --git a/scripts/lib/build_perf/report.py b/scripts/lib/build_perf/report.py index ab77424cc7..f4e6a92e09 100644 --- a/scripts/lib/build_perf/report.py +++ b/scripts/lib/build_perf/report.py | |||
@@ -294,7 +294,7 @@ class SizeVal(MeasurementVal): | |||
294 | return "null" | 294 | return "null" |
295 | return self / 1024 | 295 | return self / 1024 |
296 | 296 | ||
297 | def measurement_stats(meas, prefix=''): | 297 | def measurement_stats(meas, prefix='', time=0): |
298 | """Get statistics of a measurement""" | 298 | """Get statistics of a measurement""" |
299 | if not meas: | 299 | if not meas: |
300 | return {prefix + 'sample_cnt': 0, | 300 | return {prefix + 'sample_cnt': 0, |
@@ -319,6 +319,8 @@ def measurement_stats(meas, prefix=''): | |||
319 | stats['quantity'] = val_cls.quantity | 319 | stats['quantity'] = val_cls.quantity |
320 | stats[prefix + 'sample_cnt'] = len(values) | 320 | stats[prefix + 'sample_cnt'] = len(values) |
321 | 321 | ||
322 | # Add start time for both type sysres and disk usage | ||
323 | start_time = time | ||
322 | mean_val = val_cls(mean(values)) | 324 | mean_val = val_cls(mean(values)) |
323 | min_val = val_cls(min(values)) | 325 | min_val = val_cls(min(values)) |
324 | max_val = val_cls(max(values)) | 326 | max_val = val_cls(max(values)) |
@@ -334,6 +336,7 @@ def measurement_stats(meas, prefix=''): | |||
334 | stats[prefix + 'max'] = max_val | 336 | stats[prefix + 'max'] = max_val |
335 | stats[prefix + 'minus'] = val_cls(mean_val - min_val) | 337 | stats[prefix + 'minus'] = val_cls(mean_val - min_val) |
336 | stats[prefix + 'plus'] = val_cls(max_val - mean_val) | 338 | stats[prefix + 'plus'] = val_cls(max_val - mean_val) |
339 | stats[prefix + 'start_time'] = start_time | ||
337 | 340 | ||
338 | return stats | 341 | return stats |
339 | 342 | ||
diff --git a/scripts/lib/devtool/ide_sdk.py b/scripts/lib/devtool/ide_sdk.py index 7807b322b3..65873b088d 100755 --- a/scripts/lib/devtool/ide_sdk.py +++ b/scripts/lib/devtool/ide_sdk.py | |||
@@ -1052,7 +1052,7 @@ def register_commands(subparsers, context): | |||
1052 | parser_ide_sdk.add_argument( | 1052 | parser_ide_sdk.add_argument( |
1053 | '-I', '--key', help='Specify ssh private key for connection to the target') | 1053 | '-I', '--key', help='Specify ssh private key for connection to the target') |
1054 | parser_ide_sdk.add_argument( | 1054 | parser_ide_sdk.add_argument( |
1055 | '--skip-bitbake', help='Generate IDE configuration but skip calling bibtake to update the SDK.', action='store_true') | 1055 | '--skip-bitbake', help='Generate IDE configuration but skip calling bitbake to update the SDK', action='store_true') |
1056 | parser_ide_sdk.add_argument( | 1056 | parser_ide_sdk.add_argument( |
1057 | '-k', '--bitbake-k', help='Pass -k parameter to bitbake', action='store_true') | 1057 | '-k', '--bitbake-k', help='Pass -k parameter to bitbake', action='store_true') |
1058 | parser_ide_sdk.add_argument( | 1058 | parser_ide_sdk.add_argument( |
diff --git a/scripts/lib/devtool/standard.py b/scripts/lib/devtool/standard.py index 6674e67267..1d0fe13788 100644 --- a/scripts/lib/devtool/standard.py +++ b/scripts/lib/devtool/standard.py | |||
@@ -387,6 +387,19 @@ def _git_ls_tree(repodir, treeish='HEAD', recursive=False): | |||
387 | ret[split[3]] = split[0:3] | 387 | ret[split[3]] = split[0:3] |
388 | return ret | 388 | return ret |
389 | 389 | ||
390 | def _git_modified(repodir): | ||
391 | """List the difference between HEAD and the index""" | ||
392 | import bb | ||
393 | cmd = ['git', 'status', '--porcelain'] | ||
394 | out, _ = bb.process.run(cmd, cwd=repodir) | ||
395 | ret = [] | ||
396 | if out: | ||
397 | for line in out.split("\n"): | ||
398 | if line and not line.startswith('??'): | ||
399 | ret.append(line[3:]) | ||
400 | return ret | ||
401 | |||
402 | |||
390 | def _git_exclude_path(srctree, path): | 403 | def _git_exclude_path(srctree, path): |
391 | """Return pathspec (list of paths) that excludes certain path""" | 404 | """Return pathspec (list of paths) that excludes certain path""" |
392 | # NOTE: "Filtering out" files/paths in this way is not entirely reliable - | 405 | # NOTE: "Filtering out" files/paths in this way is not entirely reliable - |
@@ -460,32 +473,6 @@ def sync(args, config, basepath, workspace): | |||
460 | finally: | 473 | finally: |
461 | tinfoil.shutdown() | 474 | tinfoil.shutdown() |
462 | 475 | ||
463 | def symlink_oelocal_files_srctree(rd, srctree): | ||
464 | import oe.patch | ||
465 | if os.path.abspath(rd.getVar('S')) == os.path.abspath(rd.getVar('WORKDIR')): | ||
466 | # If recipe extracts to ${WORKDIR}, symlink the files into the srctree | ||
467 | # (otherwise the recipe won't build as expected) | ||
468 | local_files_dir = os.path.join(srctree, 'oe-local-files') | ||
469 | addfiles = [] | ||
470 | for root, _, files in os.walk(local_files_dir): | ||
471 | relpth = os.path.relpath(root, local_files_dir) | ||
472 | if relpth != '.': | ||
473 | bb.utils.mkdirhier(os.path.join(srctree, relpth)) | ||
474 | for fn in files: | ||
475 | if fn == '.gitignore': | ||
476 | continue | ||
477 | destpth = os.path.join(srctree, relpth, fn) | ||
478 | if os.path.exists(destpth): | ||
479 | os.unlink(destpth) | ||
480 | if relpth != '.': | ||
481 | back_relpth = os.path.relpath(local_files_dir, root) | ||
482 | os.symlink('%s/oe-local-files/%s/%s' % (back_relpth, relpth, fn), destpth) | ||
483 | else: | ||
484 | os.symlink('oe-local-files/%s' % fn, destpth) | ||
485 | addfiles.append(os.path.join(relpth, fn)) | ||
486 | if addfiles: | ||
487 | oe.patch.GitApplyTree.commitIgnored("Add local file symlinks", dir=srctree, files=addfiles, d=rd) | ||
488 | |||
489 | def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False): | 476 | def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, workspace, fixed_setup, d, tinfoil, no_overrides=False): |
490 | """Extract sources of a recipe""" | 477 | """Extract sources of a recipe""" |
491 | import oe.recipeutils | 478 | import oe.recipeutils |
@@ -657,35 +644,22 @@ def _extract_source(srctree, keep_temp, devbranch, sync, config, basepath, works | |||
657 | elif not os.path.exists(workshareddir): | 644 | elif not os.path.exists(workshareddir): |
658 | oe.path.copyhardlinktree(srcsubdir, workshareddir) | 645 | oe.path.copyhardlinktree(srcsubdir, workshareddir) |
659 | 646 | ||
660 | tempdir_localdir = os.path.join(tempdir, 'oe-local-files') | ||
661 | srctree_localdir = os.path.join(srctree, 'oe-local-files') | ||
662 | |||
663 | if sync: | 647 | if sync: |
664 | bb.process.run('git fetch file://' + srcsubdir + ' ' + devbranch + ':' + devbranch, cwd=srctree) | 648 | try: |
665 | 649 | logger.info('Backing up current %s branch as branch: %s.bak' % (devbranch, devbranch)) | |
666 | # Move the oe-local-files directory to srctree. | 650 | bb.process.run('git branch -f ' + devbranch + '.bak', cwd=srctree) |
667 | # As oe-local-files is not part of the constructed git tree, | 651 | |
668 | # removing it directly during the synchronization might surprise | 652 | # Use git fetch to update the source with the current recipe |
669 | # the user. Instead, we move it to oe-local-files.bak and remind | 653 | # To be able to update the currently checked out branch with |
670 | # the user in the log message. | 654 | # possibly new history (no fast-forward) git needs to be told |
671 | if os.path.exists(srctree_localdir + '.bak'): | 655 | # that's ok |
672 | shutil.rmtree(srctree_localdir + '.bak') | 656 | logger.info('Syncing source files including patches to git branch: %s' % devbranch) |
673 | 657 | bb.process.run('git fetch --update-head-ok --force file://' + srcsubdir + ' ' + devbranch + ':' + devbranch, cwd=srctree) | |
674 | if os.path.exists(srctree_localdir): | 658 | except bb.process.ExecutionError as e: |
675 | logger.info('Backing up current local file directory %s' % srctree_localdir) | 659 | raise DevtoolError("Error when syncing source files to local checkout: %s" % str(e)) |
676 | shutil.move(srctree_localdir, srctree_localdir + '.bak') | ||
677 | |||
678 | if os.path.exists(tempdir_localdir): | ||
679 | logger.info('Syncing local source files to srctree...') | ||
680 | shutil.copytree(tempdir_localdir, srctree_localdir) | ||
681 | else: | ||
682 | # Move oe-local-files directory to srctree | ||
683 | if os.path.exists(tempdir_localdir): | ||
684 | logger.info('Adding local source files to srctree...') | ||
685 | shutil.move(tempdir_localdir, srcsubdir) | ||
686 | 660 | ||
661 | else: | ||
687 | shutil.move(srcsubdir, srctree) | 662 | shutil.move(srcsubdir, srctree) |
688 | symlink_oelocal_files_srctree(d, srctree) | ||
689 | 663 | ||
690 | if is_kernel_yocto: | 664 | if is_kernel_yocto: |
691 | logger.info('Copying kernel config to srctree') | 665 | logger.info('Copying kernel config to srctree') |
@@ -841,34 +815,22 @@ def modify(args, config, basepath, workspace): | |||
841 | if (os.path.exists(srcdir) and os.listdir(srcdir)) and (kernelVersion in staging_kerVer and staging_kbranch == kbranch): | 815 | if (os.path.exists(srcdir) and os.listdir(srcdir)) and (kernelVersion in staging_kerVer and staging_kbranch == kbranch): |
842 | oe.path.copyhardlinktree(srcdir, srctree) | 816 | oe.path.copyhardlinktree(srcdir, srctree) |
843 | workdir = rd.getVar('WORKDIR') | 817 | workdir = rd.getVar('WORKDIR') |
818 | unpackdir = rd.getVar('UNPACKDIR') | ||
844 | srcsubdir = rd.getVar('S') | 819 | srcsubdir = rd.getVar('S') |
845 | localfilesdir = os.path.join(srctree, 'oe-local-files') | 820 | localfilesdir = os.path.join(srctree, 'oe-local-files') |
846 | # Move local source files into separate subdir | ||
847 | recipe_patches = [os.path.basename(patch) for patch in oe.recipeutils.get_recipe_patches(rd)] | ||
848 | local_files = oe.recipeutils.get_recipe_local_files(rd) | ||
849 | 821 | ||
850 | for key in local_files.copy(): | 822 | # Add locally copied files to gitignore as we add back to the metadata directly |
851 | if key.endswith('scc'): | 823 | local_files = oe.recipeutils.get_recipe_local_files(rd) |
852 | sccfile = open(local_files[key], 'r') | ||
853 | for l in sccfile: | ||
854 | line = l.split() | ||
855 | if line and line[0] in ('kconf', 'patch'): | ||
856 | cfg = os.path.join(os.path.dirname(local_files[key]), line[-1]) | ||
857 | if not cfg in local_files.values(): | ||
858 | local_files[line[-1]] = cfg | ||
859 | shutil.copy2(cfg, workdir) | ||
860 | sccfile.close() | ||
861 | |||
862 | # Ignore local files with subdir={BP} | ||
863 | srcabspath = os.path.abspath(srcsubdir) | 824 | srcabspath = os.path.abspath(srcsubdir) |
864 | local_files = [fname for fname in local_files if os.path.exists(os.path.join(workdir, fname)) and (srcabspath == workdir or not os.path.join(workdir, fname).startswith(srcabspath + os.sep))] | 825 | local_files = [fname for fname in local_files if |
826 | os.path.exists(os.path.join(unpackdir, fname)) and | ||
827 | srcabspath == unpackdir] | ||
865 | if local_files: | 828 | if local_files: |
866 | for fname in local_files: | 829 | with open(os.path.join(srctree, '.gitignore'), 'a+') as f: |
867 | _move_file(os.path.join(workdir, fname), os.path.join(srctree, 'oe-local-files', fname)) | 830 | f.write('# Ignore local files, by default. Remove following lines' |
868 | with open(os.path.join(srctree, 'oe-local-files', '.gitignore'), 'w') as f: | 831 | 'if you want to commit the directory to Git\n') |
869 | f.write('# Ignore local files, by default. Remove this file if you want to commit the directory to Git\n*\n') | 832 | for fname in local_files: |
870 | 833 | f.write('%s\n' % fname) | |
871 | symlink_oelocal_files_srctree(rd, srctree) | ||
872 | 834 | ||
873 | task = 'do_configure' | 835 | task = 'do_configure' |
874 | res = tinfoil.build_targets(pn, task, handle_events=True) | 836 | res = tinfoil.build_targets(pn, task, handle_events=True) |
@@ -893,7 +855,10 @@ def modify(args, config, basepath, workspace): | |||
893 | (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_revs["."], cwd=srctree) | 855 | (stdout, _) = bb.process.run('git rev-list --reverse %s..HEAD' % initial_revs["."], cwd=srctree) |
894 | commits["."] = stdout.split() | 856 | commits["."] = stdout.split() |
895 | check_commits = True | 857 | check_commits = True |
896 | (stdout, _) = bb.process.run('git submodule --quiet foreach --recursive \'echo `git rev-parse devtool-base` $PWD\'', cwd=srctree) | 858 | try: |
859 | (stdout, _) = bb.process.run('git submodule --quiet foreach --recursive \'echo `git rev-parse devtool-base` $PWD\'', cwd=srctree) | ||
860 | except bb.process.ExecutionError: | ||
861 | stdout = "" | ||
897 | for line in stdout.splitlines(): | 862 | for line in stdout.splitlines(): |
898 | (rev, submodule_path) = line.split() | 863 | (rev, submodule_path) = line.split() |
899 | submodule = os.path.relpath(submodule_path, srctree) | 864 | submodule = os.path.relpath(submodule_path, srctree) |
@@ -1452,8 +1417,10 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1452 | 1. updated - files that already exist in SRCURI | 1417 | 1. updated - files that already exist in SRCURI |
1453 | 2. added - new files files that don't exist in SRCURI | 1418 | 2. added - new files files that don't exist in SRCURI |
1454 | 3 removed - files that exist in SRCURI but not in exported files | 1419 | 3 removed - files that exist in SRCURI but not in exported files |
1455 | In each dict the key is the 'basepath' of the URI and value is the | 1420 | In each dict the key is the 'basepath' of the URI and value is: |
1456 | absolute path to the existing file in recipe space (if any). | 1421 | - for updated and added dicts, a dict with 1 optionnal key: |
1422 | - 'path': the absolute path to the existing file in recipe space (if any) | ||
1423 | - for removed dict, the absolute path to the existing file in recipe space | ||
1457 | """ | 1424 | """ |
1458 | import oe.recipeutils | 1425 | import oe.recipeutils |
1459 | 1426 | ||
@@ -1462,6 +1429,7 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1462 | # Instead they are directly copied over the original source files (in | 1429 | # Instead they are directly copied over the original source files (in |
1463 | # recipe space). | 1430 | # recipe space). |
1464 | existing_files = oe.recipeutils.get_recipe_local_files(rd) | 1431 | existing_files = oe.recipeutils.get_recipe_local_files(rd) |
1432 | |||
1465 | new_set = None | 1433 | new_set = None |
1466 | updated = OrderedDict() | 1434 | updated = OrderedDict() |
1467 | added = OrderedDict() | 1435 | added = OrderedDict() |
@@ -1478,24 +1446,28 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1478 | if branchname.startswith(override_branch_prefix): | 1446 | if branchname.startswith(override_branch_prefix): |
1479 | return (updated, added, removed) | 1447 | return (updated, added, removed) |
1480 | 1448 | ||
1481 | local_files_dir = os.path.join(srctreebase, 'oe-local-files') | 1449 | files = _git_modified(srctree) |
1482 | git_files = _git_ls_tree(srctree) | 1450 | #if not files: |
1483 | if 'oe-local-files' in git_files: | 1451 | # files = _ls_tree(srctree) |
1484 | # If tracked by Git, take the files from srctree HEAD. First get | 1452 | for f in files: |
1485 | # the tree object of the directory | 1453 | fullfile = os.path.join(srctree, f) |
1486 | tmp_index = os.path.join(srctree, '.git', 'index.tmp.devtool') | 1454 | if os.path.exists(os.path.join(fullfile, ".git")): |
1487 | tree = git_files['oe-local-files'][2] | 1455 | # submodules handled elsewhere |
1488 | bb.process.run(['git', 'checkout', tree, '--', '.'], cwd=srctree, | 1456 | continue |
1489 | env=dict(os.environ, GIT_WORK_TREE=destdir, | 1457 | if f not in existing_files: |
1490 | GIT_INDEX_FILE=tmp_index)) | 1458 | added[f] = {} |
1491 | new_set = list(_git_ls_tree(srctree, tree, True).keys()) | 1459 | if os.path.isdir(os.path.join(srctree, f)): |
1492 | elif os.path.isdir(local_files_dir): | 1460 | shutil.copytree(fullfile, os.path.join(destdir, f)) |
1493 | # If not tracked by Git, just copy from working copy | 1461 | else: |
1494 | new_set = _ls_tree(local_files_dir) | 1462 | shutil.copy2(fullfile, os.path.join(destdir, f)) |
1495 | bb.process.run(['cp', '-ax', | 1463 | elif not os.path.exists(fullfile): |
1496 | os.path.join(local_files_dir, '.'), destdir]) | 1464 | removed[f] = existing_files[f] |
1497 | else: | 1465 | elif f in existing_files: |
1498 | new_set = [] | 1466 | updated[f] = {'path' : existing_files[f]} |
1467 | if os.path.isdir(os.path.join(srctree, f)): | ||
1468 | shutil.copytree(fullfile, os.path.join(destdir, f)) | ||
1469 | else: | ||
1470 | shutil.copy2(fullfile, os.path.join(destdir, f)) | ||
1499 | 1471 | ||
1500 | # Special handling for kernel config | 1472 | # Special handling for kernel config |
1501 | if bb.data.inherits_class('kernel-yocto', rd): | 1473 | if bb.data.inherits_class('kernel-yocto', rd): |
@@ -1503,17 +1475,14 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1503 | fragment_path = os.path.join(destdir, fragment_fn) | 1475 | fragment_path = os.path.join(destdir, fragment_fn) |
1504 | if _create_kconfig_diff(srctree, rd, fragment_path): | 1476 | if _create_kconfig_diff(srctree, rd, fragment_path): |
1505 | if os.path.exists(fragment_path): | 1477 | if os.path.exists(fragment_path): |
1506 | if fragment_fn not in new_set: | 1478 | if fragment_fn in removed: |
1507 | new_set.append(fragment_fn) | 1479 | del removed[fragment_fn] |
1508 | # Copy fragment to local-files | 1480 | if fragment_fn not in updated and fragment_fn not in added: |
1509 | if os.path.isdir(local_files_dir): | 1481 | added[fragment_fn] = {} |
1510 | shutil.copy2(fragment_path, local_files_dir) | ||
1511 | else: | 1482 | else: |
1512 | if fragment_fn in new_set: | 1483 | if fragment_fn in updated: |
1513 | new_set.remove(fragment_fn) | 1484 | revoved[fragment_fn] = updated[fragment_fn] |
1514 | # Remove fragment from local-files | 1485 | del updated[fragment_fn] |
1515 | if os.path.exists(os.path.join(local_files_dir, fragment_fn)): | ||
1516 | os.unlink(os.path.join(local_files_dir, fragment_fn)) | ||
1517 | 1486 | ||
1518 | # Special handling for cml1, ccmake, etc bbclasses that generated | 1487 | # Special handling for cml1, ccmake, etc bbclasses that generated |
1519 | # configuration fragment files that are consumed as source files | 1488 | # configuration fragment files that are consumed as source files |
@@ -1521,42 +1490,13 @@ def _export_local_files(srctree, rd, destdir, srctreebase): | |||
1521 | if bb.data.inherits_class(frag_class, rd): | 1490 | if bb.data.inherits_class(frag_class, rd): |
1522 | srcpath = os.path.join(rd.getVar('WORKDIR'), frag_name) | 1491 | srcpath = os.path.join(rd.getVar('WORKDIR'), frag_name) |
1523 | if os.path.exists(srcpath): | 1492 | if os.path.exists(srcpath): |
1524 | if frag_name not in new_set: | 1493 | if frag_name in removed: |
1525 | new_set.append(frag_name) | 1494 | del removed[frag_name] |
1495 | if frag_name not in updated: | ||
1496 | added[frag_name] = {} | ||
1526 | # copy fragment into destdir | 1497 | # copy fragment into destdir |
1527 | shutil.copy2(srcpath, destdir) | 1498 | shutil.copy2(srcpath, destdir) |
1528 | # copy fragment into local files if exists | 1499 | |
1529 | if os.path.isdir(local_files_dir): | ||
1530 | shutil.copy2(srcpath, local_files_dir) | ||
1531 | |||
1532 | if new_set is not None: | ||
1533 | for fname in new_set: | ||
1534 | if fname in existing_files: | ||
1535 | origpath = existing_files.pop(fname) | ||
1536 | workpath = os.path.join(local_files_dir, fname) | ||
1537 | if not filecmp.cmp(origpath, workpath): | ||
1538 | updated[fname] = origpath | ||
1539 | elif fname != '.gitignore': | ||
1540 | added[fname] = None | ||
1541 | |||
1542 | workdir = rd.getVar('WORKDIR') | ||
1543 | s = rd.getVar('S') | ||
1544 | if not s.endswith(os.sep): | ||
1545 | s += os.sep | ||
1546 | |||
1547 | if workdir != s: | ||
1548 | # Handle files where subdir= was specified | ||
1549 | for fname in list(existing_files.keys()): | ||
1550 | # FIXME handle both subdir starting with BP and not? | ||
1551 | fworkpath = os.path.join(workdir, fname) | ||
1552 | if fworkpath.startswith(s): | ||
1553 | fpath = os.path.join(srctree, os.path.relpath(fworkpath, s)) | ||
1554 | if os.path.exists(fpath): | ||
1555 | origpath = existing_files.pop(fname) | ||
1556 | if not filecmp.cmp(origpath, fpath): | ||
1557 | updated[fpath] = origpath | ||
1558 | |||
1559 | removed = existing_files | ||
1560 | return (updated, added, removed) | 1500 | return (updated, added, removed) |
1561 | 1501 | ||
1562 | 1502 | ||
@@ -1640,7 +1580,8 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi | |||
1640 | redirect_output=dry_run_outdir) | 1580 | redirect_output=dry_run_outdir) |
1641 | else: | 1581 | else: |
1642 | files_dir = _determine_files_dir(rd) | 1582 | files_dir = _determine_files_dir(rd) |
1643 | for basepath, path in upd_f.items(): | 1583 | for basepath, param in upd_f.items(): |
1584 | path = param['path'] | ||
1644 | logger.info('Updating file %s%s' % (basepath, dry_run_suffix)) | 1585 | logger.info('Updating file %s%s' % (basepath, dry_run_suffix)) |
1645 | if os.path.isabs(basepath): | 1586 | if os.path.isabs(basepath): |
1646 | # Original file (probably with subdir pointing inside source tree) | 1587 | # Original file (probably with subdir pointing inside source tree) |
@@ -1650,7 +1591,8 @@ def _update_recipe_srcrev(recipename, workspace, srctree, rd, appendlayerdir, wi | |||
1650 | _move_file(os.path.join(local_files_dir, basepath), path, | 1591 | _move_file(os.path.join(local_files_dir, basepath), path, |
1651 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) | 1592 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) |
1652 | update_srcuri= True | 1593 | update_srcuri= True |
1653 | for basepath, path in new_f.items(): | 1594 | for basepath, param in new_f.items(): |
1595 | path = param['path'] | ||
1654 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) | 1596 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) |
1655 | _move_file(os.path.join(local_files_dir, basepath), | 1597 | _move_file(os.path.join(local_files_dir, basepath), |
1656 | os.path.join(files_dir, basepath), | 1598 | os.path.join(files_dir, basepath), |
@@ -1772,7 +1714,8 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1772 | else: | 1714 | else: |
1773 | # Update existing files | 1715 | # Update existing files |
1774 | files_dir = _determine_files_dir(rd) | 1716 | files_dir = _determine_files_dir(rd) |
1775 | for basepath, path in upd_f.items(): | 1717 | for basepath, param in upd_f.items(): |
1718 | path = param['path'] | ||
1776 | logger.info('Updating file %s' % basepath) | 1719 | logger.info('Updating file %s' % basepath) |
1777 | if os.path.isabs(basepath): | 1720 | if os.path.isabs(basepath): |
1778 | # Original file (probably with subdir pointing inside source tree) | 1721 | # Original file (probably with subdir pointing inside source tree) |
@@ -1806,7 +1749,7 @@ def _update_recipe_patch(recipename, workspace, srctree, rd, appendlayerdir, wil | |||
1806 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) | 1749 | dry_run_outdir=dry_run_outdir, base_outdir=recipedir) |
1807 | updatefiles = True | 1750 | updatefiles = True |
1808 | # Add any new files | 1751 | # Add any new files |
1809 | for basepath, path in new_f.items(): | 1752 | for basepath, param in new_f.items(): |
1810 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) | 1753 | logger.info('Adding new file %s%s' % (basepath, dry_run_suffix)) |
1811 | _move_file(os.path.join(local_files_dir, basepath), | 1754 | _move_file(os.path.join(local_files_dir, basepath), |
1812 | os.path.join(files_dir, basepath), | 1755 | os.path.join(files_dir, basepath), |
diff --git a/scripts/lib/devtool/upgrade.py b/scripts/lib/devtool/upgrade.py index fa5b8ef3c7..a8130ed23f 100644 --- a/scripts/lib/devtool/upgrade.py +++ b/scripts/lib/devtool/upgrade.py | |||
@@ -32,7 +32,7 @@ def _run(cmd, cwd=''): | |||
32 | 32 | ||
33 | def _get_srctree(tmpdir): | 33 | def _get_srctree(tmpdir): |
34 | srctree = tmpdir | 34 | srctree = tmpdir |
35 | dirs = scriptutils.filter_src_subdirs(tmpdir) | 35 | dirs = os.listdir(tmpdir) |
36 | if len(dirs) == 1: | 36 | if len(dirs) == 1: |
37 | srctree = os.path.join(tmpdir, dirs[0]) | 37 | srctree = os.path.join(tmpdir, dirs[0]) |
38 | else: | 38 | else: |
diff --git a/scripts/lib/recipetool/append.py b/scripts/lib/recipetool/append.py index 341e893305..10945d6008 100644 --- a/scripts/lib/recipetool/append.py +++ b/scripts/lib/recipetool/append.py | |||
@@ -101,7 +101,7 @@ def determine_file_source(targetpath, rd): | |||
101 | import oe.recipeutils | 101 | import oe.recipeutils |
102 | 102 | ||
103 | # See if it's in do_install for the recipe | 103 | # See if it's in do_install for the recipe |
104 | workdir = rd.getVar('WORKDIR') | 104 | unpackdir = rd.getVar('UNPACKDIR') |
105 | src_uri = rd.getVar('SRC_URI') | 105 | src_uri = rd.getVar('SRC_URI') |
106 | srcfile = '' | 106 | srcfile = '' |
107 | modpatches = [] | 107 | modpatches = [] |
@@ -113,9 +113,9 @@ def determine_file_source(targetpath, rd): | |||
113 | if not srcpath.startswith('/'): | 113 | if not srcpath.startswith('/'): |
114 | # Handle non-absolute path | 114 | # Handle non-absolute path |
115 | srcpath = os.path.abspath(os.path.join(rd.getVarFlag('do_install', 'dirs').split()[-1], srcpath)) | 115 | srcpath = os.path.abspath(os.path.join(rd.getVarFlag('do_install', 'dirs').split()[-1], srcpath)) |
116 | if srcpath.startswith(workdir): | 116 | if srcpath.startswith(unpackdir): |
117 | # OK, now we have the source file name, look for it in SRC_URI | 117 | # OK, now we have the source file name, look for it in SRC_URI |
118 | workdirfile = os.path.relpath(srcpath, workdir) | 118 | workdirfile = os.path.relpath(srcpath, unpackdir) |
119 | # FIXME this is where we ought to have some code in the fetcher, because this is naive | 119 | # FIXME this is where we ought to have some code in the fetcher, because this is naive |
120 | for item in src_uri.split(): | 120 | for item in src_uri.split(): |
121 | localpath = bb.fetch2.localpath(item, rd) | 121 | localpath = bb.fetch2.localpath(item, rd) |
diff --git a/scripts/lib/recipetool/create.py b/scripts/lib/recipetool/create.py index 8e9ff38db6..066366e34f 100644 --- a/scripts/lib/recipetool/create.py +++ b/scripts/lib/recipetool/create.py | |||
@@ -528,7 +528,7 @@ def create_recipe(args): | |||
528 | if ftmpdir and args.keep_temp: | 528 | if ftmpdir and args.keep_temp: |
529 | logger.info('Fetch temp directory is %s' % ftmpdir) | 529 | logger.info('Fetch temp directory is %s' % ftmpdir) |
530 | 530 | ||
531 | dirlist = scriptutils.filter_src_subdirs(srctree) | 531 | dirlist = os.listdir(srctree) |
532 | logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) | 532 | logger.debug('Directory listing (excluding filtered out):\n %s' % '\n '.join(dirlist)) |
533 | if len(dirlist) == 1: | 533 | if len(dirlist) == 1: |
534 | singleitem = os.path.join(srctree, dirlist[0]) | 534 | singleitem = os.path.join(srctree, dirlist[0]) |
diff --git a/scripts/lib/scriptutils.py b/scripts/lib/scriptutils.py index f23e53cba9..81f0b01fa5 100644 --- a/scripts/lib/scriptutils.py +++ b/scripts/lib/scriptutils.py | |||
@@ -179,6 +179,8 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr | |||
179 | f.write('SRCREV = "%s"\n' % srcrev) | 179 | f.write('SRCREV = "%s"\n' % srcrev) |
180 | f.write('PV = "0.0+"\n') | 180 | f.write('PV = "0.0+"\n') |
181 | f.write('WORKDIR = "%s"\n' % tmpworkdir) | 181 | f.write('WORKDIR = "%s"\n' % tmpworkdir) |
182 | f.write('UNPACKDIR = "%s"\n' % destdir) | ||
183 | |||
182 | # Set S out of the way so it doesn't get created under the workdir | 184 | # Set S out of the way so it doesn't get created under the workdir |
183 | f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) | 185 | f.write('S = "%s"\n' % os.path.join(tmpdir, 'emptysrc')) |
184 | if not mirrors: | 186 | if not mirrors: |
@@ -232,10 +234,6 @@ def fetch_url(tinfoil, srcuri, srcrev, destdir, logger, preserve_tmp=False, mirr | |||
232 | if e.errno != errno.ENOTEMPTY: | 234 | if e.errno != errno.ENOTEMPTY: |
233 | raise | 235 | raise |
234 | 236 | ||
235 | bb.utils.mkdirhier(destdir) | ||
236 | for fn in os.listdir(tmpworkdir): | ||
237 | shutil.move(os.path.join(tmpworkdir, fn), destdir) | ||
238 | |||
239 | finally: | 237 | finally: |
240 | if not preserve_tmp: | 238 | if not preserve_tmp: |
241 | shutil.rmtree(tmpdir) | 239 | shutil.rmtree(tmpdir) |
@@ -271,12 +269,3 @@ def is_src_url(param): | |||
271 | return True | 269 | return True |
272 | return False | 270 | return False |
273 | 271 | ||
274 | def filter_src_subdirs(pth): | ||
275 | """ | ||
276 | Filter out subdirectories of initial unpacked source trees that we do not care about. | ||
277 | Used by devtool and recipetool. | ||
278 | """ | ||
279 | dirlist = os.listdir(pth) | ||
280 | filterout = ['git.indirectionsymlink', 'source-date-epoch', 'sstate-install-recipe_qa'] | ||
281 | dirlist = [x for x in dirlist if x not in filterout] | ||
282 | return dirlist | ||
diff --git a/scripts/lib/wic/engine.py b/scripts/lib/wic/engine.py index 674ccfc244..ce7e6c5d75 100644 --- a/scripts/lib/wic/engine.py +++ b/scripts/lib/wic/engine.py | |||
@@ -359,7 +359,7 @@ class Disk: | |||
359 | Remove files/dirs and their contents from the partition. | 359 | Remove files/dirs and their contents from the partition. |
360 | This only applies to ext* partition. | 360 | This only applies to ext* partition. |
361 | """ | 361 | """ |
362 | abs_path = re.sub('\/\/+', '/', path) | 362 | abs_path = re.sub(r'\/\/+', '/', path) |
363 | cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs, | 363 | cmd = "{} {} -wR 'rm \"{}\"'".format(self.debugfs, |
364 | self._get_part_image(pnum), | 364 | self._get_part_image(pnum), |
365 | abs_path) | 365 | abs_path) |
diff --git a/scripts/lib/wic/plugins/source/bootimg-efi.py b/scripts/lib/wic/plugins/source/bootimg-efi.py index 13a9cddf4e..7cc5131541 100644 --- a/scripts/lib/wic/plugins/source/bootimg-efi.py +++ b/scripts/lib/wic/plugins/source/bootimg-efi.py | |||
@@ -428,10 +428,10 @@ class BootimgEFIPlugin(SourcePlugin): | |||
428 | elif source_params['loader'] == 'uefi-kernel': | 428 | elif source_params['loader'] == 'uefi-kernel': |
429 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") | 429 | kernel = get_bitbake_var("KERNEL_IMAGETYPE") |
430 | if not kernel: | 430 | if not kernel: |
431 | raise WicError("Empty KERNEL_IMAGETYPE %s\n" % target) | 431 | raise WicError("Empty KERNEL_IMAGETYPE") |
432 | target = get_bitbake_var("TARGET_SYS") | 432 | target = get_bitbake_var("TARGET_SYS") |
433 | if not target: | 433 | if not target: |
434 | raise WicError("Unknown arch (TARGET_SYS) %s\n" % target) | 434 | raise WicError("Empty TARGET_SYS") |
435 | 435 | ||
436 | if re.match("x86_64", target): | 436 | if re.match("x86_64", target): |
437 | kernel_efi_image = "bootx64.efi" | 437 | kernel_efi_image = "bootx64.efi" |
diff --git a/scripts/lib/wic/plugins/source/rootfs.py b/scripts/lib/wic/plugins/source/rootfs.py index e29f3a4c2f..c990143c0d 100644 --- a/scripts/lib/wic/plugins/source/rootfs.py +++ b/scripts/lib/wic/plugins/source/rootfs.py | |||
@@ -43,7 +43,7 @@ class RootfsPlugin(SourcePlugin): | |||
43 | # directory, or modify a directory outside OpenEmbedded). | 43 | # directory, or modify a directory outside OpenEmbedded). |
44 | full_path = os.path.realpath(os.path.join(rootfs_dir, path)) | 44 | full_path = os.path.realpath(os.path.join(rootfs_dir, path)) |
45 | if not full_path.startswith(os.path.realpath(rootfs_dir)): | 45 | if not full_path.startswith(os.path.realpath(rootfs_dir)): |
46 | logger.error("%s: Must point inside the rootfs:" % (cmd, path)) | 46 | logger.error("%s: Must point inside the rootfs: %s" % (cmd, path)) |
47 | sys.exit(1) | 47 | sys.exit(1) |
48 | 48 | ||
49 | return full_path | 49 | return full_path |
diff --git a/scripts/oe-build-perf-report b/scripts/oe-build-perf-report index 7812ea4540..6c3c726ee3 100755 --- a/scripts/oe-build-perf-report +++ b/scripts/oe-build-perf-report | |||
@@ -336,8 +336,12 @@ def print_html_report(data, id_comp, buildstats): | |||
336 | test_i = test_data['tests'][test] | 336 | test_i = test_data['tests'][test] |
337 | meas_i = test_i['measurements'][meas] | 337 | meas_i = test_i['measurements'][meas] |
338 | commit_num = get_data_item(meta, 'layers.meta.commit_count') | 338 | commit_num = get_data_item(meta, 'layers.meta.commit_count') |
339 | samples.append(measurement_stats(meas_i)) | 339 | commit = get_data_item(meta, 'layers.meta.commit') |
340 | # Add start_time for both test measurement types of sysres and disk usage | ||
341 | start_time = test_i['start_time'][0] | ||
342 | samples.append(measurement_stats(meas_i, '', start_time)) | ||
340 | samples[-1]['commit_num'] = commit_num | 343 | samples[-1]['commit_num'] = commit_num |
344 | samples[-1]['commit'] = commit | ||
341 | 345 | ||
342 | absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean']) | 346 | absdiff = samples[-1]['val_cls'](samples[-1]['mean'] - samples[id_comp]['mean']) |
343 | reldiff = absdiff * 100 / samples[id_comp]['mean'] | 347 | reldiff = absdiff * 100 / samples[id_comp]['mean'] |
@@ -473,7 +477,7 @@ Examine build performance test results from a Git repository""" | |||
473 | group.add_argument('--branch', '-B', default='master', help="Branch to find commit in") | 477 | group.add_argument('--branch', '-B', default='master', help="Branch to find commit in") |
474 | group.add_argument('--branch2', help="Branch to find comparision revisions in") | 478 | group.add_argument('--branch2', help="Branch to find comparision revisions in") |
475 | group.add_argument('--machine', default='qemux86') | 479 | group.add_argument('--machine', default='qemux86') |
476 | group.add_argument('--history-length', default=25, type=int, | 480 | group.add_argument('--history-length', default=300, type=int, |
477 | help="Number of tested revisions to plot in html report") | 481 | help="Number of tested revisions to plot in html report") |
478 | group.add_argument('--commit', | 482 | group.add_argument('--commit', |
479 | help="Revision to search for") | 483 | help="Revision to search for") |
diff --git a/scripts/oe-debuginfod b/scripts/oe-debuginfod index b525310225..5e70d37b8b 100755 --- a/scripts/oe-debuginfod +++ b/scripts/oe-debuginfod | |||
@@ -15,14 +15,29 @@ scriptpath.add_bitbake_lib_path() | |||
15 | 15 | ||
16 | import bb.tinfoil | 16 | import bb.tinfoil |
17 | import subprocess | 17 | import subprocess |
18 | import argparse | ||
18 | 19 | ||
19 | if __name__ == "__main__": | 20 | if __name__ == "__main__": |
21 | p = argparse.ArgumentParser() | ||
22 | p.add_argument("-d", action='store_true', \ | ||
23 | help="store debuginfod files in project sub-directory") | ||
24 | |||
25 | args = p.parse_args() | ||
26 | |||
20 | with bb.tinfoil.Tinfoil() as tinfoil: | 27 | with bb.tinfoil.Tinfoil() as tinfoil: |
21 | tinfoil.prepare(config_only=True) | 28 | tinfoil.prepare(config_only=True) |
22 | package_classes_var = "DEPLOY_DIR_" + tinfoil.config_data.getVar("PACKAGE_CLASSES").split()[0].replace("package_", "").upper() | 29 | package_classes_var = "DEPLOY_DIR_" + tinfoil.config_data.getVar("PACKAGE_CLASSES").split()[0].replace("package_", "").upper() |
23 | feed_dir = tinfoil.config_data.getVar(package_classes_var, expand=True) | 30 | feed_dir = tinfoil.config_data.getVar(package_classes_var, expand=True) |
24 | 31 | ||
32 | opts = [ '--verbose', '-R', '-U', feed_dir ] | ||
33 | |||
34 | if args.d: | ||
35 | fdir = os.path.join(os.getcwd(), 'oedid-files') | ||
36 | os.makedirs(fdir, exist_ok=True) | ||
37 | opts += [ '-d', os.path.join(fdir, 'did.sqlite') ] | ||
38 | |||
25 | subprocess.call(['bitbake', '-c', 'addto_recipe_sysroot', 'elfutils-native']) | 39 | subprocess.call(['bitbake', '-c', 'addto_recipe_sysroot', 'elfutils-native']) |
26 | 40 | ||
27 | subprocess.call(['oe-run-native', 'elfutils-native', 'debuginfod', '--verbose', '-R', '-U', feed_dir]) | 41 | subprocess.call(['oe-run-native', 'elfutils-native', 'debuginfod'] + opts) |
42 | # we should not get here | ||
28 | print("\nTo use the debuginfod server please ensure that this variable PACKAGECONFIG:pn-elfutils-native = \"debuginfod libdebuginfod\" is set in the local.conf") | 43 | print("\nTo use the debuginfod server please ensure that this variable PACKAGECONFIG:pn-elfutils-native = \"debuginfod libdebuginfod\" is set in the local.conf") |
diff --git a/scripts/oe-setup-build b/scripts/oe-setup-build index 5364f2b481..c0476992a2 100755 --- a/scripts/oe-setup-build +++ b/scripts/oe-setup-build | |||
@@ -91,7 +91,16 @@ def setup_build_env(args): | |||
91 | builddir = args.b if args.b else template["buildpath"] | 91 | builddir = args.b if args.b else template["buildpath"] |
92 | no_shell = args.no_shell | 92 | no_shell = args.no_shell |
93 | coredir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) | 93 | coredir = os.path.abspath(os.path.join(os.path.dirname(os.path.realpath(__file__)), '..')) |
94 | cmd = "TEMPLATECONF={} . {} {}".format(template["templatepath"], os.path.join(coredir, 'oe-init-build-env'), builddir) | 94 | cmd_base = ". {} {}".format(os.path.join(coredir, 'oe-init-build-env'), os.path.abspath(builddir)) |
95 | |||
96 | initbuild = os.path.join(builddir, 'init-build-env') | ||
97 | if not os.path.exists(initbuild): | ||
98 | os.makedirs(builddir, exist_ok=True) | ||
99 | with open(initbuild, 'w') as f: | ||
100 | f.write(cmd_base) | ||
101 | print("\nRun '. {}' to initialize the build in a current shell session.\n".format(initbuild)) | ||
102 | |||
103 | cmd = "TEMPLATECONF={} {}".format(template["templatepath"], cmd_base) | ||
95 | if not no_shell: | 104 | if not no_shell: |
96 | cmd = cmd + " && {}".format(os.environ['SHELL']) | 105 | cmd = cmd + " && {}".format(os.environ['SHELL']) |
97 | print("Running:", cmd) | 106 | print("Running:", cmd) |