/[gentoo-x86]/app-crypt/efitools/files/xxdi.patch
Gentoo

Contents of /app-crypt/efitools/files/xxdi.patch

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.1 - (show annotations) (download)
Sun Sep 1 22:19:57 2013 UTC (10 months, 4 weeks ago) by gregkh
Branch: MAIN
CVS Tags: HEAD
remove vim-core build dependancy by replacing it with a small perl script that has been send upstream.

(Portage version: 2.2.1/cvs/Linux x86_64, unsigned Manifest commit)

1 From gregkh@linuxfoundation.org Sun Sep 1 14:55:47 2013
2 Date: Sun, 1 Sep 2013 14:58:15 -0700
3 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
4 To: James Bottomley <James.Bottomley@HansenPartnership.com>
5 Cc: JBottomley@Parallels.com, greg@kroah.com
6 Subject: [efitools PATCH] Makefile/Make.rules: don't rely on vim-core
7 Message-ID: <20130901215815.GA8749@kroah.com>
8
9 From: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
10
11 Subject: Makefile/Make.rules: don't rely on vim-core
12
13 This adds the xxdi.pl script to replace the call to 'xxd -i', removing a
14 build dependancy on vim-core, which some distros don't really want to
15 have (i.e. Gentoo and its build derivatives like ChromeOS and CoreOS.)
16
17 Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
18 ---
19 Make.rules | 2 +-
20 Makefile | 2 +-
21 xxdi.pl | 50 ++++++++++++++++++++++++++++++++++++++++++++++++++
22 3 files changed, 52 insertions(+), 2 deletions(-)
23 create mode 100755 xxdi.pl
24
25 diff --git a/Make.rules b/Make.rules
26 index 419b3b9..309b231 100644
27 --- a/Make.rules
28 +++ b/Make.rules
29 @@ -38,7 +38,7 @@ endif
30 nm -D $@ | grep ' U ' && exit 1 || exit 0
31
32 %.h: %.auth
33 - xxd -i $< > $@
34 + ./xxdi.pl $< > $@
35
36 %.hash: %.efi hash-to-efi-sig-list
37 ./hash-to-efi-sig-list $< $@
38 diff --git a/Makefile b/Makefile
39 index 52f4551..a39cafe 100644
40 --- a/Makefile
41 +++ b/Makefile
42 @@ -62,7 +62,7 @@ DB.auth: DB.esl KEK.crt sign-efi-sig-list
43
44 hashlist.h: HashTool.hash
45 cat $^ > /tmp/tmp.hash
46 - xxd -i /tmp/tmp.hash > $@
47 + ./xxdi.pl /tmp/tmp.hash > $@
48 rm -f /tmp/tmp.hash
49
50
51 diff --git a/xxdi.pl b/xxdi.pl
52 new file mode 100755
53 index 0000000..acc974c
54 --- /dev/null
55 +++ b/xxdi.pl
56 @@ -0,0 +1,50 @@
57 +#!/usr/bin/env perl
58 +#
59 +# xxdi.pl - perl implementation of 'xxd -i' mode
60 +#
61 +# Copyright 2013 Greg Kroah-Hartman <gregkh@linuxfoundation.org>
62 +# Copyright 2013 Linux Foundation
63 +#
64 +# Released under the GPLv2.
65 +#
66 +# Implements the "basic" functionality of 'xxd -i' in perl to keep build
67 +# systems from having to build/install/rely on vim-core, which not all
68 +# distros want to do. But everyone has perl, so use it instead.
69 +#
70 +
71 +use strict;
72 +use warnings;
73 +use File::Slurp qw(slurp);
74 +
75 +my $indata = slurp(@ARGV ? $ARGV[0] : \*STDIN);
76 +my $len_data = length($indata);
77 +my $num_digits_per_line = 12;
78 +my $var_name;
79 +my $outdata;
80 +
81 +# Use the variable name of the file we read from, converting '/' and '.
82 +# to '_', or, if this is stdin, just use "stdin" as the name.
83 +if (@ARGV) {
84 + $var_name = $ARGV[0];
85 + $var_name =~ s/\//_/g;
86 + $var_name =~ s/\./_/g;
87 +} else {
88 + $var_name = "stdin";
89 +}
90 +
91 +$outdata .= "unsigned char $var_name\[] = {";
92 +
93 +# trailing ',' is acceptable, so instead of duplicating the logic for
94 +# just the last character, live with the extra ','.
95 +for (my $key= 0; $key < $len_data; $key++) {
96 + if ($key % $num_digits_per_line == 0) {
97 + $outdata .= "\n\t";
98 + }
99 + $outdata .= sprintf("0x%.2x, ", ord(substr($indata, $key, 1)));
100 +}
101 +
102 +$outdata .= "\n};\nunsigned int $var_name\_len = $len_data;\n";
103 +
104 +binmode STDOUT;
105 +print {*STDOUT} $outdata;
106 +
107 --
108 1.8.4.6.g82e253f.dirty

  ViewVC Help
Powered by ViewVC 1.1.20