5

I was playing around with texlive package recently and found out that there is a way to install tex style packages with yum install 'tex(package.sty)' command. I've never seen package name was specified like that before. Skimming through yum man page didn't yield relevant information.

After some googling I found mentions of possibility of installing Perl modules in a similar fashion, e.g. yum install 'perl(Net::Telnet)'. Though it didn't work for me.

Can someone please provide more information on this type of specifying package name with yum? Are there other packages (besides tex) modules for which can be installed in a similar way? Can I get a list of such packages on my system? Is this an extra functionality that is added to yum as a plugin during installation of a corresponding package (texlive in this case)?

Linux Distro: CentOS 7

7

The packages perl(Net::Telnet) are what are called virtual packages. They exist only in name and are essentially an "alias" for the real package whose name is really perl-Net-Telnet.

These packages come into existence through their definition within the .spec file as provides or requires. You can see some here in this package, perl-Net-HTTP:

$ more $HOME/rpmbuild/SPECS/perl-Net-HTTP.spec
...
BuildRequires:  perl(IO::Socket::IP)
BuildRequires:  perl(IO::Socket::SSL) >= 1.38
BuildRequires:  perl(IO::Uncompress::Gunzip)
BuildRequires:  perl(Symbol)
BuildRequires:  perl(URI)
BuildRequires:  perl(vars)

The advantage of specifying the package names like this is that dependencies do not have to rely on specific version numbers. Here a dependency can say, "I only need any old version of X".

NOTE: These names only work when doing a yum install 'perl(X)' they do not work with yum search or yum info, for example. If you take a look at the yum man page it discusses the true names of packages that are guaranteed to work with all of YUM's commands in the "SPECIFYING PACKAGE NAMES" section.

How else can you tell?

If you attempt to do an install of one of these and enable yum's verbose messaging you'll see hints:

$ sudo yum --verbose install "perl(Net::HTTP)"
Not loading "blacklist" plugin, as it is disabled
Loading "fastestmirror" plugin
Loading "langpacks" plugin
Loading "refresh-packagekit" plugin
Loading "tsflags" plugin
Not loading "whiteout" plugin, as it is disabled
Adding en_US to language list
Config time: 0.015
Adding en_US to language list
Yum version: 3.4.3
rpmdb time: 0.000
Setting up Package Sacks
Loading mirror speeds from cached hostfile
 * fedora: mirror.nexcess.net
 * rpmfusion-free: mirror.pw
 * rpmfusion-free-updates: mirror.pw
 * rpmfusion-nonfree: mirror.pw
 * rpmfusion-nonfree-updates: mirror.pw
 * updates: mirror.nexcess.net
pkgsack time: 0.043
Checking for virtual provide or file-provide for perl(Net::HTTP)
Obs Init time: 0.385
Package perl-Net-HTTP-6.06-4.fc20.noarch already installed and latest version
Nothing to do

Notice the mentions of "virtual provide" and "file-provide"? These are the dependency engine in yum looking for packages that "provide" what you specified in name, i.e. perl(Net::HTTP), on other packages looking for matches.

You can also lean on repoquery to show you this relationship as well:

$ repoquery -a --whatprovides 'perl(Net::HTTP)'
perl-Net-HTTP-0:6.06-4.fc20.noarch

References

| improve this answer | |
  • Thanks for the reply. A follow up question. Who does add virtual packages into repositories? Do package maintainers do that or is it more of repository maintainers privilege? – golem Oct 6 '14 at 16:48
  • It's done via the list of provides in the spec files. There is no central mgmt of a YUM repo as you're thinking, it's purely driven off of the contents of the .spec files, see the example I showed above with the BuildRequires: X? There's packages that define that they provide X. – slm Oct 6 '14 at 17:06

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.