ctdb/wscript: use python 3.6 compatible functions
[Samba.git] / source4 / script / buildtree.pl
bloba40036aa55cadcd700cc9f259193f6543719e742
1 #! /usr/bin/env perl -w
2 eval 'exec /usr/bin/env perl -S $0 ${1+"$@"}'
3 if 0; #$running_under_some_shell
5 use strict;
6 use File::Find ();
7 use File::Path qw(mkpath);
8 use Cwd 'abs_path';
10 # Set the variable $File::Find::dont_use_nlink if you're using AFS,
11 # since AFS cheats.
13 # for the convenience of &wanted calls, including -eval statements:
14 use vars qw/*name *dir *prune/;
15 *name = *File::Find::name;
16 *dir = *File::Find::dir;
17 *prune = *File::Find::prune;
18 my $builddir = abs_path($ENV{builddir});
19 my $srcdir = abs_path($ENV{srcdir});
20 sub wanted;
24 # Traverse desired filesystems
25 File::Find::find({wanted => \&wanted, no_chdir => 1}, $srcdir);
26 exit;
29 sub wanted {
30 my ($dev,$ino,$mode,$nlink,$uid,$gid,$newdir);
32 if ((($dev,$ino,$mode,$nlink,$uid,$gid) = lstat($_)) &&
33 (-d _) && (($newdir = abs_path($_)) !~ /$builddir/))
35 $newdir =~ s!$srcdir!$builddir!;
36 mkpath($newdir);
37 print("Creating $newdir\n");