aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorFrancois Pons <fpons@mandriva.com>2000-09-03 17:03:33 +0000
committerFrancois Pons <fpons@mandriva.com>2000-09-03 17:03:33 +0000
commit6b947817a5c48e175a43f95ab6d59cfec58f4e67 (patch)
treebc3eff5bb42e0ad9839daf5719db55cb196b99d8
parent75d42db69052672a2e8ce38303577e826ff380f7 (diff)
downloadrpmtools-6b947817a5c48e175a43f95ab6d59cfec58f4e67.tar
rpmtools-6b947817a5c48e175a43f95ab6d59cfec58f4e67.tar.gz
rpmtools-6b947817a5c48e175a43f95ab6d59cfec58f4e67.tar.bz2
rpmtools-6b947817a5c48e175a43f95ab6d59cfec58f4e67.tar.xz
rpmtools-6b947817a5c48e175a43f95ab6d59cfec58f4e67.zip
*** empty log message ***
-rwxr-xr-xgenbasefiles14
-rw-r--r--rpmtools.pm50
-rw-r--r--rpmtools.spec8
3 files changed, 67 insertions, 5 deletions
diff --git a/genbasefiles b/genbasefiles
index 5a68704..03411a9 100755
--- a/genbasefiles
+++ b/genbasefiles
@@ -44,15 +44,27 @@ sub main {
my @unresolved = $params->get_unresolved_provides_files();
if (@unresolved > 0) {
foreach (@unresolved) {
- print STDERR "found requires on file not yet found [$_], forcing a second pass\n";
+ print STDERR "found requires on file not yet found [$_], forcing two other linked pass\n";
}
#- cleaning.
$params->keep_only_cleaned_provides_files();
+ #- much more severe cleaning here, so we are sure with 2 pass.
+ #- else it may happen that a package need an inexistant file,
+ #- which will be in the provides forever, event after fixing the
+ #- package.
+ $params->{provides} = {};
+
+ #- compute (avoiding depslist computation on first one.
foreach (@files) {
print STDERR "reading (second pass) $_\n";
/\.rpm$/ ? $params->read_rpms($_) : $params->read_hdlists($_);
+ }
+ $params->keep_only_cleaned_provides_files();
+ foreach (@files) {
+ print STDERR "reading (third pass) $_\n";
+ /\.rpm$/ ? $params->read_rpms($_) : $params->read_hdlists($_);
$params->compute_depslist();
}
}
diff --git a/rpmtools.pm b/rpmtools.pm
index 85a6e12..6ccb303 100644
--- a/rpmtools.pm
+++ b/rpmtools.pm
@@ -53,10 +53,18 @@ sub compute_depslist {
my @info = grep { ! exists $_->{id} } values %{$params->{info}};
#- speed up the search by giving a provide from all packages.
+ #- and remove all dobles for each one !
foreach (@info) {
push @{$params->{provides}{$_->{name}} ||= []}, $_->{name};
}
+ #- remove all dobles for each provides.
+ foreach (keys %{$params->{provides}}) {
+ $params->{provides}{$_} or next;
+ my %provides; @provides{@{$params->{provides}{$_}}} = ();
+ $params->{provides}{$_} = [ keys %provides ];
+ }
+
#- search for entries in provides, if such entries are found,
#- another pass has to be done. TODO.
@@ -231,13 +239,49 @@ sub read_depslist {
1;
}
+#- relocate depslist array to use only the most recent packages,
+#- reorder info hashes too in the same manner.
+sub relocate_depslist {
+ my ($params) = @_;
+ my $relocated_entries = 0;
+
+ foreach (@{$params->{depslist} || []}) {
+ if ($params->{info}{$_->{name}} != $_) {
+ #- at this point, it is sure there is a package that
+ #- is multiply defined and this should be fixed.
+ #- first correct info hash, then a second pass on depslist
+ #- is required to relocate its entries.
+ my $cmp_version = compare_version($_->{version}, $params->{info}{$_->{name}});
+ if ($cmp_version > 0 || $cmp_version == 0 &&
+ compare_version($_->{release}, $params->{info}{$_->{name}}) > 0) {
+ $params->{info}{$_->{name}} = $_;
+ ++$relocated_entries;
+ }
+ }
+ }
+
+ if ($relocated_entries) {
+ my $n = scalar(@{$params->{depslist}}) - 1;
+ for (0..$n) {
+ my $pkg = $params->{depslist}[$_];
+ $params->{depslist}[$_] = $params->{info}{$pkg->{name}};
+ }
+ }
+
+ $relocated_entries;
+}
+
#- write depslist.ordered file according to info in params.
sub write_depslist {
my ($params, $FILE, $min, $max) = @_;
- foreach (grep { (! defined $min || $_->{id} >= $min) && (! defined $max || $_->{id} <= $max) }
- sort { $a->{id} <=> $b->{id} } values %{$params->{info}}) {
- printf $FILE "%s-%s-%s %s %s\n", $_->{name}, $_->{version}, $_->{release}, $_->{size}, $_->{deps};
+ $min > 0 or $min = 0;
+ defined $max && $max < scalar(@{$params->{depslist} || []}) or $max = scalar(@{$params->{depslist} || []}) - 1;
+ $max >= $min or return;
+
+ for ($min..$max) {
+ my $pkg = $params->{depslist}[$_];
+ printf $FILE "%s-%s-%s %s %s\n", $pkg->{name}, $pkg->{version}, $pkg->{release}, $pkg->{size}, $pkg->{deps};
}
1;
}
diff --git a/rpmtools.spec b/rpmtools.spec
index 1f7e4cf..9387569 100644
--- a/rpmtools.spec
+++ b/rpmtools.spec
@@ -1,5 +1,5 @@
%define name rpmtools
-%define release 8mdk
+%define release 9mdk
# do not modify here, see Makefile in the CVS
%define version 1.2
@@ -99,6 +99,12 @@ rm -rf $RPM_BUILD_ROOT
%changelog
+* Sun Sep 03 2000 François Pons <fpons@mandrakesoft.com> 1.2-9mdk
+- fixed write_depslist to avoid resorting, fixes dobles.
+- fixed compute_depslist to use only remove dobles in provides.
+- fixed genbasefiles to do 3 pass instead of 2, because provides is no more
+ used in such a case.
+
* Fri Sep 01 2000 François Pons <fpons@mandrakesoft.com> 1.2-8mdk
- fixed read_provides with unresolved dependancies.