From a658b8086301e05898f01ee174781a824b1fbaf4 Mon Sep 17 00:00:00 2001 From: Graham Christensen Date: Tue, 14 Dec 2021 10:03:18 -0500 Subject: [PATCH] perlcritic: Readonly -> ReadonlyX --- flake.nix | 17 ++++++++++++++++- src/lib/Hydra/Helper/CatalystUtils.pm | 24 ++++++++++++------------ 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/flake.nix b/flake.nix index 5d76568a..3fa02795 100644 --- a/flake.nix +++ b/flake.nix @@ -199,6 +199,21 @@ }; }; + ReadonlyX = final.perlPackages.buildPerlModule { + pname = "ReadonlyX"; + version = "1.04"; + src = final.fetchurl { + url = "mirror://cpan/authors/id/S/SA/SANKO/ReadonlyX-1.04.tar.gz"; + sha256 = "81bb97dba93ac6b5ccbce04a42c3590eb04557d75018773ee18d5a30fcf48188"; + }; + buildInputs = with final.perlPackages; [ ModuleBuildTiny TestFatal ]; + meta = { + homepage = "https://github.com/sanko/readonly"; + description = "Faster facility for creating read-only scalars, arrays, hashes"; + license = final.lib.licenses.artistic2; + }; + }; + TieHashMethod = final.buildPerlPackage { pname = "Tie-Hash-Method"; version = "0.02"; @@ -472,7 +487,7 @@ ParallelForkManager PerlCriticCommunity PrometheusTinyShared - Readonly + ReadonlyX SetScalar SQLSplitStatement Starman diff --git a/src/lib/Hydra/Helper/CatalystUtils.pm b/src/lib/Hydra/Helper/CatalystUtils.pm index 64e3c44f..925ed718 100644 --- a/src/lib/Hydra/Helper/CatalystUtils.pm +++ b/src/lib/Hydra/Helper/CatalystUtils.pm @@ -4,7 +4,7 @@ use utf8; use strict; use warnings; use Exporter; -use Readonly; +use ReadonlyX; use Nix::Store; use Hydra::Helper::Nix; @@ -34,7 +34,7 @@ our @EXPORT = qw( # Columns from the Builds table needed to render build lists. -Readonly our @buildListColumns => ('id', 'finished', 'timestamp', 'stoptime', 'project', 'jobset', 'job', 'nixname', 'system', 'buildstatus', 'releasename'); +Readonly::Array our @buildListColumns => ('id', 'finished', 'timestamp', 'stoptime', 'project', 'jobset', 'job', 'nixname', 'system', 'buildstatus', 'releasename'); sub getBuild { @@ -317,16 +317,16 @@ sub paramToList { # Security checking of filenames. -Readonly our $pathCompRE => "(?:[A-Za-z0-9-\+\._\$][A-Za-z0-9-\+\._\$:]*)"; -Readonly our $relPathRE => "(?:$pathCompRE(?:/$pathCompRE)*)"; -Readonly our $relNameRE => "(?:[A-Za-z0-9-_][A-Za-z0-9-\._]*)"; -Readonly our $attrNameRE => "(?:[A-Za-z_][A-Za-z0-9-_]*)"; -Readonly our $projectNameRE => "(?:[A-Za-z_][A-Za-z0-9-_]*)"; -Readonly our $jobsetNameRE => "(?:[A-Za-z_][A-Za-z0-9-_\.]*)"; -Readonly our $jobNameRE => "(?:$attrNameRE(?:\\.$attrNameRE)*)"; -Readonly our $systemRE => "(?:[a-z0-9_]+-[a-z0-9_]+)"; -Readonly our $userNameRE => "(?:[a-z][a-z0-9_\.]*)"; -Readonly our $inputNameRE => "(?:[A-Za-z_][A-Za-z0-9-_]*)"; +Readonly::Scalar our $pathCompRE => "(?:[A-Za-z0-9-\+\._\$][A-Za-z0-9-\+\._\$:]*)"; +Readonly::Scalar our $relPathRE => "(?:$pathCompRE(?:/$pathCompRE)*)"; +Readonly::Scalar our $relNameRE => "(?:[A-Za-z0-9-_][A-Za-z0-9-\._]*)"; +Readonly::Scalar our $attrNameRE => "(?:[A-Za-z_][A-Za-z0-9-_]*)"; +Readonly::Scalar our $projectNameRE => "(?:[A-Za-z_][A-Za-z0-9-_]*)"; +Readonly::Scalar our $jobsetNameRE => "(?:[A-Za-z_][A-Za-z0-9-_\.]*)"; +Readonly::Scalar our $jobNameRE => "(?:$attrNameRE(?:\\.$attrNameRE)*)"; +Readonly::Scalar our $systemRE => "(?:[a-z0-9_]+-[a-z0-9_]+)"; +Readonly::Scalar our $userNameRE => "(?:[a-z][a-z0-9_\.]*)"; +Readonly::Scalar our $inputNameRE => "(?:[A-Za-z_][A-Za-z0-9-_]*)"; sub parseJobsetName {