From ef96008c0c4c83c9bb1f377b24b436a3763cf26a Mon Sep 17 00:00:00 2001 From: Gordon Tetlow Date: Fri, 6 Dec 2024 17:25:42 -0800 Subject: [PATCH 1/2] Cleanup update logic for embedded openssl git tree. Due to the shallow clone, the existing openssl tree never updates as the tag we are attempting to move to does not exist in our tree causing the "git checkout" command to fail the pipeline. Instead, if the latest blessed version of the upstream (as defined by the regex we used to decide which openssl version we support) is different than our local tree, use "git fetch" to grab the new tag and then use "git checkout" to move our local tree to it. Tested on: Way too many trees of openssl in different states --- Makefile | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index faed6e2..e4b25ad 100644 --- a/Makefile +++ b/Makefile @@ -140,10 +140,13 @@ uninstall: .openssl.is.fresh: opensslpull true opensslpull: + upstream=`git ls-remote https://github.com/openssl/openssl | grep -Eo '(openssl-3\.0\.[0-9]+)' | sort -V | tail -n 1` ; \ if [ -d openssl -a -d openssl/.git ]; then \ - cd ./openssl && git checkout `git ls-remote https://github.com/openssl/openssl | grep -Eo '(openssl-3\.0\.[0-9]+)' | sort --version-sort | tail -n 1` && git pull | grep -q "Already up to date." && [ -e ../.openssl.is.fresh ] || touch ../.openssl.is.fresh ; \ + if [ "$$upstream" != "`cd ./openssl && git describe --exact-match --tags`" ]; then \ + cd ./openssl && git fetch --depth 1 origin refs/tags/$$upstream:refs/tags/$$upstream && git checkout $$upstream && touch ../.openssl.is.fresh ; \ + fi \ else \ - git clone --depth 1 -b `git ls-remote https://github.com/openssl/openssl | grep -Eo '(openssl-3\.0\.[0-9]+)' | sort -V | tail -n 1` https://github.com/openssl/openssl ./openssl && cd ./openssl && touch ../.openssl.is.fresh ; \ + git clone --depth 1 -b $$upstream https://github.com/openssl/openssl ./openssl && cd ./openssl && touch ../.openssl.is.fresh ; \ fi openssl/Makefile: .openssl.is.fresh From bcf271c4874781f21d4a0744dcc6866a1cd6fa00 Mon Sep 17 00:00:00 2001 From: Gordon Tetlow Date: Fri, 6 Dec 2024 17:31:47 -0800 Subject: [PATCH 2/2] Fix small whitespace nit and supress the empty target echo. --- Makefile | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Makefile b/Makefile index e4b25ad..47c73ad 100644 --- a/Makefile +++ b/Makefile @@ -138,7 +138,8 @@ uninstall: rm -f $(DESTDIR)$(MAN1DIR)/sslscan.1 .openssl.is.fresh: opensslpull - true + @true + opensslpull: upstream=`git ls-remote https://github.com/openssl/openssl | grep -Eo '(openssl-3\.0\.[0-9]+)' | sort -V | tail -n 1` ; \ if [ -d openssl -a -d openssl/.git ]; then \