From d93fd48da9a4f3903be459a30459ab9d48d5cff3 Mon Sep 17 00:00:00 2001 From: Oliver Smith Date: Thu, 12 Dec 2019 13:15:43 +0100 Subject: [PATCH] OBS: clone from gerrit.osmocom.org Work around "garbage at end of loose object" errors that occasionally cause these jenkins jobs to fail. A few repositories are not hosted on gerrit, so they still get cloned from git.osmocom.org. However, having almost all repositories cloned from gerrit should improve the situation a lot. Related: OS#4083 Change-Id: Id8f08a1bc10d6c81be9ad44c60646e2ea9f6cf4e --- scripts/common.sh | 15 +++++++++++++++ scripts/osmocom-latest-packages.sh | 3 ++- scripts/osmocom-nightly-packages.sh | 6 +++--- 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/scripts/common.sh b/scripts/common.sh index 340bac80..1c2dfe00 100644 --- a/scripts/common.sh +++ b/scripts/common.sh @@ -1,6 +1,7 @@ #!/bin/sh # Various functions and variables used in multiple osmo-ci shell scripts OSMO_GIT_URL="https://git.osmocom.org" +OSMO_GIT_URL_GERRIT="https://gerrit.osmocom.org" # Osmocom repositories of which we want to build release tarballs automatically, and list the current versions at # https://jenkins.osmocom.org/jenkins/job/Osmocom-list-commits/lastSuccessfulBuild/artifact/commits.txt @@ -99,6 +100,20 @@ osmo_git_clone_date() { fi } +# Print git clone URL for an Osmocom git repository. Prefer the gerrit clone URL, because cloning from the regular URL +# sometimes results in the "garbage at end of loose object" error (OS#4083). +# $1: Osmocom project (e.g. "osmo-hlr") +osmo_git_clone_url() { + case "$1" in + rtl-sdr|osmo-fl2k|libosmo-dsp|libgtpnl|libasn1c|libusrp|libsmpp34) + echo "$OSMO_GIT_URL"/"$1" + ;; + *) + echo "$OSMO_GIT_URL_GERRIT"/"$1" + ;; + esac +} + # Print the subdirectory of the repository where the source lies (configure.ac etc.). # Print nothing when the source is in the topdir of the repository. osmo_source_subdir() { diff --git a/scripts/osmocom-latest-packages.sh b/scripts/osmocom-latest-packages.sh index 509bced0..3770ee14 100755 --- a/scripts/osmocom-latest-packages.sh +++ b/scripts/osmocom-latest-packages.sh @@ -55,7 +55,7 @@ checkout() { if [ "$project" = "limesuite" ]; then [ -d "$project" ] || git clone "https://github.com/myriadrf/LimeSuite" "$project" else - [ -d "$project" ] || osmo_git_clone_date "https://git.osmocom.org/$project" + [ -d "$project" ] || osmo_git_clone_date "$(osmo_git_clone_url "$project")" fi cd "$project" git fetch @@ -131,6 +131,7 @@ build() { build_osmocom() { prepare + # NOTE: when adding a repository that is not in gerrit, adjust osmo_git_clone_url() checkout limesuite checkout osmo-gsm-manuals checkout libosmocore diff --git a/scripts/osmocom-nightly-packages.sh b/scripts/osmocom-nightly-packages.sh index 1c76cc13..d49d9682 100755 --- a/scripts/osmocom-nightly-packages.sh +++ b/scripts/osmocom-nightly-packages.sh @@ -64,14 +64,13 @@ get_commit_version() { checkout() { local name=$1 local branch=$2 - local url="https://git.osmocom.org" cd "$REPO" if [ -n "$branch" ] ; then - osmo_git_clone_date "$url/$name" -b "$branch" + osmo_git_clone_date "$(osmo_git_clone_url "$name")" -b "$branch" else - osmo_git_clone_date "$url/$name" + osmo_git_clone_date "$(osmo_git_clone_url "$name")" fi cd - @@ -177,6 +176,7 @@ build_osmocom() { prepare + # NOTE: when adding a repository that is not in gerrit, adjust osmo_git_clone_url() checkout_limesuite checkout osmo-gsm-manuals checkout libosmocore