Smart config file parsing

Grant McWilliams grantmasterflash at gmail.com
Mon Jun 16 12:49:44 PDT 2008


Man that was quick. I'm pasting my questions and their response exactly as
it is.


This is my question to the Yum list about why they use variables in the yum
config. Maybe it applies to us and maybe it doesn't.
Grant
---------------------------------------------------

>
> 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.labix.org/pipermail/smart-labix.org/attachments/20080616/051ed982/attachment-0003.htm>


More information about the Smart mailing list