From 19684fc39976d9f48f63142db628ab124d22fa79 Mon Sep 17 00:00:00 2001 From: Michael Richardson Date: Sun, 8 Sep 2024 18:25:17 -0400 Subject: [PATCH] restore extra instructions in Makefile --- Makefile | 70 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/Makefile b/Makefile index de46d56..37ce90e 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,17 @@ +YANGDATE=2023-01-10 +CWTSIDDATE1=ietf-voucher@${YANGDATE}.sid +CWTSIDLIST1=ietf-voucher-sid.txt +CWTSIDDATE2=ietf-voucher-request@${YANGDATE}.sid +CWTSIDLIST2=ietf-voucher-request-sid.txt +EXAMPLES+=$(wildcard examples/voucher*.b64) +EXAMPLES+=$(wildcard examples/*.pem) +EXAMPLES+=$(wildcard examples/*.crt) LIBDIR := lib + +# add this path because your local install might be newer. +YANGMODULESPATH=${HOME}/.local/share/yang/modules +PYANG?=pyang +PYANGPATH=--path=yang --path=${YANGMODULESPATH} include $(LIBDIR)/main.mk $(LIBDIR)/main.mk: @@ -9,3 +22,60 @@ else git clone -q --depth 10 $(CLONE_ARGS) \ -b main https://github.com/martinthomson/i-d-template $(LIBDIR) endif + +# because pyang likes to pick the file ./"foo.yang", when it should be looking for +# yang/foo@DATE.yang first, most invokations are pyang are done from the yang +# subdirectory so that pyang won't see the template files in the CWD. +# maybe a different extension is in order. + +draft-ietf-anima-rfc8366bis.xml:: yang/ietf-voucher@${YANGDATE}.yang \ + yang/ietf-voucher-tree-latest.txt \ + yang/ietf-voucher-request@${YANGDATE}.yang \ + yang/ietf-voucher-request-tree-latest.txt ${CWTSIDLIST1} ${CWTSIDLIST2} ${EXAMPLES} + +yang/ietf-voucher@${YANGDATE}.yang: ietf-voucher.yang + # make sure we are running a new enough pyang + pyang --help | grep sid-finalize + mkdir -p yang + sed -e 's/YYYY-MM-DD/'${YANGDATE}'/g' ietf-voucher.yang | (cd yang && pyang ${PYANGPATH} --keep-comments -f yang >ietf-voucher@${YANGDATE}.yang ) + ln -s -f ietf-voucher@${YANGDATE}.yang yang/ietf-voucher-latest.yang + +yang/ietf-voucher-request@${YANGDATE}.yang: ietf-voucher-request.yang + mkdir -p yang + sed -e 's/YYYY-MM-DD/'${YANGDATE}'/g' ietf-voucher-request.yang | (cd yang && pyang ${PYANGPATH} --keep-comments -f yang >ietf-voucher-request@${YANGDATE}.yang ) + ln -s -f ietf-voucher-request@${YANGDATE}.yang yang/ietf-voucher-request-latest.yang + +yang/ietf-voucher-tree-latest.txt: yang/ietf-voucher@${YANGDATE}.yang + # make sure we are running a new enough pyang + pyang --help | grep sid-finalize + mkdir -p yang + pyang ${PYANGPATH} -f tree --tree-print-structures --tree-line-length=70 yang/ietf-voucher@${YANGDATE}.yang > yang/ietf-voucher-tree-latest.txt + +yang/ietf-voucher-request-tree-latest.txt: yang/ietf-voucher-request@${YANGDATE}.yang + ${PYANG} ${PYANGPATH} -f tree --tree-print-structures --tree-line-length=70 yang/ietf-voucher-request@${YANGDATE}.yang > yang/ietf-voucher-request-tree-latest.txt + +# Base SID value for voucher: 2450 +boot-sid1: yang/ietf-voucher@${YANGDATE}.yang + ${PYANG} ${PYANGPATH} --sid-list --generate-sid-file 2450:50 yang/ietf-voucher@${YANGDATE}.yang + +${CWTSIDLIST1}: yang/ietf-voucher@${YANGDATE}.yang + mkdir -p yang + ln -s -f ../${CWTSIDDATE1} yang/${CWTSIDDATE1} + (cd yang && ${PYANG} ${PYANGPATH} --sid-list --sid-update-file=../${CWTSIDDATE1} ietf-voucher@${YANGDATE}.yang ) | ./truncate-sid-table >${CWTSIDLIST1} + +# Base SID value for voucher request: 2500 +boot-sid2: yang/ietf-voucher-request@${YANGDATE}.yang + mkdir -p yang + (cd yang && ${PYANG} ${PYANGPATH} --sid-list --generate-sid-file 2500:50 ietf-voucher-request@${YANGDATE}.yang ) + +${CWTSIDLIST2}: yang/ietf-voucher-request@${YANGDATE}.yang + mkdir -p yang + ln -s -f ../${CWTSIDDATE2} yang/${CWTSIDDATE2} + (cd yang && ${PYANG} ${PYANGPATH} --sid-list --sid-update-file=../${CWTSIDDATE2} ietf-voucher-request@${YANGDATE}.yang ) | ./truncate-sid-table >${CWTSIDLIST2} + + +.PHONY: pyang-install +pyang-install: + pip3 install pyang + +