Subversion Repositories DevTools

Rev

Rev 4457 | Rev 7460 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 4457 Rev 7387
Line 108... Line 108...
108
    warn "$_\n" foreach (@{$errors});
108
    warn "$_\n" foreach (@{$errors});
109
    die ("Config contained errors\n");
109
    die ("Config contained errors\n");
110
}
110
}
111
 
111
 
112
$conf->{verbose} = $opt_verbose if ( $opt_verbose > 0 );
112
$conf->{verbose} = $opt_verbose if ( $opt_verbose > 0 );
113
unless ( $opt_nodaemonise )
-
 
114
{
-
 
115
    $logger = Logger->new($conf);
113
$logger = Logger->new($conf) unless ( $opt_nodaemonise );
116
    $conf->{logger} = $logger;
114
$conf->{logger} = $logger;
117
}
-
 
118
$logger->verbose2("Args: @args");
115
$logger->verbose2("Args: @args");
119
 
116
 
120
#
117
#
121
#   Porcess command line
118
#   Porcess command line
122
#   Arguments are of the form aaaa=bbbbm
119
#   Arguments are of the form aaaa=bbbbm
Line 205... Line 202...
205
                || ( exists $data->{allProjects} && $data->{allProjects} ) 
202
                || ( exists $data->{allProjects} && $data->{allProjects} ) 
206
                ||   exists $data->{projects}{$pkginfo{proj_id}}
203
                ||   exists $data->{projects}{$pkginfo{proj_id}}
207
                ||   exists $data->{releases}{$pkginfo{rtag_id}}
204
                ||   exists $data->{releases}{$pkginfo{rtag_id}}
208
                ||   exists $data->{pkg}{$pkginfo{pkg_name}} )
205
                ||   exists $data->{pkg}{$pkginfo{pkg_name}} )
209
                {
206
                {
210
                    TouchFile( catfile( $opt_tagdir, $tag, $pkginfo{pkg_name} . '::' . $pkginfo{pkg_version} ));
207
                    Utils::TouchFile($conf, catfile( $opt_tagdir, $tag, $pkginfo{pkg_name} . '::' . $pkginfo{pkg_version} ));
211
                }
208
                }
212
        }
209
        }
213
    }
210
    }
214
    closedir $dh;
211
    closedir $dh;
215
 
212
 
216
#-------------------------------------------------------------------------------
213
###############################################################################
217
# Function        : TouchFile 
-
 
218
#
-
 
219
# Description     : touch a file
-
 
220
#                   Real use is to touch a marker file
-
 
221
#
-
 
222
# Inputs          : path        - path to the file
-
 
223
#
-
 
224
# Returns         : TRUE if an error occured in creating the file
-
 
225
#
-
 
226
sub TouchFile
-
 
227
{
-
 
228
    my ($path) = @_;
-
 
229
    my $result = 0;
-
 
230
    my $tfh;
-
 
231
    $logger->verbose( "Touching: $path" );
-
 
232
    if ( ! -f $path )
-
 
233
    {
-
 
234
        open ($tfh, ">>", $path) || ($result = 1);
-
 
235
        close $tfh;
-
 
236
    }
-
 
237
    else
-
 
238
    {
-
 
239
 
-
 
240
        #
-
 
241
        #   Modify the file
-
 
242
        #
-
 
243
        #   Need to physically modify the file
-
 
244
        #   Need to change the 'change time' on the file. Simply setting the
-
 
245
        #   last-mod and last-access is not enough to get past WIN32
-
 
246
        #   OR 'utime()' does not work as expected
-
 
247
        #
-
 
248
        #   Read in the first character of the file, rewind and write it
-
 
249
        #   out again.
-
 
250
        #
-
 
251
        my $data;
-
 
252
        open ($tfh , "+<", $path ) || return 1;
-
 
253
        if ( read ( $tfh, $data, 1 ) )
-
 
254
        {
-
 
255
            seek  ( $tfh, 0, 0 );
-
 
256
            print $tfh $data;
-
 
257
        }
-
 
258
        else
-
 
259
        {
-
 
260
            #
-
 
261
            #   File must have been of zero length
-
 
262
            #   Delete the file and create it
-
 
263
            #
-
 
264
            close ($tfh);
-
 
265
            unlink ( $path );
-
 
266
            open ($tfh, ">>", $path) || ($result = 1);
-
 
267
        }
-
 
268
        close ($tfh);
-
 
269
    }
-
 
270
 
-
 
271
    #
-
 
272
    #   Ensure all can remove the file
-
 
273
    #   May be created by root and need to be deleted by the blatDaemon
-
 
274
    #
-
 
275
    chmod 0666, $path;
-
 
276
    return $result;
-
 
277
}
-
 
278
 
-
 
279
package ConfigReader;
214
package ConfigReader;
280
our %config;
215
our %config;
281
 
216
 
282
#-------------------------------------------------------------------------------
217
#-------------------------------------------------------------------------------
283
# Function        : readConfig
218
# Function        : readConfig