- Timestamp:
- 2014-12-12T15:12:15+13:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/package-kits/linux/perllib/Greenstone/Package/_apt.pm
r29598 r29607 6 6 use parent 'Greenstone::Package'; 7 7 8 # Deb packages expect lists to be comma separated 8 9 sub replacement_array { 9 10 my $self = shift; … … 16 17 my $file = "$self->{output}/debian/$name"; 17 18 print " - $file\n"; 18 open my $OUT, '>', $file; 19 open my $OUT, '>', $file 20 or die "Failed to open $file: $!"; 19 21 for my $line (@lines) { 20 22 print $OUT $line, "\n"; … … 24 26 } 25 27 28 # Add pre/post install/remove hooks 26 29 sub add_install { 27 my $self = shift; 30 my ($self, $name) = @_; 31 my $prefix = (defined $name ? "$name." : ""); 28 32 exists $self->{config}->{PRE_INSTALL} and 29 $self->write_function (" preinst", @{$self->{config}->{PRE_INSTALL}});33 $self->write_function ("${prefix}preinst", @{$self->{config}->{PRE_INSTALL}}); 30 34 exists $self->{config}->{POST_INSTALL} and 31 $self->write_function (" postinst", @{$self->{config}->{POST_INSTALL}});35 $self->write_function ("${prefix}postinst", @{$self->{config}->{POST_INSTALL}}); 32 36 exists $self->{config}->{PRE_REMOVE} and 33 $self->write_function (" prerm", @{$self->{config}->{PRE_REMOVE}});37 $self->write_function ("${prefix}prerm", @{$self->{config}->{PRE_REMOVE}}); 34 38 exists $self->{config}->{POST_REMOVE} and 35 $self->write_function (" postrm", @{$self->{config}->{POST_REMOVE}});39 $self->write_function ("${prefix}postrm", @{$self->{config}->{POST_REMOVE}}); 36 40 } 37 41 42 # Adds a definition for a package or subpackage 38 43 sub add_package_section { 39 44 my ($self, $out) = @_; … … 42 47 'Architecture: %ARCHITECTURE%', 43 48 'Homepage: %HOMEPAGE%', 44 'Depends: ',45 ' %DEPENDS%',46 ' Description: %DESCRIPTION_SHORT',47 ' %DESCRIPTION'49 'Depends: %DEPENDS%', 50 'Description: %DESCRIPTION_SHORT%', 51 ' %DESCRIPTION%', 52 '' 48 53 ) { 49 54 my $copy = $line; … … 53 58 } 54 59 60 # Handles the apt-specific package generation 55 61 sub add_package_impl { 56 62 my ($self, $packages) = @_; 57 $self->add_install;58 63 my $file = "$self->{output}/debian/control"; 59 64 print " - $file\n"; 60 open my $CONTROL, '>', $file; 65 open my $CONTROL, '>', $file 66 or die "Failed to open $file: $!"; 61 67 for my $line ( 62 68 'Source: %NAME%', … … 64 70 'Priority: optional', 65 71 'Maintainer: %MAINTAINER_NAME% <%MAINTAINER_EMAIL%>', 66 'Build-Depends: ',67 ' %MAKEDEPENDS%',72 'Build-Depends: %MAKEDEPENDS%', 73 '' 68 74 ) { 69 75 my $copy = $line; … … 73 79 if (defined $packages) { 74 80 my $config = $self->{config}; 81 my @names; 75 82 for my $package (@{$packages}) { 83 push @names, $package->{NAME}; 76 84 $package->{HOMEPAGE} = $config->{HOMEPAGE}; 77 85 $self->{config} = $package; 86 $self->add_install ($package->{NAME}); 78 87 $self->add_package_section ($CONTROL); 88 my $install = "$self->{output}/debian/$self->{config}->{NAME}.install"; 89 open my $INSTALL, '>', $install; 90 for my $line (@{$self->{config}->{FILES}}) { 91 print $INSTALL $line, "\n"; 92 } 93 close $INSTALL; 79 94 } 80 95 $self->{config} = $config; 96 my $rules = "$self->{output}/debian/rules"; 97 open my $RULES, '>>', $rules 98 or die "Failed to open $rules: $!"; 99 print $RULES "\noverride_dh_gencontrol:\n"; 100 for my $name (@names) { 101 print $RULES "\tdh_gencontrol -p$name\n"; 102 } 103 close $RULES; 81 104 } else { 105 $self->add_install; 82 106 $self->add_package_section ($CONTROL); 83 107 }
Note:
See TracChangeset
for help on using the changeset viewer.