1997-10-31 20:33:04 +03:00
#!/usr/bin/perl
1997-12-02 01:49:09 +03:00
require "pwd.pl" || die "Required pwd.pl not found" ;
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
# This perl script automatically generates the idb file
$ PKG = 'samba' ;
$ SRCDIR = '../..' ;
$ SRCPFX = '.' ;
1997-10-31 20:33:04 +03:00
1997-12-02 01:49:09 +03:00
& initpwd ;
1997-10-31 20:33:04 +03:00
$ curdir = $ ENV { "PWD" } ;
2000-03-16 09:44:27 +03:00
if ( $ PKG eq "samba_irix" ) {
open ( BOOKS , "IDB.books" ) || die "Unable to open IDB.books file\n" ;
@ books = sort idbsort <BOOKS> ;
close BOOKS ;
}
1997-10-31 20:33:04 +03:00
# We don't want the files listed in .cvsignore in the source tree
2000-03-16 09:44:27 +03:00
open ( IGNORES , "$SRCDIR/source/.cvsignore" ) || die "Unable to open .cvsignore file\n" ;
1999-12-13 16:27:58 +03:00
while ( <IGNORES> ) {
chop ;
next if /cvs\.log/ ;
$ ignores { $ _ } + + ;
}
close IGNORES ;
# We don't want the files listed in .cvsignore in the source/include tree
2000-03-16 09:44:27 +03:00
open ( IGNORES , "$SRCDIR/source/include/.cvsignore" ) || die "Unable to open include/.cvsignore file\n" ;
1997-10-31 20:33:04 +03:00
while ( <IGNORES> ) {
chop ;
$ ignores { $ _ } + + ;
}
close IGNORES ;
# get the names of all the binary files to be installed
2000-03-16 09:44:27 +03:00
open ( MAKEFILE , "$SRCDIR/source/Makefile" ) || die "Unable to open Makefile\n" ;
2003-01-17 02:34:51 +03:00
while ( not eof ( MAKEFILE ) ) {
$ _ = <MAKEFILE> ;
chomp ;
last if /^# object file lists/ ;
if ( /^EXEEXT/ ) {
/^.*=(.*)/ ;
$ EXEEXT = $ 1 ;
}
if ( /^srcdir/ ) {
/^.*=(.*)/ ;
$ srcdir = $ 1 ;
}
if ( /^builddir/ ) {
/^.*=(.*)/ ;
$ builddir = $ 1 ;
}
if ( /^SBIN_PROGS/ ) { @ sbinprogs = get_line ( $ _ ) ; }
if ( /^BIN_PROGS1/ ) { @ binprogs1 = get_line ( $ _ ) ; }
if ( /^BIN_PROGS2/ ) { @ binprogs2 = get_line ( $ _ ) ; }
if ( /^BIN_PROGS3/ ) { @ binprogs3 = get_line ( $ _ ) ; }
if ( /^BIN_PROGS/ ) { @ binprogs = get_line ( $ _ ) ; }
if ( /^SCRIPTS/ ) { @ scripts = get_line ( $ _ ) ; }
if ( /^TORTURE_PROGS/ ) { @ tortureprogs = get_line ( $ _ ) ; }
if ( /^SHLIBS/ ) { @ shlibs = get_line ( $ _ ) ; }
}
1997-10-31 20:33:04 +03:00
close MAKEFILE ;
2003-01-17 02:34:51 +03:00
# add my local files to the list of binaries to install
@ bins = sort byfilename ( @ sbinprogs , @ binprogs , @ binprogs1 , @ binprogs2 , @ binprogs3 , @ scripts , ( "sambalp" , "smbprint" ) ) ;
2000-03-16 09:44:27 +03:00
2003-01-17 02:34:51 +03:00
@ nsswitch = sort byfilename ( @ shlibs ) ;
2000-03-16 09:44:27 +03:00
1998-03-17 02:11:48 +03:00
# install the swat files
2000-03-16 09:44:27 +03:00
chdir "$SRCDIR/source" ;
1998-08-11 02:36:11 +04:00
system ( "chmod +x ./script/installswat.sh" ) ;
2000-05-03 05:07:33 +04:00
system ( "./script/installswat.sh ../packaging/SGI/swat ./ ../packaging/SGI/swat/using_samba" ) ;
2000-03-16 09:44:27 +03:00
system ( "cp -f ../swat/README ../packaging/SGI/swat" ) ;
1998-03-17 02:11:48 +03:00
chdir $ curdir ;
1997-10-31 20:33:04 +03:00
1998-03-17 02:11:48 +03:00
# get a complete list of all files in the tree
2000-03-16 09:44:27 +03:00
chdir "$SRCDIR/" ;
1998-03-17 02:11:48 +03:00
& dodir ( '.' ) ;
chdir $ curdir ;
1997-10-31 20:33:04 +03:00
# the files installed in docs include all the original files in docs plus all
# the "*.doc" files from the source tree
2003-01-17 02:34:51 +03:00
@ docs = sort bynextdir grep ( ! /CVS/ & ( /^source\/.*\.doc$/ | /^docs\/\w/ ) , @ allfiles ) ;
@ docs = grep ( ! /htmldocs/ & ! /manpages/ , @ docs ) ;
2001-06-01 16:33:16 +04:00
@ docs = grep ( ! /docbook/ , @ docs ) ;
1997-10-31 20:33:04 +03:00
2003-01-17 02:34:51 +03:00
@ libfiles = sort byfilename ( grep ( /^source\/codepages\/\w/ , @ allfiles ) , ( "packaging/SGI/smb.conf" , "source/bin/libsmbclient.a" , "source/bin/libsmbclient.so" ) ) ;
1998-03-17 02:11:48 +03:00
@ swatfiles = sort grep ( /^packaging\/SGI\/swat/ , @ allfiles ) ;
1997-10-31 20:33:04 +03:00
@ catman = sort grep ( /^packaging\/SGI\/catman/ & ! /\/$/ , @ allfiles ) ;
@ catman = sort bydirnum @ catman ;
# strip out all the generated directories and the "*.o" files from the source
# release
2001-12-22 03:54:10 +03:00
@ allfiles = grep ( ! /^.*\.o$/ & ! /^.*\.po$/ & ! /^.*\.po32$/ & ! /^.*\.so$/ & ! /^source\/bin/ & ! /^packaging\/SGI\/bins/ & ! /^packaging\/SGI\/catman/ & ! /^packaging\/SGI\/html/ & ! /^packaging\/SGI\/codepages/ & ! /^packaging\/SGI\/swat/ , @ allfiles ) ;
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
open ( IDB , "> $curdir/$PKG.idb" ) || die "Unable to open $PKG.idb for output\n" ;
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
print IDB "f 0644 root sys etc/config/samba $SRCPFX/packaging/SGI/samba.config $PKG.sw.base config(update)\n" ;
2002-04-02 09:54:55 +04:00
print IDB "f 0644 root sys etc/config/winbind $SRCPFX/packaging/SGI/winbindd.config $PKG.sw.base config(update)\n" ;
2000-03-16 09:44:27 +03:00
print IDB "f 0755 root sys etc/init.d/samba $SRCPFX/packaging/SGI/samba.rc $PKG.sw.base\n" ;
2002-04-02 09:54:55 +04:00
print IDB "f 0755 root sys etc/init.d/winbind $SRCPFX/packaging/SGI/winbindd.rc $PKG.sw.base\n" ;
print IDB "l 0000 root sys etc/rc0.d/K36winbind $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/winbind)\n" ;
print IDB "l 0000 root sys etc/rc0.d/K37samba $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/samba)\n" ;
2000-03-16 09:44:27 +03:00
print IDB "l 0000 root sys etc/rc2.d/S81samba $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/samba)\n" ;
2002-04-02 09:54:55 +04:00
print IDB "l 0000 root sys etc/rc2.d/S82winbind $SRCPFX/packaging/SGI $PKG.sw.base symval(../init.d/winbind)\n" ;
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
if ( $ PKG eq "samba_irix" ) {
print IDB "d 0755 root sys usr/relnotes/samba_irix $SRCPFX/packaging/SGI $PKG.man.relnotes\n" ;
2003-01-17 02:34:51 +03:00
print IDB "f 0644 root sys usr/relnotes/samba_irix/TC relnotes/TC $PKG.man.relnotes\n" ;
print IDB "f 0644 root sys usr/relnotes/samba_irix/ch1.z relnotes/ch1.z $PKG.man.relnotes\n" ;
print IDB "f 0644 root sys usr/relnotes/samba_irix/ch2.z relnotes/ch2.z $PKG.man.relnotes\n" ;
print IDB "f 0644 root sys usr/relnotes/samba_irix/ch3.z relnotes/ch3.z $PKG.man.relnotes\n" ;
2000-03-16 09:44:27 +03:00
}
else {
@ copyfile = grep ( /^COPY/ , @ allfiles ) ;
print IDB "d 0755 root sys usr/relnotes/samba $SRCPFX/packaging/SGI $PKG.man.relnotes\n" ;
print IDB "f 0644 root sys usr/relnotes/samba/@copyfile[0] $SRCPFX/@copyfile[0] $PKG.man.relnotes\n" ;
print IDB "f 0644 root sys usr/relnotes/samba/legal_notice.html $SRCPFX/packaging/SGI/legal_notice.html $PKG.man.relnotes\n" ;
print IDB "f 0644 root sys usr/relnotes/samba/samba-relnotes.html $SRCPFX/packaging/SGI/relnotes.html $PKG.man.relnotes\n" ;
}
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/bin $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
1997-10-31 20:33:04 +03:00
while ( @ bins ) {
$ nextfile = shift @ bins ;
1998-08-11 02:36:11 +04:00
( $ filename = $ nextfile ) =~ s/^.*\/// ; ;
1998-01-08 13:50:18 +03:00
if ( index ( $ nextfile , '$' ) ) {
1998-08-11 02:36:11 +04:00
if ( $ filename eq "smbpasswd" ) {
2000-05-03 05:07:33 +04:00
print IDB "f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n" ;
1998-01-08 13:50:18 +03:00
}
1998-08-11 02:36:11 +04:00
elsif ( $ filename eq "swat" ) {
2000-05-03 05:07:33 +04:00
print IDB "f 4755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base preop(\"chroot \$rbase /etc/init.d/samba stop\") exitop(\"chroot \$rbase /usr/samba/scripts/startswat.sh\") removeop(\"chroot \$rbase /sbin/cp /etc/inetd.conf /etc/inetd.conf.O ; chroot \$rbase /sbin/sed -e '/^swat/D' -e '/^#SWAT/D' /etc/inetd.conf.O >/etc/inetd.conf; /etc/killall -HUP inetd || true\")\n" ;
1998-03-17 02:11:48 +03:00
}
1998-08-11 02:36:11 +04:00
elsif ( $ filename eq "sambalp" ) {
2000-05-03 05:07:33 +04:00
print IDB "f 0755 root sys usr/samba/bin/$filename $SRCPFX/packaging/SGI/$filename $PKG.sw.base \n" ;
1998-01-08 13:50:18 +03:00
}
1998-08-11 02:36:11 +04:00
elsif ( $ filename eq "smbprint" ) {
2000-03-16 09:44:27 +03:00
print IDB "f 0755 root sys usr/samba/bin/$filename $SRCPFX/packaging/SGI/$filename $PKG.sw.base\n" ;
1998-01-08 13:50:18 +03:00
}
2001-12-05 04:04:47 +03:00
elsif ( $ filename eq "smbd" ) {
print IDB "f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n" ;
2001-12-22 03:54:10 +03:00
if ( - e "$SRCDIR/source/$nextfile.noquota" ) {
print IDB "f 0755 root sys usr/samba/bin/$filename.noquota $SRCPFX/source/$nextfile.noquota $PKG.sw.base \n" ;
}
if ( - e "$SRCDIR/source/$nextfile.profile" ) {
print IDB "f 0755 root sys usr/samba/bin/$filename.profile $SRCPFX/source/$nextfile.profile $PKG.sw.base \n" ;
}
2001-12-05 04:04:47 +03:00
}
elsif ( $ filename eq "nmbd" ) {
print IDB "f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n" ;
2001-12-22 03:54:10 +03:00
if ( - e "$SRCDIR/source/$nextfile.profile" ) {
print IDB "f 0755 root sys usr/samba/bin/$filename.profile $SRCPFX/source/$nextfile.profile $PKG.sw.base \n" ;
}
2001-12-05 04:04:47 +03:00
}
1998-01-08 13:50:18 +03:00
else {
2000-05-03 05:07:33 +04:00
print IDB "f 0755 root sys usr/samba/bin/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n" ;
1998-01-08 13:50:18 +03:00
}
1997-10-31 20:33:04 +03:00
}
}
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/docs $SRCPFX/docs $PKG.man.doc\n" ;
1997-10-31 20:33:04 +03:00
while ( @ docs ) {
$ nextfile = shift @ docs ;
( $ junk , $ file ) = split ( /\// , $ nextfile , 2 ) ;
if ( grep ( /\/$/ , $ nextfile ) ) {
1998-11-12 22:34:40 +03:00
$ file =~ s/\/$// ;
$ nextfile =~ s/\/$// ;
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/docs/$file $SRCPFX/$nextfile $PKG.man.doc\n" ;
1997-10-31 20:33:04 +03:00
}
else {
2000-03-16 09:44:27 +03:00
print IDB "f 0644 root sys usr/samba/docs/$file $SRCPFX/$nextfile $PKG.man.doc\n" ;
1997-10-31 20:33:04 +03:00
}
}
2002-04-02 09:54:55 +04:00
print IDB "d 0755 root sys usr/samba/include $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
print IDB "f 0644 root sys usr/samba/include/libsmbclient.h $SRCPFX/source/include/libsmbclient.h $PKG.sw.base\n" ;
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/lib $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
2003-01-17 02:34:51 +03:00
while ( @ libfiles ) {
$ nextfile = shift @ libfiles ;
( $ file = $ nextfile ) =~ s/.*\/// ;
if ( $ file eq "smb.conf" ) {
print IDB "f 0644 root sys usr/samba/lib/$file $SRCPFX/$nextfile $PKG.sw.base config(suggest)\n" ;
} else {
print IDB "f 0644 root sys usr/samba/lib/$file $SRCPFX/$nextfile $PKG.sw.base nostrip \n" ;
}
1997-10-31 20:33:04 +03:00
}
2001-12-05 04:04:47 +03:00
print IDB "d 0755 lp sys usr/samba/printer $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
print IDB "d 0755 lp sys usr/samba/printer/W32ALPHA $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
2001-12-06 00:49:51 +03:00
print IDB "d 0755 lp sys usr/samba/printer/W32MIPS $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
2001-12-05 04:04:47 +03:00
print IDB "d 0755 lp sys usr/samba/printer/W32PPC $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
2001-12-06 00:49:51 +03:00
print IDB "d 0755 lp sys usr/samba/printer/W32X86 $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
print IDB "d 0755 lp sys usr/samba/printer/WIN40 $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
2001-12-05 04:04:47 +03:00
2000-03-16 09:44:27 +03:00
print IDB "d 0644 root sys usr/samba/private $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
print IDB "f 0600 root sys usr/samba/private/smbpasswd $SRCPFX/packaging/SGI/smbpasswd $PKG.sw.base config(suggest)\n" ;
1998-11-20 00:30:58 +03:00
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/scripts $SRCPFX/packaging/SGI $PKG.src.samba\n" ;
print IDB "f 0755 root sys usr/samba/scripts/inetd.sh $SRCPFX/packaging/SGI/inetd.sh $PKG.sw.base\n" ;
print IDB "f 0755 root sys usr/samba/scripts/inst.msg $SRCPFX/packaging/SGI/inst.msg $PKG.sw.base exitop(\"chroot \$rbase /usr/samba/scripts/inst.msg\")\n" ;
print IDB "f 0755 root sys usr/samba/scripts/mkprintcap.sh $SRCPFX/packaging/SGI/mkprintcap.sh $PKG.sw.base\n" ;
print IDB "f 0755 root sys usr/samba/scripts/removeswat.sh $SRCPFX/packaging/SGI/removeswat.sh $PKG.sw.base\n" ;
print IDB "f 0755 root sys usr/samba/scripts/startswat.sh $SRCPFX/packaging/SGI/startswat.sh $PKG.sw.base\n" ;
1998-11-20 00:30:58 +03:00
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/src $SRCPFX/packaging/SGI $PKG.src.samba\n" ;
1998-04-28 22:58:20 +04:00
@ sorted = sort ( @ allfiles ) ;
while ( @ sorted ) {
$ nextfile = shift @ sorted ;
1997-10-31 20:33:04 +03:00
( $ file = $ nextfile ) =~ s/^.*\/// ;
next if grep ( /packaging\/SGI/ & ( /Makefile/ | /samba\.spec/ | /samba\.idb/ ) , $ nextfile ) ;
next if grep ( /source/ , $ nextfile ) && ( $ ignores { $ file } ) ;
next if ( $ nextfile eq "CVS" ) ;
if ( grep ( /\/$/ , $ nextfile ) ) {
1998-11-12 22:34:40 +03:00
$ nextfile =~ s/\/$// ;
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/src/$nextfile $SRCPFX/$nextfile $PKG.src.samba\n" ;
1997-10-31 20:33:04 +03:00
}
else {
2001-01-05 20:59:31 +03:00
if ( grep ( ( /\.sh$/ | /configure$/ | /configure\.developer/ | /config\.guess/ | /config\.sub/ | /\.pl$/ | /mkman$/ | /pcp\/Install/ | /pcp\/Remove/ ) , $ nextfile ) ) {
2000-03-16 09:44:27 +03:00
print IDB "f 0755 root sys usr/samba/src/$nextfile $SRCPFX/$nextfile $PKG.src.samba\n" ;
1997-10-31 20:33:04 +03:00
}
else {
2000-03-16 09:44:27 +03:00
print IDB "f 0644 root sys usr/samba/src/$nextfile $SRCPFX/$nextfile $PKG.src.samba\n" ;
1997-10-31 20:33:04 +03:00
}
}
}
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/swat $SRCPFX/packaging/SGI/swat $PKG.sw.base\n" ;
1998-03-17 02:11:48 +03:00
while ( @ swatfiles ) {
$ nextfile = shift @ swatfiles ;
( $ file = $ nextfile ) =~ s/^packaging\/SGI\/swat\/// ;
next if ! $ file ;
if ( grep ( /\/$/ , $ file ) ) {
1998-11-12 22:34:40 +03:00
$ file =~ s/\/$// ;
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/swat/$file $SRCPFX/packaging/SGI/swat/$file $PKG.sw.base\n" ;
1998-03-17 02:11:48 +03:00
}
else {
2000-03-16 09:44:27 +03:00
print IDB "f 0444 root sys usr/samba/swat/$file $SRCPFX/packaging/SGI/swat/$file $PKG.sw.base\n" ;
1998-03-17 02:11:48 +03:00
}
}
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/samba/var $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
print IDB "d 0755 root sys usr/samba/var/locks $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
if ( $ PKG eq "samba_irix" ) {
while ( @ books ) {
$ nextfile = shift @ books ;
print IDB $ nextfile ;
}
}
1997-10-31 20:33:04 +03:00
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/share/catman/u_man $SRCPFX/packaging/SGI $PKG.man.manpages\n" ;
1997-10-31 20:33:04 +03:00
$ olddirnum = "0" ;
while ( @ catman ) {
$ nextfile = shift @ catman ;
( $ file = $ nextfile ) =~ s/^packaging\/SGI\/catman\/// ;
( $ dirnum = $ file ) =~ s/^[\D]*// ;
1999-12-13 16:27:58 +03:00
$ dirnum =~ s/\.z// ;
1997-10-31 20:33:04 +03:00
if ( $ dirnum ne $ olddirnum ) {
2000-03-16 09:44:27 +03:00
print IDB "d 0755 root sys usr/share/catman/u_man/cat$dirnum $SRCPFX/packaging/SGI $PKG.man.manpages\n" ;
1997-10-31 20:33:04 +03:00
$ olddirnum = $ dirnum ;
}
2000-03-16 09:44:27 +03:00
print IDB "f 0664 root sys usr/share/catman/u_man/cat$dirnum/$file $SRCPFX/$nextfile $PKG.man.manpages\n" ;
1997-10-31 20:33:04 +03:00
}
2001-12-22 03:54:10 +03:00
if ( @ nsswitch ) {
print IDB "d 0755 root sys var/ns/lib $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
while ( @ nsswitch ) {
$ nextfile = shift @ nsswitch ;
2003-02-04 03:14:18 +03:00
next if $ nextfile eq 'libsmbclient' ;
2001-12-22 03:54:10 +03:00
( $ filename = $ nextfile ) =~ s/^.*\/// ;
$ filename =~ s/libnss/libns/ ;
print IDB "f 0644 root sys var/ns/lib/$filename $SRCPFX/source/$nextfile $PKG.sw.base \n" ;
}
}
2001-12-05 04:04:47 +03:00
print IDB "d 01777 lp sys var/spool/samba $SRCPFX/packaging/SGI $PKG.sw.base\n" ;
1997-10-31 20:33:04 +03:00
close IDB ;
2000-03-16 09:44:27 +03:00
print "\n\n$PKG.idb file has been created\n" ;
1997-10-31 20:33:04 +03:00
sub dodir {
local ( $ dir , $ nlink ) = @ _ ;
local ( $ dev , $ ino , $ mode , $ subcount ) ;
( $ dev , $ ino , $ mode , $ nlink ) = stat ( '.' ) unless $ nlink ;
2000-03-16 09:44:27 +03:00
opendir ( DIR , '.' ) || die "Can't open current directory" ;
1997-10-31 20:33:04 +03:00
local ( @ filenames ) = sort readdir ( DIR ) ;
closedir ( DIR ) ;
if ( $ nlink == 2 ) { # This dir has no subdirectories.
for ( @ filenames ) {
next if $ _ eq '.' ;
next if $ _ eq '..' ;
$ this = substr ( $ dir , 2 ) . "/$_" ;
push ( @ allfiles , $ this ) ;
}
}
else {
$ subcount = $ nlink - 2 ;
for ( @ filenames ) {
next if $ _ eq '.' ;
next if $ _ eq '..' ;
next if $ _ eq 'CVS' ;
( $ dev , $ ino , $ mode , $ nlink ) = lstat ( $ _ ) ;
$ name = "$dir/$_" ;
$ this = substr ( $ name , 2 ) ;
$ this . = '/' if - d ;
push ( @ allfiles , $ this ) ;
next if $ subcount == 0 ; # seen all the subdirs?
next unless - d _ ;
chdir $ _ || die "Can't cd to $name" ;
& dodir ( $ name , $ nlink ) ;
chdir '..' ;
- - $ subcount ;
}
}
}
2003-01-17 02:34:51 +03:00
sub bynextdir {
1997-10-31 20:33:04 +03:00
( $ f0 , $ f1 ) = split ( /\// , $ a , 2 ) ;
( $ f0 , $ f2 ) = split ( /\// , $ b , 2 ) ;
$ f1 cmp $ f2 ;
}
2003-01-17 02:34:51 +03:00
sub byfilename {
( $ f0 , $ f1 ) = split ( /.*\// , $ a , 2 ) ;
if ( $ f1 eq "" ) { $ f1 = $ f0 } ;
( $ f0 , $ f2 ) = split ( /.*\// , $ b , 2 ) ;
if ( $ f2 eq "" ) { $ f2 = $ f0 } ;
$ f1 cmp $ f2 ;
}
1997-10-31 20:33:04 +03:00
sub bydirnum {
( $ f1 = $ a ) =~ s/^.*\/// ;
( $ f2 = $ b ) =~ s/^.*\/// ;
( $ dir1 = $ a ) =~ s/^[\D]*// ;
( $ dir2 = $ b ) =~ s/^[\D]*// ;
if ( ! ( $ dir1 <=> $ dir2 ) ) {
$ f1 cmp $ f2 ;
}
else {
$ dir1 <=> $ dir2 ;
}
}
2000-03-16 09:44:27 +03:00
sub idbsort {
( $ f0 , $ f1 , $ f2 , $ f3 ) = split ( / / , $ a , 4 ) ;
( $ f0 , $ f1 , $ f2 , $ f4 ) = split ( / / , $ b , 4 ) ;
$ f3 cmp $ f4 ;
}
2003-01-17 02:34:51 +03:00
sub get_line {
local ( $ line ) = @ _ ;
$ line =~ s/^.*=// ;
while ( ( $ cont = index ( $ line , "\\" ) ) > 0 ) {
$ _ = <MAKEFILE> ;
chomp ;
s/^\s*/ / ;
2003-06-07 02:51:28 +04:00
substr ( $ line , $ cont , 1 ) = $ _ ;
2003-01-17 02:34:51 +03:00
}
$ line =~ s/\$\(EXEEXT\)/$EXEEXT/g ;
2003-06-07 04:46:04 +04:00
$ line =~ s/\$\(srcdir\)//g ;
$ line =~ s/\$\(builddir\)//g ;
2003-01-17 02:34:51 +03:00
$ line =~ s/\$\(\S*\)\s*//g ;
$ line =~ s/\s\s*/ /g ;
@ line = split ( ' ' , $ line ) ;
return @ line ;
}