From f6ad6102e686a6b8039dccb62fb3847eb595a155 Mon Sep 17 00:00:00 2001 From: Christoffer Date: Thu, 27 Dec 2018 22:35:23 +0000 Subject: [PATCH] misc: updated JSON file to include a _comments section for when file was last modified --- lib/functions.php | 4 ---- rfc8416.php | 5 +++++ roagen.php | 7 +++++++ 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 7d6f0c0..008dfb4 100755 --- a/lib/functions.php +++ b/lib/functions.php @@ -92,9 +92,6 @@ function writeRoutinatorExceptionFile ($roas) $fp = fopen('roa/export_rfc8416_dn42.json', 'w'); - //fwrite ($fp, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/\/\/ /g'")); - // Removed as routinator complains about comments in JSON file :( - fwrite($fp, $json); fclose($fp); @@ -106,7 +103,6 @@ function writeExportJSON ($roas) $fp = fopen ('roa/export_dn42.json', 'w'); - fwrite ($fp, shell_exec ("/usr/bin/git -C ../registry/ show | sed 's/^/\/\/ /g'")); fwrite ($fp, $json); fclose ($fp); diff --git a/rfc8416.php b/rfc8416.php index bb75782..ef0b763 100755 --- a/rfc8416.php +++ b/rfc8416.php @@ -6,6 +6,11 @@ require ("lib/functions.php"); // Define array() we are going to populate with data. $roas["slurmVersion"] = 1; +$roas["_comments"]["modified"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%H'"); +$roas["_comments"]["modified"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%p'"); +$roas["_comments"]["modified"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%an <%ae>'"); +$roas["_comments"]["modified"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%aD'"); +$roas["_comments"]["modified"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%s'"); $roas["validationOutputFilters"]["prefixFilters"] = array(); $roas["validationOutputFilters"]["bgpsecFilters"] = array(); $roas["locallyAddedAssertions"]["bgpsecAssertions"] = array(); diff --git a/roagen.php b/roagen.php index 8be16c8..acacaaa 100755 --- a/roagen.php +++ b/roagen.php @@ -3,6 +3,13 @@ require ("lib/define.php"); require ("lib/functions.php"); +// Define array() we are going to populate with data. +$roas["_comments"]["modified"]["commit"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%H'"); +$roas["_comments"]["modified"]["merge"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%p'"); +$roas["_comments"]["modified"]["author"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%an <%ae>'"); +$roas["_comments"]["modified"]["date"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%aD'"); +$roas["_comments"]["modified"]["subject"] = shell_exec ("/usr/bin/git -C ../registry/ log -n 1 --pretty='format:%s'"); + /* * * IPv6