Hi,
I have butchered the intro to urpmi into English and have attached both the initial rough translation, and a (very) slightly smoothed version for your wits to pick to pieces. My partner and I are going to spend a year in France in April and I thought it would be fun/useful to translate it, seeing as there is no obvious English version. If there is one (a better one) then I shall write to Guillaume Rousse and/or the urpmi people and get it linked, or offer this as a translation. It has a few ??? points - these are areas where I just couldn't work out what it would be in English (i.e., I didn't understand the French or the concept...). Your help here would be greatly appreciated.
I am a long way from being an expert in urpmi so there may actually be some factual errors.
In terms of translation - I am not a translator, and do not claim to be, though I enjoy speaking and reading French. I have tried to walk the ever-present line in translation between literalness and sense. There is some humour that I have probably mis-represented, ah well, that was unavoidable!;-). Some of the sentences are very long in the original, and a French scholar would probably raise the eyebrows... I cut only one sentence in two - far be it from me to advise on such matters!
Please note that it is a translation into British English, so spellings like "connexion" and "colour", are correct and "which" is often used where North American English permits only "that". Other spelling corrections are warmly received.


Thanks for any help, suggests, insults you can manage!
Cheers
Anton

-=-=-
... He knew the tavernes well in every toun.
                -- Geoffrey Chaucer
At every release of an application in LinuxMag, one is faced with the ever-present 
formula "happy Debian users can simply apt-get install whatever, although others will 
have to run the hasardous gauntlet of a manual installation..." (read: serves them 
right). However, this is completely untrue???. Firstly, Connectiva has put rpm support 
into apt-get, which has become a standard for this distribution, and also both 
Mandrake and RedHat offer apt-get as part of their respective offerings. In addition, 
Mandrake offers its own tool, urpmi, whose functionality is continually expanding, 
that makes possible the above operation with the same simplicity : urpmi whatever, and 
the point is made.

Presentation
Anyone who has worked with packages has already confronted a certain number of issues. 
Firstly, the name??? : you need a text editor, so you attempt to install vim (you only 
have 10 fingers after all :-), but what is the exact name of the package? By chance, 
the local guru takes pity on you, and tells you that it's vim-enhanced you are after. 
You still need to determine its location : where are you going to dig up the latest 
version of this packages, compiled for your distribution and platform? After a quarter 
of an hour of laborious research on rpmfind.net, you finally dig it up, and 
triumphantly launch rpm with its url argument. Alas, the dependencies checker??? voils 
the best intentions, as vim-enhanced refuses outright to install while his mate 
vim-common is not there... There no option but to go looking for this new one, hoping 
the it too won't have its list of dependencies, and so on and on.

So urpmi is programme layer???, running on top of rpm, that solves certain problems, 
and offers vastly superior ease-of-use. It is a tool essentially developed in perl, 
like the Mandrake's collection of administration tools, with its own native parts 
included for performance reasons.. Beginners often use it through the rpmdrake 
graphical interface, which like all graphical interfaces quickly becomes a handicap 
when one learns how to manipulate??? the underlying engine. On the command-line, 
especially with programme-completion1???, it is infinitely more effective.
This tool can be used with any distribution that uses rpm packages, even if it means 
writing the necessary indices??? oneself. All of this presentation??? is based on the 
current development version of urpmi, 3.2 for your information, and a cooker 
distribution.

Configuration
A urpmi package source is called a medium. Media can be remote (accessed by http or 
ftp) or local (permanent support??? or removable). Remote media need to have a 
pregenerated index???(list), as urpmi can't download all the packages on the fly to 
analyse them (sentence???). Others are indexed??? on the fly. You can add a medium 
using the following command:

urpmi.addmedia [options] <name> <url> [with <relative_path>]

name is the name you want a medium to be known by. url is the URL of the repository 
where the packages are kept. This can be of the form http://, ftp://, file://, or even 
removable://, for a removable medium.
relative_path is the path to the index??? file to use, relative to the preceding URL 
in the case of remote media.

