From 3cd8ba21a5e6f7c0f25d1fe690e816a80c83192f Mon Sep 17 00:00:00 2001 From: Christoffer Date: Sun, 23 Dec 2018 17:21:41 +0000 Subject: [PATCH] Move update functions to update.sh --- lib/functions.php | 11 ----------- rfc8416.php | 6 ------ roagen.php | 6 ------ update.sh | 15 +++++++++++++-- 4 files changed, 13 insertions(+), 25 deletions(-) diff --git a/lib/functions.php b/lib/functions.php index 61763ea..5f1beed 100755 --- a/lib/functions.php +++ b/lib/functions.php @@ -53,17 +53,6 @@ function trim_special_chars ($string) return (trim ($string, " \t\n\r\0\x0B")); } -/* - * Function: - * pushToRemotes () - * - * Commit and push to all git remote repositories. - */ -function commitPushToRemotes () -{ - echo shell_exec ("./update.sh 2>&1"); -} - function writeBirdConfig ($roas) { $json = json_encode($roas, JSON_UNESCAPED_SLASHES|JSON_PRETTY_PRINT); diff --git a/rfc8416.php b/rfc8416.php index 0b39a3f..b526828 100755 --- a/rfc8416.php +++ b/rfc8416.php @@ -4,10 +4,6 @@ require ("lib/define.php"); require ("lib/functions.php"); -// Before we begin. Ensure registry repository is up-to-date -fetchUpstreamMaster(); -checkoutMaster(); - // Define array() we are going to populate with data. $roas["slurmVersion"] = 1; $roas["validationOutputFilters"]["prefixFilters"] = array(); @@ -216,6 +212,4 @@ foreach ($raw_array as $sub_array) writeRoutinatorExceptionFile($roas); -commitPushToRemotes(); - ?> diff --git a/roagen.php b/roagen.php index c733d75..129d7c2 100755 --- a/roagen.php +++ b/roagen.php @@ -3,10 +3,6 @@ require ("lib/define.php"); require ("lib/functions.php"); -// Before we begin. Ensure registry repository is up-to-date -fetchUpstreamMaster(); -checkoutMaster(); - /* * * IPv6 @@ -192,6 +188,4 @@ foreach ($raw_array as $sub_array) writeExportJSON($roas); writeBirdConfig($roas); -commitPushToRemotes(); - ?> diff --git a/update.sh b/update.sh index 07f460b..a422ae7 100755 --- a/update.sh +++ b/update.sh @@ -2,9 +2,20 @@ ISO_DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") +# Ensure registry repository is up-to-date +git -C ../registry/ pull origin master:master --quiet 2>&1 + +# Checkout master branch in dn42/repository +git -C ../registry/ checkout master --quiet + +# Update with data from registry +php roagen.php +php rfc8416.php + # Commit latest version of ROA files -git add roa/* --quiet +git add roa/* git commit roa/* -m "Updated ROA files - $ISO_DATE" --quiet # Push repository to every remote configured -for REMOTE in $(git remote | egrep -v upstream | paste -sd " " -) ; do git push $REMOTE master:master --quiet ; done +for REMOTE in $(git remote | egrep -v upstream | paste -sd " " -) ; do + git push $REMOTE master:master --quiet ; done