diff options
author | Francois Pons <fpons@mandriva.com> | 2002-06-20 09:05:53 +0000 |
---|---|---|
committer | Francois Pons <fpons@mandriva.com> | 2002-06-20 09:05:53 +0000 |
commit | ddd7a01c179588e9af4a28bce4b6b41c3324e5d2 (patch) | |
tree | 227f1f6999b3c729fce4ebaa9364189b544c8b6d | |
parent | 887d931e41c313033a93d24601a91e5f33afe326 (diff) | |
download | urpmi-ddd7a01c179588e9af4a28bce4b6b41c3324e5d2.tar urpmi-ddd7a01c179588e9af4a28bce4b6b41c3324e5d2.tar.gz urpmi-ddd7a01c179588e9af4a28bce4b6b41c3324e5d2.tar.bz2 urpmi-ddd7a01c179588e9af4a28bce4b6b41c3324e5d2.tar.xz urpmi-ddd7a01c179588e9af4a28bce4b6b41c3324e5d2.zip |
3.5-8mdk
-rw-r--r-- | Makefile | 5 | ||||
-rw-r--r-- | test/bugkernel22.tar.bz2 | bin | 0 -> 242435 bytes | |||
-rwxr-xr-x | test/do_alltests | 22 | ||||
-rwxr-xr-x | urpmi | 4 | ||||
-rw-r--r-- | urpmi.spec | 7 | ||||
-rwxr-xr-x | urpmq | 188 |
6 files changed, 132 insertions, 94 deletions
@@ -13,7 +13,7 @@ NAME = urpmi TAR = $(NAME).tar.bz2 LOG = $(NAME).logrotate -.PHONY: install clean rpm +.PHONY: install clean rpm test install: $(MAKE) -C po $@ @@ -36,6 +36,9 @@ install: autoirpm.update-all: %: %.cc $(CXX) $(CFLAGS) $< $(LIBRPM) -o $@ +test: + cd test; ./do_alltests + tar: clean cd .. ; tar cf - urpmi | bzip2 -9 >$(TAR) diff --git a/test/bugkernel22.tar.bz2 b/test/bugkernel22.tar.bz2 Binary files differnew file mode 100644 index 00000000..dd96ded9 --- /dev/null +++ b/test/bugkernel22.tar.bz2 diff --git a/test/do_alltests b/test/do_alltests new file mode 100755 index 00000000..90ef6ae9 --- /dev/null +++ b/test/do_alltests @@ -0,0 +1,22 @@ +#!/bin/sh + +LANGUAGE=C +LANG=C +export LANGUAGE +export LANG + +for t in *.tar.bz2; do + rm -rf tmp + mkdir tmp + cd tmp + tar xvfj ../$t + dir=$(dirname $(find . -name dotest)) + cd $dir + ./dotest || exit 1 + perl -pi -e 's/.*urpmi called with.*//' urpmi_env.log urpmi_env_correct.log + diff urpmi_env.log urpmi_env_correct.log || exit 2 + cd - + cd .. +done + +rm -rf tmp @@ -62,7 +62,7 @@ Copyright (C) 1999, 2000, 2001, 2002 MandrakeSoft. This is free software and may be redistributed under the terms of the GNU GPL. usage: -") . _(" --help - print this help message. +", $urpm::VERSION) . _(" --help - print this help message. ") . _(" --update - use only update media. ") . _(" --media - use only the media listed by comma. ") . _(" --auto - automatically select a good package in choices. @@ -86,7 +86,7 @@ usage: ") . _(" -q - quiet mode. ") . _(" -v - verbose mode. ") . "\n" . _(" names or rpm files given on command line are installed. -", $urpm::VERSION); +"); exit(0); } @@ -2,7 +2,7 @@ Name: urpmi Version: 3.5 -Release: 7mdk +Release: 8mdk License: GPL Source0: %{name}.tar.bz2 Source1: %{name}.logrotate @@ -144,6 +144,11 @@ fi %changelog +* Thu Jun 20 2002 François Pons <fpons@mandrakesoft.com> 3.5-8mdk +- added back version lost for some time (Guillaume Rousse). +- added --list to urpmq to list package. +- added regression test (explicit make test for instance). + * Wed Jun 19 2002 François Pons <fpons@mandrakesoft.com> 3.5-7mdk - fixed urpmq to no more use old resolution methods in urpm.pm. - fixed urpmq to take care of choices correctly (no default selection). @@ -52,6 +52,7 @@ usage: ") . _(" --media - use only the media listed by comma. ") . _(" --auto-select - automatically select packages for upgrading the system. ") . _(" --fuzzy - impose fuzzy search (same as -y). +") . _(" --list - list package available. ") . _(" --src - next package is a source package (same as -s). ") . _(" --headers - extract headers for package listed from urpmi db to stdout (root only). @@ -74,6 +75,7 @@ for (@ARGV) { /^--mediums$/ and do { push @nextargv, \$query->{media}; next }; /^--auto-select$/ and do { $query->{auto_select} = 1; next }; /^--fuzzy$/ and do { $query->{fuzzy} = 1; next }; + /^--list$/ and do { $query->{list} = 1; next }; /^--src$/ and do { $query->{src} = 1; next }; /^--headers$/ and do { $query->{headers} = 1; next }; /^--sources$/ and do { $query->{sources} = 1; next }; @@ -118,108 +120,114 @@ $urpm->configure(nocheck_access => 1, ); -my ($start, $end) = $urpm->register_rpms(@files); - -#- select individual files. my $state = { requested => {} }; -defined $start && defined $end and @{$state->{requested}}{($start .. $end)} = (); - -#- search the packages according the selection given by the user, -#- basesystem is added to the list so if it need to be upgraded, all its dependency -#- will be updated too. -if (@names) { - $urpm->search_packages($state->{requested}, [ @names ], - use_provides => $query->{use_provides}, - fuzzy => $query->{fuzzy}) - or $query->{force} or exit 1; -} -if (@src_names) { - $urpm->search_packages($state->{requested}, [ @src_names ], - use_provides => $query->{use_provides}, - fuzzy => $query->{fuzzy}, - src => 1) - or $query->{force} or exit 1; -} - -#- keep track of choices, do no propagate but mark them in selected. -my $stop_on_choices = sub { - my ($urpm, $db, $state, $choices) = @_; - $state->{selected}{join '|', sort { $a <=> $b } map { $_ ? ($_->id) : () } @$choices} = 0; -}; -#- open/close of database should be moved here, in order to allow testing -#- some bogus case and check for integrity. -if ($query->{auto_select} || $query->{upgrade}) { - my $db = URPM::DB::open($query->{root}); - my $sig_handler = sub { undef $db; exit 3 }; - local $SIG{INT} = $sig_handler; - local $SIG{QUIT} = $sig_handler; - - require URPM::Resolve; - #- auto select package for upgrading the distribution. - if ($query->{auto_select}) { - my (%to_remove, %keep_files); - - $urpm->resolve_packages_to_upgrade($db, $state, requested => 0); - - if (%{$state->{ask_remove} || {}} || %{$state->{ask_unselect} || {}}) { - $urpm->{error}(_("some packages have to be removed for being upgraded, this is not supported yet\n")); - } - } - #- filter to add in packages selected required packages. - if ($query->{upgrade}) { - $urpm->resolve_requested($db, $state, callback_choices => $stop_on_choices); - #- dependancies are not asked, just clean selected part with added value (undef). - $query->{deps} or delete @{$state->{selected}}{grep { exists $state->{selected}{$_} && - ! defined $state->{selected}{$_}} keys %{$state->{selected}}}; - } -} elsif ($query->{deps}) { - #- only deps required. - my $empty_db = new URPM; #- URPM has same methods as URPM::DB and empty URPM will be seen as empty URPM::DB. - require URPM::Resolve; - $urpm->resolve_requested($empty_db, $state, callback_choices => $stop_on_choices); - #$urpm->filter_packages_to_upgrade($db, $state->{requested}, undef, keep_alldeps => 1); +#- if list has been activated, select all... +if ($query->{list}) { + @{$state->{selected}}{0 .. $#{$urpm->{depslist}}} = (); } else { - $state->{selected} = $state->{requested}; -} + my ($start, $end) = $urpm->register_rpms(@files); -#- get out of package that should not be upgraded. -$urpm->deselect_unwanted_packages($state->{selected}); + #- select individual files. + defined $start && defined $end and @{$state->{requested}}{($start .. $end)} = (); -if ($query->{headers} || $query->{sources}) { - my ($local_sources, $list) = $urpm->get_source_packages($state->{selected}); - unless ($local_sources || $list) { - $urpm->{fatal}(1, _("unable to get source packages, aborting")); + #- search the packages according the selection given by the user, + #- basesystem is added to the list so if it need to be upgraded, all its dependency + #- will be updated too. + if (@names) { + $urpm->search_packages($state->{requested}, [ @names ], + use_provides => $query->{use_provides}, + fuzzy => $query->{fuzzy}) + or $query->{force} or exit 1; } + if (@src_names) { + $urpm->search_packages($state->{requested}, [ @src_names ], + use_provides => $query->{use_provides}, + fuzzy => $query->{fuzzy}, + src => 1) + or $query->{force} or exit 1; + } + + #- keep track of choices, do no propagate but mark them in selected. + my $stop_on_choices = sub { + my ($urpm, $db, $state, $choices) = @_; + $state->{selected}{join '|', sort { $a <=> $b } map { $_ ? ($_->id) : () } @$choices} = 0; + }; + #- open/close of database should be moved here, in order to allow testing + #- some bogus case and check for integrity. + if ($query->{auto_select} || $query->{upgrade}) { + my $db = URPM::DB::open($query->{root}); + my $sig_handler = sub { undef $db; exit 3 }; + local $SIG{INT} = $sig_handler; + local $SIG{QUIT} = $sig_handler; + + require URPM::Resolve; + #- auto select package for upgrading the distribution. + if ($query->{auto_select}) { + my (%to_remove, %keep_files); - if ($query->{headers}) { - #- now examine source package to build headers list to extract. - values %$local_sources and system 'rpm2header', values %$local_sources; - foreach (0..$#{$urpm->{media} || []}) { - my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_"; - -s $file and system 'cat', $file; - ! -s $file } - map { /(.*)\/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/ and "$2-$3-$4.$5" } values %{$list->[$_]}); - @headers > 0 or next; - - if (-s "$urpm->{statedir}/$urpm->{media}[$_]{hdlist}") { - require packdrake; - my $packer = new packdrake("$urpm->{statedir}/$urpm->{media}[$_]{hdlist}"); - $packer->extract_archive(undef, @headers); - } else { - #- fallback to retrieve rpm package before, so that --headers will be ok. - my %downloads = $urpm->download_source_packages({}, $list, 'local', undef); - print STDERR join " ", "rpm2header", values %downloads; - system "rpm2header", values %downloads; + $urpm->resolve_packages_to_upgrade($db, $state, requested => 0); + + if (%{$state->{ask_remove} || {}} || %{$state->{ask_unselect} || {}}) { + $urpm->{error}(_("some packages have to be removed for being upgraded, this is not supported yet\n")); } } + + #- filter to add in packages selected required packages. + if ($query->{upgrade}) { + $urpm->resolve_requested($db, $state, callback_choices => $stop_on_choices); + #- dependancies are not asked, just clean selected part with added value (undef). + $query->{deps} or delete @{$state->{selected}}{grep { exists $state->{selected}{$_} && + ! defined $state->{selected}{$_}} keys %{$state->{selected}}}; + } + } elsif ($query->{deps}) { + #- only deps required. + my $empty_db = new URPM; #- URPM has same methods as URPM::DB and empty URPM will be seen as empty URPM::DB. + require URPM::Resolve; + $urpm->resolve_requested($empty_db, $state, callback_choices => $stop_on_choices); + #$urpm->filter_packages_to_upgrade($db, $state->{requested}, undef, keep_alldeps => 1); } else { - print join "\n", values %$local_sources; values %$local_sources and print "\n"; - foreach (0..$#{$urpm->{media} || []}) { - print join "\n", values %{$list->[$_]}; values %{$list->[$_]} and print "\n"; + $state->{selected} = $state->{requested}; + } + + #- get out of package that should not be upgraded. + $urpm->deselect_unwanted_packages($state->{selected}); + + if ($query->{headers} || $query->{sources}) { + my ($local_sources, $list) = $urpm->get_source_packages($state->{selected}); + unless ($local_sources || $list) { + $urpm->{fatal}(1, _("unable to get source packages, aborting")); + } + + if ($query->{headers}) { + #- now examine source package to build headers list to extract. + values %$local_sources and system 'rpm2header', values %$local_sources; + foreach (0..$#{$urpm->{media} || []}) { + my @headers = (grep { my $file = "$urpm->{cachedir}/headers/$_"; + -s $file and system 'cat', $file; + ! -s $file } + map { /(.*)\/([^\/]*)-([^-]*)-([^-]*)\.([^\.]*)\.rpm/ and "$2-$3-$4.$5" } values %{$list->[$_]}); + @headers > 0 or next; + + if (-s "$urpm->{statedir}/$urpm->{media}[$_]{hdlist}") { + require packdrake; + my $packer = new packdrake("$urpm->{statedir}/$urpm->{media}[$_]{hdlist}"); + $packer->extract_archive(undef, @headers); + } else { + #- fallback to retrieve rpm package before, so that --headers will be ok. + my %downloads = $urpm->download_source_packages({}, $list, 'local', undef); + print STDERR join " ", "rpm2header", values %downloads; + system "rpm2header", values %downloads; + } + } + } else { + print join "\n", values %$local_sources; values %$local_sources and print "\n"; + foreach (0..$#{$urpm->{media} || []}) { + print join "\n", values %{$list->[$_]}; values %{$list->[$_]} and print "\n"; + } } + exit 0; } - exit 0; } #- print sub for query. |