summary refs log tree commit diff
path: root/pkgs/build-support/kernel/cpio-clean.pl
blob: de38dee49f0da28843ee154162bbe12acc543546 (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
use strict;

# Make inode number, link info and mtime consistent in order to get a consistent hash.
#
# Author: Alexander Kjeldaas <ak@formalprivacy.com>

use Archive::Cpio;

my $cpio = Archive::Cpio->new;
my $IN = \*STDIN;
my $ino = 1;
$cpio->read_with_handler($IN, sub {
        my ($e) = @_;
        $e->{inode} = $ino;
        $ino++;
        $e->{nlink} = 1;
        $e->{mtime} = 1;
	$cpio->write_one(\*STDOUT, $e);
    });
$cpio->write_trailer(\*STDOUT);