⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 nightly-rsync

📁 Rsync 3.0.5 source code
💻
字号:
#!/usr/bin/perluse strict;# This script expects the directory ~/samba-rsync-ftp to exist and to be a# copy of the /home/ftp/pub/rsync dir on samba.org.  It also requires a# pristine CVS checkout of rsync (don't use your normal rsync build dir# unless you're 100% sure that there are not unchecked-in changes).## If this is run with -ctu, it will make an updated "nightly" tar file in# the nightly dir.  It will also remove any old tar files, regenerate the# HTML man pages in the nightly dir, and then rsync the changes to the# samba.org server.use Getopt::Long;use Date::Format;# Where the local copy of /home/ftp/pub/rsync/dev/nightly should be updated.our $dest = $ENV{HOME} . '/samba-rsync-ftp/dev/nightly';our $nightly_symlink = "$dest/rsync-HEAD.tar.gz";our($make_tar, $upload, $help_opt);&Getopt::Long::Configure('bundling');&usage if !&GetOptions(    'make-tar|t' => \$make_tar,    'upload|u' => \$upload,    'help|h' => \$help_opt,) || $help_opt;our $name = time2str('rsync-HEAD-%Y%m%d-%H%M%Z', time, 'GMT');our $ztoday = time2str('%d %b %Y', time);our $today = $ztoday;our $gen_target = $upload ? 'gensend' : 'gen';die "$dest does not exist\n" unless -d $dest;die "There is no .git dir in the current directory.\n" unless -d '.git';die "There is no rsync checkout in the current directory.\n" unless -f 'rsyncd.conf.yo';if ($make_tar) {    open(IN, '-|', 'git status') or die $!;    my $status = join('', <IN>);    close IN;    die "The checkout is not clean:\n", $status unless $status =~ /\nnothing to commit \(working directory clean\)/;    die "The checkout is not on the master branch.\n" unless $status =~ /^# On branch master\n/;    system "make $gen_target" and die "make $gen_target failed!\n";    my @extra_files;    open(IN, '<', 'Makefile.in') or die "Couldn't open Makefile.in: $!\n";    while (<IN>) {	if (s/^GENFILES=//) {	    while (s/\\$//) {		$_ .= <IN>;	    }	    @extra_files = split(' ', $_);	    last;	}    }    close IN;    print "Creating $name.tar.gz\n";    system "rsync -a @extra_files $name/";    system "git archive --format=tar --prefix=$name/ HEAD | tar xf -";    system "support/git-set-file-times --prefix=$name/";    system "fakeroot tar czf $dest/$name.tar.gz $name; rm -rf $name";    unlink($nightly_symlink);    symlink("$name.tar.gz", $nightly_symlink);}foreach my $fn (qw( rsync.yo rsyncd.conf.yo )) {    my $yo_tmp = "$dest/$fn";    (my $html_fn = "$dest/$fn") =~ s/\.yo/.html/;    open(IN, '<', $fn) or die $!;    undef $/; $_ = <IN>; $/ = "\n";    close IN;    s/^(manpage\([^)]+\)\(\d+\)\()[^)]+(\).*)/$1$today$2/m;    #s/^(This man ?page is current for version) \S+ (of rsync)/$1 $version $2/m;    open(OUT, '>', $yo_tmp) or die $!;    print OUT $_;    close OUT;    system 'yodl2html', '-o', $html_fn, $yo_tmp;    unlink($yo_tmp);}chdir($dest) or die $!;my $cnt = 0;open(PIPE, '-|', 'ls -1t rsync-HEAD-*') or die $!;while (<PIPE>) {    chomp;    next if $cnt++ < 10;    unlink($_);}close PIPE;system 'ls -ltr';if ($upload) {    my $opt = '';    if (defined $ENV{RSYNC_PARTIAL_DIR}) {	$opt = " -f 'R $ENV{RSYNC_PARTIAL_DIR}'";    }    system "rsync$opt -aviHP --delete-after . samba.org:/home/ftp/pub/rsync/dev/nightly";}exit;sub usage{    die <<EOT;Usage: nightly-rsync [OPTIONS] -t, --make-tar    create a new tar file in $dest -u, --upload      upload the revised nightly dir to samba.org -h, --help        display this helpEOT}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -