Changeset 2607 in ProjectBuilder
- Timestamp:
- Apr 7, 2020, 1:03:01 AM (5 years ago)
- Files:
-
- 2 added
- 8 edited
Legend:
- Unmodified
- Added
- Removed
-
0.15.3/pb-modules/etc/pb.yml
r2603 r2607 883 883 opensuse-10.2: 640 884 884 sles-9: 640 885 sles-10: 440885 sles-10: 640 886 886 rhel-7: 440 887 887 -
0.15.3/pb-modules/lib/ProjectBuilder/Version.pm
r2489 r2607 20 20 # any code which uses this module. 21 21 our @ISA = qw(Exporter); 22 our @EXPORT = qw(pb_version_init );22 our @EXPORT = qw(pb_version_init $PBCONFVER); 23 23 24 24 $VERSION = "PBVER"."PBEXTDIR"; -
0.15.3/pb-modules/lib/ProjectBuilder/YAML.pm
r2598 r2607 7 7 # We rename it here to allow embedded usage during setupv 8 8 # when no YAML implementation is available on the target system 9 # We also made modifications to avoid object usage conflicting in setupv 10 # and changed pb_Dump to adapt to new parameters 9 11 # 10 12 package ProjectBuilder::YAML; … … 116 118 sub _load_file { 117 119 # Check the file 118 #print("SPECIAL: loadfile ".D umper(@_)."\n");120 #print("SPECIAL: loadfile ".Data::Dumper::Dumper(@_)."\n"); 119 121 my $file = shift or _error( 'You did not specify a file name' ); 120 122 _error( "File '$file' does not exist" ) … … 157 159 # Create an object from a string 158 160 sub _load_string { 159 #print("SPECIAL: loadstring ".D umper(@_)."\n");161 #print("SPECIAL: loadstring ".Data::Dumper::Dumper(@_)."\n"); 160 162 my $self = []; 161 163 my $string = $_[0]; … … 271 273 # Load a YAML scalar string to the actual Perl scalar 272 274 sub _load_scalar { 273 #print("SPECIAL: loadscalar ".D umper(@_)."\n");275 #print("SPECIAL: loadscalar ".Data::Dumper::Dumper(@_)."\n"); 274 276 my ($string, $indent, $lines) = @_; 275 277 … … 341 343 # Load an array 342 344 sub _load_array { 343 #print("SPECIAL: loadarray ".D umper(@_)."\n");345 #print("SPECIAL: loadarray ".Data::Dumper::Dumper(@_)."\n"); 344 346 my ($array, $indent, $lines) = @_; 345 347 … … 424 426 # Load a hash 425 427 sub _load_hash { 426 #print("SPECIAL: loadhash ".D umper(@_)."\n");428 #print("SPECIAL: loadhash ".Data::Dumper::Dumper(@_)."\n"); 427 429 my ($hash, $indent, $lines) = @_; 428 430 … … 512 514 513 515 514 ###515 # Dumper functions:516 517 516 # Save an object to a string 518 517 sub _dump_string { 519 #print("SPECIAL: dumpstring ".Dumper(@_)."\n"); 520 my $self = shift; 521 return '' unless ref $self && @$self; 518 my $self = $_[0]; 519 return '' unless ref $self && %$self; 520 521 #print("SPECIAL: dumpstring ".Data::Dumper::Dumper($self)."\n"); 522 522 523 523 # Iterate over the documents 524 524 my $indent = 0; 525 525 my @lines = (); 526 push @lines, '---'; 526 527 527 528 eval { 528 foreach my $cursor ( @$self ) { 529 push @lines, '---'; 529 foreach my $c ( sort keys %$self ) { 530 my $cursor = $self->{$c}; 531 #print("SPECIAL: c, cursor ".Data::Dumper::Dumper($c,$cursor)."\n"); 532 push(@lines, _dump_scalar( $c, $cursor).':'); 533 $indent += 1; 530 534 531 535 # An empty document … … 535 539 # A scalar document 536 540 } elsif ( ! ref $cursor ) { 537 $lines[-1] .= ' ' . _dump_scalar( $cursor ); 541 #print("SPECIAL: found scalar \n"); 542 $lines[-1] .= ' ' . _dump_scalar( $c, $cursor ); 543 #print("SPECIAL: dumpscalar returns".Data::Dumper::Dumper($lines[-1])."\n"); 538 544 539 545 # A list at the root 540 546 } elsif ( ref $cursor eq 'ARRAY' ) { 547 #print("SPECIAL: found array \n"); 541 548 unless ( @$cursor ) { 542 549 $lines[-1] .= ' []'; 543 550 next; 544 551 } 545 push @lines, _dump_array( $c ursor, $indent, {} );552 push @lines, _dump_array( $c, $cursor, $indent, {} ); 546 553 547 554 # A hash at the root 548 555 } elsif ( ref $cursor eq 'HASH' ) { 556 #print("SPECIAL: found hash \n"); 549 557 unless ( %$cursor ) { 550 558 $lines[-1] .= ' {}'; 551 559 next; 552 560 } 553 push @lines, _dump_hash( $c ursor, $indent, {} );561 push @lines, _dump_hash( $c, $cursor, $indent, {} ); 554 562 555 563 } else { 556 564 die \("Cannot serialize " . ref($cursor)); 557 565 } 566 #print("SPECIAL: lines ".Data::Dumper::Dumper(@lines)."\n"); 567 $indent -= 1; 558 568 } 559 569 }; … … 574 584 575 585 sub _dump_scalar { 576 #print("SPECIAL: dumpscalar ".Dumper(@_)."\n"); 577 my $string = $_[1]; 578 my $is_key = $_[2]; 586 #print("SPECIAL: dumpscalar ".Data::Dumper::Dumper(@_)."\n"); 587 my $string = $_[0]; 588 #print("SPECIAL: string ".Data::Dumper::Dumper($string)."\n"); 589 my $is_key = $_[1]; 579 590 # Check this before checking length or it winds up looking like a string! 580 591 my $has_string_flag = _has_internal_string_value($string); 592 #print("SPECIAL: hasstring ".Data::Dumper::Dumper($has_string_flag)."\n"); 581 593 return '~' unless defined $string; 582 594 return "''" unless length $string; … … 608 620 609 621 sub _dump_array { 610 #print("SPECIAL: dumparray ".D umper(@_)."\n");622 #print("SPECIAL: dumparray ".Data::Dumper::Dumper(@_)."\n"); 611 623 my ($array, $indent, $seen) = @_; 612 624 if ( $seen->{refaddr($array)}++ ) { … … 648 660 649 661 sub _dump_hash { 650 #print("SPECIAL: dumphash ".D umper(@_)."\n");651 my ($ hash, $indent, $seen) = @_;662 #print("SPECIAL: dumphash ".Data::Dumper::Dumper(@_)."\n"); 663 my ($c, $hash, $indent, $seen) = @_; 652 664 if ( $seen->{refaddr($hash)}++ ) { 653 665 die \"ProjectBuilder::YAML does not support circular references"; … … 683 695 die \"ProjectBuilder::YAML does not support $type references"; 684 696 } 697 #print("SPECIAL: lines ".Data::Dumper::Dumper(@lines)."\n"); 685 698 } 686 699 … … 700 713 require Carp; 701 714 $errstr = $_[0]; 702 #print("SPECIAL: error: ".D umper(@_)."\n");715 #print("SPECIAL: error: ".Data::Dumper::Dumper(@_)."\n"); 703 716 #$errstr =~ s/ at \S+ line \d+.*//; 704 717 Carp::croak( $errstr ); -
0.15.3/pb-modules/t/Conf.t
r2504 r2607 1 1 #!/usr/bin/perl -w 2 2 # 3 # Tests ProjectBuilder:: Basefunctions3 # Tests ProjectBuilder::Conf functions 4 4 5 5 use strict; -
devel/pb-modules/etc/pb.yml
r2603 r2607 883 883 opensuse-10.2: 640 884 884 sles-9: 640 885 sles-10: 440885 sles-10: 640 886 886 rhel-7: 440 887 887 -
devel/pb-modules/lib/ProjectBuilder/Version.pm
r2489 r2607 20 20 # any code which uses this module. 21 21 our @ISA = qw(Exporter); 22 our @EXPORT = qw(pb_version_init );22 our @EXPORT = qw(pb_version_init $PBCONFVER); 23 23 24 24 $VERSION = "PBVER"."PBEXTDIR"; -
devel/pb-modules/lib/ProjectBuilder/YAML.pm
r2598 r2607 7 7 # We rename it here to allow embedded usage during setupv 8 8 # when no YAML implementation is available on the target system 9 # We also made modifications to avoid object usage conflicting in setupv 10 # and changed pb_Dump to adapt to new parameters 9 11 # 10 12 package ProjectBuilder::YAML; … … 116 118 sub _load_file { 117 119 # Check the file 118 #print("SPECIAL: loadfile ".D umper(@_)."\n");120 #print("SPECIAL: loadfile ".Data::Dumper::Dumper(@_)."\n"); 119 121 my $file = shift or _error( 'You did not specify a file name' ); 120 122 _error( "File '$file' does not exist" ) … … 157 159 # Create an object from a string 158 160 sub _load_string { 159 #print("SPECIAL: loadstring ".D umper(@_)."\n");161 #print("SPECIAL: loadstring ".Data::Dumper::Dumper(@_)."\n"); 160 162 my $self = []; 161 163 my $string = $_[0]; … … 271 273 # Load a YAML scalar string to the actual Perl scalar 272 274 sub _load_scalar { 273 #print("SPECIAL: loadscalar ".D umper(@_)."\n");275 #print("SPECIAL: loadscalar ".Data::Dumper::Dumper(@_)."\n"); 274 276 my ($string, $indent, $lines) = @_; 275 277 … … 341 343 # Load an array 342 344 sub _load_array { 343 #print("SPECIAL: loadarray ".D umper(@_)."\n");345 #print("SPECIAL: loadarray ".Data::Dumper::Dumper(@_)."\n"); 344 346 my ($array, $indent, $lines) = @_; 345 347 … … 424 426 # Load a hash 425 427 sub _load_hash { 426 #print("SPECIAL: loadhash ".D umper(@_)."\n");428 #print("SPECIAL: loadhash ".Data::Dumper::Dumper(@_)."\n"); 427 429 my ($hash, $indent, $lines) = @_; 428 430 … … 512 514 513 515 514 ###515 # Dumper functions:516 517 516 # Save an object to a string 518 517 sub _dump_string { 519 #print("SPECIAL: dumpstring ".Dumper(@_)."\n"); 520 my $self = shift; 521 return '' unless ref $self && @$self; 518 my $self = $_[0]; 519 return '' unless ref $self && %$self; 520 521 #print("SPECIAL: dumpstring ".Data::Dumper::Dumper($self)."\n"); 522 522 523 523 # Iterate over the documents 524 524 my $indent = 0; 525 525 my @lines = (); 526 push @lines, '---'; 526 527 527 528 eval { 528 foreach my $cursor ( @$self ) { 529 push @lines, '---'; 529 foreach my $c ( sort keys %$self ) { 530 my $cursor = $self->{$c}; 531 #print("SPECIAL: c, cursor ".Data::Dumper::Dumper($c,$cursor)."\n"); 532 push(@lines, _dump_scalar( $c, $cursor).':'); 533 $indent += 1; 530 534 531 535 # An empty document … … 535 539 # A scalar document 536 540 } elsif ( ! ref $cursor ) { 537 $lines[-1] .= ' ' . _dump_scalar( $cursor ); 541 #print("SPECIAL: found scalar \n"); 542 $lines[-1] .= ' ' . _dump_scalar( $c, $cursor ); 543 #print("SPECIAL: dumpscalar returns".Data::Dumper::Dumper($lines[-1])."\n"); 538 544 539 545 # A list at the root 540 546 } elsif ( ref $cursor eq 'ARRAY' ) { 547 #print("SPECIAL: found array \n"); 541 548 unless ( @$cursor ) { 542 549 $lines[-1] .= ' []'; 543 550 next; 544 551 } 545 push @lines, _dump_array( $c ursor, $indent, {} );552 push @lines, _dump_array( $c, $cursor, $indent, {} ); 546 553 547 554 # A hash at the root 548 555 } elsif ( ref $cursor eq 'HASH' ) { 556 #print("SPECIAL: found hash \n"); 549 557 unless ( %$cursor ) { 550 558 $lines[-1] .= ' {}'; 551 559 next; 552 560 } 553 push @lines, _dump_hash( $c ursor, $indent, {} );561 push @lines, _dump_hash( $c, $cursor, $indent, {} ); 554 562 555 563 } else { 556 564 die \("Cannot serialize " . ref($cursor)); 557 565 } 566 #print("SPECIAL: lines ".Data::Dumper::Dumper(@lines)."\n"); 567 $indent -= 1; 558 568 } 559 569 }; … … 574 584 575 585 sub _dump_scalar { 576 #print("SPECIAL: dumpscalar ".Dumper(@_)."\n"); 577 my $string = $_[1]; 578 my $is_key = $_[2]; 586 #print("SPECIAL: dumpscalar ".Data::Dumper::Dumper(@_)."\n"); 587 my $string = $_[0]; 588 #print("SPECIAL: string ".Data::Dumper::Dumper($string)."\n"); 589 my $is_key = $_[1]; 579 590 # Check this before checking length or it winds up looking like a string! 580 591 my $has_string_flag = _has_internal_string_value($string); 592 #print("SPECIAL: hasstring ".Data::Dumper::Dumper($has_string_flag)."\n"); 581 593 return '~' unless defined $string; 582 594 return "''" unless length $string; … … 608 620 609 621 sub _dump_array { 610 #print("SPECIAL: dumparray ".D umper(@_)."\n");622 #print("SPECIAL: dumparray ".Data::Dumper::Dumper(@_)."\n"); 611 623 my ($array, $indent, $seen) = @_; 612 624 if ( $seen->{refaddr($array)}++ ) { … … 648 660 649 661 sub _dump_hash { 650 #print("SPECIAL: dumphash ".D umper(@_)."\n");651 my ($ hash, $indent, $seen) = @_;662 #print("SPECIAL: dumphash ".Data::Dumper::Dumper(@_)."\n"); 663 my ($c, $hash, $indent, $seen) = @_; 652 664 if ( $seen->{refaddr($hash)}++ ) { 653 665 die \"ProjectBuilder::YAML does not support circular references"; … … 683 695 die \"ProjectBuilder::YAML does not support $type references"; 684 696 } 697 #print("SPECIAL: lines ".Data::Dumper::Dumper(@lines)."\n"); 685 698 } 686 699 … … 700 713 require Carp; 701 714 $errstr = $_[0]; 702 #print("SPECIAL: error: ".D umper(@_)."\n");715 #print("SPECIAL: error: ".Data::Dumper::Dumper(@_)."\n"); 703 716 #$errstr =~ s/ at \S+ line \d+.*//; 704 717 Carp::croak( $errstr ); -
devel/pb-modules/t/Conf.t
r2504 r2607 1 1 #!/usr/bin/perl -w 2 2 # 3 # Tests ProjectBuilder:: Basefunctions3 # Tests ProjectBuilder::Conf functions 4 4 5 5 use strict;
Note:
See TracChangeset
for help on using the changeset viewer.