summaryrefslogtreecommitdiff
path: root/updater-ng/patches/0003-utils-xxdi.pl-remove-dependency-on-File-Slurp.patch
blob: a655511d5df7d2a5842853bf37ec54b85a88a2f3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
From 6e670a7a5f01be45ac7e1c98ab841deb7a6233fd Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Karel=20Ko=C4=8D=C3=AD?= <cynerd@email.cz>
Date: Mon, 1 Jun 2020 09:58:28 +0200
Subject: [PATCH 3/3] utils/xxdi.pl: remove dependency on File::Slurp

---
 configure.ac  | 1 -
 utils/xxdi.pl | 7 +++++--
 2 files changed, 5 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7421534a..06a51365 100644
--- a/configure.ac
+++ b/configure.ac
@@ -38,7 +38,6 @@ AC_LINK_IFELSE(
 
 AC_PATH_PROG([PERL], [perl])
 AS_IF([test -z "$PERL"], [AC_MSG_ERROR([Missing perl interpreter])])
-AX_PROG_PERL_MODULES([File::Slurp], , AC_MSG_ERROR(Perl modules File::Slurp is required))
 AC_PATH_PROG([XXDI], [xxdi.pl],, [$ac_abs_confdir/utils])
 AS_IF([test -z "$XXDI"], [AC_MSG_ERROR([Not able to locate xxdi.pl])])
 
diff --git a/utils/xxdi.pl b/utils/xxdi.pl
index 465e47a8..0e386922 100755
--- a/utils/xxdi.pl
+++ b/utils/xxdi.pl
@@ -14,12 +14,15 @@
 
 use strict;
 use warnings;
-use File::Slurp qw(slurp);
 
 die "Usage: xddi.pl VARIABLE_NAME INPUT OUTPUT" unless @ARGV == 3;
 
 my $var_name = $ARGV[0];
-my $indata = slurp($ARGV[1]);
+my $indata = do {
+    local $/;
+    open my $f, "<", $ARGV[1] or die "Could not open input $ARGV[1]: $!\n";
+    <$f>;
+};
 my $len_data = length($indata);
 my $num_digits_per_line = 12;
 
-- 
2.26.2