From aef5b30b81108dd8a0f7ee4bbdb844983c434ae5 Mon Sep 17 00:00:00 2001 From: lisa neigut Date: Mon, 9 Sep 2019 18:57:04 -0500 Subject: [PATCH] wire: update how experimental csv patches are managed We used to append new patches to a single file. This caused some problems and is a lot harder to cleanup later. This patch moves the experimental patches to their own, individual patch files, that are named for the current BOLTVERSION, which they're taken from. Also moves the current patchfile over to a 'gossipqueries' one, as it already exists. --- wire/Makefile | 17 ++++++++++------- wire/extracted_onion_experimental_csv | 0 ...l_csv => extracted_peer_experimental_legacy} | 0 3 files changed, 10 insertions(+), 7 deletions(-) delete mode 100644 wire/extracted_onion_experimental_csv rename wire/{extracted_peer_experimental_csv => extracted_peer_experimental_legacy} (100%) diff --git a/wire/Makefile b/wire/Makefile index 50ecb129bbfe..47fd98127ace 100644 --- a/wire/Makefile +++ b/wire/Makefile @@ -38,10 +38,10 @@ extract-bolt-csv: bolt-precheck @echo '#include ' > wire/extracted_onion_wire_csv @$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/04*.md >> wire/extracted_onion_wire_csv -# Explicit command to add diff of BOLT CSV's to an experimental_csv file +# Explicit command to add patchfile for BOLT CSV's extract-experimental-bolt-csv: bolt-precheck - @$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/0[127]*.md | diff -u wire/extracted_peer_wire_csv - >>wire/extracted_peer_experimental_csv | if [ $$? -lt 0 ];then exit 1;fi - @{ echo '#include '; $(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/04*.md; } | diff -u wire/extracted_onion_wire_csv - >>wire/extracted_onion_experimental_csv | if [ $$? -lt 0 ];then exit 1;fi + @$(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/0[127]*.md | diff -u wire/extracted_peer_wire_csv - >wire/extracted_peer_experimental_$(BOLTVERSION) | if [ $$? -lt 0 ];then exit 1;fi + @{ echo '#include '; $(BOLT_EXTRACT) $(LOCAL_BOLTDIR)/04*.md; } | diff -u wire/extracted_onion_wire_csv - > wire/extracted_onion_experimental_$(BOLTVERSION) | if [ $$? -lt 0 ];then exit 1;fi wire/extracted_peer_experimental_csv: @touch $@ @@ -50,11 +50,14 @@ wire/extracted_onion_experimental_csv: @touch $@ ifeq ($(EXPERIMENTAL_FEATURES),1) -wire/gen_peer_wire_csv: wire/extracted_peer_experimental_csv wire/extracted_peer_wire_csv - @patch --silent -o $@ wire/extracted_peer_wire_csv $< +EXPERIMENTAL_PEER_PATCHES := $(wildcard wire/extracted_peer_experimental_*) +EXPERIMENTAL_ONION_PATCHES := $(wildcard wire/extracted_onion_experimental_*) -wire/gen_onion_wire_csv: wire/extracted_onion_experimental_csv wire/extracted_onion_wire_csv - @patch --silent -o $@ wire/extracted_onion_wire_csv $< +wire/gen_peer_wire_csv: wire/extracted_peer_wire_csv $(EXPERIMENTAL_PEER_PATCHES) + @set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_PEER_PATCHES); do patch --silent $@.$$$$ $$exp; done; mv $@.$$$$ $@ + +wire/gen_onion_wire_csv: wire/extracted_onion_wire_csv $(EXPERIMENTAL_ONION_PATCHES) + @set -e; trap "rm -f $@.$$$$" 0; cp $< $@.$$$$; for exp in $(EXPERIMENTAL_ONION_PATCHES); do patch --silent $@.$$$$ $$exp; done; mv $@.$$$$ $@ else # /* EXPERIMENTAL_FEATURES */ wire/gen_peer_wire_csv: wire/extracted_peer_wire_csv diff --git a/wire/extracted_onion_experimental_csv b/wire/extracted_onion_experimental_csv deleted file mode 100644 index e69de29bb2d1..000000000000 diff --git a/wire/extracted_peer_experimental_csv b/wire/extracted_peer_experimental_legacy similarity index 100% rename from wire/extracted_peer_experimental_csv rename to wire/extracted_peer_experimental_legacy