Changeset 429


Ignore:
Timestamp:
May 8, 2008, 2:04:20 AM (12 years ago)
Author:
bruno
Message:
  • Change filtering interface to add pbrepo keyword support and PBREPO macro
  • Add repository generation support + conf files to pb for rpm
  • Adapt pb and mondorecue spec files to new interfaces
Files:
12 edited

Legend:

Unmodified
Added
Removed
  • devel/pb/bin/pb

    r428 r429  
    446446    my ($pkgv, $pkgt) = pb_conf_get_if("pkgver","pkgtag");
    447447
    448     # declare packager for filtering
    449     my ($tmp) = pb_conf_get("pbpackager");
    450     $ENV{'PBPACKAGER'} = $tmp->{$ENV{'PBPROJ'}};
     448    # declare packager and repo for filtering
     449    my ($tmp1, $tmp2) = pb_conf_get("pbpackager","pbrepo");
     450    $ENV{'PBPACKAGER'} = $tmp1->{$ENV{'PBPROJ'}};
     451    $ENV{'PBREPO'} = $tmp2->{$ENV{'PBPROJ'}};
    451452
    452453    foreach my $pbpkg (@pkgs) {
     
    551552            if (defined $ptr) {
    552553                foreach my $f (values %bfiles,values %pkgfiles) {
    553                     pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$ENV{'PBPACKAGER'},$chglog,$ENV{'PBPROJ'});
     554                    pb_filter_file_pb("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),$dtype,$pbsuf,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$defpkgdir,$extpkgdir,$ENV{'PBPACKAGER'},$chglog,$ENV{'PBPROJ'},$ENV{'PBREPO'});
    554555                }
    555556            }
     
    573574        if (defined $filteredfiles->{$pbpkg}) {
    574575            foreach my $f (split(/,/,$filteredfiles->{$pbpkg})) {
    575                 pb_filter_file_inplace($ptr,"$dest/$f",$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'},$ENV{'PBPROJ'});
     576                pb_filter_file_inplace($ptr,"$dest/$f",$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'},$ENV{'PBPROJ'},$ENV{'PBREPO'});
    576577                $liste = "$f $liste";
    577578            }
     
    581582        # Prepare the dest directory for archive
    582583        if (-x "$ENV{'PBROOTDIR'}/$pbpkg/pbinit") {
    583             pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'},$ENV{'PBPROJ'});
     584            pb_filter_file("$ENV{'PBROOTDIR'}/$pbpkg/pbinit",$ptr,"$ENV{'PBTMP'}/pbinit",$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$ENV{'PBPACKAGER'},$ENV{'PBPROJ'},$ENV{'PBREPO'});
    584585            chmod 0755,"$ENV{'PBTMP'}/pbinit";
    585586            pb_system("cd $dest ; $ENV{'PBTMP'}/pbinit","Executing init script from $ENV{'PBROOTDIR'}/$pbpkg/pbinit");
     
    823824        }
    824825    }
    825     # Adds conf file for availanility of conf elements
     826    # Adds conf file for availability of conf elements
    826827    pb_conf_add("$ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb");
    827828
    828829    if (($cmt eq "vm") || ($cmt eq "ve")) {
    829         $src="$src $ENV{'PBDESTDIR'}/pbscript $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc";
     830        $src="$src $ENV{'PBROOTDIR'}/$ENV{'PBPROJ'}.pb $ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb $ENV{'PBETC'} $ENV{'PBDESTDIR'}/pbrc";
    830831    } elsif ($cmt eq "Script") {
    831         $src="$src $ENV{'PBDESTDIR'}/pbscript";
     832        # Nothing special to do
    832833    } elsif ($cmt eq "Packages") {
    833834        # Get package list from file made during build2pkg
     
    836837        chomp($src);
    837838        close(KEEP);
    838         if ($dtype eq "rpm") {
    839             # Also make a pbscript to generate yum/urpmi bases
    840             # $src = "$src $ENV{'PBDESTDIR'}/pbscript"
    841         } elsif ($dtype eq "deb") {
    842             # Also make a pbscript to generate apt bases
    843             # $src = "$src $ENV{'PBDESTDIR'}/pbscript"
    844         }
    845     }
     839
     840    }
     841    # Systematically adds the pbscript
     842    $src="$src $ENV{'PBDESTDIR'}/pbscript";
    846843    # Remove potential leading spaces (cause problem with basename)
    847844    $src =~ s/^ *//;
     
    879876    } elsif ($cmt eq "Packages") {
    880877        $tdir = "$sshdir->{$ENV{'PBPROJ'}}/$ddir/$dver";
     878
    881879        if ((defined $testver) && (defined $testver->{$ENV{'PBPROJ'}}) && ($testver->{$ENV{'PBPROJ'}} =~ /true/i)) {
    882880            # This is a test pkg => target dir is under test
    883881            $tdir = "$sshdir->{$ENV{'PBPROJ'}}/test/$ddir/$dver";
    884882        }
     883
     884        my $repodir = $tdir;
     885        $repodir =~ s|^$sshdir->{$ENV{'PBPROJ'}}/||;
     886
     887        my ($pbrepo) = pb_conf_get("pbrepo");
     888
     889        # Repository management
     890        open(PBS,"> $ENV{'PBDESTDIR'}/pbscript") || die "Unable to create $ENV{'PBDESTDIR'}/pbscript";
     891        if ($dtype eq "rpm") {
     892            # Also make a pbscript to generate yum/urpmi bases
     893            print PBS << "EOF";
     894# Prepare a script to ease yum setup
     895cat > $ENV{'PBPROJ'}.repo << EOT
     896[$ENV{'PBPROJ'}]
     897name=$ddir $dver - $ENV{'PBPROJ'} Vanilla Packages
     898baseurl=$pbrepo->{'PBPROJ'}/$repodir
     899enabled=1
     900gpgcheck=0
     901EOT
     902chmod 644 $ENV{'PBPROJ'}.repo
     903
     904# Clean up old repo content
     905rm -rf headers/ repodata/
     906# Create yum repo
     907yum-arch .
     908# Create repodata
     909createrepo .
     910EOF
     911            if ($dfam eq "md") {
     912                # For Mandriva add urpmi management
     913                print PBS << "EOF";
     914# Prepare a script to ease urpmi setup
     915cat > $ENV{'PBPROJ'}.addmedia << EOT
     916urpmi.addmedia $ENV{'PBPROJ'} $pbrepo->{'PBPROJ'}/$repodir with hdlist.cz
     917EOT
     918chmod 755 $ENV{'PBPROJ'}.addmedia
     919
     920# Clean up old repo content
     921rm -f hdlist.cz
     922# Create urpmi repo
     923genhdlist .
     924EOF
     925            }
     926        } elsif ($dtype eq "deb") {
     927            # Also make a pbscript to generate apt bases
     928        }
     929        close(PBS);
     930
    885931    } else {
    886932        return;
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r427 r429  
    140140The fourteenth parameter is the changelog.
    141141The fifteenth parameter is the project.
     142The sixteenth parameter is the repo.
    142143
    143144=cut
     
    161162my $chglog = shift || undef;
    162163my $pbproj = shift;
     164my $pbrepo = shift;
    163165
    164166pb_log(2,"DEBUG: From $f to $destfile\n");
     
    207209The eighth parameter is the packager name.
    208210The nineth parameter is the project name.
     211The tenth parameter is the repo.
    209212
    210213=cut
     
    223226my $pbpackager=shift;
    224227my $pbproj=shift;
     228my $pbrepo = shift;
    225229
    226230my $cp = "$ENV{'PBTMP'}/".basename($destfile);
    227231copy($destfile,$cp) || die "Unable to create $cp";
    228232
    229 pb_filter_file($cp,$ptr,$destfile,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager,$pbproj);
     233pb_filter_file($cp,$ptr,$destfile,$pbpkg,$pbver,$pbtag,$pbrev,$pbdate,$pbpackager,$pbproj,$pbrepo);
    230234unlink $cp;
    231235}
     
    247251The nineth parameter is the packager name.
    248252The tenth parameter is the project name.
     253The eleventh parameter is the repo.
    249254
    250255=cut
     
    265270my $pbpackager=shift;
    266271my $pbproj=shift;
     272my $pbrepo = shift;
    267273
    268274pb_log(2,"DEBUG: From $f to $destfile\n");
  • pbconf/devel/pb.pb

    r425 r429  
    1515#
    1616pbpackager pb = Bruno Cornec <bruno@project-builder.org>
     17
     18# Repository
     19pbrepo pb = ftp://ftp.project-builder.org
    1720
    1821#
  • pbconf/devel/perl-ProjectBuilder/rpm/perl-ProjectBuilder.spec

    r404 r429  
    1313Group:      PBGRP
    1414Url:        http://trac.project-builder.org
    15 Source:     PBSRC
     15Source:     PBREPO/PBSRC
    1616BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1717BuildArch:  noarch
  • pbconf/devel/project-builder/rpm/project-builder.spec

    r407 r429  
    1313Group:      PBGRP
    1414Url:        http://trac.project-builder.org
    15 Source:     PBSRC
     15Source:     PBREPO/PBSRC
    1616BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1717BuildArch:  noarch
  • projects/dploy/pbconf/devel/dploy-common/rpm/dploy-common.spec

    r422 r429  
    1515Source:         PBSRC
    1616BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    17 BuildArch:      noarch
     17BuildArch:      noarch
    1818Requires:       openssh, PBDEP
    1919
  • projects/mondorescue/pbconf/branches/2.2.6/mindi-busybox/rpm/mindi-busybox.spec

    r384 r429  
    99Group:      PBGRP
    1010Url:        http://www.mondorescue.org
    11 Source:     PBSRC
     11Source:     PBREPO/PBSRC
    1212BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1313PBREQ
  • projects/mondorescue/pbconf/branches/2.2.6/mindi/rpm/mindi.spec

    r384 r429  
    99Group:      PBGRP
    1010Url:        http://www.mondorescue.org
    11 Source:     PBSRC
     11Source:     PBREPO/PBSRC
    1212# Not yet possible as busybox is a binary that should go alongside
    1313# BuildArch:    noarch
  • projects/mondorescue/pbconf/branches/2.2.6/mondo-doc/rpm/mondo-doc.spec

    r384 r429  
    1212Group:      PBGRP
    1313Url:        http://www.mondorescue.org
    14 Source:     PBSRC
     14Source:     PBREPO/PBSRC
    1515BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1616BuildRequires:  docbook-utils
  • projects/mondorescue/pbconf/branches/2.2.6/mondo/rpm/mondo.spec

    r384 r429  
    1414Group:      PBGRP
    1515Url:        http://www.mondorescue.org
    16 Source:     PBSRC
     16Source:     PBREPO/PBSRC
    1717BuildRoot:  %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n)
    1818BuildRequires:  newt-devel >= 0.50
  • projects/mondorescue/pbconf/branches/2.2.6/mondorescue.pb

    r426 r429  
    1111# Packager label
    1212pbpackager mondorescue = Bruno Cornec <bruno@mondorescue.org>
     13
     14# Root repo
     15pbrepo mondorescue = ftp://ftp.mondorescue.org
    1316
    1417#
  • projects/mondorescue/pbconf/branches/2.2.6/pbfilter/all.pbf

    r418 r429  
    44# Filter for rpm build
    55#
     6# PBURL is replaced by the root URL to access the repository
     7filter PBREPO = $pbrepo
     8
    69# PBSRC is replaced by the source package format
    7 filter PBSRC = ftp://ftp.mondorescue.org/src/%{name}-%{version}.tar.gz
     10filter PBSRC = src/%{name}-%{version}.tar.gz
    811
    912# PBVER is replaced by the version ($pbver in code)
Note: See TracChangeset for help on using the changeset viewer.