line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PkgForge::App; # -*-perl-*- |
2
|
1
|
|
|
1
|
|
1885
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
36
|
|
3
|
1
|
|
|
1
|
|
4
|
use warnings; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
41
|
|
4
|
|
|
|
|
|
|
|
5
|
|
|
|
|
|
|
# $Id: App.pm.in 21266 2012-07-03 14:28:40Z squinney@INF.ED.AC.UK $ |
6
|
|
|
|
|
|
|
# $Source:$ |
7
|
|
|
|
|
|
|
# $Revision: 21266 $ |
8
|
|
|
|
|
|
|
# $HeadURL: https://svn.lcfg.org/svn/source/tags/PkgForge/PkgForge_1_4_8/lib/PkgForge/App.pm.in $ |
9
|
|
|
|
|
|
|
# $Date: 2012-07-03 15:28:40 +0100 (Tue, 03 Jul 2012) $ |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = '1.4.8'; |
12
|
|
|
|
|
|
|
|
13
|
1
|
|
|
1
|
|
914
|
use File::HomeDir (); |
|
1
|
|
|
|
|
8074
|
|
|
1
|
|
|
|
|
23
|
|
14
|
1
|
|
|
1
|
|
8
|
use File::Spec (); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
15
|
1
|
|
|
1
|
|
6
|
use Readonly; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
108
|
|
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
Readonly my $CONFIGDIR => '/etc/pkgforge'; |
18
|
|
|
|
|
|
|
Readonly my $USER_CONFIGDIR => '.pkgforge'; |
19
|
|
|
|
|
|
|
Readonly my $BASECONF => 'pkgforge.yml'; |
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
1
|
|
511
|
use Moose; |
|
0
|
|
|
|
|
|
|
|
0
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
use MooseX::Types::Moose qw(Str); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
extends qw(MooseX::App::Cmd::Command); |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
with 'PkgForge::ConfigFile'; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
has '+configfile' => ( |
29
|
|
|
|
|
|
|
default => sub { |
30
|
|
|
|
|
|
|
my $class = shift @_; |
31
|
|
|
|
|
|
|
my @files = ( File::Spec->catfile( $CONFIGDIR, $BASECONF ) ); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $home = File::HomeDir->my_home; |
34
|
|
|
|
|
|
|
my $user_configdir = File::Spec->catdir( $home, $USER_CONFIGDIR ); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
my $mod = ( split /::/, $class->meta->name )[-1]; |
37
|
|
|
|
|
|
|
my $mod_conf = lc($mod) . '.yml'; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
push @files, File::Spec->catfile( $CONFIGDIR, $mod_conf ); |
40
|
|
|
|
|
|
|
push @files, File::Spec->catfile( $user_configdir, $BASECONF ); |
41
|
|
|
|
|
|
|
push @files, File::Spec->catfile( $user_configdir, $mod_conf ); |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
return \@files; |
44
|
|
|
|
|
|
|
}, |
45
|
|
|
|
|
|
|
); |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
has 'website' => ( |
48
|
|
|
|
|
|
|
traits => ['NoGetopt'], |
49
|
|
|
|
|
|
|
is => 'ro', |
50
|
|
|
|
|
|
|
isa => 'Maybe[Str]', |
51
|
|
|
|
|
|
|
predicate => 'has_website', |
52
|
|
|
|
|
|
|
documentation => 'The local PkgForge website (if any)', |
53
|
|
|
|
|
|
|
); |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
has 'incoming' => ( |
56
|
|
|
|
|
|
|
traits => ['NoGetopt'], |
57
|
|
|
|
|
|
|
is => 'ro', |
58
|
|
|
|
|
|
|
isa => Str, |
59
|
|
|
|
|
|
|
default => '/var/lib/pkgforge/incoming', |
60
|
|
|
|
|
|
|
documentation => 'The directory for incoming build jobs', |
61
|
|
|
|
|
|
|
); |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
has 'accepted' => ( |
64
|
|
|
|
|
|
|
traits => ['NoGetopt'], |
65
|
|
|
|
|
|
|
is => 'ro', |
66
|
|
|
|
|
|
|
isa => Str, |
67
|
|
|
|
|
|
|
default => '/var/lib/pkgforge/accepted', |
68
|
|
|
|
|
|
|
documentation => 'The directory for accepted build jobs', |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
has 'results' => ( |
72
|
|
|
|
|
|
|
traits => ['NoGetopt'], |
73
|
|
|
|
|
|
|
is => 'ro', |
74
|
|
|
|
|
|
|
isa => Str, |
75
|
|
|
|
|
|
|
default => '/var/lib/pkgforge/results', |
76
|
|
|
|
|
|
|
documentation => 'The directory for build job results', |
77
|
|
|
|
|
|
|
); |
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
80
|
|
|
|
|
|
|
no Moose; |
81
|
|
|
|
|
|
|
|
82
|
|
|
|
|
|
|
1; |
83
|
|
|
|
|
|
|
__END__ |
84
|
|
|
|
|
|
|
|
85
|
|
|
|
|
|
|
=head1 NAME |
86
|
|
|
|
|
|
|
|
87
|
|
|
|
|
|
|
PkgForge::App - Package Forge application base class. |
88
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
=head1 VERSION |
90
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
This documentation refers to PkgForge::App version 1.4.8 |
92
|
|
|
|
|
|
|
|
93
|
|
|
|
|
|
|
=head1 SYNOPSIS |
94
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
package PkgForge::App::Foo; |
96
|
|
|
|
|
|
|
|
97
|
|
|
|
|
|
|
use Moose; |
98
|
|
|
|
|
|
|
|
99
|
|
|
|
|
|
|
extends 'PkgForge::App'; |
100
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
|
102
|
|
|
|
|
|
|
=head1 DESCRIPTION |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
This is a base class for user-side Package Forge command-line |
105
|
|
|
|
|
|
|
applications. It adds standardised configuration file handling and |
106
|
|
|
|
|
|
|
holds some common attributes. |
107
|
|
|
|
|
|
|
|
108
|
|
|
|
|
|
|
=head1 ATTRIBUTES |
109
|
|
|
|
|
|
|
|
110
|
|
|
|
|
|
|
This class implements the L<PkgForge::ConfigFile> role, see the |
111
|
|
|
|
|
|
|
documentation for that module for all the inherited attributes. The |
112
|
|
|
|
|
|
|
following additional attributes are available: |
113
|
|
|
|
|
|
|
|
114
|
|
|
|
|
|
|
=over |
115
|
|
|
|
|
|
|
|
116
|
|
|
|
|
|
|
=item configfile |
117
|
|
|
|
|
|
|
|
118
|
|
|
|
|
|
|
The default value for the configuration files list is overridden. The |
119
|
|
|
|
|
|
|
standard C</etc/pkgforge/pkgforge.yml> file will always be consulted, |
120
|
|
|
|
|
|
|
if it exists. The application-specific files in C</etc/pkgforge> and |
121
|
|
|
|
|
|
|
C<$HOME/.pkgforge> are also examined, if they exist. For example, the |
122
|
|
|
|
|
|
|
C<submit> command will examine the following configuration files, if |
123
|
|
|
|
|
|
|
the exist (in this order) |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=over |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=item C</etc/pkgforge/pkgforge.yml> |
128
|
|
|
|
|
|
|
=item C</etc/pkgforge/submit.yml> |
129
|
|
|
|
|
|
|
=item C<$HOME/.pkgforge/pkgforge.yml> |
130
|
|
|
|
|
|
|
=item C<$HOME/.pkgforge/submit.yml> |
131
|
|
|
|
|
|
|
|
132
|
|
|
|
|
|
|
=back |
133
|
|
|
|
|
|
|
|
134
|
|
|
|
|
|
|
Settings in files later in the sequence override those earlier in the |
135
|
|
|
|
|
|
|
list. So settings in a user's home directory override the common |
136
|
|
|
|
|
|
|
application settings which override the system-wide settings. |
137
|
|
|
|
|
|
|
|
138
|
|
|
|
|
|
|
=item website |
139
|
|
|
|
|
|
|
|
140
|
|
|
|
|
|
|
The location of the local installation of the Package Forge |
141
|
|
|
|
|
|
|
website. This is mainly used for printing out helpful links to the |
142
|
|
|
|
|
|
|
user. If not set the links are not printed. |
143
|
|
|
|
|
|
|
|
144
|
|
|
|
|
|
|
=item incoming |
145
|
|
|
|
|
|
|
|
146
|
|
|
|
|
|
|
The location of the incoming jobs directory. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=item accepted |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
The location of the accepted jobs directory. |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=item results |
153
|
|
|
|
|
|
|
|
154
|
|
|
|
|
|
|
The location of the results directory for the finished build jobs. |
155
|
|
|
|
|
|
|
|
156
|
|
|
|
|
|
|
=back |
157
|
|
|
|
|
|
|
|
158
|
|
|
|
|
|
|
=head1 SUBROUTINES/METHODS |
159
|
|
|
|
|
|
|
|
160
|
|
|
|
|
|
|
This class implements the L<PkgForge::ConfigFile> role, see the |
161
|
|
|
|
|
|
|
documentation for that module for all the inherited methods. This |
162
|
|
|
|
|
|
|
class does not add any methods. |
163
|
|
|
|
|
|
|
|
164
|
|
|
|
|
|
|
=head1 DEPENDENCIES |
165
|
|
|
|
|
|
|
|
166
|
|
|
|
|
|
|
This module is powered by L<Moose>, L<MooseX::Types> and uses |
167
|
|
|
|
|
|
|
L<MooseX::App::Cmd>. It also requires the L<File::HomeDir> and |
168
|
|
|
|
|
|
|
L<Readonly> modules. |
169
|
|
|
|
|
|
|
|
170
|
|
|
|
|
|
|
=head1 PLATFORMS |
171
|
|
|
|
|
|
|
|
172
|
|
|
|
|
|
|
This is the list of platforms on which we have tested this |
173
|
|
|
|
|
|
|
software. We expect this software to work on any Unix-like platform |
174
|
|
|
|
|
|
|
which is supported by Perl. |
175
|
|
|
|
|
|
|
|
176
|
|
|
|
|
|
|
ScientificLinux5, Fedora13 |
177
|
|
|
|
|
|
|
|
178
|
|
|
|
|
|
|
=head1 BUGS AND LIMITATIONS |
179
|
|
|
|
|
|
|
|
180
|
|
|
|
|
|
|
Please report any bugs or problems (or praise!) to bugs@lcfg.org, |
181
|
|
|
|
|
|
|
feedback and patches are also always very welcome. |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
=head1 AUTHOR |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
Stephen Quinney <squinney@inf.ed.ac.uk> |
186
|
|
|
|
|
|
|
|
187
|
|
|
|
|
|
|
=head1 LICENSE AND COPYRIGHT |
188
|
|
|
|
|
|
|
|
189
|
|
|
|
|
|
|
Copyright (C) 2010-2011 University of Edinburgh. All rights reserved. |
190
|
|
|
|
|
|
|
|
191
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
192
|
|
|
|
|
|
|
it under the terms of the GPL, version 2 or later. |
193
|
|
|
|
|
|
|
|
194
|
|
|
|
|
|
|
=cut |
195
|
|
|
|
|
|
|
|