19 |
chomp $arch; |
chomp $arch; |
20 |
|
|
21 |
my @repos = ( |
my @repos = ( |
|
"$releasedir/$smerel/smeos/$arch/CentOS/RPMS", |
|
|
"$releasedir/$smerel/smeos/$arch/SME/RPMS", |
|
|
"$releasedir/$smerel/smeos/$arch/RPMS", |
|
22 |
"$releasedir/$smerel/smeos/$arch/SME", |
"$releasedir/$smerel/smeos/$arch/SME", |
23 |
|
"$releasedir/$smerel/smeos/$arch/SME/RPMS", |
24 |
|
"$releasedir/$smerel/smeos/$arch/CentOS/RPMS", |
25 |
"$releasedir/$smerel/smeupdates/$arch/RPMS", |
"$releasedir/$smerel/smeupdates/$arch/RPMS", |
26 |
"$releasedir/$smerel/smeupdates-testing/$arch/RPMS", |
"$releasedir/$smerel/smeupdates-testing/$arch/RPMS", |
27 |
"$releasedir/$smerel/smeextras/$arch/RPMS", |
"$releasedir/$smerel/smeextras/$arch/RPMS", |
33 |
"$builds/RPMS/i586", |
"$builds/RPMS/i586", |
34 |
"$builds/RPMS/i686", |
"$builds/RPMS/i686", |
35 |
"$builds/RPMS/noarch", |
"$builds/RPMS/noarch", |
36 |
"$stagedir/RPMS", |
"$stagedir/RPMS-$arch", |
37 |
); |
); |
38 |
|
|
39 |
my @srcrepos = ( |
my @srcrepos = ( |
59 |
my %changed; |
my %changed; |
60 |
my %copy; |
my %copy; |
61 |
|
|
62 |
|
print "\nReading repos...\n"; |
63 |
foreach my $repo ( @repos ) { |
foreach my $repo ( @repos ) { |
64 |
my $r = $repo; |
my $r = $repo; |
65 |
if ( $repo =~ m{$stagedir/RPMS} ) { |
if ( $repo =~ m{$stagedir/RPMS} ) { |
70 |
$r = $1; |
$r = $1; |
71 |
} |
} |
72 |
|
|
73 |
if ( $r ne 'builds' ) { |
if ( $r eq $stagedir ) { |
74 |
|
opendir SRPMS, "$r/SRPMS-$arch" or next; |
75 |
|
foreach my $srpm ( grep { /\.rpm$/ } readdir SRPMS ) { |
76 |
|
$srpms{$r}{$srpm} = 0; |
77 |
|
$sources{$srpm} = "$r/SRPMS-$arch"; |
78 |
|
} |
79 |
|
closedir SRPMS; |
80 |
|
} elsif ( $r ne 'builds' ) { |
81 |
opendir SRPMS, "$r/SRPMS" or next; |
opendir SRPMS, "$r/SRPMS" or next; |
82 |
foreach my $srpm ( grep { /\.rpm$/ } readdir SRPMS ) { |
foreach my $srpm ( grep { /\.rpm$/ } readdir SRPMS ) { |
83 |
$srpms{$r}{$srpm} = 0; |
$srpms{$r}{$srpm} = 0; |
87 |
} |
} |
88 |
|
|
89 |
opendir RPMS, $repo or next; |
opendir RPMS, $repo or next; |
90 |
|
print " - $repo\n"; |
91 |
foreach my $pkg ( reverse sort map { RPM2->open_package("$repo/$_", $rpm_flags); } grep { /\.rpm$/ } readdir RPMS ) { |
foreach my $pkg ( reverse sort map { RPM2->open_package("$repo/$_", $rpm_flags); } grep { /\.rpm$/ } readdir RPMS ) { |
92 |
my $rpm = { name => $pkg->tag("NAME"), |
my $rpm = { name => $pkg->tag("NAME"), |
93 |
filename => join("-", map { $pkg->tag($_) } qw/name version release/) . "." . $pkg->tag("ARCH"), |
filename => join("-", map { $pkg->tag($_) } qw/name version release/) . "." . $pkg->tag("ARCH"), |
111 |
closedir RPMS; |
closedir RPMS; |
112 |
} |
} |
113 |
|
|
114 |
|
print "\nReading source repos...\n"; |
115 |
foreach my $repo ( reverse @srcrepos ) { |
foreach my $repo ( reverse @srcrepos ) { |
116 |
my %temp_repo = map { $_ => $repo } grep { /\.rpm$/ } readdir SRPMS if ( opendir SRPMS, $repo ); |
my %temp_repo = map { $_ => $repo } grep { /\.rpm$/ } readdir SRPMS if ( opendir SRPMS, $repo ); |
117 |
closedir SRPMS; |
closedir SRPMS; |
119 |
%sources = (%sources, %temp_repo); |
%sources = (%sources, %temp_repo); |
120 |
} |
} |
121 |
|
|
122 |
|
print "\nFinding latest packages...\n"; |
123 |
my @latest; |
my @latest; |
124 |
foreach my $rpm ( reverse grep { $_->{repo} =~ m{^$releasedir/$smerel/} && $_->{repo} !~ m{/sme(addons|contribs|dev|extras)$} } @rpms ) { |
foreach my $rpm ( reverse grep { $_->{repo} =~ m{^$releasedir/$smerel/} && $_->{repo} !~ m{/sme(addons|contribs|dev|extras)$} } @rpms ) { |
125 |
unless ( grep { $_->{name} eq $rpm->{name} && $_->{rpm} gt $rpm->{rpm} } @latest ) { |
unless ( grep { $_->{name} eq $rpm->{name} && $_->{rpm} gt $rpm->{rpm} } @latest ) { |
126 |
push @latest, $rpm; |
push @latest, $rpm; |
127 |
unless ( grep { $_->{repo} eq $stagedir && $_->{filename} eq $rpm->{filename} } @rpms ) { |
unless ( grep { $_->{repo} eq $stagedir && $_->{filename} eq $rpm->{filename} } @rpms ) { |
128 |
push @{$copy{"$stagedir/RPMS"}}, $rpm->{rpm}->filename; |
push @{$copy{"$stagedir/RPMS-$arch"}}, $rpm->{rpm}->filename; |
129 |
push @rpms, { name => $rpm->{name}, |
push @rpms, { name => $rpm->{name}, |
130 |
filename => $rpm->{filename}, |
filename => $rpm->{filename}, |
131 |
version => $rpm->{version}, |
version => $rpm->{version}, |
148 |
} |
} |
149 |
} |
} |
150 |
|
|
151 |
|
print "\nFinding development packages...\n"; |
152 |
my @devel; |
my @devel; |
153 |
my %versions; |
my %versions; |
154 |
foreach my $rpm ( grep { $_->{repo} eq 'builds' } @rpms ) { |
foreach my $rpm ( grep { $_->{repo} eq 'builds' } @rpms ) { |
177 |
$rpm->{repo} = 'deleted' unless grep { $_->{filename} eq $rpm->{filename} } @devel; |
$rpm->{repo} = 'deleted' unless grep { $_->{filename} eq $rpm->{filename} } @devel; |
178 |
} |
} |
179 |
|
|
180 |
print "\n"; |
print "\nFinding source packages...\n"; |
181 |
foreach my $rpm ( grep { $_->{repo} !~ m{^(builds|deleted)$} } @rpms ) { |
foreach my $rpm ( grep { $_->{repo} !~ m{^(builds|deleted)$} } @rpms ) { |
182 |
my $src; |
my $src; |
183 |
my $srpm = $rpm->{rpm}->tag("SOURCERPM"); |
my $srpm = $rpm->{rpm}->tag("SOURCERPM"); |
195 |
my $repo = $rpm->{repo}; |
my $repo = $rpm->{repo}; |
196 |
foreach my $source ( @sources ) { |
foreach my $source ( @sources ) { |
197 |
if ( $sources{$source} ) { |
if ( $sources{$source} ) { |
198 |
unless ( -f "$repo/SRPMS/$source" ) { |
if ($repo eq $stagedir) { |
199 |
push @{$copy{"$repo/SRPMS"}}, "$sources{$source}/$source"; |
push @{$copy{"$repo/SRPMS-$arch"}}, "$sources{$source}/$source" unless -f "$repo/SRPMS-$arch/$source"; |
200 |
$changed{$repo}++ unless $repo eq $stagedir; |
} else { |
201 |
|
unless ( -f "$repo/SRPMS/$source" ) { |
202 |
|
push @{$copy{"$repo/SRPMS"}}, "$sources{$source}/$source"; |
203 |
|
$changed{$repo}++; |
204 |
|
} |
205 |
} |
} |
206 |
$srpms{$repo}{$source}++; |
$srpms{$repo}{$source}++; |
207 |
$found++; |
$found++; |
215 |
foreach my $repo ( keys %srpms ) { |
foreach my $repo ( keys %srpms ) { |
216 |
foreach my $rpm ( keys %{$srpms{$repo}} ) { |
foreach my $rpm ( keys %{$srpms{$repo}} ) { |
217 |
unless ( $srpms{$repo}{$rpm} ) { |
unless ( $srpms{$repo}{$rpm} ) { |
218 |
push @remove, "$repo/SRPMS/$rpm"; |
if ($repo eq $stagedir) { |
219 |
$changed{$repo}++ unless $repo eq $stagedir; |
push @remove, "$repo/SRPMS-$arch/$rpm"; |
220 |
|
} else { |
221 |
|
push @remove, "$repo/SRPMS/$rpm"; |
222 |
|
$changed{$repo}++; |
223 |
|
} |
224 |
} |
} |
225 |
} |
} |
226 |
} |
} |
229 |
foreach my $repo ( sort keys %copy ) { |
foreach my $repo ( sort keys %copy ) { |
230 |
foreach my $rpm ( keys %{{ map { $_ => 1 } @{$copy{$repo}} }} ) { |
foreach my $rpm ( keys %{{ map { $_ => 1 } @{$copy{$repo}} }} ) { |
231 |
print "copying $rpm to $repo/\n"; |
print "copying $rpm to $repo/\n"; |
232 |
|
mkdir "$repo" unless -d "$repo"; |
233 |
system(qw(cp --preserve=timestamps), $rpm, "$repo/"); |
system(qw(cp --preserve=timestamps), $rpm, "$repo/"); |
234 |
} |
} |
235 |
} |
} |
246 |
chomp $dir; |
chomp $dir; |
247 |
print "rebuilding $dir...\n"; |
print "rebuilding $dir...\n"; |
248 |
system(qw(createrepo), "$dir"); |
system(qw(createrepo), "$dir"); |
249 |
|
system(qw(rm -rf), "$dir/.olddata") if -d "$dir/.olddata"; |
250 |
system(qw(repoview), "$dir"); |
system(qw(repoview), "$dir"); |
251 |
|
system(qw(rm -rf), "$dir/.repodata") if "$dir/.repodata"; |
252 |
} |
} |