
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>
3.5 KiB
Executable File
#!/bin/bash -e
get-latest-series: Download latest patch series from Patchwork
Copyright (C) 2023 BayLibre Inc.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License version 2 as
published by the Free Software Foundation.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
the interval into the past which we want to check for new series, in minutes
INTERVAL_MINUTES=30
Maximum number of series to retrieve. the Patchwork API can support up to 250
at once
SERIES_LIMIT=250
Location to save patches
DOWNLOAD_PATH="."
Name of the file to use/check as a log of previously-tested series IDs
SERIES_TEST_LOG=".series_test.log"
Patchwork project to pull series patches from
PROJECT="oe-core"
The Patchwork server to pull from
SERVER="https://patchwork.yoctoproject.org/api/1.2/"
help() { echo "Usage: get-latest-series [ -i | --interval MINUTES ] [ -d | --directory DIRECTORY ] [ -l | --limit COUNT ] [ -h | --help ] [ -t | --tested-series LOGFILE] [ -p | --project PROJECT ] [ -s | --server SERVER ]" exit 2 }
while [ "$1" != "" ]; do case $1 in -i|--interval) INTERVAL_MINUTES=$2 shift 2 ;; -l|--limit) SERIES_LIMIT=$2 shift 2 ;; -d|--directory) DOWNLOAD_PATH=$2 shift 2 ;; -p|--project) PROJECT=$2 shift 2 ;; -s|--server) SERVER=$2 shift 2 ;; -t|--tested-series) SERIES_TEST_LOG=$2 shift 2 ;; -h|--help) help ;; *) echo "Unknown option $1" help ;; esac done
The time this script is running at
START_TIME=$(date --date "now" +"%Y-%m-%dT%H:%M:%S")
the corresponding timestamp we want to check against for new patch series
SERIES_CHECK_LIMIT=$(date --date "now - ${INTERVAL_MINUTES} minutes" +"%Y-%m-%dT%H:%M:%S")
echo "Start time is $START_TIME" echo "Series check limit is $SERIES_CHECK_LIMIT"
Create DOWNLOAD_PATH if it doesn't exist
if [ ! -d "$DOWNLOAD_PATH" ]; then mkdir "${DOWNLOAD_PATH}" fi
Create SERIES_TEST_LOG if it doesn't exist
if [ ! -f "$SERIES_TEST_LOG" ]; then touch "${SERIES_TEST_LOG}" fi
Retrieve a list of series IDs from the 'git-pw series list' output. The API
supports a maximum of 250 results, so make sure we allow that when required
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')
if [ -z "$SERIES_LIST" ]; then echo "No new series for project ${PROJECT} since ${SERIES_CHECK_LIMIT}" exit 0 fi
Check each series ID
for SERIES in $SERIES_LIST; do # Download the series only if it's not found in the SERIES_TEST_LOG if ! grep -w --quiet "${SERIES}" "${SERIES_TEST_LOG}"; then echo "Downloading $SERIES..." git-pw series download --separate "${SERIES}" "${DOWNLOAD_PATH}" echo "${SERIES}" >> "${SERIES_TEST_LOG}" else echo "Already tested ${SERIES}. Skipping..." fi done