[Yum] Variables in Yum repo files
Seth Vidal
skvidal at fedoraproject.org
Mon Jun 16 19:37:44 UTC 2008
On Mon, 16 Jun 2008, Grant McWilliams wrote:
>
> I've been using SmartPM for some time on CentOS machines and in the SmartPM mailing list we have a conversation
> that's not hot but a bit
> warm about whether we should add support for variable names in the Smart config file. It really come down to
> "That's the way Yum does it so
> we should do it too" on one side to "not all decisions are smart ones" on the opposing side.
>
> So I'm here to find out what the advantage of having a line like this
>
> baseurl=http://mirror.centos.org/centos/$releasever/centosplus/$basearch/
>
> As apposed to having it like this.
>
> baseurl=http://mirror.centos.org/centos/5/centosplus/i386/
it means you can have one config file for all arches. Which, for a long
time, was a big deal in the fedora/red hat world. fedora-release and
redhat-release are noarch pkgs.
>
> and just update the file (/etc/yum.repos.d/repofile.repo) if the repository or the version/arch changes?
you can't always update those files. They're %config(noreplace). So the
user/admin can update them but the distro cannot. - well not w/any
confidence.
>
> This isn't flame bait as I'm arguing the side of having variables but others have put up a really good defense on
> the "They're not necessary" side
> of things.
We use them all the time for simplicity of expanding out for other arches
too.
you can use the same config for i386 and x86_64 today and if you add ia64
or ppc tomorrow they'll still work, you just add the dir on the repo side.
>
> So I'm asking how are these set and does YUM use them just because that's the way it's always done it or is there
> a really strong case for them?
the above is how they are used.
They are set internal to config.py in yum. look at:
rpmUtils/arch.py in yum's source at how basearch/arch is determined.
The mechanism for determining arch is not native to yum - it comes up from
anaconda/rpm originally and some of it is god-awful-ugly. But it is what
it is.
Hope this helps.
-sv
More information about the Yum
mailing list