May 21, 2012, 2:17:30 AM (7 years ago)
  • pb: Improve build2pkg documentation so It can be referenced in build2ve. Document need to specify verpmtype for a rpm-style VE. Add substep of further fixes to filters and build files in build2ve. Provide example of needing an additional repo, which is more likely on centos. Fix bug with adapting owner since centos5.8 sets up so that we can't sudo until the sudoers file is fixed, but we don't do so until later. However, if we call su, then we need to keep the additional sudo. Apply the ftp/http proxy bits from the config file while setting up a VE. Don't try to mount /proc if it is already mounted. Fiddle with the substitution on requiretty; it wasn't working so moved to \s+ instead of [ \t]+ also left a comment to show users that the line was removed. Remove comment about applying ftp/http proxy to bootstrapping since we now do. Add note that we probably want a variable for where to get the source snapshot for source "installs" of project-builder.
  • Filter.pm: Add support for multi-line filter variables since a description in an rpm or deb file is usually multiple lines long (this is now in addition to the support of the $/ variable). Add support for transforming those things since debian files use leading spaces, and rpm files don't. Transforms let you start with the same variable and fix it for the different OSs. Leave note about unknown "correct" documentation location.
1 edited


  • devel/pb/lib/ProjectBuilder/Filter.pm

    r1434 r1549  
    119119        while(<CONF>)  {
    120120            if (/^\s*([A-z0-9-_]+)\s+([[A-z0-9-_]+)\s*=\s*(.+)$/) {
    121                 pb_log(3,"DEBUG creating entry $1, key $2, value $3\n");
    122                 $h{$1}{$2}=$3;
     121                my ($what, $var, $value) = ($1, $2, $3);
     122                pb_log(3,"DEBUG creating entry $what, key $var, value $value\n");
     123                # Add support for multi-lines
     124                while ($value =~ s/\\\s*$//o) {
     125                    $_ = <CONF>;
     126                    die "Still processing continuations for $what $var at EOF" if (not defined $_);
     127                    s/[\r\n]//go;
     128                    $value .= "\n$_";
     129                }
     130                $h{$what}{$var}=$value;
     131            } elsif ((/^\s*#/o) || (/^\s*$/o)) {
     132                # ignore
     133            } else {
     134                chomp();
     135                warn "unexpected line '$_' in $f";
    123136            }
    124137        }
    126139    }
    127140    $ptr = $h{"filter"};
     142    # TODO: find a place to document it. Why not in this file as pod and also documenting filters ?
     143    # Handle transform
     144    if (defined $h{transform}) {
     145        while (my ($out_key,$spec) = each %{$h{transform}}) {
     146            die "Unknown transform for $out_key '$spec' expected <out-key> <transform>" unless $spec =~ /^([\w\-]+)\s+(.+)$/;
     147            my ($in_key, $expr) = ($1, $2);
     148            local $_ = $ptr->{$in_key} || '';
     149            eval $expr;
     150            die "Error evaluating tranform for $out_key ($expr): $@" if $@;
     151            $ptr->{$out_key} = $_;
     152            pb_log(2, "Transform $in_key to $out_key\n$ptr->{$in_key}\n$ptr->{$out_key}\n");
     153        }
     154    }
    129156pb_log(2,"DEBUG f:".Dumper($ptr)."\n") if (defined $ptr);
Note: See TracChangeset for help on using the changeset viewer.