Skip to content
Projeler
Gruplar
Parçacıklar
Yardım
Yükleniyor...
Oturum aç / Kaydol
Gezinmeyi değiştir
C
core
Proje
Proje
Ayrıntılar
Etkinlik
Cycle Analytics
Depo (repository)
Depo (repository)
Dosyalar
Kayıtlar (commit)
Dallar (branch)
Etiketler
Katkıda bulunanlar
Grafik
Karşılaştır
Grafikler
Konular (issue)
0
Konular (issue)
0
Liste
Pano
Etiketler
Kilometre Taşları
Birleştirme (merge) Talepleri
0
Birleştirme (merge) Talepleri
0
CI / CD
CI / CD
İş akışları (pipeline)
İşler
Zamanlamalar
Grafikler
Paketler
Paketler
Wiki
Wiki
Parçacıklar
Parçacıklar
Üyeler
Üyeler
Collapse sidebar
Close sidebar
Etkinlik
Grafik
Grafikler
Yeni bir konu (issue) oluştur
İşler
Kayıtlar (commit)
Konu (issue) Panoları
Kenar çubuğunu aç
LibreOffice
core
Commits
125d4ada
Kaydet (Commit)
125d4ada
authored
Ara 28, 2009
tarafından
Vladimir Glazunov
Dosyalara gözat
Seçenekler
Dosyalara Gözat
İndir
Eposta Yamaları
Sade Fark
#i107041#
üst
2bc1a6dc
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
133 additions
and
101 deletions
+133
-101
build.pl
solenv/bin/build.pl
+94
-92
SourceConfig.pm
solenv/bin/modules/SourceConfig.pm
+39
-9
No files found.
solenv/bin/build.pl
Dosyayı görüntüle @
125d4ada
...
...
@@ -118,7 +118,7 @@
$pre_custom_job
=
''
;
$custom_job
=
''
;
$post_custom_job
=
''
;
%
LocalDepsH
ash
=
();
%
local_deps_h
ash
=
();
%
PathHash
=
();
%
PlatformHash
=
();
%
AliveDependencies
=
();
...
...
@@ -185,7 +185,7 @@
$setenv_string = ''; # string for configuration of the client environment
$ports_string = ''; # string with possible ports for server
@server_ports = ();
$html_port;
$html_port
= 0
;
$server_socket_obj = undef; # socket object for server
$html_socket_obj = undef; # socket object for server
my %clients_jobs = ();
...
...
@@ -201,7 +201,6 @@
my %module_paths = (); # hash with absolute module paths
my %active_modules = ();
my $generate_config = 0;
my $add_modules_to_config = 0;
my %add_to_config = ();
my %remove_from_config = ();
my $clear_config = 0;
...
...
@@ -385,7 +384,7 @@ sub generate_config_file {
$removal_message .= "
$1
";
} else {
push(@config_content_new, $_);
if (defined $add_to_config{$1}) {
if (defined $add_to_config{$1}
&& !$prepare
) {
push(@warnings, "
Module
$1
already
activated
in
$source_config_file
\
n
");
delete $add_to_config{$1};
}
...
...
@@ -492,11 +491,12 @@ sub start_html_message_trigger {
my $rv;
my $full_buffer = '';
my %modules_to_rebuild = ();
my $paddr;
while ($rv = sysread(HTML_PIPE, $buffer, $buffer_size)) {
$full_buffer .= $buffer;
};
if (length $full_buffer) {
print "
**********
Got
message $fullbuffe
r
\
n
";
print "
**********
Got
message $full
_
buffe
r
\
n
";
socket(SOCKET, PF_INET, SOCK_STREAM, getprotobyname('tcp')) or die "
socket
:
$!
";
if (connect(SOCKET, $paddr)) {
$full_buffer .= "
\
n
";
...
...
@@ -568,8 +568,8 @@ sub schedule_delete {
kill 9, keys %{$module_deps_hash_pids{$projects_deps_hash{$_}}};
handle_dead_children(0);
};
RemoveFromD
ependencies($_, \%global_deps_hash);
RemoveFromD
ependencies($_, \%global_deps_hash_backup);
remove_from_d
ependencies($_, \%global_deps_hash);
remove_from_d
ependencies($_, \%global_deps_hash_backup);
delete $reversed_dependencies{$_};
delete $build_is_finished{$_} if defined $build_is_finished{$_};
delete $modules_with_errors{$_} if defined $modules_with_errors{$_};
...
...
@@ -618,6 +618,7 @@ sub schedule_rebuild {
#
sub get_build_list_path {
my $module = shift;
return $build_list_paths{$module} if (defined $build_list_paths{$module});
my @possible_dirs = ($module, $module. '.lnk', $module. '.link');
return $build_list_paths{$module} if (defined $build_list_paths{$module});
foreach (@possible_dirs) {
...
...
@@ -720,19 +721,17 @@ sub build_all {
$modules_types{$initial_module} = '
mod
';
};
modules_classify(keys %global_deps_hash);
store_weights
(\%global_deps_hash);
prepare_build_from(\%global_deps_hash) if ($build_from
);
expand_dependencies
(\%global_deps_hash);
# prepare_build_from(\%global_deps_hash) if (scalar keys %incompatibles
);
prepare_incompatible_build(\%global_deps_hash) if ($incompatible);
if ($build_all_cont || $build_since) {
print STDERR "There are active module in $source_config_file. Inactive modules will be skipped.\n";
push (@warnings, "\nThere are active module in $source_config_file. Inactive modules are skipped.\n\n");
prepare_build_all_cont(\%global_deps_hash);
};
if ($generate_config) {
%add_to_config = %global_deps_hash;
generate_config_file();
exit 0;
} elsif (
keys %incompatibles
) {
} elsif (
$incompatible
) {
my @missing_modules = ();
foreach (keys %global_deps_hash) {
push(@missing_modules, $_) if (!defined $active_modules{$_});
...
...
@@ -741,8 +740,12 @@ sub build_all {
print_error("There are modules:\n@missing_modules\n\nthat should be built, but they are not activated. Please, verify your $source_config_file.\n");
};
};
foreach my $module (%dead_parents) {
remove_from_dependencies($module, \%global_deps_hash);
delete ($global_deps_hash{$module}) if (defined $global_deps_hash{$module});
};
store_weights(\%global_deps_hash);
backup_deps_hash(\%global_deps_hash, \%global_deps_hash_backup);
expand_dependencies (\%global_deps_hash_backup);
reverse_dependensies(\%global_deps_hash_backup);
$modules_number = scalar keys %global_deps_hash;
initialize_html_info($_) foreach (keys %global_deps_hash);
...
...
@@ -757,34 +760,34 @@ sub build_all {
if (!defined $dead_parents{$Prj}) {
if (scalar keys %broken_build) {
print $echo . "Skipping project $Prj because of error(s)\n";
RemoveFromD
ependencies($Prj, \%global_deps_hash);
remove_from_d
ependencies($Prj, \%global_deps_hash);
$build_is_finished{$Prj}++;
next;
};
$PrjDir = $module_paths{$Prj};
get_module_dep_hash($Prj, \%
LocalDepsH
ash);
get_module_dep_hash($Prj, \%
local_deps_h
ash);
my $info_hash = $html_info{$Prj};
$$info_hash{DIRS} = check_deps_hash(\%
LocalDepsH
ash, $Prj);
$module_by_hash{\%
LocalDepsH
ash} = $Prj;
build_dependent(\%
LocalDepsH
ash);
$$info_hash{DIRS} = check_deps_hash(\%
local_deps_h
ash, $Prj);
$module_by_hash{\%
local_deps_h
ash} = $Prj;
build_dependent(\%
local_deps_h
ash);
print $check_error_string;
};
RemoveFromD
ependencies($Prj, \%global_deps_hash);
remove_from_d
ependencies($Prj, \%global_deps_hash);
$build_is_finished{$Prj}++;
};
} else {
store_build_list_content($initial_module);
get_module_dep_hash($initial_module, \%
LocalDepsH
ash);
get_module_dep_hash($initial_module, \%
local_deps_h
ash);
initialize_html_info($initial_module);
my $info_hash = $html_info{$initial_module};
$$info_hash{DIRS} = check_deps_hash(\%
LocalDepsH
ash, $initial_module);
$module_by_hash{\%
LocalDepsH
ash} = $initial_module;
$$info_hash{DIRS} = check_deps_hash(\%
local_deps_h
ash, $initial_module);
$module_by_hash{\%
local_deps_h
ash} = $initial_module;
if ($server_mode) {
run_server();
} else {
build_dependent(\%
LocalDepsH
ash);
build_dependent(\%
local_deps_h
ash);
};
};
};
...
...
@@ -811,43 +814,42 @@ sub initialize_html_info {
# Do job
#
sub dmake_dir {
my ($new_BuildDir, $OldBuildDir, $error_code);
my $BuildDir = shift;
$jobs_hash{$BuildDir}->{START_TIME} = time();
$jobs_hash{$BuildDir}->{STATUS} = '
building
';
if ($BuildDir =~ /(\s)/o && (!-d $BuildDir)) {
print "\n$BuildDir\n\n" if ($BuildDir =~ /\sdeliver$/o);
$error_code = do_custom_job($BuildDir, \%LocalDepsHash);
} else {
html_store_job_info(\%LocalDepsHash, $BuildDir);
print_error("$BuildDir not found!!\n") if (!-d $BuildDir);
if (!-d $BuildDir) {
$new_BuildDir = $BuildDir;
$new_BuildDir =~ s/_simple//g;
if ((-d $new_BuildDir)) {
print("\nTrying $new_BuildDir, $BuildDir not found!!\n");
$BuildDir = $new_BuildDir;
} else {
print_error("\n$BuildDir not found!!\n");
my ($new_job_name, $error_code);
my $job_name = shift;
$jobs_hash{$job_name}->{START_TIME} = time();
$jobs_hash{$job_name}->{STATUS} = '
building
';
if ($job_name =~ /(\s)/o && (!-d $job_name)) {
$error_code = do_custom_job($job_name, \%local_deps_hash);
} else {
html_store_job_info(\%local_deps_hash, $job_name);
print_error("$job_name not found!!\n") if (!-d $job_name);
if (!-d $job_name) {
$new_job_name = $job_name;
$new_job_name =~ s/_simple//g;
if ((-d $new_job_name)) {
print("\nTrying $new_job_name, $job_name not found!!\n");
$job_name = $new_job_name;
} else {
print_error("\n$job_name not found!!\n");
}
}
if ($cmd_file) {
print "cd $
BuildDir
\n";
print "cd $
job_name
\n";
print $check_error_string;
print $echo.$
BuildDir
."\n";
print $echo.$
job_name
."\n";
print "$dmake\n";
print $check_error_string;
} else {
print "\n" if ( ! $show );
print "Entering $
BuildDir
\n";
print "Entering $
job_name
\n";
};
RemoveFromDependencies($BuildDir, \%LocalDepsH
ash) if (!$child);
remove_from_dependencies($job_name, \%local_deps_h
ash) if (!$child);
return if ($cmd_file || $show);
$error_code = run_job($dmake, $
BuildDir
);
html_store_job_info(\%
LocalDepsHash, $BuildDir
, $error_code) if (!$child);
$error_code = run_job($dmake, $
job_name
);
html_store_job_info(\%
local_deps_hash, $job_name
, $error_code) if (!$child);
};
if ($error_code && $ignore) {
push(@ignored_errors, $
BuildDir
);
push(@ignored_errors, $
job_name
);
$error_code = 0;
};
if ($child) {
...
...
@@ -863,7 +865,7 @@ sub dmake_dir {
_exit(0);
} elsif ($error_code && ($error_code != -1)) {
return $error_code;
# print_error("Error $? occurred while making $
BuildDir
");
# print_error("Error $? occurred while making $
job_name
");
};
};
...
...
@@ -1065,7 +1067,7 @@ sub get_deps_hash {
foreach
my
$alias
(
keys
%
DeadDependencies
)
{
next
if
defined
$AliveDependencies
{
$alias
};
if
(
!
IsHashNative
(
$alias
))
{
RemoveFromD
ependencies
(
$alias
,
$dependencies_hash
);
remove_from_d
ependencies
(
$alias
,
$dependencies_hash
);
delete
$DeadDependencies
{
$alias
};
};
};
...
...
@@ -1208,7 +1210,9 @@ sub get_stand_dir {
foreach
(
@possible_build_lists
)
{
# ('build.lst', 'build.xlist');
if
(
-
e
$StandDir
.
'/prj/'
.
$_
)
{
$initial_module
=
File::Basename::
basename
(
$StandDir
);
$build_list_paths
{
$initial_module
}
=
$StandDir
.
'/prj/'
.
$_
;
$StandDir
=
File::Basename::
dirname
(
$StandDir
);
$module_paths
{
$initial_module
}
=
$StandDir
.
"/$initial_module"
;
return
$StandDir
;
}
elsif
(
$StandDir
eq
$previous_dir
)
{
$ENV
{
mk_tmp
}
=
''
;
...
...
@@ -1255,7 +1259,7 @@ sub CheckPlatform {
# Remove project to build ahead from dependencies and make an array
# of all from given project dependent projects
#
sub
RemoveFromD
ependencies
{
sub
remove_from_d
ependencies
{
my
(
$ExclPrj
,
$i
,
$Prj
,
$Dependencies
);
$ExclPrj
=
shift
;
my
$ExclPrj_orig
=
''
;
...
...
@@ -1326,7 +1330,7 @@ sub check_deps_hash {
CLIENT
=>
'-'
};
};
RemoveFromD
ependencies
(
$key
,
\%
deps_hash
);
remove_from_d
ependencies
(
$key
,
\%
deps_hash
);
delete
$deps_hash
{
$key
};
$consistent
++
;
};
...
...
@@ -1576,7 +1580,6 @@ sub get_options {
$arg
=~
/^--genconf$/
and
$generate_config
=
1
and
next
;
if
(
$arg
=~
/^--add$/
)
{
get_list_of_modules
(
\%
add_to_config
);
$add_modules_to_config
++
;
next
;
};
if
(
$arg
=~
/^--remove$/
)
{
...
...
@@ -1676,16 +1679,19 @@ sub get_options {
};
sub
get_module_and_buildlist_paths
{
if
(
$build_all_parents
)
{
my
$source_config
=
SourceConfig
->
new
(
$StandDir
);
$source_config_file
=
$source_config
->
get_config_file_path
();
$active_modules
{
$_
}
++
foreach
(
$source_config
->
get_active_modules
());
my
%
active_modules_copy
=
%
active_modules
;
foreach
(
$source_config
->
get_all_modules
())
{
delete
$active_modules_copy
{
$_
}
if
defined
(
$active_modules_copy
{
$_
});
next
if
(
$_
eq
$initial_module
);
$module_paths
{
$_
}
=
$source_config
->
get_module_path
(
$_
);
$build_list_paths
{
$_
}
=
$source_config
->
get_module_build_list
(
$_
)
}
$dead_parents
{
$_
}
++
foreach
(
keys
%
active_modules_copy
);
};
};
...
...
@@ -1735,7 +1741,7 @@ sub cancel_build {
}
else
{
$message_part
.=
"--all:@broken_modules_names\n"
;
};
if
(
$broken_modules_number
)
{
if
(
$broken_modules_number
&&
$build_all_parents
)
{
print
"\n"
;
print
$broken_modules_number
;
print
" module(s): "
;
...
...
@@ -1848,7 +1854,7 @@ sub clear_from_child {
if
(
defined
$broken_build
{
$child_nick
})
{
$error_code
=
$broken_build
{
$child_nick
};
}
else
{
RemoveFromD
ependencies
(
$child_nick
,
remove_from_d
ependencies
(
$child_nick
,
$folders_hashes
{
$child_nick
});
};
foreach
(
keys
%
module_deps_hash_pids
)
{
...
...
@@ -2034,12 +2040,12 @@ sub build_actual_queue {
delete
$$build_queue
{
$Prj
};
next
;
};
$started_children
=+
build_dependent
(
$projects_deps_hash
{
$Prj
});
$started_children
+=
build_dependent
(
$projects_deps_hash
{
$Prj
});
if
((
!
scalar
keys
%
{
$projects_deps_hash
{
$Prj
}})
&&
!
$running_children
{
$projects_deps_hash
{
$Prj
}})
{
if
(
!
defined
$modules_with_errors
{
$projects_deps_hash
{
$Prj
}}
||
$ignore
)
{
RemoveFromD
ependencies
(
$Prj
,
\%
global_deps_hash
);
remove_from_d
ependencies
(
$Prj
,
\%
global_deps_hash
);
$build_is_finished
{
$Prj
}
++
;
delete
$$build_queue
{
$Prj
};
$finished_projects
++
;
...
...
@@ -2060,10 +2066,8 @@ sub build_actual_queue {
sub
run_job
{
my
(
$job
,
$path
,
$registered_name
)
=
@_
;
my
$job_to_do
=
$job
;
if
(
$show
)
{
print
"$job_to_do\n"
;
return
0
;
}
print
"$registered_name\n"
;
return
0
if
(
$show
);
$job_to_do
=
$deliver_command
if
(
$job
eq
'deliver'
);
$registered_name
=
$path
if
(
!
defined
$registered_name
);
chdir
$path
;
...
...
@@ -2095,7 +2099,7 @@ sub do_custom_job {
if
(
$job
eq
$pre_job
)
{
announce_module
(
$module
);
# html_store_job_info($dependencies_hash, $job_dir);
RemoveFromD
ependencies
(
$module_job
,
$dependencies_hash
);
remove_from_d
ependencies
(
$module_job
,
$dependencies_hash
);
}
else
{
$error_code
=
run_job
(
$job
,
$module_paths
{
$module
},
$module_job
);
if
(
$error_code
)
{
...
...
@@ -2108,7 +2112,7 @@ sub do_custom_job {
$modules_with_errors
{
$dependencies_hash
}
++
;
$broken_build
{
$module
}
=
$error_code
;
}
else
{
RemoveFromD
ependencies
(
$module_job
,
$dependencies_hash
);
remove_from_d
ependencies
(
$module_job
,
$dependencies_hash
);
};
};
html_store_job_info
(
$dependencies_hash
,
$module_job
,
$error_code
);
...
...
@@ -2349,19 +2353,17 @@ sub fix_permissions {
sub
prepare_incompatible_build
{
my
(
$prj
,
$deps_hash
,
@missing_modules
);
$deps_hash
=
shift
;
foreach
(
keys
%
incompatibles
)
{
my
$incomp_prj
=
$_
;
if
(
!
defined
$$deps_hash
{
$_
})
{
$incomp_prj
.=
'.lnk'
if
(
$module_paths
{
$module
}
=~
/\.lnk$/
);
$incomp_prj
.=
'.link'
if
(
$module_paths
{
$module
}
=~
/\.link$/
);
foreach
my
$module
(
keys
%
incompatibles
)
{
if
(
!
defined
$$deps_hash
{
$module
})
{
print_error
(
"The module $initial_module is independent from $module\n"
);
}
delete
$incompatibles
{
$
_
};
$incompatibles
{
$
incomp_prj
}
=
$$deps_hash
{
$incomp_prj
};
delete
$$deps_hash
{
$
incomp_prj
};
delete
$incompatibles
{
$
module
};
$incompatibles
{
$
module
}
=
$$deps_hash
{
$module
};
delete
$$deps_hash
{
$
module
};
}
while
(
$prj
=
pick_prj_to_build
(
$deps_hash
))
{
RemoveFromD
ependencies
(
$prj
,
$deps_hash
);
RemoveFromD
ependencies
(
$prj
,
\%
incompatibles
);
remove_from_d
ependencies
(
$prj
,
$deps_hash
);
remove_from_d
ependencies
(
$prj
,
\%
incompatibles
);
};
foreach
(
keys
%
incompatibles
)
{
$$deps_hash
{
$_
}
=
$incompatibles
{
$_
};
...
...
@@ -2373,7 +2375,7 @@ sub prepare_incompatible_build {
@modules_built
=
keys
%
$deps_hash
;
%
add_to_config
=
%
$deps_hash
;
if
(
$prepare
)
{
generate_config_file
();
generate_config_file
()
if
((
!
defined
$ENV
{
UPDATER
})
||
(
defined
$ENV
{
CWS_WORK_STAMP
}))
;
clear_delivered
();
}
my
$old_output_tree
=
''
;
...
...
@@ -2419,16 +2421,16 @@ sub prepare_incompatible_build {
# Removes projects which it is not necessary to build
# with -with_branches switch
#
sub
prepare_build_from
{
my
(
$prj
,
$deps_hash
);
$deps_hash
=
shift
;
my
%
from_deps_hash
=
();
# hash of dependencies of the -from project
get_parent_deps
(
$build_from_with_branches
,
\%
from_deps_hash
);
foreach
$prj
(
keys
%
from_deps_hash
)
{
delete
$$deps_hash
{
$prj
};
RemoveFromD
ependencies
(
$prj
,
$deps_hash
);
};
};
#
sub prepare_build_from {
#
my ($prj, $deps_hash);
#
$deps_hash = shift;
#
my %from_deps_hash = (); # hash of dependencies of the -from project
#
get_parent_deps($build_from_with_branches, \%from_deps_hash);
#
foreach $prj (keys %from_deps_hash) {
#
delete $$deps_hash{$prj};
# remove_from_d
ependencies($prj, $deps_hash);
#
};
#
};
#
# Removes projects which it is not necessary to build
...
...
@@ -2445,13 +2447,13 @@ sub prepare_build_all_cont {
$orig_prj
=
$`
if
(
$prj
=~
/\.link$/o
);
if
((
$border_prj
ne
$prj
)
&&
(
$border_prj
ne
$orig_prj
))
{
RemoveFromD
ependencies
(
$prj
,
$deps_hash
);
remove_from_d
ependencies
(
$prj
,
$deps_hash
);
next
;
}
else
{
if
(
$build_all_cont
)
{
$$deps_hash
{
$prj
}
=
();
}
else
{
RemoveFromD
ependencies
(
$prj
,
$deps_hash
);
remove_from_d
ependencies
(
$prj
,
$deps_hash
);
};
return
;
};
...
...
@@ -2605,15 +2607,15 @@ sub clear_delivered {
my
$undeliver
=
"$deliver_command $deliver_delete_switches $nul"
;
# my $current_dir = getcwd();
foreach
my
$module
(
sort
@modules_built
)
{
if
(
!
chdir
(
$module_paths
{
$module
}))
{
push
(
@warnings
,
"Could not remove delivered files from the module $module. Your build can become inconsistent.\n"
);
}
else
{
if
(
chdir
(
$module_paths
{
$module
}))
{
print
"Removing delivered from module $module\n"
;
next
if
(
$show
);
if
(
system
(
$undeliver
))
{
$ENV
{
$_
}
=
$backup_vars
{
$_
}
foreach
(
keys
%
backup_vars
);
print_error
(
"Cannot run: $undeliver"
);
}
}
else
{
push
(
@warnings
,
"Could not remove delivered files from the module $module. Your build can become inconsistent.\n"
);
};
};
# chdir $current_dir;
...
...
@@ -3520,9 +3522,9 @@ sub get_job_string {
};
}
while
(
!
$job_dir
);
}
else
{
$dependencies_hash
=
\%
LocalDepsH
ash
;
$dependencies_hash
=
\%
local_deps_h
ash
;
do
{
$job_dir
=
pick_prj_to_build
(
\%
LocalDepsH
ash
);
$job_dir
=
pick_prj_to_build
(
\%
local_deps_h
ash
);
if
(
!
$job_dir
&&
!
children_number
())
{
cancel_build
()
if
(
scalar
keys
%
broken_build
);
mp_success_exit
();
...
...
@@ -3577,7 +3579,7 @@ sub pick_jobdir {
if
((
!
scalar
keys
%
$prj_deps_hash
)
&&
!
$running_children
{
$prj_deps_hash
})
{
if
(
!
defined
$modules_with_errors
{
$prj_deps_hash
}
||
$ignore
)
{
RemoveFromD
ependencies
(
$Prj
,
\%
global_deps_hash
);
remove_from_d
ependencies
(
$Prj
,
\%
global_deps_hash
);
$build_is_finished
{
$Prj
}
++
;
splice
(
@$build_queue
,
$i
,
1
);
next
;
...
...
solenv/bin/modules/SourceConfig.pm
Dosyayı görüntüle @
125d4ada
...
...
@@ -57,12 +57,16 @@ sub new {
my
$proto
=
shift
;
my
$class
=
ref
(
$proto
)
||
$proto
;
my
$source_root
=
shift
;
my
$self
=
{};
$self
->
{
USER_SOURCE_ROOT
}
=
undef
;
if
(
defined
$source_root
)
{
$self
->
{
USER_SOURCE_ROOT
}
=
$source_root
;
$source_root
=~
s/\\|\/$//
;
$source_root
.=
'/..'
;
}
else
{
$source_root
=
$ENV
{
SO
LARSRC
};
$source_root
=
$ENV
{
SO
URCE_ROOT_DIR
};
};
my
$self
=
{}
;
$source_root
=
Cwd::
realpath
(
$source_root
)
;
$self
->
{
DEBUG
}
=
0
;
$self
->
{
SOURCE_ROOT
}
=
$source_root
;
$self
->
{
REPOSITORIES
}
=
{};
...
...
@@ -72,7 +76,7 @@ sub new {
$self
->
{
MODULE_REPOSITORY
}
=
{};
$self
->
{
REAL_MODULES
}
=
{};
$self
->
{
SOURCE_CONFIG_FILE
}
=
get_config_file
(
$source_root
);
$self
->
{
SOURCE_CONFIG_DEFAULT
}
=
Cwd::
realpath
(
$source_root
)
.
'/'
.
SOURCE_CONFIG_FILE_NAME
;
$self
->
{
SOURCE_CONFIG_DEFAULT
}
=
$source_root
.
'/'
.
SOURCE_CONFIG_FILE_NAME
;
read_config_file
(
$self
);
bless
(
$self
,
$class
);
return
$self
;
...
...
@@ -206,18 +210,39 @@ sub get_module_paths {
sub
get_config_file
{
my
$source_root
=
shift
;
foreach
(
$source_root
,
$source_root
.
'/..'
)
{
if
(
-
f
$_
.
'/'
.
SOURCE_CONFIG_FILE_NAME
)
{
return
Cwd::
realpath
(
$_
)
.
'/'
.
SOURCE_CONFIG_FILE_NAME
;
my
$possible_path
=
$source_root
.
'/'
.
SOURCE_CONFIG_FILE_NAME
;
return
$possible_path
if
(
-
f
$possible_path
);
return
''
;
};
sub
get_hg_root
{
my
$hg_root
;
if
(
open
(
COMMAND
,
"hg root 2>&1 |"
))
{
foreach
(
<
COMMAND
>
)
{
next
if
(
/^Not trusting file/
);
chomp
;
$hg_root
=
$_
;
last
;
};
close
COMMAND
;
chomp
$hg_root
;
if
(
$hg_root
!~
/There is no Mercurial repository here/
)
{
return
$hg_root
;
};
return
''
;
};
croak
(
'Cannot open find source_config and/or determine hg root directory for '
.
cwd
());
};
sub
read_config_file
{
my
$self
=
shift
;
if
(
!
$self
->
{
SOURCE_CONFIG_FILE
})
{
$
{
$self
->
{
REPOSITORIES
}}{
File::Basename::
basename
(
$self
->
{
SOURCE_ROOT
})}
=
$self
->
{
SOURCE_ROOT
};
my
$repository_root
;
if
(
defined
$self
->
{
USER_SOURCE_ROOT
})
{
$repository_root
=
$self
->
{
USER_SOURCE_ROOT
};
}
else
{
$repository_root
=
get_hg_root
();
};
$
{
$self
->
{
REPOSITORIES
}}{
File::Basename::
basename
(
$repository_root
)}
=
$repository_root
;
return
;
};
my
$repository_section
=
0
;
...
...
@@ -243,7 +268,7 @@ sub read_config_file {
next
if
(
!
$repository_section
&&
!
$module_section
);
if
(
/\s*(\S+)=active\s*(\s+#)*/
)
{
if
(
$repository_section
)
{
$
{
$self
->
{
REPOSITORIES
}}{
$1
}
=
File::Basename::
dirname
(
$self
->
{
SOURCE_ROOT
})
.
"/$1"
;
$
{
$self
->
{
REPOSITORIES
}}{
$1
}
=
$self
->
{
SOURCE_ROOT
}
.
"/$1"
;
next
;
}
if
(
$module_section
)
{
...
...
@@ -254,6 +279,11 @@ sub read_config_file {
croak
(
"Line $line in "
.
$self
->
{
SOURCE_CONFIG_FILE
}
.
'violates format. Please make your checks!!'
);
};
close
SOURCE_CONFIG_FILE
;
if
(
!
scalar
keys
%
{
$self
->
{
REPOSITORIES
}})
{
# Fallback - default repository is the directory where is our module...
my
$hg_root
=
get_hg_root
();
$
{
$self
->
{
REPOSITORIES
}}{
File::Basename::
basename
(
$hg_root
)}
=
$hg_root
;
};
}
else
{
croak
(
'Cannot open '
.
$self
->
{
SOURCE_CONFIG_FILE
}
.
'for reading'
);
};
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment