Skip to content

Commit a0b136e

Browse files
committed
Add first version of the new package install scripts and adapt build steps udfclient_deps and language_deps of flavor python3-ds-EXASOL-6.1.0 to them.
1 parent 1fee154 commit a0b136e

13 files changed

+447
-22
lines changed

Diff for: ext/scripts/install_batch.pl

+75
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
#!/usr/bin/perl -w
2+
3+
=pod
4+
5+
=head1 SYNOPSIS
6+
7+
install_batch.pl [OPTIONS]
8+
Options:
9+
--help Brief help message
10+
--dry-run Doesn't execute the command, only prints it to STDOUT
11+
--file Input file with each line represents a input.
12+
A line can have multiple elements separated by --element-separator.
13+
Lines everything after a # is interpreted as comment
14+
--element-separator Separates elements in a line of the input file
15+
--combining-template Templates which combines all joined templates
16+
for the lines of the input file into one string.
17+
The templates are addressed with <<<<0>>>>, ,,,
18+
--templates Pairs of template and separator pair.
19+
The template is applied for each line in the input file and
20+
than joined together with the separator.
21+
The elements of a line are addressed with <<<<0>>>>, ,,,
22+
23+
=cut
24+
25+
use strict;
26+
use File::Basename;
27+
use lib dirname (__FILE__);
28+
use utils;
29+
use Getopt::Long;
30+
use Pod::Usage;
31+
32+
my $help = 0;
33+
my $dry_run = 0;
34+
my $file = '';
35+
my $element_separator = '';
36+
my $combining_template = '';
37+
my @template_separator_array = ();
38+
39+
GetOptions (
40+
"help" => \$help,
41+
"dry-run" => \$dry_run,
42+
"file=s" => \$file,
43+
"element-separator=s" => \$element_separator,
44+
"combining-template=s" => \$combining_template,
45+
"templates=s{2,}" => \@template_separator_array
46+
) or pod2usage(2);
47+
pod2usage(1) if $help;
48+
49+
50+
if($file eq ''){
51+
pod2usage("Error in command line arguments: --file was not specified");
52+
}
53+
if($element_separator eq ''){
54+
pod2usage("Error in command line arguments: --element-separator was not specified");
55+
}
56+
if($combining_template eq ''){
57+
pod2usage("Error in command line arguments: --combining_template was not specified");
58+
}
59+
60+
61+
if($#template_separator_array < 1 and ($#template_separator_array+1) % 2 != 0){
62+
pod2usage("Error in command line arguments: --templates need to be specified in pairs of template and separator");
63+
}
64+
my @templates = ();
65+
my @separators = ();
66+
for (my $i = 0; $i < $#template_separator_array; $i += 2) {
67+
push(@templates,$template_separator_array[$i]);
68+
push(@separators,$template_separator_array[$i+1]);
69+
}
70+
71+
my $cmd =
72+
utils::generate_joined_and_transformed_string_from_file(
73+
$file,$element_separator,$combining_template,\@templates,\@separators);
74+
75+
utils::execute("$cmd",$dry_run)

Diff for: ext/scripts/install_batch_test_file

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#comment 1
2+
wget;;1
3+
4+
curl;;2 #comment 2
5+
6+
tar;;3

Diff for: ext/scripts/install_via_apt.pl

+54
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
#!/usr/bin/perl -w
2+
3+
=pod
4+
5+
=head1 SYNOPSIS
6+
7+
install_via_apt.pl [OPTIONS]
8+
Options:
9+
--help Brief help message
10+
--dry-run Doesn't execute the command, only prints it to STDOUT
11+
--file Input file with each line represents a input.
12+
A line can have multiple elements separated by --element-separator.
13+
Lines everything after a # is interpreted as comment
14+
15+
=cut
16+
17+
use strict;
18+
use File::Basename;
19+
use lib dirname (__FILE__);
20+
use utils;
21+
use Getopt::Long;
22+
23+
my $help = 0;
24+
my $dry_run = 0;
25+
my $file = '';
26+
27+
GetOptions (
28+
"help" => \$help,
29+
"dry-run" => \$dry_run,
30+
"file=s" => \$file,
31+
) or utils::print_usage_and_abort(__FILE__,"Error in command line arguments",2);
32+
utils::print_usage_and_abort(__FILE__,"",0) if $help;
33+
34+
35+
if($file eq ''){
36+
utils::print_usage_and_abort(__FILE__,"Error in command line arguments: --file was not specified",1);
37+
}
38+
39+
my $element_separator = '\\|\\|\\|\\|\\|\\|\\|\\|';
40+
my $combining_template = 'apt-get install -y --no-install-recommends <<<<0>>>>';
41+
my @templates = ("'<<<<0>>>>'");
42+
my @separators = (" ");
43+
44+
my $cmd =
45+
utils::generate_joined_and_transformed_string_from_file(
46+
$file,$element_separator,$combining_template,\@templates,\@separators);
47+
48+
utils::execute("apt-get -y update",$dry_run);
49+
utils::execute($cmd,$dry_run);
50+
utils::execute("locale-gen en_US.UTF-8",$dry_run);
51+
utils::execute("update-locale LC_ALL=en_US.UTF-8",$dry_run);
52+
utils::execute("apt-get -y clean",$dry_run);
53+
utils::execute("apt-get -y autoremove",$dry_run);
54+
utils::execute("ldconfig",$dry_run);