There are several types of index??? files: complete indices???, generally named 
hdlist.cz, and synthetique indices???, generally named synthesis.hdlist.cz. The former 
contain the all of the data needed for the management of the package (description, 
list of files, etc...), while the latter only contain the dependencies. Index file 
size is the obvious difference here (16MB compared to 200KB for a complete 
distribution), but in terms of functionality they are the same: there is no longer a 
need to find the package containing the famous foo.bar file that the HOWTO talks about 
that is not on your system (a partir d'un index synthetique???). In addition, 
dependencies expressed in terms of files rather than packages will no be resolved by 
urpmi, and will generate an rpm error message at the time of the installation.

One should note that urpmi also recognises a simplified syntax for remote media, 
without an explicitly designated index??? file, but that has a option which specifies 
the order to look for one in order of priority:

urpmi.addmedia [options] <name> <url> --probe synthesis,hdlist

You can also chose between --wget and --curl as options which will be used for 
downloading remote media. Curl, the default option, is better because it uses only one 
connexion to download many files, in contrast to wget that uses multiple successive 
connexions that have a tendency to disconnect at the wrong time with certain ftp 
servers. (???worth a relook).

When Mandrake is installed urpmi is automatically configured with the media 
corresponding to the method of installation. The same thing can be achieved after the 
fact via the option --distrib. You can chose any name you wish in this case.

Examples:
urpmi.addmedia cooker 
ftp://ftp.lip6.fr/pub/linux/distributions/mandrake-devel/cooker/i586/Mandrake/RPMS 
with ../base/hdlist.cz to add the cooker packages (if you want to live dangerously :-)
urpmi.addmedia plf http://plf.zarb.org/rpm/cooker with hdlist.cz to add packages from 
the PLF project (shameless self-promotion :-)
urpmi.addmedia --distrib removable://mnt/cdrom  to automatically add all the media 
defined on the install CD.

Some media are stable (a CD, the FTP archive of the current version) but others change 
(the FTP archive of the development version, updates). It is therefore necessary to 
regularly update them (a cron job does the job nicely). Some media become outdated, or 
useless, and they need to be removed. These operations respectively are performed with 
the following commands:

urpmi.update [options] <name>
urpmi.removemedia [options] <name>

name is obviously the name of the medium we are dealing with (or a non-ambiguous 
sub-part of the name). You can also use the option -a to refer to all the media.

Use
When your media are correctly configured, you can enjoy yourself a little. The command 
couldn't be simpler:

urpmi [options] <name>

name is first resolved among the different possibilities. When there is an ambiguity, 
the user is consulted. The option --auto short-circuits this procedure, selecting 
automatically the first on the list. The most recent available for the architecture of 
the machine is thus??? selected.

Next comes the resolution of dependencies, which repeats the above procedure 
recursively for each package. After the collection of packages has been determined, 
the user is then informed of the corresponding size???.
The files are then collected by the appropriate method, in the case of remote media 
they are temporarily???stored in /var/cache/urpmi/rpms, and then installed all at once.

So, the example we began with resumes with:

[EMAIL PROTECTED] guillaume]# urpmi vim
One of the following packages is necessary :
 1- vim-X11-6.0-6mdk
 2- vim-minimal-6.0-6mdk
 3- vim-enhanced-6.0-6mdk
Please choose one ? (1-3)3
To satisfy dependencies, one of the following must be installed (9 MB):
vim-enhanced-6.0-6mdk vim-common-6.0-6mdk
Is this OK ? (y/n) y
[ ..downloading.. ]
Preparing...                ##################################################
vim-common                  ##################################################
vim-enhanced                ##################################################

The list of media examined for packages can be determined by the user???. The option 
--update only uses those that were created as updates???. The option --media only uses 
the comma-separated list of names that follow.

It is also possible to directly influence the packages that are proposed. The option 
--auto-select selects all those packages already present in the system that have a new 
version available, allowing a general update of the system??? By including the name of 
a package in the file /etc/urpmi/skip.list you can stop the automatic selection of the 
package (very practical in avoiding the unintended installation of a new noyau???, 
although it remains possible to install it if explicitly directed???

Finally, urpmi can be invoked directly with an rpm file, rather than with the name of 
a package. The package is queried to find out the dependencies and they are then 
automatically collected. This is very practical to install non-distribution packages, 
even if this practise is not recommended if you want to keep your system consistent.

[EMAIL PROTECTED] rpms]# urpmi gimp-1.2.3-3mdk.i586.rpm
To satisfy dependencies, the following packages must be installed (41 MB):
gimp-1.2.3-3mdk.i586 gimp-perl-1.2.3-3mdk.i586 libgimp1.2_1-1.2.3-3mdk.i586
Is this OK ? (Y/n) y
...

Implementation
Let's now turn to the situation of a package distributor : how do we generate the 
famous indices??? necessary in order to enable remote access?

The short perl script that follows takes the name of a repository as an argument and 
automatically creates a complete synthetic index??? corresponding to the collection of 
packages found recursively starting from this folder???, as well as a file giving 
there relative paths. In effect, by default urpmi considers that all packages are 
located in the same repository, something true of classic FTP distribution archives 
but not necessarily true for everyone. If this file is present, however, it will be 
used to determine an individualised??? path.

