[ale] SUCCESSFUL: Add source repo to CentOS, Was: Epic 'wish I had chosen Debian' fail

Richard Bronosky Richard at Bronosky.com
Wed Sep 9 13:41:50 EDT 2009


My repos list included the following "base" entry:
[base]
name=CentOS-$releasever - Base
mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
#baseurl=http://mirror.centos.org/centos/$releasever/os/$basearch/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

I discovered the if you use your browser to visit the baseurl which is
commented out, you can navigate back out of the architecture directory
and find the SRPMS directory. Using this I created the following
"base-source" entry:
[base-source]
name=CentOS-$releasever - Base - Source
#mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
baseurl=http://mirror.centos.org/centos/5/os/SRPMS/
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-5

Now I can successfully do "yumdownloader --source" commands. From what
I can tell this is either non-documented or completely Google-proof. I
did try every combo of &arch=(source|src|srpm|SRPM) and
repo=os-(source|src|srpm|SRPM) but the CentOS mirror list seems to not
have any source repos in it.

.!# RichardBronosky #!.



On Mon, Sep 7, 2009 at 2:35 PM, Michael H. Warfield <mhw at wittsend.com> wrote:
> On Mon, 2009-09-07 at 11:56 -0400, Richard Bronosky wrote:
>> --source is exactly what I was trying, but the default CentOS install
>> does list any source repos. I cannot find any documentation on adding
>> source repos to CentOS.
>
>        Ah, sorry.  I missed that little point in your original post.  Guess I
> should read a little closer, next time.  That does raise an interesting
> question then.  Since CentOS largely mirrors RHEL, I wonder whats in
> RHEL.  I'll have to check that out.  Should be possible to create a
> source repo for yum if CentOS has to corresponding repos in their mirror
> list.  Checking in the repos, I see that they do.
>
>        This should work for a straight baseurl repo.  I'm not sure about the
> correct syntax for enabling the mirrors:
>
> CentOS-Base-Source.repo:
>
> [base-source]
> name=CentOS-$releasever - Base Source
> # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=os
> baseurl=http://mirror.centos.org/centos/$releasever/os/SRPM/
> enable=0
> gpgcheck=1
> gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
>
> #released updates
> [updates-source]
> name=CentOS-$releasever - Updates
> # mirrorlist=http://mirrorlist.centos.org/?release=$releasever&arch=$basearch&repo=updates
> baseurl=http://mirror.centos.org/centos/$releasever/updates/SRPMS/
> enabled=0
> gpgcheck=1
> gpgkey=http://mirror.centos.org/centos/RPM-GPG-KEY-CentOS-5
>
>        Just tested that as well.  Works like a charm.
>
>        Follow the same pattern for all the others.  Name the repo
> [repo-source], comment out the mirrors, uncomment the baseurl, and
> change $basearch to SRPMS and add "enabled=0" to the repo.
>
>        The source rpm repos are typically not "enabled" per se.  Seems like
> yumdownloader uses them anyways if the corresponding non "-source" repo
> is enabled.  Not sure how it manages that.  You probably do NOT want to
> enable it or yum update might do strange things.  They do NOT have to be
> in the same repo file, so you can create a separate -source repo and not
> have to worry about an update clobbering your changes.
>
>        Mike
>
>> On 9/7/09, Michael H. Warfield <mhw at wittsend.com> wrote:
>> > On Sun, 2009-09-06 at 22:52 -0400, Richard Bronosky wrote:
>> >> I never did learn how to add a source repo to yum, but I did work
>> >> around it. The following works for downloading a source package:
>> >
>> >> p=postfix; # Change this to your packagename.
>> >> curl -O $(yumdownloader --urls $p |sed
>> >> '$!d;s?/os/.*/?/os/SRPMS/?;s/[^.]*\.rpm$/src.rpm/')
>> >>
>> >> .!# RichardBronosky #!.
>> >
>> > How about "yumdownloader --source foo"
>> >
>> > It's in yum-utils.  I use it all the time to snatch rawhide source rpm's
>> > (like the gnupg and gnupg2 packages just recently) to backport into
>> > earlier distros:
>> >
>> > yumdownloader --enablerepo=rawhide --source gnupg gnupg2
>> >
>> > Done.  Install the rpms and rebuild them.
>> >
>> >     Mike
>> >
>> >> On Sun, Sep 6, 2009 at 1:09 AM, Richard Bronosky<Richard at bronosky.com>
>> >> wrote:
>> >> > I just spent 3 hours trying to install postfix compiled with mysql
>> >> > support. Most of that time was spent trying to get a source repo added
>> >> > so I could: yumdownloader --source postfix
>> >> >
>> >> > No luck. Wasted night. I could have really used the sleep. </rant>
>> >> >
>> >> > --
>> >> > Sent from my mobile device
>> >> >
>> >> > .!# RichardBronosky #!.
>> >> >
>> >> _______________________________________________
>> >> Ale mailing list
>> >> Ale at ale.org
>> >> http://mail.ale.org/mailman/listinfo/ale
>> >
>> > --
>> > Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
>> >    /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
>> >    NIC whois: MHW9          | An optimist believes we live in the best of
>> > all
>> >  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
>> >
>
> --
> Michael H. Warfield (AI4NB) | (770) 985-6132 |  mhw at WittsEnd.com
>   /\/\|=mhw=|\/\/          | (678) 463-0932 |  http://www.wittsend.com/mhw/
>   NIC whois: MHW9          | An optimist believes we live in the best of all
>  PGP Key: 0x674627FF        | possible worlds.  A pessimist is sure of it!
>



More information about the Ale mailing list