diff options
-rw-r--r-- | Makefile | 1 | ||||
-rw-r--r-- | autoirpm.8 | 20 | ||||
-rw-r--r-- | urpmf.8 | 40 | ||||
-rwxr-xr-x | urpmi | 142 | ||||
-rw-r--r-- | urpmi.8 | 63 | ||||
-rw-r--r-- | urpmi.addmedia.8 | 47 | ||||
-rw-r--r-- | urpmi.removemedia.8 | 26 | ||||
-rw-r--r-- | urpmi.spec | 8 | ||||
-rw-r--r-- | urpmi.update.8 | 26 | ||||
-rwxr-xr-x | urpmq | 324 | ||||
-rw-r--r-- | urpmq.8 | 85 |
11 files changed, 613 insertions, 169 deletions
@@ -18,6 +18,7 @@ install: autoirpm.update-all $(MAKE) -C po $@ install -d $(BINDIR) $(SBINDIR) $(XBINDIR) $(URPMIDIR) $(URPMIDIR2) $(MANDIR)/man8 install -m 4755 urpmi $(BINDIR) + install -m 4755 urpmq $(BINDIR) install _irpm rpm-find-leaves urpmf $(BINDIR) install -m 644 autoirpm.deny $(URPMIDIR2) install -m 644 *.8 $(MANDIR)/man8 @@ -1,18 +1,25 @@ -.TH autoirpm 8 "29 Feb 2000" "Mandrakesoft" "Linux-Mandrake" +.TH autoirpm 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" .IX autoirpm .SH NAME autoirpm \- auto installs the RPM matching your command .SH SYNOPSIS .B autoirpm .SH DESCRIPTION -autoirpm *magically* guesses which package you need and installs it. Let's imagine that you typed gmix to launch your sound mixer. If it is not available, you are then asked if you wish to install the package gnome-media which contains the gmix binary... +autoirpm *magically* guesses which package you need and installs it. +Let's imagine that you typed gmix to launch your sound mixer. If it is +not available, you are then asked if you wish to install the package +gnome-media which contains the gmix binary... .PP -To do so, launch autoirpm.update-all, which scans all packages known by urpmi for all binary executables. It then creates links in respective binary directories... +To do so, launch autoirpm.update-all, which scans all packages known by +urpmi for all binary executables. It then creates links in respective binary +directories... Use autoirpm.uninstall to remove all links created by autoirpm.update. .PP -use \fBautoirpm.update <name>\fP to update executables contained in packages of <name>d media. +use \fBautoirpm.update <name>\fP to update executables contained in packages +of <name>d media. .PP -use \fBautoirpm.update-all\fP to update executables contained in packages of all medias known by urpmi. +use \fBautoirpm.update-all\fP to update executables contained in packages of +all medias known by urpmi. .PP use \fBautoirpm.uninstall\fP to remove all links installed by autoirpm. .PP @@ -24,7 +31,8 @@ All binaries contained in packages listed in this file won't lead to an auto ins .PP /etc/urpmi/autoirpm.allow .br -If present, only binaries of listed packages will offer the feature of auto-install. +If present, only binaries of listed packages will offer the feature of +auto-install. .SH "SEE ALSO" urpmi(8) @@ -1,41 +1,53 @@ -.TH rpmf 8 "29 Feb 2000" "Mandrakesoft" "Linux-Mandrake" -.IX rpmf +.TH urpmf 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" +.IX urpmf .SH NAME -rpmf \- RPMFind - Finds the RPM package providing the specified file +urpmf \- RPMFind - Finds the RPM package providing the specified file .SH SYNOPSIS -.B rpmf [<\fIFile\fP>] +.B urpmf [<\fIFile\fP>] .SH DESCRIPTION -rpmf outputs a list of packages providing the file specified as an argument. +urpmf outputs a list of packages providing the file specified as an argument. .PP -<\fIFile\fP> is the name of the file you wish to know the package providing it. Note that you may type just a substring of the file you are looking for, \fBrpmf\fP will then print a list of matching files with their corresponding packages. +<\fIFile\fP> is the name of the file you wish to know the package providing +it. Note that you may type just a substring of the file you are looking for, +\fBrpmf\fP will then print a list of matching files with their corresponding +packages. .PP -rpmf searches through installed and uninstalled packages. +urpmf searches through installed and uninstalled packages. .SH FILES -/usr/bin/rpmf +/usr/bin/urpmf .br -The \fBrpmf\fP executable (perl script) +The \fBurpmf\fP executable (perl script) .PP /var/lib/urpmi/list.* .br -Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). +Contains the list of all packages known by urpmi and their location. +There is one filelist per media(*). .PP /var/lib/urpmi/hdlist.* .br -Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). +Contain information about all known packages, it's a summary of rpm headers. +There is one filelist per media(*). .PP /etc/urpmi/urpmi.cfg .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/var/lib/urpmi/depslist +/var/lib/urpmi/depslist.ordered .br A simple text file containing all dependencies of all known packages. .PP -/var/lib/urpmi/depslist.html +/var/lib/urpmi/provides .br -The same but in html format, user readable. +A simple text file containning all provides and the list of associated +packages that contains them. +.PP +/var/lib/urpmi/compss +.br +A simple text file containning for each Group used the list of package in +this group. .SH "SEE ALSO" urpmi(8), +urpmq(8), urpmi.addmedia(8), urpmi.update(8), urpmi.removemedia(8), @@ -25,7 +25,6 @@ my $force = 0; my $X = 0; my $all = 0; my $rpm_opt = "-U"; -my $query = undef; my $datadir = "/var/lib/urpmi"; my $confdir = "/etc/urpmi"; @@ -44,17 +43,8 @@ $ENV{PATH} = "/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin"; delete @ENV{qw(ENV BASH_ENV IFS)}; ($<, $uid) = ($>, $<); -log_it(scalar localtime, " urpmi called with @ARGV\n"); - -open SAVEOUT, ">&STDOUT"; -open SAVEERR, ">&STDERR"; -open STDOUT, "|tee -a /var/log/urpmi.log" or die; -open STDERR, "|tee >&2 -a /var/log/urpmi.log" or die; -select STDERR; $| = 1; # make unbuffered -select STDOUT; $| = 1; # make unbuffered - sub usage { - die(_("usage: urpmi [-h] [--auto] [--force] [-a] package_name [package_names...]\n")); + die(_("usage: urpmi [-h] [--auto] [--force] [-a] [-v] package_name|rpm_file [package_names|rpm_files...]\n")); } #- parse arguments list. @@ -69,12 +59,6 @@ for (@ARGV) { /[\?h]/ and do { usage; next }; /a/ and do { $all = 1; next }; /v/ and do { $rpm_opt = "-Uvh"; next }; - /q/ and do { $query = {}; next }; - /d/ and do { $query or die "urpmi: query mode not set to require dependancies\n"; $query->{deps} = 1; next }; - /u/ and do { $query or die "urpmi: query mode not set to filter dependancies\n"; $query->{upgrade} = 1; next }; - /g/ and do { $query or die "urpmi: query mode not set to require group\n"; $query->{group} = 1; next }; - /v/ and do { $query or die "urpmi: query mode not set to require version\n"; $query->{version} = 1; next }; - /r/ and do { $query or die "urpmi: query mode not set to require release\n"; $query->{release} = 1; next }; die "urpmi: unknown option \"-$1\", check usage with --help\n"; } next }; @nextargv and do { my $r = shift @nextargv; $r and $$r = $_; next }; /\.rpm$/ and do { -r $_ or print STDERR "urpmi: cannot read rpm file \"$_\"\n", next; @@ -82,6 +66,16 @@ for (@ARGV) { push @names, $_; } +#- log only at this point in case of query usage. +log_it(scalar localtime, " urpmi called with @ARGV\n"); + +open SAVEOUT, ">&STDOUT"; +open SAVEERR, ">&STDERR"; +open STDOUT, "|tee -a /var/log/urpmi.log" or die; +open STDERR, "|tee >&2 -a /var/log/urpmi.log" or die; +select STDERR; $| = 1; # make unbuffered +select STDOUT; $| = 1; # make unbuffered + #- params contains informations to parse installed system. my $params = new rpmtools; @@ -89,12 +83,6 @@ open F, $depslist or die "$depslist file not found, run urpmi.addmedia first\n"; $params->read_depslist(\*F); close F; -if ($query && $query->{group}) { - open F, $compss or die "$compss file not found, run urpmi.addmedia first\n"; - $params->read_compss(\*F); - close F; -} - if (@files) { $uid == 0 or die _("Only superuser is allowed to install local packages"); @@ -224,80 +212,40 @@ while (defined($id = shift @packages)) { } } -if (!$query || $query->{upgrade}) { - #- now the packages_to_install contains as keys all packages that may be selected, - #- this is used to determine a restricted list of packages installed, as it can - #- improve performance on some cases. - my @packages_to_install = map { $params->{depslist}[$_]{name} } keys %packages_to_install; - my @packages_installed; - if (@packages_to_install > 100) { - rpmtools::get_all_packages_installed('', \@packages_installed); - } else { - rpmtools::get_packages_installed('', \@packages_installed, \@packages_to_install); - } - - #- examine installed packages, determine if a package need upgrade or not. - #- this list may be bigger than packages than really need to be upgraded because they - #- are selected. - foreach (@packages_installed) { - my $pkg = $params->{info}{$_->{name}}; - #- if package has not event been selected by upgrade, continue. - #- but if the package is part of a choice, if it need upgrade, the choice will - #- be dropped, if it does not need upgrade, the choice has to been dropped. - #- in any case, a choice has to be dropped. - exists $packages_to_install{$pkg->{id}} or next; - if ($packages_to_install{$pkg->{id}}) { - drop_in_choices(\%packages_to_install, $pkg->{id}); - } - #- at this point, $_ is the package installed and $pkg is the package candidate to install. - my $cmp = rpmtools::version_compare($pkg->{version}, $_->{version}); - if ($cmp < 0 || $cmp == 0 && rpmtools::version_compare($pkg->{release}, $_->{release}) <= 0) { - #- the package $pkg is older or the same as the installed package, - #- this means it has to be removed from the list, and considered to be - #- already installed. - delete $packages_to_install{$pkg->{id}}; - } else { - $packages_to_install{$pkg->{id}} = undef; - } - } +#- now the packages_to_install contains as keys all packages that may be selected, +#- this is used to determine a restricted list of packages installed, as it can +#- improve performance on some cases. +my @packages_to_install = map { $params->{depslist}[$_]{name} } keys %packages_to_install; +my @packages_installed; +if (@packages_to_install > 100) { + rpmtools::get_all_packages_installed('', \@packages_installed); +} else { + rpmtools::get_packages_installed('', \@packages_installed, \@packages_to_install); } -#- query informations is a way to suppress any information here! -if ($query) { - #- query of dependancies will make use of packages_to_install, else just - #- need to use @names where all informations are given, with eventual - #- limitation on packages already installed. - my $l = $query->{deps} ? \%packages_to_install : \%packages; - - #- print sub for query. - my $query_sub = sub { - my ($id) = @_; - my $info = $params->{depslist}[$id]; - my $str = ''; - $query->{group} and $str .= $info->{group} . '/'; - $str .= $info->{name}; - $query->{version} and $str .= '-' . $info->{version}; - $query->{release} and $str .= '-' . $info->{release}; - $str; - }; - - foreach my $id (keys %$l) { - my $class = $l->{$id}; - if ($class) { - my %hack_only_one; - foreach my $choices_id (@{$class || []}) { - exists $hack_only_one{$choices_id} and next; - print SAVEOUT join('|', map { $query_sub->($_) } @$choices_id), "\n"; - drop_in_choices($l, $choices_id->[0]); - $hack_only_one{$choices_id} = undef; - } - } else { - exists $l->{$id} and print SAVEOUT $query_sub->($id), "\n"; - } +#- examine installed packages, determine if a package need upgrade or not. +#- this list may be bigger than packages than really need to be upgraded because they +#- are selected. +foreach (@packages_installed) { + my $pkg = $params->{info}{$_->{name}}; + #- if package has not event been selected by upgrade, continue. + #- but if the package is part of a choice, if it need upgrade, the choice will + #- be dropped, if it does not need upgrade, the choice has to been dropped. + #- in any case, a choice has to be dropped. + exists $packages_to_install{$pkg->{id}} or next; + if ($packages_to_install{$pkg->{id}}) { + drop_in_choices(\%packages_to_install, $pkg->{id}); + } + #- at this point, $_ is the package installed and $pkg is the package candidate to install. + my $cmp = rpmtools::version_compare($pkg->{version}, $_->{version}); + if ($cmp < 0 || $cmp == 0 && rpmtools::version_compare($pkg->{release}, $_->{release}) <= 0) { + #- the package $pkg is older or the same as the installed package, + #- this means it has to be removed from the list, and considered to be + #- already installed. + delete $packages_to_install{$pkg->{id}}; + } else { + $packages_to_install{$pkg->{id}} = undef; } - - #- on query mode, exit here. - exit 0; } #- resolution of choices by the user, or automatically by the first listed. @@ -452,7 +400,7 @@ sub install { $something_was_installed = 1; print SAVEOUT _("installing %s\n", join(' ', @_)); log_it(scalar localtime, " @_\n"); - system($X ? "grpmi" : ("rpm", "-U"), @_); + system($X ? "grpmi" : ("rpm", $rpm_opt), @_); if ($?) { message(_("Installation failed")); $X and exit 1; #- grpmi handles --nodeps and --force by itself @@ -461,13 +409,13 @@ sub install { print SAVEOUT _("Try installation without checking dependencies?"), " (Y/n) "; $force or <STDIN> =~ /n/i and exit 1; - system("rpm", "-U", "--nodeps", @_); + system("rpm", $rpm_opt, "--nodeps", @_); if ($?) { message(_("Installation failed")); print SAVEOUT _("Try installation even more strongly (--force)?"), " (Y/n) "; $force or <STDIN> =~ /n/i and exit 0; - system("rpm", "-U", "--nodeps", "--force", @_); + system("rpm", $rpm_opt, "--nodeps", "--force", @_); } } } @@ -1,44 +1,58 @@ -.TH urpmi 8 "29 Feb 2000" "Mandrakesoft" "Linux-Mandrake" +.TH urpmi 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" .IX urpmi .SH NAME urpmi \- rpm wrapper making installs easier for the user .SH SYNOPSIS .B urpmi [options] -package_name -[package_names...] +package_name|rpm_file +[package_names|rpm_files...] .SH DESCRIPTION urpmi enables non-superuser install of rpms. In fact, it only authorizes -well-known rpms to be installed. +well-known rpms to be installed. If you want to install local rpm file, you +will have to be root. -You can compare rpm vs. urpmi with insmod vs. modprobe or dpkg vs apt-get +You can compare rpm vs. urpmi with insmod vs. modprobe or dpkg vs apt-get .PP All users belonging to group urpmi are allowed to install packages. .br -Just launch urpmi followed by what you think is the name of the package(s), and urpmi will: +Just launch urpmi followed by what you think is the name of the package(s), +and urpmi will: .br \- Propose different package names if availables and quit. .br -\- If found only one Package corresponding, check wether dependencies are already installed or not. +\- If found only one Package corresponding, check wether dependencies are +already installed or not. .br -\- If not, propose to install the dependencies and then install all required dependencies and the package. +\- If not, propose to install the dependencies and then install all required +dependencies and the package. .PP -Note that urpmi handle installations from various medias (ftp, local and nfs volumes, removable medias such as CDROMs) and is able to install dependencies from a media different from the package's media. If necessary, urpmi asks you to insert the required media. +Note that urpmi handle installations from various medias (ftp, local and +nfs volumes, removable medias such as CDROMs) and is able to install +dependencies from a media different from the package's media. +If necessary, urpmi asks you to insert the required media. .PP To add a new media containing rpms run urpmi.addmedia. .br To remove a media use urpmi.removemedia. .br -To update the packages list (for example when the ftp archive changed) use urpmi.update. +To update the packages list (for example when the ftp archive changed) use +urpmi.update. .br -To automatically install a package corresponding to an executable you tried to launch, use autoirpm. +To automatically install a package corresponding to an executable you tried +to launch, use autoirpm. .br -To install all available menu entries of all known packages, use autoirpm-icons. +To install all available menu entries of all known packages, +use autoirpm-icons. .SH OPTION .IP "\fB\--auto\fP" -installs all required dependencies without asking. +installs all required dependencies without asking. +.IP "\fB\--force\fP" +assumes yes on all questions. .IP "\fB\-a\fP" -if multiple packages match the substring given, take them all +if multiple packages match the substring given, take them all +.IP "\fB\-v\fP" +proposes a verbose mode when calling rpm. .SH FILES /usr/bin/urpmi .br @@ -46,23 +60,31 @@ The \fBurpmi\fP executable (perl script) .PP /var/lib/urpmi/list.* .br -Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). +Contains the list of all packages known by urpmi and their location. +There is one filelist per media(*). .PP /var/lib/urpmi/hdlist.* .br -Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). +Contain information about all known packages, it's a summary of rpm headers. +There is one filelist per media(*). .PP /etc/urpmi/urpmi.cfg .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/var/lib/urpmi/depslist +/var/lib/urpmi/depslist.ordered .br A simple text file containning all dependencies of all known packages. .PP -/var/lib/urpmi/depslist.html +/var/lib/urpmi/provides .br -The same but in html format, user readable. +A simple text file containning all provides and the list of associated +packages that contains them. +.PP +/var/lib/urpmi/compss +.br +A simple text file containning for each Group used the list of package in +this group. .SH "SEE ALSO" urpmi.addmedia(8), urpmi.update(8), @@ -70,7 +92,8 @@ urpmi.removemedia(8), urpmi.update(8), autoirpm(8), gurpmi(8), -rpmf(8), +urpmf(8), +urpmq(8), rpmdrake(8) .SH AUTHOR Pascal Rigaux, Mandrakesoft diff --git a/urpmi.addmedia.8 b/urpmi.addmedia.8 index 87bc28db..296d4094 100644 --- a/urpmi.addmedia.8 +++ b/urpmi.addmedia.8 @@ -1,11 +1,13 @@ -.TH urpmi.addmedia 8 "29 Feb 2000" "Mandrakesoft" "Linux-Mandrake" +.TH urpmi.addmedia 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" .IX urpmi.addmedia .SH NAME urpmi.addmedia \- adds a new rpms media for use with urpmi .SH SYNOPSIS -.B urpmi.addmedia <\fIname\fP> <\fIurl\fP> +.B urpmi.addmedia <\fIname\fP> <\fIurl\fP> .SH DESCRIPTION -urpmi.addmedia tells urpmi that he can find new rpms at the specified location. Currently supported medias are: local drives, removable drives (such as cd's), http and ftp. +urpmi.addmedia tells urpmi that he can find new rpms at the specified +location. Currently supported medias are: local drives, removable drives +(such as cd's), http and ftp. .PP All users belonging to group urpmi are allowed to add a new media. .PP @@ -18,13 +20,15 @@ Where <\fIname\fP> is your reference for the media (e.g. MandrakeUpdate). .br <\fIhost\fP>/<\fIpath\fP> is the location of the rpm directory on the net. .br -<\fIrelative path of hdlist\fP> is the pathname where to find the hdlist of the rpms. The location is given relative to <\fIpath\fP>. +<\fIrelative path of hdlist\fP> is the pathname where to find the hdlist of +the rpms. The location is given relative to <\fIpath\fP>. .nf eg: urpmi.addmedia ftp ftp://a:a@leia//export/Mandrake/RPMS with ../base/hdlist -.fi +.fi .br .IP "\fB urpmi.addmedia <\fIname\fP> ftp://<\fIlogin\fP>:<\fIuser\fP>@<\fIhost\fP>/<\fIpath\fP> with <\fIrelative path of hdlist\fP>\fP" -The same as for http, just add your login and user if required (Note that you needn't to specify anonymous as login for anonymous access ftp servers). +The same as for http, just add your login and user if required (Note that +you needn't to specify anonymous as login for anonymous access ftp servers). .PP Local drive or NFS: .br @@ -36,11 +40,15 @@ Where <\fIname\fP> is your reference for the media (e.g. Myrpms). Removable device: .br .IP "\fB urpmi.addmedia removable_<\fIdevice\fP>_<\fInumber\fP>://<\fIpath\fP>\fP" -<\fIdevice\fP> is the name of your media as specified in the /dev/ directory (e.g. cdrom, floppy, zip, ...). +<\fIdevice\fP> is the name of your media as specified in the /dev/ directory +(e.g. cdrom, floppy, zip, ...). .br -<\fInumber\fP> is used urpmi to choose in what order medias are inserted in case of multiple medias install with dependencies. '1' is reserved for the origin install medias. +<\fInumber\fP> is used urpmi to choose in what order medias are inserted in +case of multiple medias install with dependencies. '1' is reserved for the +origin install medias. .br -<\fIpath\fP> is the location of the rpm directory on your machine when media is mounted. +<\fIpath\fP> is the location of the rpm directory on your machine when media +is mounted. .PP .SH FILES @@ -50,23 +58,31 @@ The \fBurpmi\fP executable (perl script) .PP /var/lib/urpmi/list.* .br -Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). +Contains the list of all packages known by urpmi and their location. There +is one filelist per media(*). .PP /var/lib/urpmi/hdlist.* .br -Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). +Contain information about all known packages, it's a summary of rpm headers. +There is one filelist per media(*). .PP /etc/urpmi/urpmi.cfg .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/var/lib/urpmi/depslist +/var/lib/urpmi/depslist.ordered .br A simple text file containing all dependencies of all known packages. .PP -/var/lib/urpmi/depslist.html +/var/lib/urpmi/provides .br -The same but in html format, user readable. +A simple text file containning all provides and the list of associated +packages that contains them. +.PP +/var/lib/urpmi/compss +.br +A simple text file containning for each Group used the list of package in +this group. .SH "SEE ALSO" urpmi(8), urpmi.update(8), @@ -74,7 +90,8 @@ urpmi.removemedia(8), autoirpm(8), autoirpm-icons(8), gurpmi(8), -rpmf(8), +urpmf(8), +urpmq(8), rpmdrake(8) .SH AUTHOR Pascal Rigaux, Mandrakesoft diff --git a/urpmi.removemedia.8 b/urpmi.removemedia.8 index 09dad38c..4b58dae1 100644 --- a/urpmi.removemedia.8 +++ b/urpmi.removemedia.8 @@ -1,11 +1,12 @@ -.TH urpmi.removemedia 8 "29 Feb 2000" "Mandrakesoft" "Linux-Mandrake" +.TH urpmi.removemedia 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" .IX urpmi.removemedia .SH NAME urpmi.removemedia \- remove a rpms media from the known medias of urpmi .SH SYNOPSIS .B urpmi.removemedia <\fIname\fP> .SH DESCRIPTION -urpmi.removemedia removes from all configuration files all references to the named media and to rpms from that media. +urpmi.removemedia removes from all configuration files all references to +the named media and to rpms from that media. .PP <\fIname\fP> is the name you first told to urpmi.addmedia @@ -16,30 +17,39 @@ The \fBurpmi\fP executable (perl script) .PP /var/lib/urpmi/list.* .br -Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). +Contains the list of all packages known by urpmi and their location. +There is one filelist per media(*). .PP /var/lib/urpmi/hdlist.* .br -Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). +Contain information about all known packages, it's a summary of rpm headers. +There is one filelist per media(*). .PP /etc/urpmi/urpmi.cfg .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/var/lib/urpmi/depslist +/var/lib/urpmi/depslist.ordered .br A simple text file containing all dependencies of all known packages. .PP -/var/lib/urpmi/depslist.html +/var/lib/urpmi/provides .br -The same but in html format, user readable. +A simple text file containning all provides and the list of associated +packages that contains them. +.PP +/var/lib/urpmi/compss +.br +A simple text file containning for each Group used the list of package in +this group. .SH "SEE ALSO" urpmi(8), urpmi.addmedia(8), autoirpm(8), autoirpm-icons(8), gurpmi(8), -rpmf(8), +urpmf(8), +urpmq(8), rpmdrake(8) .SH AUTHOR Pascal Rigaux, Mandrakesoft @@ -2,7 +2,7 @@ Name: urpmi Version: 1.3 -Release: 5mdk +Release: 6mdk License: GPL Source0: %{name}.tar.bz2 Summary: User mode rpm install @@ -84,6 +84,7 @@ autoirpm.uninstall %attr(4750, root, urpmi) %{_bindir}/urpmi %{_bindir}/urpmi_rpm-find-leaves %{_bindir}/urpmf +%{_bindir}/urpmq %{_sbindir}/urpme %{_sbindir}/urpmi.* %{_mandir}/*/urpm* @@ -103,6 +104,11 @@ autoirpm.uninstall %changelog +* Tue Sep 05 2000 François Pons <fpons@mandrakesoft.com> 1.3-6mdk +- split query mode of urpmi into new tools urpmq. +- fixed -v option of urpmi. +- updated man pages of various tools. + * Sun Sep 03 2000 François Pons <fpons@mandrakesoft.com> 1.3-5mdk - fixed incorporation of media with already defined packages, choose the relocated one by rpmtools library. diff --git a/urpmi.update.8 b/urpmi.update.8 index 5838287f..5ce51ce3 100644 --- a/urpmi.update.8 +++ b/urpmi.update.8 @@ -1,11 +1,12 @@ -.TH urpmi.update 8 "18 Nov 1999" "Mandrakesoft" "Linux-Mandrake" +.TH urpmi.update 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" .IX urpmi.update .SH NAME urpmi.update \- Updates packages list for specified medias .SH SYNOPSIS .B urpmi.update <\fIname\fP> .SH DESCRIPTION -urpmi.update scans the <\fIname\fP> media to update its packages list. Usefull for ftp location for example. +urpmi.update scans the <\fIname\fP> media to update its packages list. +Usefull for ftp location for example. .PP <\fIname\fP> is the name you first told to urpmi.addmedia @@ -16,27 +17,36 @@ The \fBurpmi\fP executable (perl script) .PP /var/lib/urpmi/list.* .br -Contains the list of all packages known by urpmi and their location. There is one filelist per media(*). +Contains the list of all packages known by urpmi and their location. +There is one filelist per media(*). .PP /var/lib/urpmi/hdlist.* .br -Contain information about all known packages, it's a summary of rpm headers. There is one filelist per media(*). +Contain information about all known packages, it's a summary of rpm headers. +There is one filelist per media(*). .PP /etc/urpmi/urpmi.cfg .br Contains one line <\fIname\fP> <\fIurl\fP> per media. .PP -/var/lib/urpmi/depslist +/var/lib/urpmi/depslist.ordered .br A simple text file containing all dependencies of all known packages. .PP -/var/lib/urpmi/depslist.html +/var/lib/urpmi/provides .br -The same but in html format, user readable. +A simple text file containning all provides and the list of associated +packages that contains them. +.PP +/var/lib/urpmi/compss +.br +A simple text file containning for each Group used the list of package in +this group. .SH "SEE ALSO" urpmi(8), urpmi.addmedia(8), -rpmf(8), +urpmf(8), +urpmq(8), autoirpm(8), autoirpm-icons(8), gurpmi(8), @@ -0,0 +1,324 @@ +#!/usr/bin/perl + +#- Copyright (C) 2000 MandrakeSoft (fpons@mandrakesoft.com) +#- +#- This program is free software; you can redistribute it and/or modify +#- it under the terms of the GNU General Public License as published by +#- the Free Software Foundation; either version 2, or (at your option) +#- any later version. +#- +#- This program is distributed in the hope that it will be useful, +#- but WITHOUT ANY WARRANTY; without even the implied warranty of +#- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#- GNU General Public License for more details. +#- +#- You should have received a copy of the GNU General Public License +#- along with this program; if not, write to the Free Software +#- Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. + +#- this program is based upon urpmi. + +#use strict qw(subs vars refs); +use rpmtools; + +#- default options. +my $query = {}; +my $datadir = "/var/lib/urpmi"; +my $confdir = "/etc/urpmi"; + +my $depslist = "$datadir/depslist.ordered"; +my $provides = "$datadir/provides"; +my $compss = "$datadir/compss"; + +my @files; +my @names; + +my %I18N; +load_po(); + +sub usage { + die(_("usage: urpmq [-h] [-d] [-u] [-g] [-v] [-r] package_name|rpm_file [package_names|rpm_files...]\n")); +} + +#- parse arguments list. +my @nextargv; +for (@ARGV) { + /^--help$/ and do { usage; next }; + /^-(.*)$/ and do { foreach (split //, $1) { + /[\?h]/ and do { usage; next }; + /d/ and do { $query->{deps} = 1; next }; + /u/ and do { $query->{upgrade} = 1; next }; + /g/ and do { $query->{group} = 1; next }; + /v/ and do { $query->{version} = 1; next }; + /r/ and do { $query->{release} = 1; next }; + die "urpmq: unknown option \"-$1\", check usage with --help\n"; } next }; + @nextargv and do { my $r = shift @nextargv; $r and $$r = $_; next }; + /\.rpm$/ and do { -r $_ or print STDERR "urpmq: cannot read rpm file \"$_\"\n", next; + push @files, $_; next }; + push @names, $_; +} + +#- params contains informations to parse installed system. +my $params = new rpmtools; + +open F, $depslist or die "$depslist file not found, run urpmi.addmedia first\n"; +$params->read_depslist(\*F); +close F; + +if ($query && $query->{group}) { + open F, $compss or die "$compss file not found, run urpmi.addmedia first\n"; + $params->read_compss(\*F); + close F; +} + +if (@files) { + #- read provides file which is needed only to compute incremental + #- dependancies, of files provided. + open F, $provides or die "$provides file not found, run urpmi.addmedia first\n"; + $params->read_provides(\*F); + close F; + + #- compute depslist of files provided on command line. + $params->read_rpms($_) foreach @files; + $params->compute_depslist; + + #- gets full names of packages, sanity check of pathname. + m|(.*/)?(.*)\.[^.]+\.rpm$| and push @names, $2 foreach @files; + m|^/| or $_ = "./$_" foreach @files; +} + +#- reparse whole internal depslist to match against newer packages only. +$params->relocate_depslist(); + +my %exact; +my %found; +my %foundi; +my @packages; + +foreach my $v (@names) { + #- it is a way of speedup, providing the name of a package directly help + #- to find the package. + #- this is necessary if providing a name list of package to upgrade. + if ($params->{info}{$v}) { + $exact{$v} = $params->{info}{$v}; next; + } + + my $qv = quotemeta $v; + foreach (keys %{$params->{info}}) { + my $info = $params->{info}{$_}; + my $pack = $info->{name} .'-'. $info->{version} .'-'. $info->{release}; + + $pack =~ /^$qv-[^-]+-[^-]+$/ and $exact{$v} = $info; + $pack =~ /^$qv-[^-]+$/ and $exact{$v} = $info; + $pack =~ /$qv/ and push @{$found{$v}}, $info; + $pack =~ /$qv/i and push @{$foundi{$v}}, $info; + } +} + +foreach (@names) { + my $info = $exact{$_}; + if ($info) { + push @packages, $info->{id}; + } else { + my $l = $found{$_} || $foundi{$_}; + if (@{$l || []} == 0) { + warn(_("no package named %s\n", $_)); + } elsif (@$l > 1 && !$all) { + warn(_("The following packages contain %s: %s\n", $_, join(' ', map { $_->{name} } @$l))); + } else { + push @packages, map { $_->{id} } @$l; + } + } +} + +#- keep in mind the packages asked by the user, just for interactive activity. +my %packages; @packages{@packages} = (); + +#- compute closure of package to install/upgrade before examining installed +#- packages, this help speed up the process to retrieve installed packages in +#- the given list. +my %packages_to_install; +my @packages_installed; +if (rpmtools::get_packages_installed('', \@packages_installed, [ 'basesystem' ])) { + #- if basesystem is installed and need to be updated. + #- we have to add it in the list explicitely. + #- in order to take care of all basesystem packages. + my $pkg = $params->{info}{basesystem}; + foreach (@packages_installed) { + my $cmp = rpmtools::version_compare($pkg->{version}, $_->{version}); + if ($cmp > 0 || $cmp == 0 && rpmtools::version_compare($pkg->{release}, $_->{release}) > 0) { + push @packages, $pkg->{id}; last; + } + } +} + +my $id; +while (defined($id = shift @packages)) { + if (ref $id) { + #- in such case, this is a dependancy on a choices, check + #- if one of the package is already selected, in such case, the choice + #- can safely be dropped. in other cases, the choices has to be registered. + foreach (@$id) { + exists $packages_to_install{$_} && !$packages_to_install{$_} and $id = undef, last; + } + #- registering the choice is done by adding the class in any referenced id. + if ($id) { + foreach (@$id) { + push @{$packages_to_install{$_} ||= []}, $id; + } + } + } else { + if ($packages_to_install{$id}) { + drop_in_choices(\%packages_to_install, $id); + } + exists $packages_to_install{$id} and next; + #- force selection as mandatory package. + $packages_to_install{$id} = undef; + #- rebuild requires_id array according to deps as requires_id is no more available (because of speed :-) + #- and because id have been relocated. + my @rebuild_requires_id; + foreach (split /\s+/, $params->{depslist}[$id]{deps}) { + if (/\|/) { + push @rebuild_requires_id, [ map { $params->{depslist}[$_]{id} } split /\|/, $_ ]; + } else { + push @rebuild_requires_id, $params->{depslist}[$_]{id}; + } + } + #- get all dependancies to add them. + #- this is a partial closure, it assumes it has already be done before. + foreach (@rebuild_requires_id) { + if (ref $_) { + push @packages, $_; + } else { + $packages_to_install{$_} = undef; + } + } + } +} + +if ($query->{upgrade}) { + #- now the packages_to_install contains as keys all packages that may be selected, + #- this is used to determine a restricted list of packages installed, as it can + #- improve performance on some cases. + my @packages_to_install = map { $params->{depslist}[$_]{name} } keys %packages_to_install; + my @packages_installed; + if (@packages_to_install > 100) { + rpmtools::get_all_packages_installed('', \@packages_installed); + } else { + rpmtools::get_packages_installed('', \@packages_installed, \@packages_to_install); + } + + #- examine installed packages, determine if a package need upgrade or not. + #- this list may be bigger than packages than really need to be upgraded because they + #- are selected. + foreach (@packages_installed) { + my $pkg = $params->{info}{$_->{name}}; + #- if package has not event been selected by upgrade, continue. + #- but if the package is part of a choice, if it need upgrade, the choice will + #- be dropped, if it does not need upgrade, the choice has to been dropped. + #- in any case, a choice has to be dropped. + exists $packages_to_install{$pkg->{id}} or next; + if ($packages_to_install{$pkg->{id}}) { + drop_in_choices(\%packages_to_install, $pkg->{id}); + } + #- at this point, $_ is the package installed and $pkg is the package candidate to install. + my $cmp = rpmtools::version_compare($pkg->{version}, $_->{version}); + if ($cmp < 0 || $cmp == 0 && rpmtools::version_compare($pkg->{release}, $_->{release}) <= 0) { + #- the package $pkg is older or the same as the installed package, + #- this means it has to be removed from the list, and considered to be + #- already installed. + delete $packages_to_install{$pkg->{id}}; + } else { + $packages_to_install{$pkg->{id}} = undef; + } + } +} + +#- query of dependancies will make use of packages_to_install, else just +#- need to use @names where all informations are given, with eventual +#- limitation on packages already installed. +my $l = $query->{deps} ? \%packages_to_install : \%packages; + +#- print sub for query. +my $query_sub = sub { + my ($id) = @_; + my $info = $params->{depslist}[$id]; + my $str = ''; + $query->{group} and $str .= $info->{group} . '/'; + $str .= $info->{name}; + $query->{version} and $str .= '-' . $info->{version}; + $query->{release} and $str .= '-' . $info->{release}; + $str; +}; + +foreach my $id (keys %$l) { + my $class = $l->{$id}; + if ($class) { + my %hack_only_one; + foreach my $choices_id (@{$class || []}) { + exists $hack_only_one{$choices_id} and next; + print join('|', map { $query_sub->($_) } @$choices_id), "\n"; + drop_in_choices($l, $choices_id->[0]); + $hack_only_one{$choices_id} = undef; + } + } else { + exists $l->{$id} and print $query_sub->($id), "\n"; + } +} + +#- remove any reference to package in choices, +#- it is NECESSARY the package to be in a choice, or it will die. +sub drop_in_choices { + my ($packages_to_install, $id) = @_; + + #- the package here is listed in a choices, drop any reference to the choices + #- as this package will have to be selected. + my %class_to_drop; @class_to_drop{@{$packages_to_install->{$id}}} = (); + foreach (keys %$packages_to_install) { + if ($packages_to_install->{$_}) { + my @keeped_choices = grep { ! exists $class_to_drop{$_} } @{$packages_to_install->{$_}}; + if (@keeped_choices) { + $packages_to_install->{$_} = \@keeped_choices; + } else { + delete $packages_to_install->{$_}; + } + } + } +} + +sub _ { + my $s = shift @_; my $t = translate($s); + $t && ref $t or return sprintf $t, @_; + my ($T, @p) = @$t; + sprintf $T, @_[@p]; +} +sub translate { $I18N{$_[0]} || $_[0]; } + +sub load_po { + my ($from, $to, $state, $fuzzy); + + my $lang = $ENV{LANGUAGE} || $ENV{LC_ALL} || $ENV{LC_MESSAGES} || $ENV{LANG}; + my $f; -e ($f = "/usr/share/locale/$_/LC_MESSAGES/urpmi.po") and last foreach split ':', $lang; + + local *F; open F, $f or return; + foreach (<F>) { + /^msgstr/ and $state = 1; + /^msgid/ && !$fuzzy and $state = 2; + + if (/^(#|$)/ && $state != 3) { + $state = 3; + s/\\n/\n/g foreach $from, $to; + + if (my @l = $to =~ /%(\d+)\$/g) { + $to =~ s/%(\d+)\$/%/g; + $to = [ $to, map { $_ - 1 } @l ]; + } + $I18N{$from} = $to if $from; + $from = $to = ''; + } + $to .= (/"(.*)"/)[0] if $state == 1; + $from .= (/"(.*)"/)[0] if $state == 2; + + $fuzzy = /^#, fuzzy/; + } +} diff --git a/urpmq.8 b/urpmq.8 new file mode 100644 index 00000000..03431c26 --- /dev/null +++ b/urpmq.8 @@ -0,0 +1,85 @@ +.TH urpmq 8 "05 Sep 2000" "Mandrakesoft" "Linux-Mandrake" +.IX urpmq +.SH NAME +urpmq \- urpmi database query tool. +.SH SYNOPSIS +.B urpmq +[options] +package_name | rpm_file +[package_names | rpm_files...] +.SH DESCRIPTION +urpmq allows querying the urpmi database. It is for you if want to list +available packages in the various media of urpmi, or list dependancies of +packages or packages that will be installed if you start urpmi. +.PP +Output format of urpmq is the following according to command line options: +.IP +[group/]package_name[-version][-release] +.SH OPTION +.IP "\fB\-g\fP" +print group of each packages listed. +.IP "\fB\-v\fP" +print version of each packages listed. +.IP "\fB\-r\fP" +print release of each packages listed. +.IP "\fB\-d\fP" +print closure of required packages needed by requested packages on command +line. +.IP "\fB\-u\fP" +filter the closure of required packages according to packages that need to +be upgraded on your system. +.SH FILES +/usr/bin/urpmq +.br +The \fBurpmq\fP executable (perl script) +.PP +/var/lib/urpmi/list.* +.br +Contains the list of all packages known by urpmi and their location. +There is one filelist per media(*). +.PP +/var/lib/urpmi/hdlist.* +.br +Contain information about all known packages, it's a summary of rpm headers. +There is one filelist per media(*). +.PP +/etc/urpmi/urpmi.cfg +.br +Contains one line <\fIname\fP> <\fIurl\fP> per media. +.PP +/var/lib/urpmi/depslist.ordered +.br +A simple text file containning all dependencies of all known packages. +.PP +/var/lib/urpmi/provides +.br +A simple text file containning all provides and the list of associated +packages that contains them. +.PP +/var/lib/urpmi/compss +.br +A simple text file containning for each Group used the list of package in +this group. +.SH "SEE ALSO" +urpmi(8), +urpmi.addmedia(8), +urpmi.update(8), +urpmi.removemedia(8), +urpmi.update(8), +autoirpm(8), +gurpmi(8), +urpmf(8), +rpmdrake(8) +.SH AUTHOR +François Pons, Mandrakesoft +.br +fpons@mandrakesoft.com + + + + + + + + + |