#!/usr/bin/perl

use strict;
use rpmtools;
use File::Find;
use File::Path;

my $params = new rpmtools;
my $tmpdir = "/tmp/genhdlist";
my $index="hdlist.cz";
my $synthesis="synthesis.$index";
my $list="list";
my $dir = @ARGV[0] or die "usage: genhdlist <dir>";

chdir $dir or die "can't chdir in directory $dir";

# get rpm list
my @rpms;
File::Find::find({wanted => \&wanted}, ".");
sub wanted {
    if (-f $_ && $_ =~ /^.*\.rpm$/ ) {
        print "$File::Find::name\n";
        push(@rpms, $File::Find::name);
    }
}
if ([EMAIL PROTECTED]) {
        print "no rpms found, aborting\n";
        exit(0);
}

# create index file
mkpath($tmpdir);
$params->build_hdlist('noclean', 9, $tmpdir, $index, @rpms);
rmtree($tmpdir);

# create synthesis file
system "parsehdlist --synthesis $index | gzip -9 > $synthesis";

# create list file
open(LIST, "> $list") or die "can't create list file $list: $!";
foreach my $rpm (@rpms) { print LIST "$rpm\n" };
close(LIST);

Free gift
urpmi is in fact the principal programme of a collection of utilities based on the 
rpmtools library, complemented??? by the other applications:

urpmf lets you find which package contains a certain file
urpme lets you uninstall a package and all its dependencies
urpmq lets you query the urpmi database
urpmi_rpm-find-leaves lets you obtain the list of packages with no dependencies (the 
terminal nodes of the graph)

For more indepth information on this subject see the documents created by Fabrice 
Facorat2???

Future development
Support for source packages, currently under development, will let a user authorised 
to use urpmi collect and install a source package in his/her account, as well as the 
build dependencies being collected and installed on the system(sentence ???). However, 
this does necessitate juggling with administrator rights, something not without 
concerns???

Conclusion
I hope that this quick pass over the functionalities of urpmi has convinced those who 
go for a "install everything" approach to move on to healthier practices, as it is so 
easy to install only that which is needed to meet your real needs.???
I would also like to show detractors of all shades that the specifics of Mandrake are 
not limited to pastel colours and graphical tools but I imagine that there will always 
be pitiful souls who feel sufficiently threatened by the diffusion of their knowledge 
which takes??? an elitism and permanent bad faith.

I would also like to take the chance to warmly thank Francois Pons, the author of 
urpmi, for his patient explanation and his unfaltering support, as well as a number of 
reviewers for the suggestions they submitted.

1. zsh completion is already integrated into the distribution, bash support? is 
integrated into the project bash-completion. PLF packages ready for use are available 
here.
2. rpm_howto and cooker_howto.
Introduction to urpmi
At every release of an application in LinuxMag, one is faced with the ever-present 
refrain "happy Debian users can simply apt-get install whatever, although others will 
have to run the hazardous gauntlet of a manual installation..." (read: serves them 
right). However, this is completely untrue. Firstly, Connectiva has put rpm support 
into apt-get, which has become a standard for this distribution, and also both 
Mandrake and RedHat offer apt-get as part of their respective offerings. In addition, 
Mandrake offers its own tool, urpmi, whose functionality is continually expanding, 
that makes possible the above operation with the same simplicity : urpmi whatever, and 
the point driven home.

Presentation
Anyone who has worked with packages has already confronted a certain number of issues. 
Firstly, the name : you need a text editor, so you attempt to install vim (you only 
have 10 fingers after all :-), but what is the exact name of the package? By chance, 
the local guru takes pity on you, and tells you that it's vim-enhanced you are after. 
You still need to find it : where are you going to dig up the latest version of this 
package, compiled for your distribution and platform? After a quarter of an hour of 
laborious research on rpmfind.net, you finally dig it up, and triumphantly launch rpm 
with a url argument. Alas, the dependency checker foils the best laid plans, as 
vim-enhanced refuses outright to install while his mate vim-common is not there... 
There no choice but to go looking for this new beasty, hoping that it too won't have 
its list of dependencies, and so on and on.

