Changeset 1621


Ignore:
Timestamp:
06/02/12 19:06:12 (13 months ago)
Author:
bruno
Message:
  • Try to allow usage of script without previous launch. Improved, but still incomplete
  • Repository files generated now contains in their name a tag corresponding to the delivery dir. This allows to have easily both a test and non-test version in the same yum repo e.g. Tested for yum. Used by the MondoRescue? regression suite.
File:
1 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r1612 r1621  
    18921892        # Get list of packages to build 
    18931893        my $ptr = pb_get_pkg(); 
    1894         @pkgs = @$ptr; 
     1894        my @pkgs = (); 
     1895        @pkgs = @$ptr if (defined $ptr); 
    18951896 
    18961897        # Get the running distro to consider 
    18971898        $pbos = pb_distro_get_context($v); 
    18981899 
     1900        my $pkg = { }; 
    18991901        # Get content saved in cms2build 
    1900         my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 
    1901         $pkg = { } if (not defined $pkg); 
     1902        if ((defined $ENV{'PBDESTDIR'}) && (defined $ENV{'PBPROJVER'}) && (defined $ENV{'PBPROJTAG'}) && (-f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb")) { 
     1903            ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 
     1904            $pkg = { } if (not defined $pkg); 
     1905        } 
    19021906 
    19031907        pb_mkdir_p("$ENV{'PBBUILDDIR'}") if (! -d "$ENV{'PBBUILDDIR'}"); 
     
    19281932        } 
    19291933        # Adds conf file for availability of conf elements 
    1930         pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb"); 
     1934        pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb") if ((defined $ENV{'PBROOTDIR'}) && (-f "$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb")); 
    19311935    } 
    19321936    my ($rbsconf,$testver,$delivery) = pb_conf_get_if($conf,"testver","delivery"); 
     
    20372041        my $repodir = $tdir; 
    20382042        $repodir =~ s|^$remdir/||; 
     2043        my $repotag = ""; 
     2044        $repotag = "-$delivery->{$ENV{'PBPROJ'}}" if ($delivery->{$ENV{'PBPROJ'}} ne ""); 
    20392045 
    20402046        my ($pbrepo) = pb_conf_get("pbrepo"); 
     
    20562062            print PBS "set -x\n" if ($pbdebug gt 1); 
    20572063            print PBS << "EOF"; 
    2058 cat > $ENV{'PBPROJ'}.repo << EOT 
    2059 [$ENV{'PBPROJ'}] 
     2064cat > $ENV{'PBPROJ'}$repotag.repo << EOT 
     2065[$ENV{'PBPROJ'}$repotag] 
    20602066name=$pbos->{'name'} $pbos->{'version'} $pbos->{'arch'} - $ENV{'PBPROJ'} Vanilla Packages 
    20612067baseurl=$pbrepo->{$ENV{'PBPROJ'}}/$repodir 
     
    20872093                print PBS << "EOF"; 
    20882094# Prepare a script to ease urpmi setup 
    2089 cat > $ENV{'PBPROJ'}.addmedia << EOT 
    2090 urpmi.addmedia $ENV{'PBPROJ'} $pbrepo->{$ENV{'PBPROJ'}}/$repodir with media_info/hdlist.cz 
     2095cat > $ENV{'PBPROJ'}$repotag.addmedia << EOT 
     2096urpmi.addmedia $ENV{'PBPROJ'}$repotag $pbrepo->{$ENV{'PBPROJ'}}/$repodir with media_info/hdlist.cz 
    20912097EOT 
    20922098chmod 755 $ENV{'PBPROJ'}.addmedia 
     
    21182124# Cf: http://de.opensuse.org/1-Klick-Installation/ISV 
    21192125# 
    2120 cat > $ENV{'PBPROJ'}.ymp << EOT 
     2126cat > $ENV{'PBPROJ'}$repotag.ymp << EOT 
    21212127<?xml version="1.0" encoding="utf-8"?> 
    21222128<!-- vim: set sw=2 ts=2 ai et: --> 
     
    21242130    <group><!-- The group of software, typically one for project-builder.org --> 
    21252131        <name>$ENV{'PBPROJ'} Bundle</name> <!-- Name of the software group --> 
    2126         <summary>Software bundle for the $ENV{'PBPROJ'} project</summary> <!--This message is shown to the user and should describe the whole bundle --> 
    2127         <description>This is the summary of the $ENV{'PBPROJ'} Project 
     2132        <summary>Software bundle for the $ENV{'PBPROJ'}$repotag project</summary> <!--This message is shown to the user and should describe the whole bundle --> 
     2133        <description>This is the summary of the $ENV{'PBPROJ'}$repotag Project 
    21282134               
    21292135            Details are available on a per package basis below 
     
    21332139        <repositories><!-- List of needed repositories --> 
    21342140            <repository> 
    2135                 <name>$ENV{'PBPROJ'} Repository</name> <!-- Name of the repository  --> 
    2136                 <summary>This repository contains the $ENV{'PBPROJ'} project packages.</summary> <!-- Summary of the repository --> 
    2137                 <description>This repository contains the $ENV{'PBPROJ'} project packages.</description><!-- This description is shown to the user --> 
     2141                <name>$ENV{'PBPROJ'}$repotag Repository</name> <!-- Name of the repository  --> 
     2142                <summary>This repository contains the $ENV{'PBPROJ'}$repotag project packages.</summary> <!-- Summary of the repository --> 
     2143                <description>This repository contains the $ENV{'PBPROJ'}$repotag project packages.</description><!-- This description is shown to the user --> 
    21382144                <url>$pbrepo->{$ENV{'PBPROJ'}}/$repodir</url><!--URL of repository, which is added --> 
    21392145            </repository> 
     
    21452151    name=`rpm -q --qf '%{NAME}' \$p` 
    21462152    desc=`rpm -q --qf '%{description}' \$p` 
    2147     cat >> $ENV{'PBPROJ'}.ymp << EOT 
     2153    cat >> $ENV{'PBPROJ'}$repotag.ymp << EOT 
    21482154            <item> 
    21492155                <name>\$name</name><!-- Name of the package, is shown to the user and used to identify the package at the repository --> 
     
    21532159EOT 
    21542160done 
    2155 cat >> $ENV{'PBPROJ'}.ymp << EOT 
     2161cat >> $ENV{'PBPROJ'}$repotag.ymp << EOT 
    21562162        </software> 
    21572163    </group> 
    21582164</metapackage> 
    21592165EOT 
    2160 chmod 644 $ENV{'PBPROJ'}.ymp 
     2166chmod 644 $ENV{'PBPROJ'}$repotag.ymp 
    21612167EOF 
    21622168            } 
     
    21772183#!/bin/bash 
    21782184# Prepare a script to ease apt setup 
    2179 cat > $ENV{'PBPROJ'}.sources.list << EOT 
     2185cat > $ENV{'PBPROJ'}$repotag.sources.list << EOT 
    21802186deb $rpd $pbos->{'version'} $projcomponent 
    21812187deb-src $rpd $pbos->{'version'} $projcomponent 
    21822188EOT 
    2183 chmod 644 $ENV{'PBPROJ'}.sources.list 
     2189chmod 644 $ENV{'PBPROJ'}$repotag.sources.list 
    21842190 
    21852191# Up two levels to deal with the dist dir cross versions 
     
    21942200Archive: unstable 
    21952201Component: $projcomponent 
    2196 Origin: $ENV{'PBPROJ'} 
    2197 Label: $ENV{'PBPROJ'} dev repository $pbrepo->{$ENV{'PBPROJ'}} 
     2202Origin: $ENV{'PBPROJ'}$repotag 
     2203Label: $ENV{'PBPROJ'}$repotag dev repository $pbrepo->{$ENV{'PBPROJ'}} 
    21982204EOT 
    21992205 
     
    42074213my @pkgs = (); 
    42084214 
     4215# In script actions that file may not exist. 
     4216return(\@pkgs) if ((not defined $ENV{'PBDESTDIR'}) || (not defined $ENV{'PBPROJVER'}) || (not defined $ENV{'PBPROJTAG'}) || (! -f "$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb")); 
     4217 
    42094218my ($var) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 
    4210 @pkgs = keys %$var; 
    4211  
    4212 pb_log(0,"Packages: ".join(',',@pkgs)."\n"); 
     4219@pkgs = keys %$var if (defined $var); 
     4220 
     4221pb_log(0,"Packages: ".join(',',@pkgs)."\n") if (@pkgs); 
    42134222return(\@pkgs); 
    42144223} 
Note: See TracChangeset for help on using the changeset viewer.