From: Heiko Schlittermann (HS12-RIPE) Date: Sat, 5 Nov 2016 22:34:21 +0000 (+0100) Subject: Tidying X-Git-Url: https://git.exim.org/buildfarm-client.git/commitdiff_plain/34e7f3555072b6ac03fca1d9715909dc093f8a36 Tidying * run_cron is a symlink to run_branches now * some more tests at startup time --- diff --git a/run_branches b/run_branches index e837aa9..9e267af 100755 --- a/run_branches +++ b/run_branches @@ -12,21 +12,33 @@ use vars qw($VERSION); $VERSION = 'REL_0.1'; use strict; use warnings; +use 5.010; + use Fcntl qw(:flock :seek); -use EximBuild::Options; use File::Basename; +use FindBin qw($RealBin); +use Cwd; +use lib $RealBin; +use EximBuild::Options; + +sub branch_last_sort; + +# Complain on old-style use (.pl extension), but only if a +# terminal is available. if ($0 =~ /(.*)\.pl$/) { die "$0: Please use `@{[join ' ' => $1, @ARGV]}' instead.\n" if -t; exec $1, @ARGV; } -my %branch_last; -sub branch_last_sort; +# Most of the client code assumes that our working directory +# is the client code directory. +chdir $RealBin or die "$0: Can't chdir to '$RealBin': $!\n"; +say "Changed working directory to '$RealBin'" if -t; -my $run_build; -($run_build = $0) =~ s/run_branches/run_build/; +my %branch_last; +my $run_build = './run_build'; my($run_all, $run_one); my %extra_options =( @@ -41,14 +53,14 @@ EximBuild::Options::fetch_options(%extra_options); die("$0: non-option arguments not permitted") if @ARGV; -die "only one of --run-all and --run-one permitted" +die "$0: only one of --run-all and --run-one permitted" if ($run_all && $run_one); -die "need one of --run-all and --run-one" +die "$0: need one of --run-all and --run-one" unless ($run_all || $run_one); # common mistake -die "need group searchable homedir" +die "$0: need group searchable homedir" unless (stat($ENV{HOME}) & 0550 == 0550); # set up a "branch" variable for processing the config file @@ -86,13 +98,11 @@ elsif ($EximBuild::conf{branches_to_build} =~ # i.e. specially *not* the MinGW SDK perl that is invoked for the # build script, which means we need to put the path back the way it was # when we're done - my $save_path = $ENV{PATH}; - $ENV{PATH} = $EximBuild::conf{build_env}->{PATH} + local $ENV{PATH} = $EximBuild::conf{build_env}->{PATH} if ($EximBuild::conf{build_env}->{PATH}); (my $url = $EximBuild::conf{target}) =~s/cgi-bin.*/branches_of_interest.txt/; my $branches_of_interest = `perl -MLWP::Simple -e "getprint(q{$url})"`; die "getting branches of interest" unless $branches_of_interest; - $ENV{PATH} = $save_path; push(@branches,$_)foreach (split(/\s+/,$branches_of_interest)); #splice(@branches,0,-2) # if $EximBuild::conf{branches_to_build} eq 'HEAD_PLUS_LATEST'; diff --git a/run_build b/run_build index d2de73f..2212415 100755 --- a/run_build +++ b/run_build @@ -32,7 +32,7 @@ See accompanying License file for license details ################################################### -use vars qw($VERSION); $VERSION = 'REL_0.1'; +our $VERSION = 'REL_0.1'; use strict; use warnings; @@ -83,6 +83,8 @@ if ($0 =~ /(.*)\.pl$/) { exec $1, @ARGV; } +die "$0: please use an umask of 022\n" + if umask > 022; my %module_hooks; my $orig_dir = getcwd(); @@ -153,6 +155,18 @@ print_help() if ($help); # process config file # require $buildconf; +#use Data::Dumper; +#die Dumper \%EximBuild::conf; + +# some basic checks +die "$0: need read/write permissions on '$EximBuild::conf{global_lock_dir}': $!\n" + if not -r -w $EximBuild::conf{global_lock_dir}; + +# Does not seem to be necessary +#die "$0: permissions on '$EximBuild::conf{build_root}' should be >= 0775\n" +# if -d $EximBuild::conf{build_root} +# and ((stat $EximBuild::conf{build_root})[2] & 0775) != 0775; + # get the config data into some local variables my ( diff --git a/run_cron b/run_cron deleted file mode 100755 index 278084e..0000000 --- a/run_cron +++ /dev/null @@ -1,25 +0,0 @@ -#!/usr/bin/env perl - -use 5.010; -use strict; -use warnings; -use FindBin qw($Bin); - -chdir $Bin or die "$0: Can't chdir '$Bin': $!\n"; - -# check if we've git available and if we've a cloned -# client installation. FIXME: What to do, if we have -# a 'detached' .git? -if (-d '.git') { - die "$0: found .git dir, but git is not available\n" - if not grep { -x } map { "$_/git" } split /:/, $ENV{PATH}; - system('git pull >/dev/null') == 0 or die $? >> 8; -} - -# the process building the documentation seems to break -# if PERL_UNICODE is set. -delete $ENV{PERL_UNICODE}; - -exec './run_branches', @ARGV; - -# vim:ts=8 et sw=4 ai si: diff --git a/run_cron b/run_cron new file mode 120000 index 0000000..022fd6b --- /dev/null +++ b/run_cron @@ -0,0 +1 @@ +run_branches \ No newline at end of file diff --git a/wiki b/wiki index 9e0a648..12443b2 160000 --- a/wiki +++ b/wiki @@ -1 +1 @@ -Subproject commit 9e0a648f78bc31b0b16f0cd3fc2cfbe8c1cfa05a +Subproject commit 12443b26b1d0c86686f8e0b9b3c0a4ac8999fc03