Ignore:
Timestamp:
2014-12-11T18:45:10+13:00 (9 years ago)
Author:
Jeremy Symon
Message:

Modifying package generation to use sub-packages in order to avoid compiling the same source multiple times. Currently works for Pacman. Needs testing (and fixing) for other package managers.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/package-kits/linux/perllib/Greenstone/Package.pm

    r29583 r29595  
    88use File::Copy 'cp';
    99use POSIX 'uname';
     10use Storable 'dclone';
    1011use Greenstone::Helpers;
    1112use base 'Exporter';
     
    127128sub add_package {
    128129    my $self = shift;
     130   
     131    # Add the (relatively) static files
    129132    $self->add ("managers/$self->{config}->{MANAGER}", $self->{output});
     133
     134    if (exists $self->{config}->{SUB_PACKAGES}) {
     135        my $packages = [];
     136        for my $subpackage (sort @{$self->{config}->{SUB_PACKAGES}}) {
     137            my $config = {};
     138            for my $key (keys %{$self->{config}}) {
     139                if ($key =~ /^${subpackage}_(.*)$/) {
     140                    # print "setting '$1' to '$key' = '$self->{config}->{$key}'\n";
     141                    $config->{$1} = $self->{config}->{$key};
     142                }
     143            }
     144            # hashdump $self->{config};
     145            push @{$packages}, $config;
     146        }
     147        $self->add_package_impl ($packages);
     148    } else {
     149        $self->add_package_impl;
     150    }
    130151}
    131152
Note: See TracChangeset for help on using the changeset viewer.