New version, with control*.txt
git-svn-id: https://fhem.svn.sourceforge.net/svnroot/fhem/trunk/fhem@1672 2b470e98-0d58-463d-a4d8-8e2adae1ed80
This commit is contained in:
@@ -1,5 +1,7 @@
|
|||||||
#!/usr/bin/perl
|
#!/usr/bin/perl
|
||||||
|
|
||||||
|
use IO::File;
|
||||||
|
|
||||||
# Server-Side script to check out the fhem SVN repository, and upload the
|
# Server-Side script to check out the fhem SVN repository, and upload the
|
||||||
# changed files to the server
|
# changed files to the server
|
||||||
|
|
||||||
@@ -33,6 +35,7 @@ if($ndiff != 4) { # more than the standard stuff is different
|
|||||||
my @filelist = (
|
my @filelist = (
|
||||||
"./fhem.pl.txt",
|
"./fhem.pl.txt",
|
||||||
"FHEM/.*.pm",
|
"FHEM/.*.pm",
|
||||||
|
"FHEM/FhemUtils/.*.pm",
|
||||||
"webfrontend/pgm2/.*",
|
"webfrontend/pgm2/.*",
|
||||||
"docs/commandref.html",
|
"docs/commandref.html",
|
||||||
"docs/faq.html",
|
"docs/faq.html",
|
||||||
@@ -111,19 +114,21 @@ my $uploaddir2="UPLOAD2";
|
|||||||
system("mkdir -p $uploaddir2");
|
system("mkdir -p $uploaddir2");
|
||||||
|
|
||||||
my %filelist2 = (
|
my %filelist2 = (
|
||||||
"./fhem.pl.txt" => ".",
|
"./fhem.pl.txt" => { type=>",fhem,pgm2,", dir=>"." },
|
||||||
"./CHANGED" => ".",
|
"./CHANGED" => { type=>",fhem,pgm2,", dir=>"." },
|
||||||
"FHEM/.*.pm" => "FHEM",
|
"FHEM/.*.pm" => { type=>",fhem,pgm2,", dir=>"FHEM" },
|
||||||
"../culfw/Devices/CUL/.*.hex" => "FHEM",
|
"FHEM/FhemUtils/.*.pm" => { type=>",fhem,pgm2,", dir=>"FHEM/FhemUtils"},
|
||||||
"webfrontend/pgm2/.*.pm\$" => "FHEM",
|
"../culfw/Devices/CUL/.*.hex" => { type=>",fhem,pgm2,", dir=>"FHEM"},
|
||||||
"webfrontend/pgm2/.*" => "www/pgm2",
|
"webfrontend/pgm2/.*.pm\$" => { type=>",pgm2,", dir=>"FHEM"},
|
||||||
"docs/commandref.html" => "www/pgm2",
|
"webfrontend/pgm2/.*" => { type=>",pgm2,", dir=>"www/pgm2"},
|
||||||
"docs/faq.html" => "www/pgm2",
|
"docs/commandref.html" => { type=>",pgm2,", dir=>"www/pgm2"},
|
||||||
"docs/HOWTO.html" => "www/pgm2",
|
"docs/faq.html" => { type=>",pgm2,", dir=>"www/pgm2"},
|
||||||
"docs/fhem.*.png" => "www/pgm2",
|
"docs/HOWTO.html" => { type=>",pgm2,", dir=>"www/pgm2"},
|
||||||
"docs/.*.jpg" => "www/pgm2",
|
"docs/fhem.*.png" => { type=>",pgm2,", dir=>"www/pgm2"},
|
||||||
|
"docs/.*.jpg" => { type=>",pgm2,", dir=>"www/pgm2"},
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|
||||||
# Can't make negative regexp to work, so do it with extra logic
|
# Can't make negative regexp to work, so do it with extra logic
|
||||||
my %skiplist2 = (
|
my %skiplist2 = (
|
||||||
"www/pgm2" => ".pm\$",
|
"www/pgm2" => ".pm\$",
|
||||||
@@ -133,11 +138,12 @@ my %skiplist2 = (
|
|||||||
my %filetime2;
|
my %filetime2;
|
||||||
my %filesize2;
|
my %filesize2;
|
||||||
my %filedir2;
|
my %filedir2;
|
||||||
|
my %filetype2;
|
||||||
chdir("$homedir/fhem");
|
chdir("$homedir/fhem");
|
||||||
foreach my $fspec (keys %filelist2) {
|
foreach my $fspec (keys %filelist2) {
|
||||||
$fspec =~ m,^(.+)/([^/]+)$,;
|
$fspec =~ m,^(.+)/([^/]+)$,;
|
||||||
my ($dir,$pattern) = ($1, $2);
|
my ($dir,$pattern) = ($1, $2);
|
||||||
my $tdir = $filelist2{$fspec};
|
my $tdir = $filelist2{$fspec}{dir};
|
||||||
opendir DH, $dir || die("Can't open $dir: $!\n");
|
opendir DH, $dir || die("Can't open $dir: $!\n");
|
||||||
foreach my $file (grep { /$pattern/ && -f "$dir/$_" } readdir(DH)) {
|
foreach my $file (grep { /$pattern/ && -f "$dir/$_" } readdir(DH)) {
|
||||||
next if($skiplist2{$tdir} && $file =~ m/$skiplist2{$tdir}/);
|
next if($skiplist2{$tdir} && $file =~ m/$skiplist2{$tdir}/);
|
||||||
@@ -147,6 +153,7 @@ foreach my $fspec (keys %filelist2) {
|
|||||||
$mt[5]+1900, $mt[4]+1, $mt[3], $mt[2], $mt[1], $mt[0];
|
$mt[5]+1900, $mt[4]+1, $mt[3], $mt[2], $mt[1], $mt[0];
|
||||||
$filesize2{"$tdir/$file"} = $st[7];
|
$filesize2{"$tdir/$file"} = $st[7];
|
||||||
$filedir2{"$tdir/$file"} = $dir;
|
$filedir2{"$tdir/$file"} = $dir;
|
||||||
|
$filetype2{"$tdir/$file"} = $filelist2{$fspec}{type};
|
||||||
}
|
}
|
||||||
closedir(DH);
|
closedir(DH);
|
||||||
}
|
}
|
||||||
@@ -163,19 +170,30 @@ if(open FH, "filetimes.txt") {
|
|||||||
close(FH);
|
close(FH);
|
||||||
}
|
}
|
||||||
|
|
||||||
open FH, ">filetimes.txt" || die "Can't open filetimes.txt: $!\n";
|
open FTP, ">script.txt" || die "Can't open script.txt: $!\n";
|
||||||
open CTL, ">controls.txt" || die "Can't open controls.txt: $!\n";
|
|
||||||
open FTP, ">script.txt" || die "Can't open script.txt: $!\n";
|
|
||||||
print FTP "cd fhem/fhemupdate2\n";
|
print FTP "cd fhem/fhemupdate2\n";
|
||||||
print FTP "pas\n"; # Without passive only 28 files can be transferred
|
print FTP "pas\n"; # Without passive only 28 files can be transferred
|
||||||
|
|
||||||
|
open FH, ">filetimes.txt" || die "Can't open filetimes.txt: $!\n";
|
||||||
print FTP "put filetimes.txt\n";
|
print FTP "put filetimes.txt\n";
|
||||||
print FTP "put controls.txt\n";
|
|
||||||
|
my %controls = (fhem=>0, pgm2=>0);
|
||||||
|
foreach my $k (keys %controls) {
|
||||||
|
my $fname = "controls_$k.txt";
|
||||||
|
$controls{$k} = new IO::File ">$fname" || die "Can't open $fname: $!\n";
|
||||||
|
print FTP "put $fname\n";
|
||||||
|
}
|
||||||
|
|
||||||
my $cnt;
|
my $cnt;
|
||||||
foreach my $f (sort keys %filetime2) {
|
foreach my $f (sort keys %filetime2) {
|
||||||
my $fn = $f;
|
my $fn = $f;
|
||||||
$fn =~ s/.txt$// if($fn =~ m/.pl.txt$/);
|
$fn =~ s/.txt$// if($fn =~ m/.pl.txt$/);
|
||||||
print FH "$filetime2{$f} $filesize2{$f} $fn\n";
|
print FH "$filetime2{$f} $filesize2{$f} $fn\n";
|
||||||
print CTL "UPD $filetime2{$f} $filesize2{$f} $fn\n";
|
foreach my $k (keys %controls) {
|
||||||
|
my $fh = $controls{$k};
|
||||||
|
print $fh "UPD $filetime2{$f} $filesize2{$f} $fn\n"
|
||||||
|
if(",$filetype2{$f}," =~ m/,$k,/);
|
||||||
|
}
|
||||||
my $newfname = $f;
|
my $newfname = $f;
|
||||||
if(!$oldtime{$f} || $oldtime{$f} ne $filetime2{$f}) {
|
if(!$oldtime{$f} || $oldtime{$f} ne $filetime2{$f}) {
|
||||||
$f =~ m,^(.*)/([^/]*)$,;
|
$f =~ m,^(.*)/([^/]*)$,;
|
||||||
@@ -189,13 +207,16 @@ foreach my $f (sort keys %filetime2) {
|
|||||||
close FH;
|
close FH;
|
||||||
close FTP;
|
close FTP;
|
||||||
|
|
||||||
if(open(ADD, "../contrib/fhemupdate.control")) {
|
foreach my $k (keys %controls) {
|
||||||
while(my $l = <ADD>) {
|
if(open(ADD, "../contrib/fhemupdate.control.$k")) {
|
||||||
print CTL $l;
|
while(my $l = <ADD>) {
|
||||||
|
my $fh = $controls{$k};
|
||||||
|
print $fh $l;
|
||||||
|
}
|
||||||
|
close ADD;
|
||||||
}
|
}
|
||||||
close ADD;
|
close $controls{$k};
|
||||||
}
|
}
|
||||||
close CTL;
|
|
||||||
|
|
||||||
if($cnt) {
|
if($cnt) {
|
||||||
print "FTP Upload needed for $cnt files\n";
|
print "FTP Upload needed for $cnt files\n";
|
||||||
|
|||||||
Reference in New Issue
Block a user