Change in osmo-ci[master]: Add scripts/osmocom-list-commits.sh

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

osmith gerrit-no-reply at lists.osmocom.org
Wed Mar 20 13:36:05 UTC 2019


osmith has submitted this change and it was merged. ( https://gerrit.osmocom.org/13301 )

Change subject: Add scripts/osmocom-list-commits.sh
......................................................................

Add scripts/osmocom-list-commits.sh

Generate a table of Osmocom CNI repositories and their latest tag,
related commit, and last commit on master.

Related: OS#3840
Change-Id: I91cab0139229e6c1c67e889d33b3d984025bc9da
---
A scripts/osmocom-list-commits.sh
1 file changed, 85 insertions(+), 0 deletions(-)

Approvals:
  Max: Looks good to me, but someone else must approve
  Harald Welte: Looks good to me, approved
  osmith: Verified



diff --git a/scripts/osmocom-list-commits.sh b/scripts/osmocom-list-commits.sh
new file mode 100755
index 0000000..d8183c6
--- /dev/null
+++ b/scripts/osmocom-list-commits.sh
@@ -0,0 +1,85 @@
+#!/bin/sh -e
+# Environment variables:
+# * NO_HEADER: do not output the header line when set
+
+FORMAT_STR="%-22s %-42s %9s %-40s %s\n"
+URL="https://git.osmocom.org"
+REPOS="
+	libasn1c
+	libosmo-abis
+	libosmocore
+	libosmo-netif
+	libosmo-sccp
+	libsmpp34
+	libusrp
+	osmo-bsc
+	osmo-bts
+	osmo-ggsn
+	osmo-hlr
+	osmo-iuh
+	osmo-mgw
+	osmo-msc
+	osmo-pcu
+	osmo-sgsn
+	osmo-sip-connector
+	osmo-sysmon
+	osmo-trx
+	osmocom-bb
+"
+
+# Print commit of HEAD for an Osmocom git repository, e.g.:
+# "f90496f577e78944ce8db1aa5b900477c1e479b0"
+# $1: repository
+get_head_commit() {
+	# git output:
+	# f90496f577e78944ce8db1aa5b900477c1e479b0        HEAD
+	ret="$(git ls-remote "$URL/$1" HEAD)"
+	ret="$(echo "$ret" | awk '{print $1}')"
+	echo "$ret"
+}
+
+# Print last tag and related commit for an Osmocom git repository, e.g.:
+# "ec798b89700dcca5c5b28edf1a1cd16ea311f30a        refs/tags/1.0.1"
+# Print "-" when no tags were found.
+# $1: repository
+get_last() {
+	# git output:
+	# ec798b89700dcca5c5b28edf1a1cd16ea311f30a        refs/tags/1.0.1
+	# eab5f594b0a7cf50ad97b039f73beff42cc8312a        refs/tags/1.0.1^{}
+	# ...
+	# 41e7cf115d4148a9f34fcb863b68b2d5370e335d        refs/tags/1.3.1^{}
+	# 8a9f12dc2f69bf3a4e861cc9a81b71bdc5f13180        refs/tags/3G_2016_09
+	# ee618ecbedec82dfd240334bc87d0d1c806477b0        refs/tags/debian/0.9.13-0_jrsantos.1
+	# a3fdd24af099b449c9856422eb099fb45a5595df        refs/tags/debian/0.9.13-0_jrsantos.1^{}
+	# ...
+	ret="$(git ls-remote --tags "$URL/$1")"
+	ret="$(echo "$ret" | grep 'refs/tags/[0-9.]*$' || true)"
+	ret="$(echo "$ret" | sort -n -k2)"
+	ret="$(echo "$ret" | tail -n 1)"
+
+	if [ -n "$ret" ]; then
+		echo "$ret"
+	else
+		echo "-"
+	fi
+}
+
+# Header
+if [ -z "$NO_HEADER" ]; then
+	printf "$FORMAT_STR" "# repository" "clone URL" "last tag" "last tag commit" "HEAD commit"
+fi
+
+# Table
+for repo in $REPOS; do
+	last="$(get_last "$repo")"
+	last_tag="$(echo "$last" | cut -d/ -f 3)"
+	last_commit="$(echo "$last" | awk '{print $1}')"
+	head_commit="$(get_head_commit "$repo")"
+
+	printf "$FORMAT_STR" \
+		"$repo.git" \
+		"$URL/$repo" \
+		"$last_tag" \
+		"$last_commit" \
+		"$head_commit"
+done

-- 
To view, visit https://gerrit.osmocom.org/13301
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-ci
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I91cab0139229e6c1c67e889d33b3d984025bc9da
Gerrit-Change-Number: 13301
Gerrit-PatchSet: 5
Gerrit-Owner: osmith <osmith at sysmocom.de>
Gerrit-Reviewer: Harald Welte <laforge at gnumonks.org>
Gerrit-Reviewer: Max <msuraev at sysmocom.de>
Gerrit-Reviewer: Neels Hofmeyr <nhofmeyr at sysmocom.de>
Gerrit-Reviewer: Pau Espin Pedrol <pespin at sysmocom.de>
Gerrit-Reviewer: osmith <osmith at sysmocom.de>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190320/d3dd7ac3/attachment.htm>


More information about the gerrit-log mailing list