[Yum] Creating complete repository

Chris Kittlitz ckittlitz at gmail.com
Mon Jun 24 15:15:07 UTC 2013


I've created a perl script which does this somewhat.  It is rough - my
first stab at it.  And it doesn't handle more than one provider very well.

Here it is.

use strict;
use warnings;
#use List::MoreUtils;
#use Util::Any;

# Read in all the packages
my @packages = (@ARGV);

# Process each set of packages.
my $p=0;
while ($p <= $#packages ) {
    # Get the list of packages from p to the end.
    my $next = join(' ', at packages[$p..$#packages]);
    print "Processing packages $next ($p-$#packages)...\n";
    $p=$#packages + 1;
    open(DEPS, "yum deplist $next|") || die "Failed $! $next\n";
    chomp(my @lines = <DEPS>);
    my $count=0;
    while ($count <= $#lines) {
    if ($lines[$count] =~ /dependency: (.*)/ ) {
        my $dep=$1;
        $count++;
        my @providers = ();
        while ($count <= $#lines && $lines[$count] =~ /provider: (.*)
(.*)/) {
        push(@providers, $1);
        $count++;
        }
        foreach (@providers) {
        my $provider=$_;
        if ($provider !~ /i386/) {
            if (!grep {$_ eq $provider} @packages) {
            # Add it
            print "  Adding package $provider\n";
            push(@packages, $provider);
            }
            last;
        }
        }
    } else {
        $count++;
    }
    }
}

# Print the results
print "\nPackages:\n";
my @sorted = sort @packages;
foreach (@sorted) {
    print "\t$_\n";
}


On Mon, Jun 24, 2013 at 10:32 AM, Chris Kittlitz <ckittlitz at gmail.com>wrote:

> That is pretty much exactly what I am doing, however, I need to know how
> to get the list of packages.
>
>
>
>
> On Mon, Jun 24, 2013 at 10:00 AM, Frank Murphy <frankly3d at gmail.com>wrote:
>
>> On Mon, 24 Jun 2013 09:51:50 -0400
>> Chris Kittlitz <ckittlitz at gmail.com> wrote:
>>
>> > I suppose we could set up a system and then clone it, but we may be
>> > including packages we don't need or missing ones that we do need.
>> > I want create the minimal list and then test it.
>> >
>> > Thanks!
>> >
>>
>> Maybe modify to suit:
>>
>> http://www.howtoforge.com/how-to-create-a-kickstart-file-for-centos-fedora-redhat-rhel
>>
>>
>> --
>> Regards,
>> Frank  "When in doubt PANIC!"
>>  I check for new mail app. 20min
>> www.frankly3d.com
>> _______________________________________________
>> Yum mailing list
>> Yum at lists.baseurl.org
>> http://lists.baseurl.org/mailman/listinfo/yum
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.baseurl.org/pipermail/yum/attachments/20130624/40bd788f/attachment.html>


More information about the Yum mailing list