urpmi is application interface(???), running on top of rpm, that solves a number of 
problems and offers vastly superior ease-of-use. It is a tool essentially developed in 
perl, like Mandrake's collection of administration tools, with its own native parts 
included for performance reasons.. Beginners often use it through the rpmdrake 
graphical interface, which like all graphical interfaces, quickly becomes a handicap 
when one learns how to manipulate the underlying engine. On the command-line, 
especially with programme-completion^1, it is infinitely more effective.
This tool can be used with any distribution that uses rpm packages, even if it means 
writing the necessary indices oneself. All of this presentation is based on the 
current development version of urpmi, 3.2 if you need to know, and a cooker 
distribution.

Configuration
A urpmi package source is called a medium. Media can be remote (accessed by http or 
ftp) or local (permanent support??? or removable). Remote media need to have a 
pregenerated index (hdlist), as urpmi can't download all the packages to analyse them 
on the fly. Others are indexed on the fly. You can add a medium using the following 
command:

urpmi.addmedia [options] <name> <url> [with <relative_path>]

name is the name you want a medium to be known by. url is the URL of the directory 
where the packages are kept. This can be of the form http://, ftp://, file://, or even 
removable://, for a removable medium.
relative_path is the path to the index file to use, relative to the preceding URL in 
the case of remote media.

There are several types of index files: complete indices, generally named hdlist.cz, 
and synthetic indices, generally named synthesis.hdlist.cz. The former contain the all 
of the data needed for the management of the package (description, list of files, 
etc...), while the latter only contain the dependencies. Index file size is the 
obvious difference here (16MB compared to 200KB for a complete distribution), but in 
terms of functionality they are the same: there is no longer a need to find the 
package containing the famous foo.bar file that the HOWTO talks about that is not on 
your system when using a synthetic index. In addition, dependencies expressed in terms 
of files rather than packages will no be resolved by urpmi, and will generate an rpm 
error message at the time of the installation.

One should note that urpmi also recognises a simplified syntax for remote media, 
without an explicitly designated index file, but that has an option which specifies 
the order to look for one in order of priority:

urpmi.addmedia [options] <name> <url> --probe synthesis,hdlist

You can also chose between --wget and --curl to use for downloading remote media. 
Curl, the default option, is better because it uses only one connexion to download 
many files, in contrast to wget that uses multiple successive connexions that have a 
tendency to disconnect at the most inopportune time with certain ftp servers.

When Mandrake is installed, urpmi is automatically configured with the media 
corresponding to the method of installation. The same thing can be achieved after the 
fact via the option --distrib. You can chose any name you wish in this case.

Examples:
urpmi.addmedia cooker 
ftp://ftp.lip6.fr/pub/linux/distributions/mandrake-devel/cooker/i586/Mandrake/RPMS 
with ../base/hdlist.cz to add the cooker packages (if you want to live dangerously :-)
urpmi.addmedia plf http://plf.zarb.org/rpm/cooker with hdlist.cz to add packages from 
the PLF project (shameless self-promotion :-)
urpmi.addmedia --distrib removable://mnt/cdrom  to automatically add all the media 
defined on the install CD.

Some media are stable (a CD, the FTP archive of the current version) but others change 
(the FTP archive of the development version, updates). It is therefore necessary to 
regularly update them (a cron job does the job nicely). Some media become outdated, or 
useless, and need to be removed. These operations respectively are performed with the 
following commands:

urpmi.update [options] <name>
urpmi.removemedia [options] <name>

name is obviously the name of the medium we are dealing with (or a non-ambiguous 
sub-part of the name). You can also use the option -a to refer to all media.

Use
When your media are correctly configured, you can enjoy yourself a little. The command 
couldn't be simpler:

urpmi [options] <name>

name is first resolved among the different possibilities. When there is an ambiguity, 
the user is consulted. The option --auto short-circuits this procedure, selecting 
automatically the first on the list. The most recent available for the architecture of 
the machine is thus selected.

Next comes the resolution of dependencies, which repeats the above procedure 
recursively for each package. After the collection of packages has been determined, 
the user is then informed of the corresponding total size.
The files are then collected by the appropriate method, in the case of remote media 
they are temporarily stored in /var/cache/urpmi/rpms, and then installed all at once.

So, the example we began with resumes with:

[EMAIL PROTECTED] guillaume]# urpmi vim
One of the following packages is necessary :
 1- vim-X11-6.0-6mdk
 2- vim-minimal-6.0-6mdk
 3- vim-enhanced-6.0-6mdk
Please choose one ? (1-3)3
To satisfy dependencies, one of the following must be installed (9 MB):
vim-enhanced-6.0-6mdk vim-common-6.0-6mdk
Is this OK ? (y/n) y
[ ..downloading.. ]
Preparing...                ##################################################
vim-common                  ##################################################
vim-enhanced                ##################################################

