source: main/trunk/package-kits/linux/perllib/Greenstone/Package/_pacman.pm@ 29536

Last change on this file since 29536 was 29536, checked in by Jeremy Symon, 9 years ago

Working on a more flexible generation system. Only working for pacman so far, so if you want to generate packages you'll need to check out an old revision. The reason behind this change is that I discovered that the greenstone user database really needs to be owned by the tomcat user rather than root (things such as edit mode don't work properly otherwise), and setting file ownership requires .install files, which was not really possible with the existing system. At this point it would certainly have been faster to just write all the scripts by hand, but this way I get to learn perl.

File size: 812 bytes
Line 
1package Greenstone::Package::_pacman;
2
3use strict;
4use warnings;
5use utf8;
6use parent 'Greenstone::Package';
7use Digest::MD5;
8
9sub replacement_array {
10 my $self = shift;
11 my $array = shift;
12 return join "\n", @{$array};
13}
14
15sub add_md5 {
16 my $self = shift;
17 my $md5 = Digest::MD5->new;
18 for my $source (@_) {
19 open my $MD5FH, '<', "$self->{output}/$source";
20 binmode $MD5FH;
21 $md5->addfile ($MD5FH);
22 push @{$self->{config}->{SOURCE_SUMS}}, $md5->hexdigest;
23 close $MD5FH
24 }
25}
26
27sub add_sources {
28 my $self = shift;
29 $self->SUPER::add_sources;
30 $self->{config}->{SOURCE_SUMS} = [];
31 $self->add_md5 (@{$self->{config}->{SOURCES}});
32}
33
34sub add_makefile {
35 my $self = shift;
36 $self->SUPER::add_makefile;
37 $self->add_md5 ('Makefile');
38}
39
401;
Note: See TracBrowser for help on using the repository browser.