diff options
author | Trevor Gamblin <tgamblin@baylibre.com> | 2023-10-16 15:44:57 -0400 |
---|---|---|
committer | Richard Purdie <richard.purdie@linuxfoundation.org> | 2023-10-17 11:41:34 +0100 |
commit | 6e53a778f10c77eab3c0172a0cbc4d63efc663e9 (patch) | |
tree | 2790a50300d53a809ede675f0d163a999149331d /scripts/patchtest-get-series | |
parent | 9d137188ad03c111ff8df7396b6b3dfd59307ac0 (diff) | |
download | poky-6e53a778f10c77eab3c0172a0cbc4d63efc663e9.tar.gz |
patchtest: add scripts to oe-core
Add the following from the patchtest repo:
- patchtest: core patch testing tool
- patchtest-get-branch: determine the target branch of a patch
- patchtest-get-series: pull patch series from Patchwork
- patchtest-send-results: send test results to selected mailing list
- patchtest-setup-sharedir: create sharedir for use with patchtest guest
mode
- patchtest.README: instructions for using patchtest based on the README
in the original repository
Note that the patchtest script was modified slightly from the repo
version to retain compatibility with the oe-core changes.
patchtest-send-results and patchtest-setup-sharedir are also primarily
intended for automated testing in guest mode, but are added for
consistency.
(From OE-Core rev: cf318c3c05fc050b8c838c04f28797325c569c5c)
Signed-off-by: Trevor Gamblin <tgamblin@baylibre.com>
Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'scripts/patchtest-get-series')
-rwxr-xr-x | scripts/patchtest-get-series | 125 |
1 files changed, 125 insertions, 0 deletions
diff --git a/scripts/patchtest-get-series b/scripts/patchtest-get-series new file mode 100755 index 0000000000..773701f80b --- /dev/null +++ b/scripts/patchtest-get-series | |||
@@ -0,0 +1,125 @@ | |||
1 | #!/bin/bash -e | ||
2 | # | ||
3 | # get-latest-series: Download latest patch series from Patchwork | ||
4 | # | ||
5 | # Copyright (C) 2023 BayLibre Inc. | ||
6 | # | ||
7 | # This program is free software; you can redistribute it and/or modify | ||
8 | # it under the terms of the GNU General Public License version 2 as | ||
9 | # published by the Free Software Foundation. | ||
10 | # | ||
11 | # This program is distributed in the hope that it will be useful, | ||
12 | # but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
13 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
14 | # GNU General Public License for more details. | ||
15 | # | ||
16 | # You should have received a copy of the GNU General Public License along | ||
17 | # with this program; if not, write to the Free Software Foundation, Inc., | ||
18 | # 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. | ||
19 | |||
20 | # the interval into the past which we want to check for new series, in minutes | ||
21 | INTERVAL_MINUTES=30 | ||
22 | |||
23 | # Maximum number of series to retrieve. the Patchwork API can support up to 250 | ||
24 | # at once | ||
25 | SERIES_LIMIT=250 | ||
26 | |||
27 | # Location to save patches | ||
28 | DOWNLOAD_PATH="." | ||
29 | |||
30 | # Name of the file to use/check as a log of previously-tested series IDs | ||
31 | SERIES_TEST_LOG=".series_test.log" | ||
32 | |||
33 | # Patchwork project to pull series patches from | ||
34 | PROJECT="oe-core" | ||
35 | |||
36 | # The Patchwork server to pull from | ||
37 | SERVER="https://patchwork.yoctoproject.org/api/1.2/" | ||
38 | |||
39 | help() | ||
40 | { | ||
41 | echo "Usage: get-latest-series [ -i | --interval MINUTES ] | ||
42 | [ -d | --directory DIRECTORY ] | ||
43 | [ -l | --limit COUNT ] | ||
44 | [ -h | --help ] | ||
45 | [ -t | --tested-series LOGFILE] | ||
46 | [ -p | --project PROJECT ] | ||
47 | [ -s | --server SERVER ]" | ||
48 | exit 2 | ||
49 | } | ||
50 | |||
51 | while [ "$1" != "" ]; do | ||
52 | case $1 in | ||
53 | -i|--interval) | ||
54 | INTERVAL_MINUTES=$2 | ||
55 | shift 2 | ||
56 | ;; | ||
57 | -l|--limit) | ||
58 | SERIES_LIMIT=$2 | ||
59 | shift 2 | ||
60 | ;; | ||
61 | -d|--directory) | ||
62 | DOWNLOAD_PATH=$2 | ||
63 | shift 2 | ||
64 | ;; | ||
65 | -p|--project) | ||
66 | PROJECT=$2 | ||
67 | shift 2 | ||
68 | ;; | ||
69 | -s|--server) | ||
70 | SERVER=$2 | ||
71 | shift 2 | ||
72 | ;; | ||
73 | -t|--tested-series) | ||
74 | SERIES_TEST_LOG=$2 | ||
75 | shift 2 | ||
76 | ;; | ||
77 | -h|--help) | ||
78 | help | ||
79 | ;; | ||
80 | *) | ||
81 | echo "Unknown option $1" | ||
82 | help | ||
83 | ;; | ||
84 | esac | ||
85 | done | ||
86 | |||
87 | # The time this script is running at | ||
88 | START_TIME=$(date --date "now" +"%Y-%m-%dT%H:%M:%S") | ||
89 | |||
90 | # the corresponding timestamp we want to check against for new patch series | ||
91 | SERIES_CHECK_LIMIT=$(date --date "now - ${INTERVAL_MINUTES} minutes" +"%Y-%m-%dT%H:%M:%S") | ||
92 | |||
93 | echo "Start time is $START_TIME" | ||
94 | echo "Series check limit is $SERIES_CHECK_LIMIT" | ||
95 | |||
96 | # Create DOWNLOAD_PATH if it doesn't exist | ||
97 | if [ ! -d "$DOWNLOAD_PATH" ]; then | ||
98 | mkdir "${DOWNLOAD_PATH}" | ||
99 | fi | ||
100 | |||
101 | # Create SERIES_TEST_LOG if it doesn't exist | ||
102 | if [ ! -f "$SERIES_TEST_LOG" ]; then | ||
103 | touch "${SERIES_TEST_LOG}" | ||
104 | fi | ||
105 | |||
106 | # Retrieve a list of series IDs from the 'git-pw series list' output. The API | ||
107 | # supports a maximum of 250 results, so make sure we allow that when required | ||
108 | SERIES_LIST=$(git-pw --project "${PROJECT}" --server "${SERVER}" series list --since "${SERIES_CHECK_LIMIT}" --limit "${SERIES_LIMIT}" | awk '{print $2}' | xargs | sed -e 's/[^0-9 ]//g') | ||
109 | |||
110 | if [ -z "$SERIES_LIST" ]; then | ||
111 | echo "No new series for project ${PROJECT} since ${SERIES_CHECK_LIMIT}" | ||
112 | exit 0 | ||
113 | fi | ||
114 | |||
115 | # Check each series ID | ||
116 | for SERIES in $SERIES_LIST; do | ||
117 | # Download the series only if it's not found in the SERIES_TEST_LOG | ||
118 | if ! grep -w --quiet "${SERIES}" "${SERIES_TEST_LOG}"; then | ||
119 | echo "Downloading $SERIES..." | ||
120 | git-pw series download --separate "${SERIES}" "${DOWNLOAD_PATH}" | ||
121 | echo "${SERIES}" >> "${SERIES_TEST_LOG}" | ||
122 | else | ||
123 | echo "Already tested ${SERIES}. Skipping..." | ||
124 | fi | ||
125 | done | ||