Changeset 1363


Ignore:
Timestamp:
Nov 21, 2011, 2:34:56 PM (8 years ago)
Author:
bruno
Message:
  • Fix to support directories under the debian dir (such as source/format)
  • Fix to apply build files really from generic to specific
  • Add initial support for quilt patches on Debian
Location:
devel
Files:
2 edited

Legend:

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

    r1348 r1363  
    335335        die "$ENV{'PBROOTDIR'} is not a directory" if (not -d $ENV{'PBROOTDIR'});
    336336    }
     337    pb_log(1,"PBROOTDIR=$ENV{'PBROOTDIR'}\n");
    337338
    338339    # Adds that conf file to the list to consider
  • devel/pb/bin/pb

    r1360 r1363  
    913913                # Used in Filter.pm by pb_filter_file
    914914
    915                 $build{$v} = "yes";
     915                $build{$v} = "no";
    916916                if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'os'}") {
    917917                    pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'os'}",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
    918                 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'type'}") {
     918                    $build{$v} = "yes";
     919                }
     920                if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'type'}") {
    919921                    pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'type'}",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
    920                 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'family'}") {
     922                    $build{$v} = "yes";
     923                }
     924                if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'family'}") {
    921925                    pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'family'}",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
    922                 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}") {
     926                    $build{$v} = "yes";
     927                }
     928                if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}") {
    923929                    pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
    924                 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}-$pbos->{'version'}") {
     930                    $build{$v} = "yes";
     931                }
     932                if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}-$pbos->{'version'}") {
    925933                    pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}-$pbos->{'version'}",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
    926                 } elsif (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") {
     934                    $build{$v} = "yes";
     935                }
     936                if (-d "$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}") {
    927937                    pb_list_bfiles("$ENV{'PBROOTDIR'}/$pbpkg/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}",$pbpkg,\%bfiles,\%pkgfiles,$supfiles);
    928                 } else {
    929                     $build{$v} = "no";
     938                    $build{$v} = "yes";
    930939                }
    931940                pb_log(2,"DEBUG($v) bfiles: ".Dumper(\%bfiles)."\n");
     
    961970                    }
    962971                    # Filter build files at the end, as they depend on patches and sources
    963                     foreach my $f (values %bfiles,values %pkgfiles) {
    964                         pb_filter_file("$ENV{'PBROOTDIR'}/$f",$ptr,"$dest/pbconf/$v/".basename($f),$pb);
     972                    foreach my $f (keys %bfiles) {
     973                        pb_filter_file("$ENV{'PBROOTDIR'}/$bfiles{$f}",$ptr,"$dest/pbconf/$v/$f",$pb);
     974                    }
     975                    foreach my $f (keys %pkgfiles) {
     976                        pb_filter_file("$ENV{'PBROOTDIR'}/$pkgfiles{$f}",$ptr,"$dest/pbconf/$v/$f",$pb);
    965977                    }
    966978                }
     
    12481260
    12491261            # We need to handle potential patches to upstream sources
    1250             pb_mkdir_p("$ENV{'PBBUILDDIR'}/debian/patches");
    1251             my @f = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}/pbpatch/","$ENV{'PBBUILDDIR'}/debian/patches","patch");
    1252             # Generate Debian patch series
    1253             open(SERIE,"> $ENV{'PBBUILDDIR'}/debian/series") || die "Unable to write in $ENV{'PBBUILDDIR'}/debian/series";
    1254             foreach my $f (@f) {
     1262            pb_mkdir_p("debian/patches");
     1263            my @f = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}/pbpatch/","debian/patches","patch");
     1264
     1265            # If we use quilt to manage patches, we then setup the env correctly as per http://pkg-perl.alioth.debian.org/howto/quilt.html
     1266            # Generate Debian patch series for quilt
     1267            # If we use dpatch to manage patches, we then setup the 00list file as well
     1268            open(SERIE,"> debian/patches/series") || die "Unable to write in debian/patches/series";
     1269            open(LIST,"> debian/patches/00list") || die "Unable to write in debian/patches/00list";
     1270            foreach my $f (sort @f) {
     1271                # We also need to ncompress them
    12551272                print SERIE "$f\n";
     1273                print LIST "$f\n";
    12561274            }
    12571275            close(SERIE);
     1276            close(LIST);
     1277            $ENV{'QUILT_PATCHES'}="debian/patches";
    12581278
    12591279            # We need to handle potential additional sources to upstream sources
     
    34503470my $pkgfiles = shift;
    34513471my $supfiles = shift;
    3452 
    3453 pb_log(2,"DEBUG: entering pb_list_bfiles: ".Dumper($bfiles)."\n");
     3472# subdir to keep if recursive mode, empty by default
     3473my $subdir = shift || "";
     3474
     3475pb_log(2,"DEBUG: entering pb_list_bfiles in $dir: ".Dumper($bfiles)."\n");
    34543476opendir(BDIR,"$dir") || die "Unable to open dir $dir: $!";
    34553477foreach my $f (readdir(BDIR)) {
     3478    pb_log(3,"DEBUG: pb_list_bfiles found $f\n");
    34563479    next if ($f =~ /^\./);
    3457     if (-d $f) {
     3480    if (-d "$dir/$f") {
    34583481        # Recurse for directories (Debian 3.0 format e.g.)
    3459         pb_list_bfiles($f,$pbpkg,$bfiles,$pkgfiles,$supfiles);
     3482        pb_log(2,"DEBUG: pb_list_bfiles recurse in $dir/$f\n");
     3483        pb_list_bfiles("$dir/$f",$pbpkg,$bfiles,$pkgfiles,$supfiles,$f);
    34603484        next;
    34613485    }
    3462     $bfiles->{$f} = "$dir/$f";
    3463     $bfiles->{$f} =~ s~$ENV{'PBROOTDIR'}~~;
     3486
     3487    my $key = $f;
     3488    # if recursive then store also the subdir
     3489    $key = "$subdir/$f" if ($subdir ne "");
     3490    $bfiles->{$key} = "$dir/$f";
     3491    $bfiles->{$key} =~ s~$ENV{'PBROOTDIR'}~~;
    34643492    if (defined $supfiles->{$pbpkg}) {
    3465         $pkgfiles->{$f} = "$dir/$f" if ($f =~ /$supfiles->{$pbpkg}/);
     3493        $pkgfiles->{$key} = "$dir/$f" if ($f =~ /$supfiles->{$pbpkg}/);
    34663494    }
    34673495}
Note: See TracChangeset for help on using the changeset viewer.