From 5ef41781aab1d1172b4abe960fe532060e4edfc4 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Tue, 27 Apr 2021 15:34:23 +0200 Subject: OBS: add PACKAGES env var Skip checking out and building source packages of all other packages, if the environment variable is set. Related: SYS#5370 Change-Id: I83c3744713fd6abda4b832460f30eb2e79ebeed8 --- scripts/common-obs.sh | 25 +++++++++++++++++++++++++ scripts/osmocom-latest-packages.sh | 10 ++++++++++ scripts/osmocom-nightly-packages.sh | 17 +++++++++++++++++ 3 files changed, 52 insertions(+) diff --git a/scripts/common-obs.sh b/scripts/common-obs.sh index c5b03f9..156dfba 100644 --- a/scripts/common-obs.sh +++ b/scripts/common-obs.sh @@ -171,6 +171,27 @@ osmo_obs_distro_specific_patch() { fi } +# Check if checkout or build of a given package should be skipped, based on the +# PACKAGES environment variable. +# $1: package name (e.g. "libosmocore") +osmo_obs_skip_pkg() { + local pkgname="$1" + + if [ -z "$PACKAGES" ]; then + # Don't skip + return 1 + fi + + for i in "osmocom-$FEED" $PACKAGES; do + if [ "$i" = "$pkgname" ]; then + return 1 + fi + done + + # Skip + return 0 +} + # Copy an already checked out repository dir and apply a distribution specific patch. # $PWD must be where all repositories are checked out in subdirs. # $1: distribution name (e.g. "debian8") @@ -180,6 +201,10 @@ osmo_obs_checkout_copy() { local repo="$2" local patch + if osmo_obs_skip_pkg "$repo"; then + return + fi + echo echo "====> Checking out $repo-$distro" diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh index e3c9452..301c6c6 100755 --- a/scripts/osmocom-latest-packages.sh +++ b/scripts/osmocom-latest-packages.sh @@ -7,6 +7,7 @@ # * "latest": use latest tagged release (default) # * other (e.g. "2021q1"): use last commit of branch of same name, exit with # error if it does not exist +# * PACKAGES: set to a space-separated list of packages to skip all others . "$(dirname "$0")/common.sh" . "$(dirname "$0")/common-obs.sh" @@ -75,6 +76,10 @@ checkout() { url=$2 gitbpargs="" + if osmo_obs_skip_pkg "$project"; then + return + fi + if [ -z "$url" ]; then url="$(osmo_git_clone_url "$project")" fi @@ -105,6 +110,11 @@ build() { project=$1 gitbpargs="$2" output="$DEBSRCDIR/$project" + + if osmo_obs_skip_pkg "$project"; then + return + fi + echo echo "====> Building $project" cd "$TOP/$project" diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh index bcbb6f3..4fe0104 100755 --- a/scripts/osmocom-nightly-packages.sh +++ b/scripts/osmocom-nightly-packages.sh @@ -7,6 +7,7 @@ # * FEED: controls the source branch that is used: # * "nightly": use "master" branch (default) # * "next": use "next" branch if it exists, otherwise use "master" branch +# * PACKAGES: set to a space-separated list of packages to skip all others . "$(dirname "$0")/common.sh" . "$(dirname "$0")/common-obs.sh" @@ -85,6 +86,10 @@ checkout() { local url=$2 local branch=$3 + if osmo_obs_skip_pkg "$name"; then + return + fi + if [ -z "$url" ]; then url="$(osmo_git_clone_url "$name")" fi @@ -118,6 +123,10 @@ build() { local oscdir=$REPO/osc/$PROJ/$name local dependver="$OSMO_OBS_CONFLICT_PKGVER" + if osmo_obs_skip_pkg "$name"; then + return + fi + if [ -d "$oscdir" ] ; then # remove earlier version cd "$oscdir" @@ -167,6 +176,10 @@ post() { } checkout_limesuite() { + if osmo_obs_skip_pkg "limesuite"; then + return + fi + cd "$REPO" git clone https://github.com/myriadrf/LimeSuite limesuite TAG="$(get_last_tag limesuite)" @@ -175,6 +188,10 @@ checkout_limesuite() { } checkout_open5gs() { + if osmo_obs_skip_pkg "open5gs"; then + return + fi + cd "$REPO" git clone https://github.com/open5gs/open5gs cd open5gs -- cgit v1.2.3