-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathfind-latest-version
executable file
·49 lines (38 loc) · 1.44 KB
/
find-latest-version
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
#!/usr/local/cpanel/3rdparty/bin/perl
# cpanel - find-latest-version Copyright(c) 2019 cPanel, L.L.C.
# All rights Reserved.
# copyright@cpanel.net http://cpanel.net
# This code is subject to the cPanel license. Unauthorized copying is prohibited
#
# This provides incremental updates to existing packages in EasyApache4.
package libcurl::find_latest_version;
use strict;
use warnings;
use lib "../ea-tools/lib/ea4_tool"; # assumes ea-tools is checked out next to this repo
use ea4_tool::util ();
unless ( caller() ) {
ea4_tool::util::find_latest_version( \&_get_required, \&_add_sum );
}
###############
#### helpers ##
###############
sub _get_required {
my ($http) = @_;
my $res = $http->get("https://curl.haxx.se/download.html");
if ( !$res->{success} ) {
die "Could not GET libcurl dist page ($res->{status} $res->{reason})\n";
}
my @libcurl = sort { $b <=> $a } ( $res->{content} =~ m{href="/download/curl-[78]\.([0-9]+\.[0-9]+)\.tar\.gz"}g );
if ( !@libcurl ) {
die "Could not find libcurl versions\n";
}
my $version = "8.$libcurl[0]";
my $name = "curl-$version.tar.gz";
my $url = "https://curl.haxx.se/download/$name";
return ( $version, $url, $name );
}
sub _add_sum {
my ( $http, $hr ) = @_;
# the gpg key is no longer valid, stop including it
return;
}