Changeset 1367 in ProjectBuilder for devel/pb/bin/pb
- Timestamp:
- Nov 27, 2011, 3:44:49 AM (13 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
devel/pb/bin/pb
r1365 r1367 954 954 # Filter potential patches (local + remote) 955 955 pb_mkdir_p("$dest/pbconf/$v/pbpatch"); 956 # If Debian based distribution, then prepare what will be done at build time 957 my ($patchcmd,$patchopt); 958 if ($pbos->{'type'} eq "deb") { 959 ($patchcmd,$patchopt) = pb_distro_get_param($pbos,pb_conf_get_if("ospatchcmd","ospatchopt")); 960 open(SCRIPT,"> $dest/pbconf/$v/pbpatch/pbapplypatch") || die "Unable to create $dest/pbconf/$v/pbpatch/pbapplypatch"; 961 print SCRIPT "#!/bin/bash\n"; 962 print SCRIPT "set -x\n" if ($pbdebug gt 1); 963 } 956 964 foreach my $pf (split(/,/,$pb->{'patches'}->{$v})) { 957 965 my $pp = basename($pf); … … 959 967 pb_filter_file_inplace($ptr,"$dest/pbconf/$v/pbpatch/$pp",$pb); 960 968 pb_system("gzip -9f $dest/pbconf/$v/pbpatch/$pp","","quiet"); 969 if ($pbos->{'type'} eq "deb") { 970 # If Debian based distribution, then prepare what will be done at build time 971 # by applying the patches that will be available under the debian/patches dir 972 print SCRIPT "$patchcmd $patchopt \< debian/patches/$pp\n"; 973 } 961 974 } 975 if ($pbos->{'type'} eq "deb") { 976 close(SCRIPT); 977 chmod 0755,"$dest/pbconf/$v/pbpatch/pbapplypatch"; 978 } 979 #pb_system("cat $dest/pbconf/$v/pbpatch/pbapplypatch","APPLY","verbose"); 962 980 } 963 981 if (defined $pb->{'sources'}->{$v}) { … … 1263 1281 my @f = pb_extract_build_files($src2,"$pbpkg-$pbver/pbconf/$pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'}/pbpatch/","debian/patches","patch"); 1264 1282 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"; 1283 # By default we use format 1.0 - Cf man dpkg-source 1284 my $debsrcfmt = "1.0"; 1285 my $debsrcfile = "debian/source/format"; 1286 if (-f $debsrcfile) { 1287 $debsrcfmt = pb_get_content($debsrcfile); 1288 } 1289 1290 if ($debsrcfmt =~ /^3.*quilt/) { 1291 # If we use quilt to manage patches, we then setup the env correctly 1292 # as per http://pkg-perl.alioth.debian.org/howto/quilt.html 1293 # Generate Debian patch series for quilt 1294 open(SERIE,"> debian/patches/series") || die "Unable to write in debian/patches/series"; 1295 $ENV{'QUILT_PATCHES'}="debian/patches"; 1296 } else { 1297 # If we use dpatch to manage patches, we then setup the 00list file as well 1298 open(SERIE,"> debian/patches/00list") || die "Unable to write in debian/patches/00list"; 1299 } 1270 1300 foreach my $f (sort @f) { 1271 # We also need to ncompress them 1301 # Skip the script made to apply the patches to the Debian tree 1302 next if ($f =~ /pbapplypatch/); 1303 # We also need to uncompress them 1304 pb_system("gzip -d $f","","quiet"); 1305 $f =~ s/\.gz$//; 1272 1306 print SERIE "$f\n"; 1273 print LIST "$f\n";1274 1307 } 1275 1308 close(SERIE); 1276 close(LIST); 1277 $ENV{'QUILT_PATCHES'}="debian/patches"; 1309 if ($debsrcfmt =~ /^1.*/) { 1310 # In that case we need to apply the patches ourselves locally 1311 pb_system("cat debian/patches/pbapplypatch","APPLY","verbose"); 1312 pb_system("debian/patches/pbapplypatch","Applying patches to $pbos->{'name'}-$pbos->{'version'}-$pbos->{'arch'} tree"); 1313 } 1314 if (@f) { 1315 # We have patches, so modify the name of files to be Debian compliant 1316 move("../$src","../$pbpkg-$pbver.orig.tar.gz"); 1317 } 1278 1318 1279 1319 # We need to handle potential additional sources to upstream sources … … 3477 3517 # subdir to keep if recursive mode, empty by default 3478 3518 my $subdir = shift || ""; 3519 # In a recursive function , we need a local var as DIR handle 3520 my $bdir; 3479 3521 3480 3522 pb_log(2,"DEBUG: entering pb_list_bfiles in $dir: ".Dumper($bfiles)."\n"); 3481 opendir( BDIR,"$dir") || die "Unable to open dir $dir: $!";3482 foreach my $f (readdir( BDIR)) {3523 opendir($bdir,"$dir") || die "Unable to open dir $dir: $!"; 3524 foreach my $f (readdir($bdir)) { 3483 3525 pb_log(3,"DEBUG: pb_list_bfiles found $f\n"); 3484 3526 next if ($f =~ /^\./); … … 3499 3541 } 3500 3542 } 3501 closedir( BDIR);3543 closedir($bdir); 3502 3544 pb_log(2,"DEBUG: exiting pb_list_bfiles: ".Dumper($bfiles)."\n"); 3503 3545 }
Note:
See TracChangeset
for help on using the changeset viewer.