Skip to content

Commit

Permalink
CEF_Parser-update.sh wrapper fixes wild diffs from Parse::Yapp hash r…
Browse files Browse the repository at this point in the history
…andomization
  • Loading branch information
ikluft committed Aug 30, 2023
1 parent dd51cc7 commit 79b2b47
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/perl/prefvote/tools/CEF_Parser-update.pl
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
# Copyright (c) 2023 by Ian Kluft
# Open Source license: Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
#
# Run this to update the generated parser code after modifications to the CEF grammar.
# This updates the generated parser code after modifications to the CEF grammar. Use the CEF_Parser-update.sh
# wrapper script to run this. It sets environment variables so Perl will use the same hash keys each time and
# generate consistent diffs on the generated code.
use strict;
use warnings;
use utf8;
Expand Down
31 changes: 31 additions & 0 deletions src/perl/prefvote/tools/CEF_Parser-update.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh
# CEF_Parser-update.sh - shell warpper for CEF_Parser-update.pl to update CEF_Parser.pm with minimal diffs
# Copyright (c) 2023 by Ian Kluft
# Open Source license: Apache License 2.0 https://www.apache.org/licenses/LICENSE-2.0
#
# Run this to update the generated parser code after modifications to the CEF grammar.
export PERL_HASH_SEED=0
export PERL_PERTURB_KEYS="NO"
readlink=$(which readlink)
dirname=$(which dirname)
if [ -n "$readlink" ] && [ -n "$dirname" ]
then
# find location of the script because CEF_Parser-update.pl is in the same directory
canonical_script="$( $readlink -f -- "$0" )"
dir=$( $dirname -- "$canonical_script")
else
# without readlink and dirname, we're at a disadvantage to determine the location of the script
# -> fall back to a requirement to run this script from the build root
dir="tools"
fi

# find the update script
update_script="$dir/CEF_Parser-update.pl"
if [ ! -f "$update_script" ]
then
echo "update script not found at $update_script"
exit 1
fi

# run the update script
perl "$update_script"

0 comments on commit 79b2b47

Please sign in to comment.