Changeset 500


Ignore:
Timestamp:
08/03/08 13:20:30 (5 years ago)
Author:
bruno
Message:
  • Working patch support added to pb (tested with buffer)
  • Filtering functions now handle also pointer on hashes (such as the new pb hash)
  • Filtering functions support new macro for patch support (PBPATCHSRC and PBPATCHCMD)
  • Env.pm now generates correct templates for patch support and uses the new pb hash
  • pb_cms_export extended to support  file:// URI, and also supports an undef second param (no local export available)
  • In pb, hashes now include also the arch (for better patch support)
  • pb supports local CMS based patches, as well as external references (not tested yet)
  • New pb_get_arch function provided
  • New parameters for pb_system (mayfail and quiet)
Location:
devel
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • devel/pb-modules/lib/ProjectBuilder/Base.pm

    r495 r500  
    152152my $redir = ""; 
    153153 
    154 pb_log(0,"$cmt... "); 
     154pb_log(0,"$cmt... ") if ($verbose ne "quiet"); 
    155155pb_log(1,"Executing $cmd\n"); 
    156156unlink("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 
     
    158158system("$cmd $redir"); 
    159159my $res = $?; 
     160# Exit now if the command may fail 
     161if ((defined $verbose) and ($verbose eq "mayfail")) { 
     162    pb_log(0,"N/A\n") if ($res != 0); 
     163    pb_log(0,"OK\n") if ($res == 0); 
     164    return($res)  
     165    } 
    160166if ($res == -1) { 
    161     pb_log(0,"failed to execute ($cmd): $!\n"); 
    162     pb_display_file("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 
     167    pb_log(0,"failed to execute ($cmd): $!\n") if ($verbose ne "quiet"); 
     168    pb_display_file("$ENV{'PBTMP'}/system.log") if ((-f "$ENV{'PBTMP'}/system.log") and ($verbose ne "quiet")); 
    163169} elsif ($res & 127) { 
    164     pb_log(0, "child ($cmd) died with signal ".($? & 127).", ".($? & 128) ? 'with' : 'without'." coredump\n"); 
    165     pb_display_file("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 
     170    pb_log(0, "child ($cmd) died with signal ".($? & 127).", ".($? & 128) ? 'with' : 'without'." coredump\n") if ($verbose ne "quiet"); 
     171    pb_display_file("$ENV{'PBTMP'}/system.log") if ((-f "$ENV{'PBTMP'}/system.log") and ($verbose ne "quiet")); 
    166172} elsif ($res == 0) { 
    167     pb_log(0,"OK\n"); 
    168     pb_display_file("$ENV{'PBTMP'}/system.log") if ((defined $verbose) && (-f "$ENV{'PBTMP'}/system.log")); 
     173    pb_log(0,"OK\n") if ($verbose ne "quiet"); 
     174    pb_display_file("$ENV{'PBTMP'}/system.log") if ((defined $verbose) and (-f "$ENV{'PBTMP'}/system.log") and ($verbose ne "quiet")); 
    169175} else { 
    170     pb_log(0, "child ($cmd) exited with value ".($? >> 8)."\n"); 
    171     pb_display_file("$ENV{'PBTMP'}/system.log") if (-f "$ENV{'PBTMP'}/system.log"); 
     176    pb_log(0, "child ($cmd) exited with value ".($? >> 8)."\n") if ($verbose ne "quiet"); 
     177    pb_display_file("$ENV{'PBTMP'}/system.log") if ((-f "$ENV{'PBTMP'}/system.log") and ($verbose ne "quiet")); 
    172178} 
    173179return($res); 
  • devel/pb/bin/pb

    r499 r500  
    521521        my @pt; 
    522522        my $tmpl = ""; 
    523         my @patches = (); 
     523        my %patches; 
    524524 
    525525        @pt = pb_conf_get_if("vmlist","velist"); 
     
    547547        $pb{'proj'} = $ENV{'PBPROJ'}; 
    548548        $pb{'repo'} = $ENV{'PBREPO'}; 
     549        $pb{'patches'} = \%patches; 
     550        pb_log(2,"DEBUG: pb: ".Dumper(%pb)."\n"); 
    549551 
    550552        foreach my $d (split(/,/,$tmpl)) { 
     
    563565            my %bfiles = (); 
    564566            my %pkgfiles = (); 
    565             $build{"$ddir-$dver"} = "yes"; 
     567            $build{"$ddir-$dver-$arch"} = "yes"; 
    566568 
    567569            if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pb{'dtype'}") { 
     
    573575            } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$ddir-$dver") { 
    574576                pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$ddir-$dver",$pbpkg,\%bfiles,\%pkgfiles,$supfiles); 
     577            } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$ddir-$dver-$arch") { 
     578                pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$ddir-$dver-$arch",$pbpkg,\%bfiles,\%pkgfiles,$supfiles); 
    575579            } else { 
    576                 $build{"$ddir-$dver"} = "no"; 
     580                $build{"$ddir-$dver-$arch"} = "no"; 
    577581                next; 
    578582            } 
     
    582586            my $ptr = pb_get_filters($pbpkg, $pb{'dtype'}, $dfam, $ddir, $dver); 
    583587 
    584             # Prepare patches for this distro 
     588            # Prepare local patches for this distro - They are always applied first - May be a problem one day 
    585589            foreach my $p (sort(<$ENV{'PBROOTDIR'}/$pbpkg/pbpatch/*>)) { 
    586                 push @patches,$p if ($p =~ /\.all$/); 
    587                 push @patches,$p if ($p =~ /\.$pb{'dtype'}$/); 
    588                 push @patches,$p if ($p =~ /\.$dfam$/); 
    589                 push @patches,$p if ($p =~ /\.$ddir$/); 
    590                 push @patches,$p if ($p =~ /\.$ddir-$dver$/); 
    591             } 
    592             $pb{'patches'} = \@patches; 
     590                $patches{"$ddir-$dver-$arch"} .= "," if ((defined $patches{"$ddir-$dver-$arch"}) and ($p =~ /\.all$/)); 
     591                $patches{"$ddir-$dver-$arch"} .= "file://$p" if ($p =~ /\.all$/); 
     592                $patches{"$ddir-$dver-$arch"} .= "," if ((defined $patches{"$ddir-$dver-$arch"}) and ($p =~ /\.$pb{'dtype'}$/)); 
     593                $patches{"$ddir-$dver-$arch"} .= "file://$p" if ($p =~ /\.$pb{'dtype'}$/); 
     594                $patches{"$ddir-$dver-$arch"} .= "," if ((defined $patches{"$ddir-$dver-$arch"}) and ($p =~ /\.$dfam$/)); 
     595                $patches{"$ddir-$dver-$arch"} .= "file://$p" if ($p =~ /\.$dfam$/); 
     596                $patches{"$ddir-$dver-$arch"} .= "," if ((defined $patches{"$ddir-$dver-$arch"}) and ($p =~ /\.$ddir$/)); 
     597                $patches{"$ddir-$dver-$arch"} .= "file://$p" if ($p =~ /\.$ddir$/); 
     598                $patches{"$ddir-$dver-$arch"} .= "," if ((defined $patches{"$ddir-$dver-$arch"}) and ($p =~ /\.$ddir-$dver$/)); 
     599                $patches{"$ddir-$dver-$arch"} .= "file://$p" if ($p =~ /\.$ddir-$dver$/); 
     600                $patches{"$ddir-$dver-$arch"} .= "," if ((defined $patches{"$ddir-$dver-$arch"}) and ($p =~ /\.$ddir-$dver-$arch$/)); 
     601                $patches{"$ddir-$dver-$arch"} .= "file://$p" if ($p =~ /\.$ddir-$dver-$arch$/); 
     602            } 
     603 
     604            # Prepare also remote patches to be included - Applied after the local ones 
     605            foreach my $p ("all","$pb{'dtype'}","$dfam","$ddir","$ddir-$dver","$ddir-$dver-$arch") { 
     606                my $f = "$ENV{'PBROOTDIR'}/$pbpkg/pbextpatch.$p"; 
     607                next if (not -f $f); 
     608                if (not open(PATCH,$f)) { 
     609                    pb_display("Unable to open existing external patch file content $f\n"); 
     610                    next; 
     611                } 
     612                while (<PATCH>) { 
     613                    chomp(); 
     614                    $patches{"$ddir-$dver-$arch"} .= "," if (defined $patches{"$ddir-$dver-$arch"}); 
     615                    $patches{"$ddir-$dver-$arch"} .= "$_"; 
     616                } 
     617                close(PATCH); 
     618            } 
     619            pb_log(2,"DEBUG: pb->patches: ".Dumper($pb{'patches'})."\n"); 
    593620 
    594621            # Apply now all the filters on all the files concerned 
    595622            # destination dir depends on the type of file 
    596623            if (defined $ptr) { 
     624                # For patch support 
     625                $pb{'tuple'} = "$ddir-$dver-$arch"; 
    597626                foreach my $f (values %bfiles,values %pkgfiles) { 
    598                     pb_filter_file("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver/".basename($f),\%pb); 
     627                    pb_filter_file("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$ddir-$dver-$arch/".basename($f),\%pb); 
    599628                } 
    600629            } 
     
    608637        pb_log(0,"Build files generated for ".join(',',sort(@found))."\n"); 
    609638        pb_log(0,"No Build files found for ".join(',',sort(@notfound))."\n") if (@notfound); 
     639        pb_log(2,"DEBUG: patches: ".Dumper(%patches)."\n"); 
     640 
    610641        # Get the generic filter (all.pbf) and  
    611642        # apply those to the non-build files including those 
     
    624655        pb_log(2,"Files ".$liste."have been filtered\n"); 
    625656 
    626         # Filter potential patches 
    627         pb_mkdir_p("$dest/pbconf/pbpatch"); 
    628         foreach my $p (sort(@patches)) { 
    629             my $pp = basename($p); 
    630             pb_filter_file($p,$ptr,"$dest/pbconf/pbpatch/$pp",\%pb); 
    631             pb_system("gzip -9 $dest/pbconf/pbpatch/$pp"); 
    632         } 
     657        # Filter potential patches (local + remote) 
     658        pb_log(0,"Delivering and compressing patches "); 
     659        foreach my $v (keys %patches) { 
     660            pb_mkdir_p("$dest/pbconf/$v/pbpatch"); 
     661            foreach my $pf (split(/,/,$patches{$v})) { 
     662                my $pp = basename($pf); 
     663                pb_cms_export($pf,undef,"$dest/pbconf/$v/pbpatch"); 
     664                pb_filter_file_inplace($ptr,"$dest/pbconf/$v/pbpatch/$pp",\%pb); 
     665                pb_system("gzip -9f $dest/pbconf/$v/pbpatch/$pp","","quiet"); 
     666            } 
     667            pb_log(0,"$patches{$v} "); 
     668        } 
     669        pb_log(0,"\n"); 
    633670 
    634671        # Prepare the dest directory for archive 
     
    685722    @pkgs = @$ptr; 
    686723 
     724    my $arch = pb_get_arch(); 
     725 
    687726    my ($pkg) = pb_conf_read("$ENV{'PBDESTDIR'}/$ENV{'PBPROJVER'}-$ENV{'PBPROJTAG'}.pb","pbpkg"); 
    688727    $pkg = { } if (not defined $pkg); 
     
    712751            symlink "$src","$ENV{'PBBUILDDIR'}/SOURCES/".basename($src) || die "Unable to symlink $src in $ENV{'PBBUILDDIR'}/SOURCES"; 
    713752            # We need to first extract the spec file 
    714             my @specfile = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$ENV{'PBBUILDDIR'}/SPECS"); 
     753            my @specfile = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$ddir-$dver-$arch/","$ENV{'PBBUILDDIR'}/SPECS","spec"); 
    715754 
    716755            # We need to handle potential patches to upstream sources 
    717             my @patchfiles = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/pbpatch/","$ENV{'PBBUILDDIR'}/SOURCES"); 
     756            pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$ddir-$dver-$arch/pbpatch/","$ENV{'PBBUILDDIR'}/SOURCES","patch"); 
    718757 
    719758            pb_log(2,"specfile: ".Dumper(\@specfile)."\n"); 
     
    742781            chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver"; 
    743782            pb_rm_rf("debian"); 
    744             symlink "pbconf/$ddir-$dver","debian" || die "Unable to symlink to pbconf/$ddir-$dver"; 
     783            symlink "pbconf/$ddir-$dver-$arch","debian" || die "Unable to symlink to pbconf/$ddir-$dver-$arch"; 
    745784            chmod 0755,"debian/rules"; 
    746785            if ($dver !~ /[0-9]/) { 
     
    763802 
    764803            # We need to first extract the ebuild file  
    765             @ebuildfile = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$ddir-$dver/","$tmpd"); 
     804            @ebuildfile = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$ddir-$dver-$arch/","$tmpd","ebuild"); 
    766805 
    767806            # Prepare the build env for gentoo 
     
    811850            pb_system("tar xfz $src2","Extracting pbconf"); 
    812851            chdir "$pbpkg-$pbver" || die "Unable to chdir to $pbpkg-$pbver"; 
    813             symlink "pbconf/$ddir-$dver","install" || die "Unable to symlink to pbconf/$ddir-$dver"; 
     852            symlink "pbconf/$ddir-$dver-$arch","install" || die "Unable to symlink to pbconf/$ddir-$dver-$arch"; 
    814853            if (-x "install/pbslack") { 
    815854                pb_system("./install/pbslack","Building package"); 
     
    11881227    $v =~ s/,.*//; 
    11891228 
    1190     # Which is our local arch ? (standardize on i386 for those platforms) 
    1191     my $arch = `uname -m`; 
    1192     chomp($arch); 
    1193     $arch =~ s/i.86/i386/; 
     1229    my $arch = pb_get_arch(); 
    11941230 
    11951231    # Launch the VMs/VEs 
     
    20432079my $dir=shift; 
    20442080my $ddir=shift; 
     2081my $mandatory=shift || "spec"; 
    20452082my @files; 
    20462083 
     2084my $flag = "mayfail" if ($mandatory eq "patch"); 
     2085my $res; 
     2086 
    20472087if ($src =~ /tar\.gz$/) { 
    2048     pb_system("tar xfpz $src $dir","Extracting build files"); 
     2088    $res = pb_system("tar xfpz $src $dir","Extracting $mandatory files from $src",$flag); 
    20492089} elsif ($src =~ /tar\.bz2$/) { 
    2050     pb_system("tar xfpj $src $dir","Extracting build files"); 
     2090    $res = pb_system("tar xfpj $src $dir","Extracting $mandatory files from $src",$flag); 
    20512091} else { 
    20522092    die "Unknown compression algorithm for $src"; 
    20532093} 
     2094# If not mandatory return now 
     2095return() if (($res != 0) and ($mandatory eq "patch")); 
    20542096opendir(DIR,"$dir") || die "Unable to open directory $dir"; 
    20552097foreach my $f (readdir(DIR)) { 
    20562098    next if ($f =~ /^\./); 
     2099    # Skip potential patch dir 
     2100    next if ($f =~ /^pbpatch/); 
    20572101    move("$dir/$f","$ddir") || die "Unable to move $dir/$f to $ddir"; 
    20582102    pb_log(2,"mv $dir/$f $ddir\n"); 
     
    21002144} 
    21012145 
     2146# Which is our local arch ? (standardize on i386 for those platforms) 
     2147sub pb_get_arch { 
     2148 
     2149my $arch = `uname -m`; 
     2150chomp($arch); 
     2151$arch =~ s/i.86/i386/; 
     2152return($arch); 
     2153} 
     2154 
    210221551; 
  • devel/pb/lib/ProjectBuilder/CMS.pm

    r452 r500  
    1616use English; 
    1717use File::Basename; 
     18use File::Copy; 
    1819use POSIX qw(strftime); 
    1920use lib qw (lib); 
     
    109110This function exports a CMS content to a directory. 
    110111The first parameter is the URL of the CMS content. 
    111 The second parameter is the directory in which it is locally exposed (result of a checkout). 
     112The second parameter is the directory in which it is locally exposed (result of a checkout). If undef, then use the original CMS content. 
    112113The third parameter is the directory where we want to deliver it (result of export). 
    113114 
     
    127128 
    128129if ($scheme =~ /^svn/) { 
    129     if (-d $source) { 
    130         $tmp = $destdir; 
    131     } else { 
    132         $tmp = "$destdir/".basename($source); 
    133     } 
    134     pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp"); 
     130    if (defined $source) { 
     131        if (-d $source) { 
     132            $tmp = $destdir; 
     133        } else { 
     134            $tmp = "$destdir/".basename($source); 
     135        } 
     136        pb_system("svn export $source $tmp","Exporting $source from SVN to $tmp"); 
     137    } else { 
     138        pb_system("svn export $uri $destdir","Exporting $uri from SVN to $destdir"); 
     139    } 
    135140} elsif ($scheme eq "dir") { 
    136141    pb_system("cp -a $path $destdir","Copying $uri from DIR to $destdir"); 
     
    152157    pb_mkdir_p($destdir); 
    153158 
    154     # Check whether the file is well formed  
    155     # (containing already a directory with the project-version name) 
    156     my ($pbwf) = pb_conf_get_if("pbwf"); 
    157     if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) { 
    158         $destdir = dirname($destdir); 
     159    if (defined $source) { 
     160        # Check whether the file is well formed  
     161        # (containing already a directory with the project-version name) 
     162        my ($pbwf) = pb_conf_get_if("pbwf"); 
     163        if ((defined $pbwf) && (defined $pbwf->{$ENV{'PBPROJ'}})) { 
     164            $destdir = dirname($destdir); 
     165        } 
    159166    } 
    160167 
     
    174181        # zip 
    175182        pb_system("cd $destdir ; unzip $path","Extracting $path in $destdir"); 
     183    } else { 
     184        # simple file: copy it (patch e.g.) 
     185        copy($path,$destdir); 
    176186    } 
    177187} elsif ($scheme =~ /^cvs/) { 
     
    179189    my $dir=dirname($destdir); 
    180190    my $base=basename($destdir); 
    181     # CVS also needs a modules name not a dir 
    182     #if (-d $source) { 
     191    if (defined $source) { 
     192        # CVS also needs a modules name not a dir 
    183193        $tmp1 = basename($source); 
    184         #} else { 
    185         #$tmp1 = dirname($source); 
    186         #$tmp1 = basename($tmp1); 
    187         #} 
     194    } else { 
     195        # Probably not right, should be checked, but that way I'll notice it :-) 
     196        $tmp1 = $uri; 
     197    } 
    188198    my $optcvs = ""; 
    189199 
     
    304314} elsif ($scheme =~ /^cvs/) { 
    305315    pb_system("cvs co $url $destination","Checking out $url to $destination "); 
     316} elsif ($scheme =~ /^file/) { 
     317    pb_cms_export($url,undef,$destination); 
    306318} else { 
    307319    die "cms $scheme unknown"; 
     
    417429} 
    418430 
    419 =item B<pb_cms_isdiff> 
     431=item B<pb_cms_getpkg> 
    420432 
    421433This function returns the list of packages we are working on in a CMS action. 
  • devel/pb/lib/ProjectBuilder/Env.pm

    r484 r500  
    477477# 
    478478# PBREPO is replaced by the root URL to access the repository 
    479 filter PBREPO = \$pbrepo 
     479filter PBREPO = \$pb->{'repo'} 
    480480 
    481481# PBSRC is replaced by the source package location after the repo 
    482482#filter PBSRC = src/%{name}-%{version}.tar.gz 
    483483 
    484 # PBVER is replaced by the version (\$pbver in code) 
    485 filter PBVER = \$pbver 
    486  
    487 # PBDATE is replaced by the date (\$pbdate in code) 
    488 filter PBDATE = \$pbdate 
     484# PBVER is replaced by the version (\$pb->{'ver'} in code) 
     485filter PBVER = \$pb->{'ver'} 
     486 
     487# PBDATE is replaced by the date (\$pb->{'date'} in code) 
     488filter PBDATE = \$pb->{'date'} 
    489489 
    490490# PBLOG is replaced by the changelog if value is yes 
    491491#filter PBLOG = yes 
    492492 
    493 # PBTAG is replaced by the tag (\$pbtag in code) 
    494 filter PBTAG = \$pbtag 
    495  
    496 # PBREV is replaced by the revision (\$pbrev in code) 
    497 filter PBREV = \$pbrev 
    498  
    499 # PBPKG is replaced by the package name (\$pbpkg in code) 
    500 filter PBPKG = \$pbpkg 
    501  
    502 # PBPACKAGER is replaced by the packager name (\$pbpackager in code) 
    503 filter PBPACKAGER = \$pbpackager 
     493# PBPATCHSRC is replaced by the patches names if value is yes 
     494#filter PBPATCHSRC = yes 
     495 
     496# PBPATCHCMD is replaced by the patches commands if value is yes 
     497#filter PBPATCHCMD = yes 
     498 
     499# PBTAG is replaced by the tag (\$pb->{'tag'} in code) 
     500filter PBTAG = \$pb->{'tag'} 
     501 
     502# PBREV is replaced by the revision (\$pb->{'rev'} in code) 
     503filter PBREV = \$pb->{'rev'} 
     504 
     505# PBPKG is replaced by the package name (\$pb->{'pkg'} in code) 
     506filter PBPKG = \$pb->{'pkg'} 
     507 
     508# PBPACKAGER is replaced by the packager name (\$pb->{'packager'} in code) 
     509filter PBPACKAGER = \$pb->{'packager'} 
    504510 
    505511# PBDESC contains the description of the package 
     
    527533#filter PBDEP = 
    528534 
    529 # PBSUF is replaced by the package suffix (\$pbsuf in code) 
    530 filter PBSUF = \$pbsuf 
     535# PBSUF is replaced by the package suffix (\$pb->{'suf'} in code) 
     536filter PBSUF = \$pb->{'suf'} 
    531537 
    532538# PBOBS is replaced by the Obsolete line 
     
    554560#filter PBDEP = 
    555561 
    556 # PBSUF is replaced by the package suffix (\$pbsuf in code) 
     562# PBSUF is replaced by the package suffix (\$pbsuf'} in code) 
    557563filter PBSUF = %{dist} 
    558564 
     
    844850Url:            PBURL 
    845851Source:         PBREPO/PBSRC 
     852#PBPATCHSRC 
    846853BuildRoot:      %{_tmppath}/%{name}-%{version}-%{release}-root-%(id -u -n) 
    847854#Requires:       PBDEP 
     
    855862%prep 
    856863%setup -q 
     864#PBPATCHCMD 
    857865 
    858866%build 
  • devel/pb/lib/ProjectBuilder/Filter.pm

    r499 r500  
    139139my $destfile=shift; 
    140140my $pb=shift; 
    141 my %pb = %$pb; 
    142141 
    143142pb_log(2,"DEBUG: From $f to $destfile\n"); 
     
    149148    foreach my $s (keys %filter) { 
    150149        # Process single variables 
    151         pb_log(2,"DEBUG filter{$s}: $filter{$s}\n"); 
    152150        my $tmp = $filter{$s}; 
    153151        next if (not defined $tmp); 
     152        pb_log(3,"DEBUG filter{$s}: $filter{$s}\n"); 
    154153        # Expand variables if any single one found 
    155         pb_log(2,"DEBUG tmp: $tmp\n"); 
    156154        if ($tmp =~ /\$/) { 
     155            # Order is important as we need to handle hashes refs before simple vars 
     156            eval { $tmp =~ s/(\$\w+-\>\{\'\w+\'\})/$1/eeg }; 
    157157            eval { $tmp =~ s/(\$\w+)/$1/eeg }; 
    158158            eval { $tmp =~ s/(\$\/)/$1/eeg }; 
    159159        # special case for ChangeLog only for pb 
    160160        } elsif (($s =~ /^PBLOG$/) && ($line =~ /^PBLOG$/)) { 
    161             my $p = $pb{'defpkgdir'}->{$pbpkg}; 
    162             $p = $pb{'extpkgdir'}->{$pbpkg} if (not defined $p); 
    163             pb_changelog($pb{'dtype'}, $pb{'pkg'}, $pb{'ver'}, $pb{'tag'}, $pb{'suf'}, $p, \*DEST, $tmp, $pb{'chglog'}); 
     161            pb_log(3,"DEBUG filtering PBLOG\n"); 
     162            my $p = $pb->{'defpkgdir'}->{$pb->{'pkg'}}; 
     163            $p = $pb->{'extpkgdir'}->{$pb->{'pkg'}} if (not defined $p); 
     164            pb_changelog($pb->{'dtype'}, $pb->{'pkg'}, $pb->{'ver'}, $pb->{'tag'}, $pb->{'suf'}, $p, \*DEST, $tmp, $pb->{'chglog'}); 
    164165            $tmp = ""; 
    165166        } elsif (($s =~ /^PBPATCHSRC$/) && ($line =~ /^PBPATCHSRC$/)) { 
     167            pb_log(3,"DEBUG filtering PBPATCHSRC\n"); 
    166168            my $i = 0; 
    167             foreach my $p (sort @$pb{'patches'}) { 
    168                 print DEST "Patch$i: $p\n"; 
     169            foreach my $p (split(/,/,$pb->{'patches'}->{$pb->{'tuple'}})) { 
     170                print DEST "Patch$i:         ".basename($p).".gz\n"; 
     171                $i++; 
    169172            } 
    170173            $tmp = ""; 
    171174        } elsif (($s =~ /^PBPATCHCMD$/) && ($line =~ /^PBPATCHCMD$/)) { 
     175            pb_log(3,"DEBUG filtering PBPATCHCMD\n"); 
    172176            my $i = 0; 
    173             foreach my $p (sort @$pb{'patches'}) { 
    174                 print DEST "%patch$i\n"; 
     177            foreach my $p (split(/,/,$pb->{'patches'}->{$pb->{'tuple'}})) { 
     178                print DEST "%patch$i -p1\n"; 
     179                $i++; 
    175180            } 
    176181            print DEST "\n"; 
     
    204209my $destfile=shift; 
    205210my $pb=shift; 
    206 my %pb = %$pb; 
    207211 
    208212my $cp = "$ENV{'PBTMP'}/".basename($destfile); 
    209 copy($destfile,$cp) || die "Unable to create $cp"; 
     213copy($destfile,$cp) || die "Unable to copy $destfile to $cp"; 
    210214 
    211215pb_filter_file($cp,$ptr,$destfile,$pb); 
Note: See TracChangeset for help on using the changeset viewer.