/[smeserver]/builds_bin/linksource
ViewVC logotype

Contents of /builds_bin/linksource

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.4 - (show annotations) (download)
Tue Dec 12 03:48:04 2006 UTC (17 years, 11 months ago) by slords
Branch: MAIN
Changes since 1.3: +11 -4 lines
update tools

1 #!/usr/bin/perl
2
3 use strict;
4 use warnings;
5 use RPM2;
6 use File::Copy;
7 use Getopt::Std;
8
9 my %opts;
10 getopts( "s:d:", \%opts );
11 my $src = $opts{s} || '/builds/RPMS';
12 my $dest = $opts{d} || '/builds/SRPMS';
13
14 my $rpm_flags = RPM2->vsf_nodsa;
15 my @repositories = qw(
16 /mirrors/centos/4/fasttrack/SRPMS
17 /mirrors/centos/4/updates/SRPMS
18 /mirrors/centos/4/os/SRPMS
19 /mirrors/centos/4/extras/SRPMS
20 /mirrors/rpmforge/dag/source/
21 /mirrors/atrpms/src/el4-i386/atrpms/stable/
22 /mirrors/fedora-legacy/fedora/3/updates/SRPMS/
23 /mirrors/fedora-legacy/fedora/3/os/SRPMS/
24 /builds/rpms/SRPMS/
25 /builds/old_rpms/SRPMS/
26 );
27
28 opendir RPMS, "$src" or die "Couldn't opendir $src";
29 my %rpms = map { my $x = RPM2->open_package("$src/$_", $rpm_flags); $x->tag('NAME') => $x; } grep { /\.rpm$/ } readdir RPMS;
30 closedir RPMS;
31
32 my %repos;
33 foreach my $repo (reverse @repositories)
34 {
35 my %temp_repo = map { $_ => $repo } grep { /\.rpm$/ } readdir RPMS if ( opendir RPMS, $repo );
36 closedir RPMS;
37
38 %repos = (%repos, %temp_repo);
39 }
40
41 foreach my $rpm ( sort keys %rpms )
42 {
43 my (@headers, $header);
44
45 my $rpmfix = $rpm;
46 $rpmfix =~ s@\+@\\+@g;
47
48 my @sources;
49 my $src = $rpms{$rpm}->tag('SOURCERPM');
50 push @sources, $src;
51 push @sources, $src if ($src =~ s/\.2\.el4\.rf\./\.rf\./);
52 push @sources, $src if ($src =~ s/\.el4\.rf\./\.rf\./);
53 push @sources, $src if ($src =~ s/\.el4\.at\./\.at\./);
54 push @sources, $src if ($src =~ s/\.rf\./\.dag\./);
55
56 my $found = 0;
57 foreach my $source ( @sources )
58 {
59 if( -f "$dest/$source" )
60 {
61 $found = 1;
62 last;
63 } else {
64 if ($repos{$source})
65 {
66 my $fromfile = $repos{$source} . "/$source";
67 $fromfile =~ s#//#/#g;
68 `cp --preserve=timestamps $fromfile $dest/`;
69 $found = 1;
70 last;
71 }
72
73 }
74 }
75 print "can't find SRPM ($sources[0]) for $rpm\n" unless $found;
76 }

admin@koozali.org
ViewVC Help
Powered by ViewVC 1.2.1 RSS 2.0 feed