From 014b9eb1b7ae54eefe6fb7307c8f18242aea30a6 Mon Sep 17 00:00:00 2001 From: Simon McVittie Date: Tue, 9 Jun 2015 11:40:14 +0100 Subject: [PATCH] polygen: if deterministic build is requested, use a well-known random seed --- IkiWiki/Plugin/polygen.pm | 5 +++-- debian/changelog | 2 +- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/IkiWiki/Plugin/polygen.pm b/IkiWiki/Plugin/polygen.pm index 78e3611e1..8ce62b754 100644 --- a/IkiWiki/Plugin/polygen.pm +++ b/IkiWiki/Plugin/polygen.pm @@ -28,6 +28,7 @@ sub preprocess (@) { my %params=@_; my $grammar = ($params{grammar} or 'polygen'); my $symbol = ($params{symbol} or undef); + my $options = ($config{deterministic} ? '-seed 42' : ''); # Sanitize parameters $grammar =~ IkiWiki::basename($grammar); @@ -51,10 +52,10 @@ sub preprocess (@) { my $res; if (defined $symbol) { - $res = `polygen -S $symbol $grmfile 2>/dev/null`; + $res = `polygen -S $symbol $options $grmfile 2>/dev/null`; } else { - $res = `polygen $grmfile 2>/dev/null`; + $res = `polygen $options $grmfile 2>/dev/null`; } if ($?) { diff --git a/debian/changelog b/debian/changelog index 41a47e57f..f7219d0f5 100644 --- a/debian/changelog +++ b/debian/changelog @@ -35,7 +35,7 @@ ikiwiki (3.20150330) UNRELEASED; urgency=medium if the link text is identical * Add a $config{deterministic} option and use it for the docwiki * haiku: if deterministic build is requested, return a hard-coded haiku - * If deterministic build is requested, return a hard-coded haiku + * polygen: if deterministic build is requested, use a well-known random seed -- Joey Hess Tue, 28 Apr 2015 12:24:08 -0400 -- 2.39.2