This is the mail archive of the libc-hacker@sourceware.cygnus.com mailing list for the glibc project.
Note that libc-hacker is a closed list. You may look at the archives of this list, but subscription and posting are not open.
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |
Since I'm behind a slow connection, I don't like to do issue a 'cvs update' for the complete glibc sources. Instead I prefer to only get the changed files. I've written a small perl script that parses the emails send to glibc-cvs and generates minimal cvs update commands. I'm appending the script in the hope that others find it useful and might want to use and enhance it (patches are welcome!). The script should work not only for glibc-cvs but also for egcs-cvs but I don't want to circulate it further in the current state. I'm not sure if the script handles all cvs mails correctly, this needs some more testing. In future I'd like to add an option for automatic generation of diffs. Andreas #!/usr/bin/perl -w # Copyright 1999, Andreas Jaeger, aj@arthur.rhein-neckar.de # # Parse cvs mail from glibc and generate cvs commands # Todo: # - Does creation of new directories work # - Creation of diff files use vars qw ($state @files); use vars qw ($lastdir $current_tag @state_log); # Data structure: hash of arrays # hash entry is tag - or "" for main branch use vars qw (%modified %added %removed %log); $current_tag = ""; $state = 0; @state_log = ("", "(added)", "(removed)", "(modified)", ""); while (<>) { chop; $state = 0, next if /^$/; $state = 1, next if /^Added files:/; $state = 2, next if /^Removed files:/; $state = 3, next if /^Modified files:/; $state = 4, next if /^Log message:/; if ($state == 0) { #print "Skipped: $_\n"; next; } if ($state >= 1 && $state <= 3) { @files = &parse_files ($_); push @{$added{$current_tag}}, @files if $state == 1; push @{$removed{$current_tag}}, @files if $state == 2; push @{$modified{$current_tag}}, @files if $state == 3; push @{$log{$current_tag}}, map {"File: " . $_ . " " . $state_log[$state]. ":"} @files; next; } if ($state == 4) { push @{$log{$current_tag}}, $_; } } &output (); sub output { my ($tag, %seen, $cvs_tag); my (@commands); %seen = (); foreach (keys %added) { $seen{$_} = 1; } foreach (keys %removed) { $seen{$_} = 1; } foreach (keys %modified) { $seen{$_} = 1; } foreach $tag(sort keys %seen) { my (%files, %file_list); print "\n\nTag: $tag\n"; print '=' x 40, "\n"; $cvs_tag = ""; %files = (); if ($tag ne "") { $cvs_tag = "-r $tag"; } if (exists $added{$tag}) { print "\n\nAdded:\n"; map {print "$_\n";$files{$_}=1;} @{$added{$tag}}; } if (exists $removed{$tag}) { print "\n\nRemoved:\n"; map {print "$_\n";$files{$_}=1;} @{$removed{$tag}}; } if (exists $modified{$tag}) { print "\n\nModified:\n"; map {print "$_\n";$files{$_}=1;} @{$modified{$tag}}; } if (exists $log{$tag}) { print "\n\nLog:\n"; map {print "$_\n";} @{$log{$tag}}; } $file_list = join ' ', sort keys %files; push @commands, "cvs update $cvs_tag $file_list"; } print '=' x 40, "\n"; print "\nYou can issue:\n"; foreach (@commands) { print "$_\n"; } } sub parse_files { my ($line) = @_; my ($filelist, @files, $dir, $tag); if ($line =~ /Tag:/) { my ($before, $after); ($tag) = ($line =~ /Tag:\s([-a-z_A-Z0-9]+)\s/); $line =~ s/Tag:\s([-a-z_A-Z0-9]+)\s//; $current_tag = $tag; } else { $current_tag = ""; } if ($line =~ /:/) { ($dir, $filelist) = ($line =~ /^\s+(\S+)\s*:\s(.*)$/); $lastdir = $dir; } else { $dir = $lastdir; ($filelist) = ($line =~ /^\s+(.*)$/); } @files = map {"$dir/$_"} split /\s/,$filelist; @files; } -- Andreas Jaeger aj@arthur.rhein-neckar.de jaeger@informatik.uni-kl.de for pgp-key finger ajaeger@aixd1.rhrk.uni-kl.de
Index Nav: | [Date Index] [Subject Index] [Author Index] [Thread Index] | |
---|---|---|
Message Nav: | [Date Prev] [Date Next] | [Thread Prev] [Thread Next] |