/[smeserver]/builds_bin/linksource
ViewVC logotype

Diff of /builds_bin/linksource

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

Revision 1.4 by slords, Tue Dec 12 03:48:04 2006 UTC Revision 1.7 by slords, Mon Jan 22 16:37:24 2007 UTC
# Line 22  my @repositories = qw( Line 22  my @repositories = qw(
22          /mirrors/fedora-legacy/fedora/3/updates/SRPMS/          /mirrors/fedora-legacy/fedora/3/updates/SRPMS/
23          /mirrors/fedora-legacy/fedora/3/os/SRPMS/          /mirrors/fedora-legacy/fedora/3/os/SRPMS/
24          /builds/rpms/SRPMS/          /builds/rpms/SRPMS/
         /builds/old_rpms/SRPMS/  
25          );          );
26    
27  opendir RPMS, "$src" or die "Couldn't opendir $src";  opendir RPMS, "$src" or die "Couldn't opendir $src";
28  my %rpms = map { my $x = RPM2->open_package("$src/$_", $rpm_flags); $x->tag('NAME') => $x; } grep { /\.rpm$/ } readdir RPMS;  my @rpms = map { RPM2->open_package("$src/$_", $rpm_flags) } grep { /\.rpm$/ } readdir RPMS;
29  closedir RPMS;  closedir RPMS;
30    
31    opendir SRPMS, "$dest" or die "Couldn't opendir $dest";
32    my %srpms = map { $_ => 0 } grep { /\.rpm$/ } readdir SRPMS;
33    closedir SRPMS;
34    
35  my %repos;  my %repos;
36  foreach my $repo (reverse @repositories)  foreach my $repo (reverse @repositories)
37  {  {
# Line 38  foreach my $repo (reverse @repositories) Line 41  foreach my $repo (reverse @repositories)
41      %repos = (%repos, %temp_repo);      %repos = (%repos, %temp_repo);
42  }  }
43    
44  foreach my $rpm ( sort keys %rpms )  foreach my $rpm ( sort @rpms )
45  {  {
46      my (@headers, $header);      my (@headers, $header);
47    
# Line 46  foreach my $rpm ( sort keys %rpms ) Line 49  foreach my $rpm ( sort keys %rpms )
49      $rpmfix =~ s@\+@\\+@g;      $rpmfix =~ s@\+@\\+@g;
50    
51      my @sources;      my @sources;
52      my $src = $rpms{$rpm}->tag('SOURCERPM');      my $src = $rpm->tag('SOURCERPM');
53      push @sources, $src;      push @sources, $src;
54      push @sources, $src if ($src =~ s/\.2\.el4\.rf\./\.rf\./);      push @sources, $src if ($src =~ s/\.2\.el4\.rf\./\.rf\./);
55      push @sources, $src if ($src =~ s/\.el4\.rf\./\.rf\./);      push @sources, $src if ($src =~ s/\.el4\.rf\./\.rf\./);
# Line 59  foreach my $rpm ( sort keys %rpms ) Line 62  foreach my $rpm ( sort keys %rpms )
62          if( -f "$dest/$source" )          if( -f "$dest/$source" )
63          {          {
64              $found = 1;              $found = 1;
65                $srpms{$source}++;
66              last;              last;
67          } else {          } else {
68              if ($repos{$source})              if ($repos{$source})
69              {              {
70                  my $fromfile = $repos{$source} . "/$source";                  my $fromfile = $repos{$source} . "/$source";
71                  $fromfile =~ s#//#/#g;                  $fromfile =~ s#//#/#g;
72                  `cp --preserve=timestamps $fromfile $dest/`;                  print "copying $source\n";
73                    system(qw(cp --preserve=timestamps), $fromfile, "$dest/");
74                  $found = 1;                  $found = 1;
75                    $srpms{$source}++;
76                  last;                  last;
77              }              }
78    
79          }          }
80      }      }
81      print "can't find SRPM ($sources[0]) for $rpm\n" unless $found;      print "can't find SRPM ($sources[0]) for ", $rpm->as_nvre(), "\n" unless $found;
82    }
83    
84    foreach my $srpm ( grep { $srpms{$_} == 0 } keys %srpms ) {
85        print "removing unused SRPM ($srpm)\n";
86        unlink "$dest/$srpm";
87  }  }


Legend:
Removed lines/characters  
Changed lines/characters
  Added lines/characters

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