- Timestamp:
- 2014-12-11T18:45:10+13:00 (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/package-kits/linux/perllib/Greenstone/Package/_rpm.pm
r29559 r29595 33 33 sub add_install { 34 34 my $self = shift; 35 $self->{config}->{INSTALL} = "";35 my $ret = ''; 36 36 exists $self->{config}->{PRE_INSTALL} and 37 $ self->{config}->{INSTALL}.= write_function "pre", @{$self->{config}->{PRE_INSTALL}};37 $ret .= write_function "pre", @{$self->{config}->{PRE_INSTALL}}; 38 38 exists $self->{config}->{POST_INSTALL} and 39 $ self->{config}->{INSTALL}.= write_function "post", @{$self->{config}->{POST_INSTALL}};39 $ret .= write_function "post", @{$self->{config}->{POST_INSTALL}}; 40 40 exists $self->{config}->{PRE_REMOVE} and 41 $ self->{config}->{INSTALL}.= write_function "preun", @{$self->{config}->{PRE_INSTALL}};41 $ret .= write_function "preun", @{$self->{config}->{PRE_INSTALL}}; 42 42 exists $self->{config}->{POST_REMOVE} and 43 $self->{config}->{INSTALL} .= write_function "postun", @{$self->{config}->{POST_INSTALL}}; 43 $ret .= write_function "postun", @{$self->{config}->{POST_INSTALL}}; 44 return $ret; 45 } 46 47 sub add_package_impl { 48 my ($self, $packages) = @_; 49 open my $SPEC, '>', '/tmp/gspkg.spec'; 50 for my $line ( 51 'Name: %NAME%', 52 'Version: %VERSION%', 53 'Release: %RELEASE%', 54 'License: %LICENSE_SHORT%', 55 'URL: %HOMEPAGE%', 56 'Source0: %NAME%', 57 'AutoReqProv: no', 58 'BuildRequires: %MAKEDEPENDS%', 59 '', 60 '%prep', 61 'cp -pr %SOURCE0 .', 62 '', 63 '%build', 64 'cd %NAME%', 65 'make %{?_smp_mflags}', 66 '', 67 '%install', 68 'cd %NAME%', 69 '%make_install', 70 '', 71 '%changelog', 72 '' 73 ) { 74 my $copy = $line; 75 $self->subst ($copy); 76 print $SPEC $copy, "\n"; 77 } 78 if (defined $packages) { 79 my $config = $self->{config}; 80 for my $package (@{$packages}) { 81 $self->{config} = $package; 82 for my $line ( 83 '%package %NAME%', 84 '%requires', 85 '%DEPENDS%', 86 '%description', 87 '%DESCRIPTION%', 88 $self->add_install, 89 '%files', 90 '%FILES%' 91 ) { 92 my $copy = $line; 93 $self->subst ($copy); 94 print $SPEC $copy, "\n"; 95 } 96 } 97 $self->{config} = $config; 98 } else { 99 for my $line ( 100 '%requires', 101 '%DEPENDS%', 102 '%description', 103 '%DESCRIPTION%', 104 $self->add_install, 105 '%files', 106 '%FILES%' 107 ) { 108 my $copy = $line; 109 $self->subst ($copy); 110 print $SPEC $copy, "\n"; 111 } 112 } 113 close $SPEC; 114 $self->add ("/tmp/gspkg.spec", "$self->{output}/$self->{config}->{NAME}.spec"); 44 115 } 45 116
Note:
See TracChangeset
for help on using the changeset viewer.