The Design and Implementation of the FreeBSD Operating System, Second Edition
Now available: The Design and Implementation of the FreeBSD Operating System (Second Edition)


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]

FreeBSD/Linux Kernel Cross Reference
sys/contrib/device-tree/scripts/rewrite-index.pl

Version: -  FREEBSD  -  FREEBSD-13-STABLE  -  FREEBSD-13-0  -  FREEBSD-12-STABLE  -  FREEBSD-12-0  -  FREEBSD-11-STABLE  -  FREEBSD-11-0  -  FREEBSD-10-STABLE  -  FREEBSD-10-0  -  FREEBSD-9-STABLE  -  FREEBSD-9-0  -  FREEBSD-8-STABLE  -  FREEBSD-8-0  -  FREEBSD-7-STABLE  -  FREEBSD-7-0  -  FREEBSD-6-STABLE  -  FREEBSD-6-0  -  FREEBSD-5-STABLE  -  FREEBSD-5-0  -  FREEBSD-4-STABLE  -  FREEBSD-3-STABLE  -  FREEBSD22  -  l41  -  OPENBSD  -  linux-2.6  -  MK84  -  PLAN9  -  xnu-8792 
SearchContext: -  none  -  3  -  10 

    1 #!/usr/bin/perl
    2 use strict;
    3 use warnings;
    4 use IPC::Open2;
    5 my $pid;
    6 
    7 open(my $lsfiles, "-|", "git ls-files -s") or die "fork lsfiles: $!";
    8 
    9 while (<$lsfiles>) {
   10     if ($_ =~ m/^120000 ([0-9a-f]{40}) (.*)\t(.*)/) {
   11         my ($obj, $stage, $path) = ($1,$2,$3);
   12         if (!defined $pid) {
   13             $pid = open2(*Rderef, *Wderef, "git cat-file --batch-check='deref-ok %(objectname)' --follow-symlinks")
   14                 or die "open git cat-file: $!";
   15         }
   16         print Wderef "$ENV{GIT_COMMIT}:$path\n" or die "write Wderef: $!";
   17         my $deref = <Rderef>;
   18         if ($deref =~ m/^deref-ok ([0-9a-f]{40})$/) {
   19             $_ = "100644 $1 $stage\t$path\n"
   20         } elsif ($deref =~ /^dangling /) {
   21             # Skip next line
   22             my $dummy = <Rderef>;
   23         } else {
   24             die "Failed to parse symlink $ENV{GIT_COMMIT}:$path $deref";
   25         }
   26     }
   27 
   28     my $m = 0;
   29 
   30     # Keep the copyright. Also ensures we never have a completely empty commit.
   31     $m++ if m/\tCOPYING$/;
   32 
   33     # A few architectures have dts files at non standard paths. Massage those into
   34     # a standard arch/ARCH/boot/dts first.
   35 
   36     # symlink: arch/microblaze/boot/dts/system.dts -> ../../platform/generic/system.dts
   37     next if m,\tarch/microblaze/boot/dts/system.dts$,;
   38     $m++ if s,\tarch/microblaze/platform/generic/(system.dts)$,\tarch/microblaze/boot/dts/$1,;
   39 
   40     # arch/mips/lantiq/dts/easy50712.dts
   41     # arch/mips/lantiq/dts/danube.dtsi
   42     # arch/mips/netlogic/dts/xlp_evp.dts
   43     # arch/mips/ralink/dts/rt3050.dtsi
   44     # arch/mips/ralink/dts/rt3052_eval.dts
   45     $m++ if s,\tarch/mips/([^/]*)/dts/(.*\.dts.?)$,\tarch/mips/boot/dts/$2,;
   46 
   47     # arch/mips/cavium-octeon/octeon_68xx.dts
   48     # arch/mips/cavium-octeon/octeon_3xxx.dts
   49     # arch/mips/mti-sead3/sead3.dts
   50     $m++ if s,\tarch/mips/([^/]*)/([^/]*\.dts.?)$,\tarch/mips/boot/dts/$2,;
   51 
   52     # arch/x86/platform/ce4100/falconfalls.dts
   53     $m++ if s,\tarch/x86/platform/ce4100/falconfalls.dts,\tarch/x86/boot/dts/falconfalls.dts,;
   54 
   55     # test cases
   56     $m++ if s,\tdrivers/of/testcase-data/,\ttestcase-data/,;
   57 
   58     # Now rewrite generic DTS paths
   59     $m++ if s,\tarch/([^/]*)/boot/dts/(.*\.dts.?)$,\tsrc/$1/$2,;
   60     $m++ if s,\tarch/([^/]*)/boot/dts/(.*\.h)$,\tsrc/$1/$2,;
   61 
   62     # Also rewrite the DTS include paths for dtc+cpp support
   63     $m++ if s,\tarch/([^/]*)/include/dts/,\tsrc/$1/include/,;
   64     $m++ if s,\tinclude/dt-bindings/,\tinclude/dt-bindings/,;
   65 
   66     # Rewrite the bindings subdirectory
   67     $m++ if s,\tDocumentation/devicetree/bindings/,\tBindings/,;
   68 
   69     print if $m > 0;
   70 }
   71 kill $pid if $pid;
   72 exit 0;

Cache object: c42a367c233014890d6d8fe1e1ab7377


[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ] [ list types ] [ track identifier ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.