/[CCFs]/ccfdev/packages/devel/lib/uploadccf
ViewVC logotype

Annotation of /ccfdev/packages/devel/lib/uploadccf

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.4 - (hide annotations)
Tue Apr 3 09:55:14 2001 UTC (23 years, 8 months ago) by gvacanti
Branch: MAIN
Changes since 1.3: +2 -2 lines
Fix documentation typo.

1 gvacanti 1.1 #!/usr/local/bin/perl
2     #
3     # uploadccf
4    
5     BEGIN {
6     my $fail = 0;
7     my @mods = qw(Net::FTP Mail::Send);
8     foreach (@mods) {
9     unless (eval "require $_") {
10     warn "Could not find required module $_: $@.\n";
11     $fail++;
12     }
13     }
14     die "Some of the required modules could not be found.\n"if $fail;
15     }
16    
17    
18     require 5.001;
19    
20 gvacanti 1.4 $VERSION = "1.0";
21 gvacanti 1.1
22     use Getopt::Long;
23    
24     =head1 NAME
25    
26     uploadccf -
27    
28     =head1 SYNOPSIS
29    
30     uploadccf package ...
31    
32     =head1 DESCRIPTION
33    
34    
35     =head1 EXAMPLES
36    
37     =over 4
38    
39     =item *
40    
41     Submit packages foo-1.2.tgz and bar-2.4.tgz
42    
43 gvacanti 1.4 C< uploadccf foo-1.2.tgz bar-2.4.tgz>
44 gvacanti 1.1
45     =back
46    
47     =head1 AUTHOR
48    
49     Giuseppe Vacanti <gvacanti@astro.estec.esa.nl>
50    
51     =cut
52    
53    
54     # Configure these for the remote FTP server:
55     $server = "astro.estec.esa.nl";
56     $remote_dir = "/pub/ccflib/private/incoming/";
57     $user = "anonymous";
58    
59     $ccflib = 'ccflib@astro.estec.esa.nl';
60    
61     # Get program name
62     $progname = $0;
63     $progname =~ s/.*\///;
64    
65     # Process each ".tgz" file in turn
66     my @flist;
67    
68     foreach(@ARGV){
69     if(/-v/){
70     print "$progname - $VERSION\n";
71     exit(0);
72     }
73     if(-r){
74     if(! /.+\.tgz/){
75     warn("$_ is not a package and it'll be ignored.\n");
76     next;
77     }
78     push @flist, $_;
79     } else {
80     warn("$_ cannot be read.\n");
81     }
82     }
83    
84     die "No files to transfer.\n" unless @flist;
85    
86     my $ftp = Net::FTP->new("$server") or die "Cannot connect to $server: $!\n";
87     $ftp->login($user) or die "Cannot login as $user: $!\n";
88     $ftp->binary();
89     $ftp->cwd($remote_dir) or die "Cannot change directory to $remote_dir: $!\n";;
90     my @oklist;
91    
92     foreach(@flist){
93     $ftp->put($_) ? push @oklist, $_ : warn("Could not tranfer $_: $!\n");
94     }
95    
96 gvacanti 1.3 foreach (@oklist) {
97     $_ =~ s/^.*\///;
98     }
99    
100 gvacanti 1.1 my $msg = Mail::Send->new(
101 gvacanti 1.2 Subject => "CCF package upload: @oklist",
102 gvacanti 1.1 To => $ccflib,
103     );
104     my $fh = $msg->open();
105     print $fh "\nThe following files were uploaded to $server:\n";
106     foreach (@oklist) {
107     print $fh " $_\n";
108     }
109     $fh->close();
110     print "Notification message sent to $ccflib\n";

  ViewVC Help
Powered by ViewVC 1.1.27