The list of media examined for packages can be determined by the user. The option 
--update only uses those that were created as updates. The option --media only uses 
the comma-separated list of names that follow.

It is also possible to directly influence the packages that are suggested. The option 
--auto-select selects all those packages already present in the system that have a new 
version available, allowing a general update of the system to occur. By including the 
name of a package in the file /etc/urpmi/skip.list you can stop the automatic 
selection of a package (very practical for avoiding the unintended installation of a 
new kernel), although it remains possible to install it if explicitly directed

Finally, urpmi can be invoked directly with an rpm file, rather than with the name of 
a package. The package is queried to find out the dependencies and they are then 
automatically collected. This is very practical way to install non-distribution 
packages, even if this practice is not recommended if you want to keep your system 
consistent.

[EMAIL PROTECTED] rpms]# urpmi gimp-1.2.3-3mdk.i586.rpm
To satisfy dependencies, the following packages must be installed (41 MB):
gimp-1.2.3-3mdk.i586 gimp-perl-1.2.3-3mdk.i586 libgimp1.2_1-1.2.3-3mdk.i586
Is this OK ? (Y/n) y
...

Implementation
Let's now turn to the situation of a package distributor : how do we generate the 
famous indices necessary in order to enable remote access?

The short perl script that follows takes the name of a directory as an argument and 
automatically creates a complete synthetic index corresponding to the collection of 
packages found recursively, starting from this directory, as well as a file giving 
their relative paths. In effect, by default urpmi considers that all packages are 
located in the same directory, something true of classic FTP distribution archives but 
not necessarily true everywhere. If this file is present, however, it will be used to 
determine specific paths.

#!/usr/bin/perl

use strict;
use rpmtools;
use File::Find;
use File::Path;

my $params = new rpmtools;
my $tmpdir = "/tmp/genhdlist";
my $index="hdlist.cz";
my $synthesis="synthesis.$index";
my $list="list";
my $dir = @ARGV[0] or die "usage: genhdlist <dir>";

chdir $dir or die "can't chdir in directory $dir";

# get rpm list
my @rpms;
File::Find::find({wanted => \&wanted}, ".");
sub wanted {
    if (-f $_ && $_ =~ /^.*\.rpm$/ ) {
        print "$File::Find::name\n";
        push(@rpms, $File::Find::name);
    }
}
if ([EMAIL PROTECTED]) {
        print "no rpms found, aborting\n";
        exit(0);
}

# create index file
mkpath($tmpdir);
$params->build_hdlist('noclean', 9, $tmpdir, $index, @rpms);
rmtree($tmpdir);

# create synthesis file
system "parsehdlist --synthesis $index | gzip -9 > $synthesis";

# create list file
open(LIST, "> $list") or die "can't create list file $list: $!";
foreach my $rpm (@rpms) { print LIST "$rpm\n" };
close(LIST);

Free gift
urpmi is, in fact, only the principal programme of a collection of utilities based on 
the rpmtools library, and is complemented by the applications:

urpmf lets you find which package contains a certain file
urpme lets you uninstall a package and all its dependencies
urpmq lets you query the urpmi database
urpmi_rpm-find-leaves lets you obtain the list of packages with no dependencies (the 
terminal nodes of the graph)

For more in-depth information on this subject see the documents created by Fabrice 
Facorat^2

Future development
Support for source packages, currently under development, will let a user authorised 
to use urpmi collect and install a source package in his/her account, as well as 
collect and install the build dependencies on the system. However, this does mean 
juggling around with administrator rights, something not without serious concerns.

Conclusion
I hope that this quick pass over the functionalities of urpmi has convinced those who 
go for a "install everything" approach to move on to healthier practices, as it is 
really so easy to install only that which is needed to meet your real needs.
I would also like to show detractors of all shades that the specifics of Mandrake are 
not limited to pastel colours and graphical tools. I imagine, though, that there will 
always be pitiful souls who feel sufficiently threatened by the diffusion of their 
knowledge that they will always show elitism and bad faith.

I would also like to take the chance to warmly thank Francois Pons, the author of 
urpmi, for his patient explanation and his unfaltering support, as well as a number of 
reviewers for the suggestions they submitted.

1. zsh completion is already integrated into the distribution, bash is integrated by 
the project bash-completion. PLF packages ready for use are available here.
2. rpm_howto and cooker_howto.
Want to buy your Pack or Services from MandrakeSoft? 
Go to http://www.mandrakestore.com

Reply via email to