Dev: Is it http_download? [build]

This commit is contained in:
Ilia Ross
2024-04-14 00:17:36 +03:00
parent 5f28c37cab
commit d3b46a6675
2 changed files with 13 additions and 15 deletions

View File

@@ -1,6 +1,6 @@
#!/usr/local/bin/perl
# Builds a tar.gz package of a specified Webmin version
use Cwd 'abs_path', 'getcwd';
if ($0 =~ /^(.*)\//) {
chdir($1);
}
@@ -88,9 +88,13 @@ else {
# Build EOL data
if (-r "./webmin/os-eol-lib.pl") {
print "Building OS EOL data\n";
print "Before do: ", getcwd(), "\n";
do "./web-lib-funcs.pl";
print "After do 1: ", getcwd(), "\n";
do "./webmin/os-eol-lib.pl";
print "After do 2: ", getcwd(), "\n";
&eol_build_all_os_data("./os_eol.json");
print "After run 1: ", getcwd(), "\n";
print &backquote_command("cat ./os_eol.json");
}

View File

@@ -42,20 +42,14 @@ $eol_cache_file ||= "$root_directory/os_eol.json";
my @eol_oses = &eol_oses_list();
my @eol_oses_data;
foreach my $os (@eol_oses) {
my ($fdata, $ferror);
&http_download('endoflife.date', 443, "/api/$os.json", \$fdata,
\$ferror, undef, 1, undef, undef, 5);
if ($ferror) {
$fdata =
&backquote_command(
"curl -sS --request GET " .
"--url https://endoflife.date/api/$os.json ".
"--header 'Accept: application/json' ".
"2>&1 </dev/null");
if ($?) {
die("Could not fetch OS EOL data: http_download :
$ferror; curl : $?");
}
my $fdata =
&backquote_command(
"curl -sS --request GET " .
"--url https://endoflife.date/api/$os.json ".
"--header 'Accept: application/json' ".
"2>&1 </dev/null");
if ($?) {
die("Could not fetch OS EOL data : $?");
}
my $fdata_json;
eval { $fdata_json = &convert_from_json($fdata); };