Diff for: ext/scripts/install_via_apt_test_file

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
curl
2+
wget

Diff for: ext/scripts/install_via_pip.pl

+55
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/perl -w
2+
3+
=pod
4+
5+
=head1 SYNOPSIS
6+
7+
install_via_apt.pl [OPTIONS]
8+
Options:
9+
--help Brief help message
10+
--dry-run Doesn't execute the command, only prints it to STDOUT
11+
--file Input file with each line represents a input.
12+
A line can have multiple elements separated by --element-separator.
13+
Lines everything after a # is interpreted as comment
14+
--python-binary Python-binary to use for the installation
15+
16+
=cut
17+
18+
use strict;
19+
use File::Basename;
20+
use lib dirname (__FILE__);
21+
use utils;
22+
use Getopt::Long;
23+
24+
my $help = 0;
25+
my $dry_run = 0;
26+
my $file = '';
27+
my $python_binary = '';
28+
29+
GetOptions (
30+
"help" => \$help,
31+
"dry-run" => \$dry_run,
32+
"file=s" => \$file,
33+
"python-binary=s" => \$python_binary
34+
) or utils::print_usage_and_abort(__FILE__,"Error in command line arguments",2);
35+
utils::print_usage_and_abort(__FILE__,"",0) if $help;
36+
37+
38+
if($file eq ''){
39+
utils::print_usage_and_abort(__FILE__,"Error in command line arguments: --file was not specified",1);
40+
}
41+
42+
if($python_binary eq ''){
43+
utils::print_usage_and_abort(__FILE__,"Error in command line arguments: --python-binary was not specified",1);
44+
}
45+
46+
my $element_separator = '\\|\\|\\|\\|\\|\\|\\|\\|';
47+
my $combining_template = "$python_binary -m pip install --force-reinstall --progress-bar ascii --no-cache-dir <<<<0>>>>";
48+
my @templates = ("'<<<<0>>>>'");
49+
my @separators = (" ");
50+
51+
my $cmd =
52+
utils::generate_joined_and_transformed_string_from_file(
53+
$file,$element_separator,$combining_template,\@templates,\@separators);
54+
55+
utils::execute($cmd,$dry_run);

Diff for: ext/scripts/install_via_pip_test_file

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
numpy==1.18.1
2+
pandas==1.0.1

Diff for: ext/scripts/install_via_r_versions.pl

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
#!/usr/bin/perl -w
2+
3+
=pod
4+
5+
=head1 SYNOPSIS
6+
7+
install_via_apt.pl [OPTIONS]
8+
Options:
9+
--help Brief help message
10+
--dry-run Doesn't execute the command, only prints it to STDOUT
11+
--file Input file with each line represents a input.
12+
A line can have multiple elements separated by --element-separator.
13+
Lines everything after a # is interpreted as comment
14+
--rscript-binary Rscript binary to use for installation
15+
16+
=cut
17+
18+
use strict;
19+
use File::Basename;
20+
use lib dirname (__FILE__);
21+
use utils;
22+
use Getopt::Long;
23+
use Pod::Usage;
24+
#use IPC::System::Simple;
25+
26+
my $help = 0;
27+
my $dry_run = 0;
28+
my $file = '';
29+
my $rscript_binary = '';
30+
31+
GetOptions (
32+
"help" => \$help,
33+
"dry-run" => \$dry_run,
34+
"file=s" => \$file,
35+
"rscript-binary=s" => \$rscript_binary
36+
) or pod2usage(2);
37+
pod2usage(1) if $help;
38+
39+
40+
if($file eq ''){
41+
pod2usage("Error in command line arguments: --file was not specified");
42+
}
43+
44+
if($rscript_binary eq ''){
45+
pod2usage("Error in command line arguments: --rscript-binary was not specified");
46+
}
47+
48+
my $element_separator = '\\|';
49+
my $combining_template = "$rscript_binary --default-packages 'versions' -e 'install.versions(c(<<<<0>>>>),c(<<<<1>>>>))'";
50+
my @templates = ('"<<<<0>>>>"','"<<<<1>>>>"');
51+
my @separators = (",",",");
52+
53+
my $cmd =
54+
utils::generate_joined_and_transformed_string_from_file(
55+
$file,$element_separator,$combining_template,\@templates,\@separators);
56+
57+
utils::execute("$rscript_binary -e 'install.packages(\"install.packages('versions')\")'",$dry_run);
58+
utils::execute($cmd,$dry_run);

Diff for: ext/scripts/install_via_r_versions_test_file

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
dplyr|0.8.3
2+
purrr|0.3.2
3+
magrittr|1.4

Diff for: ext/scripts/run_tests.sh

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
./install_batch.pl --file install_batch_test_file --element-separator ";;" --combining-template "echo 'install(c(<<<<0>>>>),c(<<<<1>>>>))'" --templates '"<<<<0>>>>"' ',' '"<<<<1>>>>"' ','
2+
echo
3+
./install_via_apt.pl --file install_via_apt_test_file --dry-run
4+
echo
5+
./install_via_pip.pl --file install_via_pip_test_file --python-binary python3 --dry-run
6+
echo
7+
./install_via_r_versions.pl --file install_via_r_versions_test_file --rscript-binary Rscript --dry-run

0 commit comments

Comments
 (0)