Changeset 983 in ProjectBuilder for devel/rpmbootstrap/bin/rpmbootstrap


Ignore:
Timestamp:
Feb 20, 2010, 2:22:11 AM (14 years ago)
Author:
Bruno Cornec
Message:
  • rpmbootstrap good up to package name identification
  • fedora-12 package list updated
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/rpmbootstrap/bin/rpmbootstrap

    r982 r983  
    133133my ($projectbuilderver,$projectbuilderrev) = pb_version_init();
    134134my $appname = "rpmbootstrap";
     135$ENV{'PBPROJ'} = $appname;
    135136
    136137# Initialize the syntax string
     
    241242    die "Unable to download packages from $mirror for $ddir-$dver-$darch";
    242243}
    243 pb_log(3,"Mirror $mirror gave answer: $response->dump(maxlength => 0)\n");
    244 
    245 # Just print packages names if asked so.
    246 if ($opts{'p'}) {
    247     pb_log(0,"Should process package list: $pkgs\n");
    248     exit(0);
    249 }
     244pb_log(3,"Mirror $mirror gave answer: ".Dumper($response->dump(maxlength => 0))."\n");
     245
     246# Manages architectures specificities
     247my $parch = $darch;
     248$parch = "i?86" if ($darch eq "i386");
     249
     250# Get the list of packages and their URL in this hash
     251my %url;
     252foreach my $l (split(/\n/,$response->as_string())) {
     253    # Find a href ref
     254    if ($l =~ /<a href="(.*)">(.*)<\/a>/i) {
     255        my $url = $1;
     256        my $pkg = $1;
     257        my $desc = $2;
     258        pb_log(3,"Found desc URL $desc: ");
     259        # find an rpm package ref name-ver-tag.arch.rpm
     260        if ($pkg =~ /(.+)-([^-]+)-([^-]+)\.(noarch|$parch)\.rpm$/) {
     261            pb_log(3,"package ($1 + $2 + $3 + $4)\n");
     262            $url{$1} = "$mirror/$url";
     263        } else {
     264            pb_log(3,"not a package\n");
     265        }
     266    }
     267}
     268
    250269
    251270# For each package to process, get it, put it in the cache dir
     
    253272# Just download if asked so.
    254273
     274my $warning = 0;
     275my $lwpkg ="";
    255276foreach my $p (split(/,/,$pkgs)) {
    256     pb_log(1,"Processing package $p ...\n")
     277    pb_log(1,"Processing package $p ...\n");
     278    # Just print packages names if asked so.
     279    if ($opts{'p'}) {
     280        if (defined $url{$p}) {
     281            pb_log(0,"$url{$p}\n");
     282        } else {
     283            pb_log(0,"WARNING: unable to find URL for $p\n");
     284            $warning++;
     285            $lwpkg .= " $p";
     286        }
     287        next;
    257288    }
     289}
     290
     291if ($warning ge 1) {
     292    pb_log(0,"$warning WARNINGS found.\nMaybe you should review your package list for $ddir-$dver-$darch\nand remove$lwpkg\n");
     293}
     294
     295# We Just printed packages names so now end
     296if ($opts{'p'}) {
     297    exit(0);
     298}
Note: See TracChangeset for help on using the changeset viewer.