From 88f2c6fe64543be801ea80551391206d764e6f9e Mon Sep 17 00:00:00 2001
From: Maxim Cournoyer <maxim.cournoyer@savoirfairelinux.com>
Date: Sun, 14 Feb 2021 23:57:12 -0500
Subject: [PATCH] contrib: Add a 'list-tarballs' target.

This target can be used to print a list of the contrib tarballs
required to build the daemon.  It can be used to copy only the
required tarballs from a cache when building a source release, for
example.

Change-Id: I402c29989b3e6fed8a82418d19dbbacea8c44f50
---
 contrib/bootstrap    | 19 ++++++++++---------
 contrib/src/main.mak | 11 +++++++++--
 2 files changed, 19 insertions(+), 11 deletions(-)

diff --git a/contrib/bootstrap b/contrib/bootstrap
index 4a5e4b9cc9..a9346cd2e6 100755
--- a/contrib/bootstrap
+++ b/contrib/bootstrap
@@ -277,15 +277,16 @@ Bootstrap completed.
 Run "make" to start compilation.
 
 Other targets:
- * make install      same as "make"
- * make prebuilt     fetch and install prebuilt binaries
- * make list         list packages
- * make fetch        fetch required source tarballs
- * make fetch-all    fetch all source tarballs
- * make distclean    clean everything and undo bootstrap
- * make mostlyclean  clean everything except source tarballs
- * make clean        clean everything
- * make package      prepare prebuilt packages
+ * make install       same as "make"
+ * make prebuilt      fetch and install prebuilt binaries
+ * make list          list packages
+ * make list-tarballs list required source tarballs
+ * make fetch         fetch required source tarballs
+ * make fetch-all     fetch all source tarballs
+ * make distclean     clean everything and undo bootstrap
+ * make mostlyclean   clean everything except source tarballs
+ * make clean         clean everything
+ * make package       prepare prebuilt packages
 EOF
 
 mkdir -p ../../contrib/tarballs || exit $?
diff --git a/contrib/src/main.mak b/contrib/src/main.mak
index 752dfc0455..101a302fc0 100644
--- a/contrib/src/main.mak
+++ b/contrib/src/main.mak
@@ -478,7 +478,14 @@ list:
 	@echo To-be-built packages:
 	$(call pprint,$(PKGS))
 
-.PHONY: all fetch fetch-all install mostlyclean clean distclean package list prebuilt
+tarball-target = $(shell sed -n 's|^\($$(TARBALLS).*tar.*\):.*|\1|p' \
+				'$(SRC)/$(pkg)/rules.mak')
+list-tarballs:
+	@$(foreach pkg,$(sort $(PKGS)), \
+		$(eval tmp_var = $(tarball-target)) \
+		$(foreach t,$(tmp_var), echo $(t);))
+
+.PHONY: all fetch fetch-all install mostlyclean clean distclean package list list-tarballs prebuilt
 
 # CMake toolchain
 toolchain.cmake:
@@ -528,7 +535,7 @@ $(patsubst %,.dep-%,$(filter-out $(PKGS_FOUND),$(PKGS_ALL))): .dep-%: .%
 
 # dump list of packages to build
 list-build-packages:
-	@echo ${PKGS}
+	@echo $(sort $(PKGS))
 
 .SECONDEXPANSION:
 
-- 
GitLab