Add deps locally
This commit is contained in:
63
deps/curl/scripts/Makefile.am
vendored
Normal file
63
deps/curl/scripts/Makefile.am
vendored
Normal file
@ -0,0 +1,63 @@
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
EXTRA_DIST = updatemanpages.pl coverage.sh completion.pl firefox-db2pem.sh \
|
||||
checksrc.pl mk-ca-bundle.pl schemetable.c
|
||||
|
||||
ZSH_FUNCTIONS_DIR = @ZSH_FUNCTIONS_DIR@
|
||||
FISH_FUNCTIONS_DIR = @FISH_FUNCTIONS_DIR@
|
||||
PERL = @PERL@
|
||||
|
||||
ZSH_COMPLETION_FUNCTION_FILENAME = _curl
|
||||
FISH_COMPLETION_FUNCTION_FILENAME = curl.fish
|
||||
|
||||
CLEANFILES = $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
|
||||
all-local: $(ZSH_COMPLETION_FUNCTION_FILENAME) $(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
|
||||
$(ZSH_COMPLETION_FUNCTION_FILENAME): completion.pl
|
||||
if CROSSCOMPILING
|
||||
@echo "NOTICE: we can't generate zsh completion when cross-compiling!"
|
||||
else # if not cross-compiling:
|
||||
@if ! test -x "$(PERL)"; then echo "No perl: can't install completion.pl"; exit 0; fi
|
||||
$(PERL) $(srcdir)/completion.pl --curl $(top_builddir)/src/curl$(EXEEXT) --shell zsh > $@
|
||||
endif
|
||||
|
||||
$(FISH_COMPLETION_FUNCTION_FILENAME): completion.pl
|
||||
if CROSSCOMPILING
|
||||
@echo "NOTICE: we can't generate fish completion when cross-compiling!"
|
||||
else # if not cross-compiling:
|
||||
@if ! test -x "$(PERL)"; then echo "No perl: can't install completion.pl"; exit 0; fi
|
||||
$(PERL) $(srcdir)/completion.pl --curl $(top_builddir)/src/curl$(EXEEXT) --shell fish > $@
|
||||
endif
|
||||
|
||||
install-data-local:
|
||||
if CROSSCOMPILING
|
||||
@echo "NOTICE: we can't install zsh completion when cross-compiling!"
|
||||
else # if not cross-compiling:
|
||||
$(MKDIR_P) $(DESTDIR)$(ZSH_FUNCTIONS_DIR)
|
||||
$(MKDIR_P) $(DESTDIR)$(FISH_FUNCTIONS_DIR)
|
||||
$(INSTALL_DATA) $(ZSH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(ZSH_FUNCTIONS_DIR)/$(ZSH_COMPLETION_FUNCTION_FILENAME)
|
||||
$(INSTALL_DATA) $(FISH_COMPLETION_FUNCTION_FILENAME) $(DESTDIR)$(FISH_FUNCTIONS_DIR)/$(FISH_COMPLETION_FUNCTION_FILENAME)
|
||||
endif
|
988
deps/curl/scripts/checksrc.pl
vendored
Normal file
988
deps/curl/scripts/checksrc.pl
vendored
Normal file
@ -0,0 +1,988 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
|
||||
my $max_column = 79;
|
||||
my $indent = 2;
|
||||
|
||||
my $warnings = 0;
|
||||
my $swarnings = 0;
|
||||
my $errors = 0;
|
||||
my $serrors = 0;
|
||||
my $suppressed; # skipped problems
|
||||
my $file;
|
||||
my $dir=".";
|
||||
my $wlist="";
|
||||
my @alist;
|
||||
my $windows_os = $^O eq 'MSWin32' || $^O eq 'cygwin' || $^O eq 'msys';
|
||||
my $verbose;
|
||||
my %skiplist;
|
||||
|
||||
my %ignore;
|
||||
my %ignore_set;
|
||||
my %ignore_used;
|
||||
my @ignore_line;
|
||||
|
||||
my %warnings_extended = (
|
||||
'COPYRIGHTYEAR' => 'copyright year incorrect',
|
||||
'STRERROR', => 'strerror() detected',
|
||||
'STDERR', => 'stderr detected',
|
||||
);
|
||||
|
||||
my %warnings = (
|
||||
'ASSIGNWITHINCONDITION' => 'assignment within conditional expression',
|
||||
'ASTERISKNOSPACE' => 'pointer declared without space before asterisk',
|
||||
'ASTERISKSPACE' => 'pointer declared with space after asterisk',
|
||||
'BADCOMMAND' => 'bad !checksrc! instruction',
|
||||
'BANNEDFUNC' => 'a banned function was used',
|
||||
'BANNEDPREPROC' => 'a banned symbol was used on a preprocessor line',
|
||||
'BRACEELSE' => '} else on the same line',
|
||||
'BRACEPOS' => 'wrong position for an open brace',
|
||||
'BRACEWHILE' => 'A single space between open brace and while',
|
||||
'COMMANOSPACE' => 'comma without following space',
|
||||
'COMMENTNOSPACEEND' => 'no space before */',
|
||||
'COMMENTNOSPACESTART' => 'no space following /*',
|
||||
'COPYRIGHT' => 'file missing a copyright statement',
|
||||
'CPPCOMMENTS' => '// comment detected',
|
||||
'DOBRACE' => 'A single space between do and open brace',
|
||||
'EMPTYLINEBRACE' => 'Empty line before the open brace',
|
||||
'EQUALSNOSPACE' => 'equals sign without following space',
|
||||
'EQUALSNULL' => 'if/while comparison with == NULL',
|
||||
'EXCLAMATIONSPACE' => 'Whitespace after exclamation mark in expression',
|
||||
'FOPENMODE' => 'fopen needs a macro for the mode string',
|
||||
'INCLUDEDUP', => 'same file is included again',
|
||||
'INDENTATION' => 'wrong start column for code',
|
||||
'LONGLINE' => "Line longer than $max_column",
|
||||
'SPACEBEFORELABEL' => 'labels not at the start of the line',
|
||||
'MULTISPACE' => 'multiple spaces used when not suitable',
|
||||
'NOSPACEEQUALS' => 'equals sign without preceding space',
|
||||
'NOTEQUALSZERO', => 'if/while comparison with != 0',
|
||||
'ONELINECONDITION' => 'conditional block on the same line as the if()',
|
||||
'OPENCOMMENT' => 'file ended with a /* comment still "open"',
|
||||
'PARENBRACE' => '){ without sufficient space',
|
||||
'RETURNNOSPACE' => 'return without space',
|
||||
'SEMINOSPACE' => 'semicolon without following space',
|
||||
'SIZEOFNOPAREN' => 'use of sizeof without parentheses',
|
||||
'SNPRINTF' => 'use of snprintf',
|
||||
'SPACEAFTERPAREN' => 'space after open parenthesis',
|
||||
'SPACEBEFORECLOSE' => 'space before a close parenthesis',
|
||||
'SPACEBEFORECOMMA' => 'space before a comma',
|
||||
'SPACEBEFOREPAREN' => 'space before an open parenthesis',
|
||||
'SPACESEMICOLON' => 'space before semicolon',
|
||||
'SPACESWITCHCOLON' => 'space before colon of switch label',
|
||||
'TABS' => 'TAB characters not allowed',
|
||||
'TRAILINGSPACE' => 'Trailing whitespace on the line',
|
||||
'TYPEDEFSTRUCT' => 'typedefed struct',
|
||||
'UNUSEDIGNORE' => 'a warning ignore was not used',
|
||||
);
|
||||
|
||||
sub readskiplist {
|
||||
open(my $W, '<', "$dir/checksrc.skip") or return;
|
||||
my @all=<$W>;
|
||||
for(@all) {
|
||||
$windows_os ? $_ =~ s/\r?\n$// : chomp;
|
||||
$skiplist{$_}=1;
|
||||
}
|
||||
close($W);
|
||||
}
|
||||
|
||||
# Reads the .checksrc in $dir for any extended warnings to enable locally.
|
||||
# Currently there is no support for disabling warnings from the standard set,
|
||||
# and since that's already handled via !checksrc! commands there is probably
|
||||
# little use to add it.
|
||||
sub readlocalfile {
|
||||
my $i = 0;
|
||||
|
||||
open(my $rcfile, "<", "$dir/.checksrc") or return;
|
||||
|
||||
while(<$rcfile>) {
|
||||
$i++;
|
||||
|
||||
# Lines starting with '#' are considered comments
|
||||
if (/^\s*(#.*)/) {
|
||||
next;
|
||||
}
|
||||
elsif (/^\s*enable ([A-Z]+)$/) {
|
||||
if(!defined($warnings_extended{$1})) {
|
||||
print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
|
||||
next;
|
||||
}
|
||||
$warnings{$1} = $warnings_extended{$1};
|
||||
}
|
||||
elsif (/^\s*disable ([A-Z]+)$/) {
|
||||
if(!defined($warnings{$1})) {
|
||||
print STDERR "invalid warning specified in .checksrc: \"$1\"\n";
|
||||
next;
|
||||
}
|
||||
# Accept-list
|
||||
push @alist, $1;
|
||||
}
|
||||
else {
|
||||
die "Invalid format in $dir/.checksrc on line $i\n";
|
||||
}
|
||||
}
|
||||
close($rcfile);
|
||||
}
|
||||
|
||||
sub checkwarn {
|
||||
my ($name, $num, $col, $file, $line, $msg, $error) = @_;
|
||||
|
||||
my $w=$error?"error":"warning";
|
||||
my $nowarn=0;
|
||||
|
||||
#if(!$warnings{$name}) {
|
||||
# print STDERR "Dev! there's no description for $name!\n";
|
||||
#}
|
||||
|
||||
# checksrc.skip
|
||||
if($skiplist{$line}) {
|
||||
$nowarn = 1;
|
||||
}
|
||||
# !checksrc! controlled
|
||||
elsif($ignore{$name}) {
|
||||
$ignore{$name}--;
|
||||
$ignore_used{$name}++;
|
||||
$nowarn = 1;
|
||||
if(!$ignore{$name}) {
|
||||
# reached zero, enable again
|
||||
enable_warn($name, $num, $file, $line);
|
||||
}
|
||||
}
|
||||
|
||||
if($nowarn) {
|
||||
$suppressed++;
|
||||
if($w) {
|
||||
$swarnings++;
|
||||
}
|
||||
else {
|
||||
$serrors++;
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
if($w) {
|
||||
$warnings++;
|
||||
}
|
||||
else {
|
||||
$errors++;
|
||||
}
|
||||
|
||||
$col++;
|
||||
print "$file:$num:$col: $w: $msg ($name)\n";
|
||||
print " $line\n";
|
||||
|
||||
if($col < 80) {
|
||||
my $pref = (' ' x $col);
|
||||
print "${pref}^\n";
|
||||
}
|
||||
}
|
||||
|
||||
$file = shift @ARGV;
|
||||
|
||||
while(defined $file) {
|
||||
|
||||
if($file =~ /-D(.*)/) {
|
||||
$dir = $1;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-W(.*)/) {
|
||||
$wlist .= " $1 ";
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-A(.+)/) {
|
||||
push @alist, $1;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-i([1-9])/) {
|
||||
$indent = $1 + 0;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /-m([0-9]+)/) {
|
||||
$max_column = $1 + 0;
|
||||
$file = shift @ARGV;
|
||||
next;
|
||||
}
|
||||
elsif($file =~ /^(-h|--help)/) {
|
||||
undef $file;
|
||||
last;
|
||||
}
|
||||
|
||||
last;
|
||||
}
|
||||
|
||||
if(!$file) {
|
||||
print "checksrc.pl [option] <file1> [file2] ...\n";
|
||||
print " Options:\n";
|
||||
print " -A[rule] Accept this violation, can be used multiple times\n";
|
||||
print " -D[DIR] Directory to prepend file names\n";
|
||||
print " -h Show help output\n";
|
||||
print " -W[file] Skip the given file - ignore all its flaws\n";
|
||||
print " -i<n> Indent spaces. Default: 2\n";
|
||||
print " -m<n> Maximum line length. Default: 79\n";
|
||||
print "\nDetects and warns for these problems:\n";
|
||||
my @allw = keys %warnings;
|
||||
push @allw, keys %warnings_extended;
|
||||
for my $w (sort @allw) {
|
||||
if($warnings{$w}) {
|
||||
printf (" %-18s: %s\n", $w, $warnings{$w});
|
||||
}
|
||||
else {
|
||||
printf (" %-18s: %s[*]\n", $w, $warnings_extended{$w});
|
||||
}
|
||||
}
|
||||
print " [*] = disabled by default\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
readskiplist();
|
||||
readlocalfile();
|
||||
|
||||
do {
|
||||
if("$wlist" !~ / $file /) {
|
||||
my $fullname = $file;
|
||||
$fullname = "$dir/$file" if ($fullname !~ '^\.?\.?/');
|
||||
scanfile($fullname);
|
||||
}
|
||||
$file = shift @ARGV;
|
||||
|
||||
} while($file);
|
||||
|
||||
sub accept_violations {
|
||||
for my $r (@alist) {
|
||||
if(!$warnings{$r}) {
|
||||
print "'$r' is not a warning to accept!\n";
|
||||
exit;
|
||||
}
|
||||
$ignore{$r}=999999;
|
||||
$ignore_used{$r}=0;
|
||||
}
|
||||
}
|
||||
|
||||
sub checksrc_clear {
|
||||
undef %ignore;
|
||||
undef %ignore_set;
|
||||
undef @ignore_line;
|
||||
}
|
||||
|
||||
sub checksrc_endoffile {
|
||||
my ($file) = @_;
|
||||
for(keys %ignore_set) {
|
||||
if($ignore_set{$_} && !$ignore_used{$_}) {
|
||||
checkwarn("UNUSEDIGNORE", $ignore_set{$_},
|
||||
length($_)+11, $file,
|
||||
$ignore_line[$ignore_set{$_}],
|
||||
"Unused ignore: $_");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub enable_warn {
|
||||
my ($what, $line, $file, $l) = @_;
|
||||
|
||||
# switch it back on, but warn if not triggered!
|
||||
if(!$ignore_used{$what}) {
|
||||
checkwarn("UNUSEDIGNORE",
|
||||
$line, length($what) + 11, $file, $l,
|
||||
"No warning was inhibited!");
|
||||
}
|
||||
$ignore_set{$what}=0;
|
||||
$ignore_used{$what}=0;
|
||||
$ignore{$what}=0;
|
||||
}
|
||||
sub checksrc {
|
||||
my ($cmd, $line, $file, $l) = @_;
|
||||
if($cmd =~ / *([^ ]*) *(.*)/) {
|
||||
my ($enable, $what) = ($1, $2);
|
||||
$what =~ s: *\*/$::; # cut off end of C comment
|
||||
# print "ENABLE $enable WHAT $what\n";
|
||||
if($enable eq "disable") {
|
||||
my ($warn, $scope)=($1, $2);
|
||||
if($what =~ /([^ ]*) +(.*)/) {
|
||||
($warn, $scope)=($1, $2);
|
||||
}
|
||||
else {
|
||||
$warn = $what;
|
||||
$scope = 1;
|
||||
}
|
||||
# print "IGNORE $warn for SCOPE $scope\n";
|
||||
if($scope eq "all") {
|
||||
$scope=999999;
|
||||
}
|
||||
|
||||
# Comparing for a literal zero rather than the scalar value zero
|
||||
# covers the case where $scope contains the ending '*' from the
|
||||
# comment. If we use a scalar comparison (==) we induce warnings
|
||||
# on non-scalar contents.
|
||||
if($scope eq "0") {
|
||||
checkwarn("BADCOMMAND",
|
||||
$line, 0, $file, $l,
|
||||
"Disable zero not supported, did you mean to enable?");
|
||||
}
|
||||
elsif($ignore_set{$warn}) {
|
||||
checkwarn("BADCOMMAND",
|
||||
$line, 0, $file, $l,
|
||||
"$warn already disabled from line $ignore_set{$warn}");
|
||||
}
|
||||
else {
|
||||
$ignore{$warn}=$scope;
|
||||
$ignore_set{$warn}=$line;
|
||||
$ignore_line[$line]=$l;
|
||||
}
|
||||
}
|
||||
elsif($enable eq "enable") {
|
||||
enable_warn($what, $line, $file, $l);
|
||||
}
|
||||
else {
|
||||
checkwarn("BADCOMMAND",
|
||||
$line, 0, $file, $l,
|
||||
"Illegal !checksrc! command");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
sub nostrings {
|
||||
my ($str) = @_;
|
||||
$str =~ s/\".*\"//g;
|
||||
return $str;
|
||||
}
|
||||
|
||||
sub scanfile {
|
||||
my ($file) = @_;
|
||||
|
||||
my $line = 1;
|
||||
my $prevl="";
|
||||
my $prevpl="";
|
||||
my $l = "";
|
||||
my $prep = 0;
|
||||
my $prevp = 0;
|
||||
open(my $R, '<', $file) || die "failed to open $file";
|
||||
|
||||
my $incomment=0;
|
||||
my @copyright=();
|
||||
my %includes;
|
||||
checksrc_clear(); # for file based ignores
|
||||
accept_violations();
|
||||
|
||||
while(<$R>) {
|
||||
$windows_os ? $_ =~ s/\r?\n$// : chomp;
|
||||
my $l = $_;
|
||||
my $ol = $l; # keep the unmodified line for error reporting
|
||||
my $column = 0;
|
||||
|
||||
# check for !checksrc! commands
|
||||
if($l =~ /\!checksrc\! (.*)/) {
|
||||
my $cmd = $1;
|
||||
checksrc($cmd, $line, $file, $l)
|
||||
}
|
||||
|
||||
if($l =~ /^#line (\d+) \"([^\"]*)\"/) {
|
||||
# a #line instruction
|
||||
$file = $2;
|
||||
$line = $1;
|
||||
next;
|
||||
}
|
||||
|
||||
# check for a copyright statement and save the years
|
||||
if($l =~ /\* +copyright .* (\d\d\d\d|)/i) {
|
||||
my $count = 0;
|
||||
while($l =~ /([\d]{4})/g) {
|
||||
push @copyright, {
|
||||
year => $1,
|
||||
line => $line,
|
||||
col => index($l, $1),
|
||||
code => $l
|
||||
};
|
||||
$count++;
|
||||
}
|
||||
if(!$count) {
|
||||
# year-less
|
||||
push @copyright, {
|
||||
year => -1,
|
||||
line => $line,
|
||||
col => index($l, $1),
|
||||
code => $l
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
# detect long lines
|
||||
if(length($l) > $max_column) {
|
||||
checkwarn("LONGLINE", $line, length($l), $file, $l,
|
||||
"Longer than $max_column columns");
|
||||
}
|
||||
# detect TAB characters
|
||||
if($l =~ /^(.*)\t/) {
|
||||
checkwarn("TABS",
|
||||
$line, length($1), $file, $l, "Contains TAB character", 1);
|
||||
}
|
||||
# detect trailing whitespace
|
||||
if($l =~ /^(.*)[ \t]+\z/) {
|
||||
checkwarn("TRAILINGSPACE",
|
||||
$line, length($1), $file, $l, "Trailing whitespace");
|
||||
}
|
||||
|
||||
# no space after comment start
|
||||
if($l =~ /^(.*)\/\*\w/) {
|
||||
checkwarn("COMMENTNOSPACESTART",
|
||||
$line, length($1) + 2, $file, $l,
|
||||
"Missing space after comment start");
|
||||
}
|
||||
# no space at comment end
|
||||
if($l =~ /^(.*)\w\*\//) {
|
||||
checkwarn("COMMENTNOSPACEEND",
|
||||
$line, length($1) + 1, $file, $l,
|
||||
"Missing space end comment end");
|
||||
}
|
||||
# ------------------------------------------------------------
|
||||
# Above this marker, the checks were done on lines *including*
|
||||
# comments
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# strip off C89 comments
|
||||
|
||||
comment:
|
||||
if(!$incomment) {
|
||||
if($l =~ s/\/\*.*\*\// /g) {
|
||||
# full /* comments */ were removed!
|
||||
}
|
||||
if($l =~ s/\/\*.*//) {
|
||||
# start of /* comment was removed
|
||||
$incomment = 1;
|
||||
}
|
||||
}
|
||||
else {
|
||||
if($l =~ s/.*\*\///) {
|
||||
# end of comment */ was removed
|
||||
$incomment = 0;
|
||||
goto comment;
|
||||
}
|
||||
else {
|
||||
# still within a comment
|
||||
$l="";
|
||||
}
|
||||
}
|
||||
|
||||
# ------------------------------------------------------------
|
||||
# Below this marker, the checks were done on lines *without*
|
||||
# comments
|
||||
# ------------------------------------------------------------
|
||||
|
||||
# prev line was a preprocessor **and** ended with a backslash
|
||||
if($prep && ($prevpl =~ /\\ *\z/)) {
|
||||
# this is still a preprocessor line
|
||||
$prep = 1;
|
||||
goto preproc;
|
||||
}
|
||||
$prep = 0;
|
||||
|
||||
# crude attempt to detect // comments without too many false
|
||||
# positives
|
||||
if($l =~ /^(([^"\*]*)[^:"]|)\/\//) {
|
||||
checkwarn("CPPCOMMENTS",
|
||||
$line, length($1), $file, $l, "\/\/ comment");
|
||||
}
|
||||
|
||||
if($l =~ /^(\#\s*include\s+)([\">].*[>}"])/) {
|
||||
my ($pre, $path) = ($1, $2);
|
||||
if($includes{$path}) {
|
||||
checkwarn("INCLUDEDUP",
|
||||
$line, length($1), $file, $l, "duplicated include");
|
||||
}
|
||||
$includes{$path} = $l;
|
||||
}
|
||||
|
||||
# detect and strip preprocessor directives
|
||||
if($l =~ /^[ \t]*\#/) {
|
||||
# preprocessor line
|
||||
$prep = 1;
|
||||
goto preproc;
|
||||
}
|
||||
|
||||
my $nostr = nostrings($l);
|
||||
# check spaces after for/if/while/function call
|
||||
if($nostr =~ /^(.*)(for|if|while|switch| ([a-zA-Z0-9_]+)) \((.)/) {
|
||||
my ($leading, $word, $extra, $first)=($1,$2,$3,$4);
|
||||
if($1 =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
elsif(defined $3 && $3 eq "return") {
|
||||
# return must have a space
|
||||
}
|
||||
elsif(defined $3 && $3 eq "case") {
|
||||
# case must have a space
|
||||
}
|
||||
elsif(($first eq "*") && ($word !~ /(for|if|while|switch)/)) {
|
||||
# A "(*" beginning makes the space OK because it wants to
|
||||
# allow function pointer declared
|
||||
}
|
||||
elsif($1 =~ / *typedef/) {
|
||||
# typedefs can use space-paren
|
||||
}
|
||||
else {
|
||||
checkwarn("SPACEBEFOREPAREN", $line, length($leading)+length($word), $file, $l,
|
||||
"$word with space");
|
||||
}
|
||||
}
|
||||
# check for '== NULL' in if/while conditions but not if the thing on
|
||||
# the left of it is a function call
|
||||
if($nostr =~ /^(.*)(if|while)(\(.*?)([!=]= NULL|NULL [!=]=)/) {
|
||||
checkwarn("EQUALSNULL", $line,
|
||||
length($1) + length($2) + length($3),
|
||||
$file, $l, "we prefer !variable instead of \"== NULL\" comparisons");
|
||||
}
|
||||
|
||||
# check for '!= 0' in if/while conditions but not if the thing on
|
||||
# the left of it is a function call
|
||||
if($nostr =~ /^(.*)(if|while)(\(.*[^)]) != 0[^x]/) {
|
||||
checkwarn("NOTEQUALSZERO", $line,
|
||||
length($1) + length($2) + length($3),
|
||||
$file, $l, "we prefer if(rc) instead of \"rc != 0\" comparisons");
|
||||
}
|
||||
|
||||
# check spaces in 'do {'
|
||||
if($nostr =~ /^( *)do( *)\{/ && length($2) != 1) {
|
||||
checkwarn("DOBRACE", $line, length($1) + 2, $file, $l, "one space after do before brace");
|
||||
}
|
||||
# check spaces in 'do {'
|
||||
elsif($nostr =~ /^( *)\}( *)while/ && length($2) != 1) {
|
||||
checkwarn("BRACEWHILE", $line, length($1) + 2, $file, $l, "one space between brace and while");
|
||||
}
|
||||
if($nostr =~ /^((.*\s)(if) *\()(.*)\)(.*)/) {
|
||||
my $pos = length($1);
|
||||
my $postparen = $5;
|
||||
my $cond = $4;
|
||||
if($cond =~ / = /) {
|
||||
checkwarn("ASSIGNWITHINCONDITION",
|
||||
$line, $pos+1, $file, $l,
|
||||
"assignment within conditional expression");
|
||||
}
|
||||
my $temp = $cond;
|
||||
$temp =~ s/\(//g; # remove open parens
|
||||
my $openc = length($cond) - length($temp);
|
||||
|
||||
$temp = $cond;
|
||||
$temp =~ s/\)//g; # remove close parens
|
||||
my $closec = length($cond) - length($temp);
|
||||
my $even = $openc == $closec;
|
||||
|
||||
if($l =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
elsif($even && $postparen &&
|
||||
($postparen !~ /^ *$/) && ($postparen !~ /^ *[,{&|\\]+/)) {
|
||||
checkwarn("ONELINECONDITION",
|
||||
$line, length($l)-length($postparen), $file, $l,
|
||||
"conditional block on the same line");
|
||||
}
|
||||
}
|
||||
# check spaces after open parentheses
|
||||
if($l =~ /^(.*[a-z])\( /i) {
|
||||
checkwarn("SPACEAFTERPAREN",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"space after open parenthesis");
|
||||
}
|
||||
|
||||
# check spaces before close parentheses, unless it was a space or a
|
||||
# close parenthesis!
|
||||
if($l =~ /(.*[^\) ]) \)/) {
|
||||
checkwarn("SPACEBEFORECLOSE",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"space before close parenthesis");
|
||||
}
|
||||
|
||||
# check spaces before comma!
|
||||
if($l =~ /(.*[^ ]) ,/) {
|
||||
checkwarn("SPACEBEFORECOMMA",
|
||||
$line, length($1)+1, $file, $l,
|
||||
"space before comma");
|
||||
}
|
||||
|
||||
# check for "return(" without space
|
||||
if($l =~ /^(.*)return\(/) {
|
||||
if($1 =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
else {
|
||||
checkwarn("RETURNNOSPACE", $line, length($1)+6, $file, $l,
|
||||
"return without space before paren");
|
||||
}
|
||||
}
|
||||
|
||||
# check for "sizeof" without parenthesis
|
||||
if(($l =~ /^(.*)sizeof *([ (])/) && ($2 ne "(")) {
|
||||
if($1 =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
}
|
||||
else {
|
||||
checkwarn("SIZEOFNOPAREN", $line, length($1)+6, $file, $l,
|
||||
"sizeof without parenthesis");
|
||||
}
|
||||
}
|
||||
|
||||
# check for comma without space
|
||||
if($l =~ /^(.*),[^ \n]/) {
|
||||
my $pref=$1;
|
||||
my $ign=0;
|
||||
if($pref =~ / *\#/) {
|
||||
# this is a #if, treat it differently
|
||||
$ign=1;
|
||||
}
|
||||
elsif($pref =~ /\/\*/) {
|
||||
# this is a comment
|
||||
$ign=1;
|
||||
}
|
||||
elsif($pref =~ /[\"\']/) {
|
||||
$ign = 1;
|
||||
# There is a quote here, figure out whether the comma is
|
||||
# within a string or '' or not.
|
||||
if($pref =~ /\"/) {
|
||||
# within a string
|
||||
}
|
||||
elsif($pref =~ /\'$/) {
|
||||
# a single letter
|
||||
}
|
||||
else {
|
||||
$ign = 0;
|
||||
}
|
||||
}
|
||||
if(!$ign) {
|
||||
checkwarn("COMMANOSPACE", $line, length($pref)+1, $file, $l,
|
||||
"comma without following space");
|
||||
}
|
||||
}
|
||||
|
||||
# check for "} else"
|
||||
if($l =~ /^(.*)\} *else/) {
|
||||
checkwarn("BRACEELSE",
|
||||
$line, length($1), $file, $l, "else after closing brace on same line");
|
||||
}
|
||||
# check for "){"
|
||||
if($l =~ /^(.*)\)\{/) {
|
||||
checkwarn("PARENBRACE",
|
||||
$line, length($1)+1, $file, $l, "missing space after close paren");
|
||||
}
|
||||
# check for "^{" with an empty line before it
|
||||
if(($l =~ /^\{/) && ($prevl =~ /^[ \t]*\z/)) {
|
||||
checkwarn("EMPTYLINEBRACE",
|
||||
$line, 0, $file, $l, "empty line before open brace");
|
||||
}
|
||||
|
||||
# check for space before the semicolon last in a line
|
||||
if($l =~ /^(.*[^ ].*) ;$/) {
|
||||
checkwarn("SPACESEMICOLON",
|
||||
$line, length($1), $file, $ol, "no space before semicolon");
|
||||
}
|
||||
|
||||
# check for space before the colon in a switch label
|
||||
if($l =~ /^( *(case .+|default)) :/) {
|
||||
checkwarn("SPACESWITCHCOLON",
|
||||
$line, length($1), $file, $ol, "no space before colon of switch label");
|
||||
}
|
||||
|
||||
if($prevl !~ /\?\z/ && $l =~ /^ +([A-Za-z_][A-Za-z0-9_]*):$/ && $1 ne 'default') {
|
||||
checkwarn("SPACEBEFORELABEL",
|
||||
$line, length($1), $file, $ol, "no space before label");
|
||||
}
|
||||
|
||||
# scan for use of banned functions
|
||||
if($l =~ /^(.*\W)
|
||||
(gmtime|localtime|
|
||||
gets|
|
||||
strtok|
|
||||
v?sprintf|
|
||||
(str|_mbs|_tcs|_wcs)n?cat|
|
||||
LoadLibrary(Ex)?(A|W)?)
|
||||
\s*\(
|
||||
/x) {
|
||||
checkwarn("BANNEDFUNC",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned");
|
||||
}
|
||||
if($warnings{"STRERROR"}) {
|
||||
# scan for use of banned strerror. This is not a BANNEDFUNC to
|
||||
# allow for individual enable/disable of this warning.
|
||||
if($l =~ /^(.*\W)(strerror)\s*\(/x) {
|
||||
if($1 !~ /^ *\#/) {
|
||||
# skip preprocessor lines
|
||||
checkwarn("STRERROR",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned");
|
||||
}
|
||||
}
|
||||
}
|
||||
if($warnings{"STDERR"}) {
|
||||
# scan for use of banned stderr. This is not a BANNEDFUNC to
|
||||
# allow for individual enable/disable of this warning.
|
||||
if($l =~ /^([^\"-]*\W)(stderr)[^\"_]/x) {
|
||||
if($1 !~ /^ *\#/) {
|
||||
# skip preprocessor lines
|
||||
checkwarn("STDERR",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned (use tool_stderr instead)");
|
||||
}
|
||||
}
|
||||
}
|
||||
# scan for use of snprintf for curl-internals reasons
|
||||
if($l =~ /^(.*\W)(v?snprintf)\s*\(/x) {
|
||||
checkwarn("SNPRINTF",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned");
|
||||
}
|
||||
|
||||
# scan for use of non-binary fopen without the macro
|
||||
if($l =~ /^(.*\W)fopen\s*\([^,]*, *\"([^"]*)/) {
|
||||
my $mode = $2;
|
||||
if($mode !~ /b/) {
|
||||
checkwarn("FOPENMODE",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of non-binary fopen without FOPEN_* macro: $mode");
|
||||
}
|
||||
}
|
||||
|
||||
# check for open brace first on line but not first column only alert
|
||||
# if previous line ended with a close paren and it wasn't a cpp line
|
||||
if(($prevl =~ /\)\z/) && ($l =~ /^( +)\{/) && !$prevp) {
|
||||
checkwarn("BRACEPOS",
|
||||
$line, length($1), $file, $ol, "badly placed open brace");
|
||||
}
|
||||
|
||||
# if the previous line starts with if/while/for AND ends with an open
|
||||
# brace, or an else statement, check that this line is indented $indent
|
||||
# more steps, if not a cpp line
|
||||
if(!$prevp && ($prevl =~ /^( *)((if|while|for)\(.*\{|else)\z/)) {
|
||||
my $first = length($1);
|
||||
# this line has some character besides spaces
|
||||
if($l =~ /^( *)[^ ]/) {
|
||||
my $second = length($1);
|
||||
my $expect = $first+$indent;
|
||||
if($expect != $second) {
|
||||
my $diff = $second - $first;
|
||||
checkwarn("INDENTATION", $line, length($1), $file, $ol,
|
||||
"not indented $indent steps (uses $diff)");
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# if the previous line starts with if/while/for AND ends with a closed
|
||||
# parenthesis and there's an equal number of open and closed
|
||||
# parentheses, check that this line is indented $indent more steps, if
|
||||
# not a cpp line
|
||||
elsif(!$prevp && ($prevl =~ /^( *)(if|while|for)(\(.*\))\z/)) {
|
||||
my $first = length($1);
|
||||
my $op = $3;
|
||||
my $cl = $3;
|
||||
|
||||
$op =~ s/[^(]//g;
|
||||
$cl =~ s/[^)]//g;
|
||||
|
||||
if(length($op) == length($cl)) {
|
||||
# this line has some character besides spaces
|
||||
if($l =~ /^( *)[^ ]/) {
|
||||
my $second = length($1);
|
||||
my $expect = $first+$indent;
|
||||
if($expect != $second) {
|
||||
my $diff = $second - $first;
|
||||
checkwarn("INDENTATION", $line, length($1), $file, $ol,
|
||||
"not indented $indent steps (uses $diff)");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# check for 'char * name'
|
||||
if(($l =~ /(^.*(char|int|long|void|CURL|CURLM|CURLMsg|[cC]url_[A-Za-z_]+|struct [a-zA-Z_]+) *(\*+)) (\w+)/) && ($4 !~ /^(const|volatile)$/)) {
|
||||
checkwarn("ASTERISKSPACE",
|
||||
$line, length($1), $file, $ol,
|
||||
"space after declarative asterisk");
|
||||
}
|
||||
# check for 'char*'
|
||||
if(($l =~ /(^.*(char|int|long|void|curl_slist|CURL|CURLM|CURLMsg|curl_httppost|sockaddr_in|FILE)\*)/)) {
|
||||
checkwarn("ASTERISKNOSPACE",
|
||||
$line, length($1)-1, $file, $ol,
|
||||
"no space before asterisk");
|
||||
}
|
||||
|
||||
# check for 'void func() {', but avoid false positives by requiring
|
||||
# both an open and closed parentheses before the open brace
|
||||
if($l =~ /^((\w).*)\{\z/) {
|
||||
my $k = $1;
|
||||
$k =~ s/const *//;
|
||||
$k =~ s/static *//;
|
||||
if($k =~ /\(.*\)/) {
|
||||
checkwarn("BRACEPOS",
|
||||
$line, length($l)-1, $file, $ol,
|
||||
"wrongly placed open brace");
|
||||
}
|
||||
}
|
||||
|
||||
# check for equals sign without spaces next to it
|
||||
if($nostr =~ /(.*)\=[a-z0-9]/i) {
|
||||
checkwarn("EQUALSNOSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space after equals sign");
|
||||
}
|
||||
# check for equals sign without spaces before it
|
||||
elsif($nostr =~ /(.*)[a-z0-9]\=/i) {
|
||||
checkwarn("NOSPACEEQUALS",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space before equals sign");
|
||||
}
|
||||
|
||||
# check for plus signs without spaces next to it
|
||||
if($nostr =~ /(.*)[^+]\+[a-z0-9]/i) {
|
||||
checkwarn("PLUSNOSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space after plus sign");
|
||||
}
|
||||
# check for plus sign without spaces before it
|
||||
elsif($nostr =~ /(.*)[a-z0-9]\+[^+]/i) {
|
||||
checkwarn("NOSPACEPLUS",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space before plus sign");
|
||||
}
|
||||
|
||||
# check for semicolons without space next to it
|
||||
if($nostr =~ /(.*)\;[a-z0-9]/i) {
|
||||
checkwarn("SEMINOSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"no space after semicolon");
|
||||
}
|
||||
|
||||
# typedef struct ... {
|
||||
if($nostr =~ /^(.*)typedef struct.*{/) {
|
||||
checkwarn("TYPEDEFSTRUCT",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"typedef'ed struct");
|
||||
}
|
||||
|
||||
if($nostr =~ /(.*)! +(\w|\()/) {
|
||||
checkwarn("EXCLAMATIONSPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"space after exclamation mark");
|
||||
}
|
||||
|
||||
# check for more than one consecutive space before open brace or
|
||||
# question mark. Skip lines containing strings since they make it hard
|
||||
# due to artificially getting multiple spaces
|
||||
if(($l eq $nostr) &&
|
||||
$nostr =~ /^(.*(\S)) + [{?]/i) {
|
||||
checkwarn("MULTISPACE",
|
||||
$line, length($1)+1, $file, $ol,
|
||||
"multiple spaces");
|
||||
}
|
||||
preproc:
|
||||
if($prep) {
|
||||
# scan for use of banned symbols on a preprocessor line
|
||||
if($l =~ /^(^|.*\W)
|
||||
(WIN32)
|
||||
(\W|$)
|
||||
/x) {
|
||||
checkwarn("BANNEDPREPROC",
|
||||
$line, length($1), $file, $ol,
|
||||
"use of $2 is banned from preprocessor lines" .
|
||||
(($2 eq "WIN32") ? ", use _WIN32 instead" : ""));
|
||||
}
|
||||
}
|
||||
$line++;
|
||||
$prevp = $prep;
|
||||
$prevl = $ol if(!$prep);
|
||||
$prevpl = $ol if($prep);
|
||||
}
|
||||
|
||||
if(!scalar(@copyright)) {
|
||||
checkwarn("COPYRIGHT", 1, 0, $file, "", "Missing copyright statement", 1);
|
||||
}
|
||||
|
||||
# COPYRIGHTYEAR is a extended warning so we must first see if it has been
|
||||
# enabled in .checksrc
|
||||
if(defined($warnings{"COPYRIGHTYEAR"})) {
|
||||
# The check for updated copyrightyear is overly complicated in order to
|
||||
# not punish current hacking for past sins. The copyright years are
|
||||
# right now a bit behind, so enforcing copyright year checking on all
|
||||
# files would cause hundreds of errors. Instead we only look at files
|
||||
# which are tracked in the Git repo and edited in the workdir, or
|
||||
# committed locally on the branch without being in upstream master.
|
||||
#
|
||||
# The simple and naive test is to simply check for the current year,
|
||||
# but updating the year even without an edit is against project policy
|
||||
# (and it would fail every file on January 1st).
|
||||
#
|
||||
# A rather more interesting, and correct, check would be to not test
|
||||
# only locally committed files but inspect all files wrt the year of
|
||||
# their last commit. Removing the `git rev-list origin/master..HEAD`
|
||||
# condition below will enforce copyright year checks against the year
|
||||
# the file was last committed (and thus edited to some degree).
|
||||
my $commityear = undef;
|
||||
@copyright = sort {$$b{year} cmp $$a{year}} @copyright;
|
||||
|
||||
# if the file is modified, assume commit year this year
|
||||
if(`git status -s -- "$file"` =~ /^ [MARCU]/) {
|
||||
$commityear = (localtime(time))[5] + 1900;
|
||||
}
|
||||
else {
|
||||
# min-parents=1 to ignore wrong initial commit in truncated repos
|
||||
my $grl = `git rev-list --max-count=1 --min-parents=1 --timestamp HEAD -- "$file"`;
|
||||
if($grl) {
|
||||
chomp $grl;
|
||||
$commityear = (localtime((split(/ /, $grl))[0]))[5] + 1900;
|
||||
}
|
||||
}
|
||||
|
||||
if(defined($commityear) && scalar(@copyright) &&
|
||||
$copyright[0]{year} != $commityear) {
|
||||
checkwarn("COPYRIGHTYEAR", $copyright[0]{line}, $copyright[0]{col},
|
||||
$file, $copyright[0]{code},
|
||||
"Copyright year out of date, should be $commityear, " .
|
||||
"is $copyright[0]{year}", 1);
|
||||
}
|
||||
}
|
||||
|
||||
if($incomment) {
|
||||
checkwarn("OPENCOMMENT", 1, 0, $file, "", "Missing closing comment", 1);
|
||||
}
|
||||
|
||||
checksrc_endoffile($file);
|
||||
|
||||
close($R);
|
||||
|
||||
}
|
||||
|
||||
|
||||
if($errors || $warnings || $verbose) {
|
||||
printf "checksrc: %d errors and %d warnings\n", $errors, $warnings;
|
||||
if($suppressed) {
|
||||
printf "checksrc: %d errors and %d warnings suppressed\n",
|
||||
$serrors,
|
||||
$swarnings;
|
||||
}
|
||||
exit 5; # return failure
|
||||
}
|
190
deps/curl/scripts/ciconfig.pl
vendored
Normal file
190
deps/curl/scripts/ciconfig.pl
vendored
Normal file
@ -0,0 +1,190 @@
|
||||
#!/usr/bin/perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# these options are enabled by default in the sense that they will attempt to
|
||||
# check for and use this feature without the configure flag
|
||||
my %defaulton = (
|
||||
# --enable-
|
||||
'shared' => 1,
|
||||
'static' => 1,
|
||||
'fast-install' => 1,
|
||||
'silent-rules' => 1,
|
||||
'optimize' => 1,
|
||||
'http' => 1,
|
||||
'ftp' => 1,
|
||||
'file' => 1,
|
||||
'ldap' => 1,
|
||||
'ldaps' => 1,
|
||||
'rtsp' => 1,
|
||||
'proxy' => 1,
|
||||
'dict' => 1,
|
||||
'telnet' => 1,
|
||||
'tftp' => 1,
|
||||
'pop3' => 1,
|
||||
'imap' => 1,
|
||||
'smb' => 1,
|
||||
'smtp' => 1,
|
||||
'gopher' => 1,
|
||||
'mqtt' => 1,
|
||||
'manual' => 1,
|
||||
'libcurl-option' => 1,
|
||||
'libgcc' => 1,
|
||||
'ipv6' => 1,
|
||||
'openssl-auto-load-config' => 1,
|
||||
'versioned-symbols' => 1,
|
||||
'symbol-hiding' => 1,
|
||||
'threaded-resolver' => 1,
|
||||
'pthreads' => 1,
|
||||
'verbose' => 1,
|
||||
'basic-auth' => 1,
|
||||
'bearer-auth' => 1,
|
||||
'digest-auth' => 1,
|
||||
'kerberos-auth' => 1,
|
||||
'negotiate-auth' => 1,
|
||||
'aws' => 1,
|
||||
'ntlm' => 1,
|
||||
'ntlm-wb' => 1,
|
||||
'tls-srp' => 1,
|
||||
'unix-sockets' => 1,
|
||||
'cookies' => 1,
|
||||
'socketpair' => 1,
|
||||
'http-auth' => 1,
|
||||
'doh' => 1,
|
||||
'mime' => 1,
|
||||
'dateparse' => 1,
|
||||
'netrc' => 1,
|
||||
'progress-meter' => 1,
|
||||
'dnsshuffle' => 1,
|
||||
'get-easy-options' => 1,
|
||||
'alt-svc' => 1,
|
||||
'hsts' => 1,
|
||||
|
||||
# --with-
|
||||
'aix-soname' => 1,
|
||||
'pic' => 1,
|
||||
'zlib' => 1,
|
||||
'zstd' => 1,
|
||||
'brotli' => 1,
|
||||
'random' => 1,
|
||||
'ca-bundle' => 1,
|
||||
'ca-path' => 1,
|
||||
'libssh2' => 1,
|
||||
'nghttp2' => 1,
|
||||
'librtmp' => 1,
|
||||
'libidn2' => 1,
|
||||
'sysroot' => 1,
|
||||
'lber-lib' => 1,
|
||||
'ldap-lib' => 1,
|
||||
|
||||
);
|
||||
|
||||
|
||||
sub configureopts {
|
||||
my ($opts)=@_;
|
||||
my %thisin;
|
||||
my %thisout;
|
||||
|
||||
while($opts =~ s/--with-([^ =]*)//) {
|
||||
$with{$1}++;
|
||||
$used{$1}++;
|
||||
$thisin{$1}++;
|
||||
}
|
||||
while($opts =~ s/--enable-([^ =]*)//) {
|
||||
$with{$1}++;
|
||||
$used{$1}++;
|
||||
$thisin{$1}++;
|
||||
}
|
||||
|
||||
while($opts =~ s/--without-([^ =]*)//) {
|
||||
$without{$1}++;
|
||||
$used{$1}++;
|
||||
$thisout{$1}++;
|
||||
}
|
||||
while($opts =~ s/--disable-([^ =]*)//) {
|
||||
$without{$1}++;
|
||||
$used{$1}++;
|
||||
$thisout{$1}++;
|
||||
}
|
||||
return join(" ", sort(keys %thisin), "/", sort(keys %thisout));
|
||||
}
|
||||
|
||||
# run configure --help and check what available WITH/ENABLE options that exist
|
||||
sub configurehelp {
|
||||
open(C, "./configure --help|");
|
||||
while(<C>) {
|
||||
if($_ =~ /^ --(with|enable)-([a-z0-9-]+)/) {
|
||||
$avail{$2}++;
|
||||
}
|
||||
}
|
||||
close(C);
|
||||
}
|
||||
|
||||
sub scanjobs {
|
||||
|
||||
my $jobs;
|
||||
open(CI, "./scripts/cijobs.pl|");
|
||||
while(<CI>) {
|
||||
if($_ =~ /^\#\#\#/) {
|
||||
$jobs++;
|
||||
}
|
||||
if($_ =~ /^configure: (.*)/) {
|
||||
my $c= configureopts($1);
|
||||
#print "C: $c\n";
|
||||
}
|
||||
}
|
||||
close(CI);
|
||||
}
|
||||
|
||||
configurehelp();
|
||||
scanjobs();
|
||||
|
||||
print "Used configure options (with / without)\n";
|
||||
for my $w (sort keys %used) {
|
||||
printf " %s: %d %d%s\n", $w, $with{$w}, $without{$w},
|
||||
$defaulton{$w} ? " (auto)":"";
|
||||
}
|
||||
|
||||
print "Never used configure options\n";
|
||||
for my $w (sort keys %avail) {
|
||||
if(!$used{$w}) {
|
||||
printf " %s%s\n", $w,
|
||||
$defaulton{$w} ? " (auto)":"";
|
||||
}
|
||||
}
|
||||
|
||||
print "Never ENABLED configure options that aren't on by default\n";
|
||||
for my $w (sort keys %avail) {
|
||||
if(!$with{$w} && !$defaulton{$w}) {
|
||||
printf " %s\n", $w;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
print "ENABLED configure options that aren't available\n";
|
||||
for my $w (sort keys %with) {
|
||||
if(!$avail{$w}) {
|
||||
printf " %s\n", $w;
|
||||
}
|
||||
}
|
510
deps/curl/scripts/cijobs.pl
vendored
Normal file
510
deps/curl/scripts/cijobs.pl
vendored
Normal file
@ -0,0 +1,510 @@
|
||||
#!/usr/bin/perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
my %filelevel= ('file' => 1,
|
||||
'service' => 1);
|
||||
|
||||
my $jobid = 1;
|
||||
|
||||
sub submit {
|
||||
my ($jref)=@_;
|
||||
my %job = %$jref;
|
||||
|
||||
printf "\n##### job %u \n", $jobid++;
|
||||
for my $k (sort keys %job) {
|
||||
printf "%s: %s\n", $k, $job{$k} if($job{$k});
|
||||
undef $$jref{$k} if(!$filelevel{$k});
|
||||
}
|
||||
}
|
||||
|
||||
sub githubactions {
|
||||
my ($tag)=@_;
|
||||
my @files= `git ls-tree -r --name-only $tag .github/workflows 2>/dev/null`;
|
||||
my $c = 0;
|
||||
foreach my $f (sort @files) {
|
||||
my $j = 0;
|
||||
my $m = -1;
|
||||
my $done = 0;
|
||||
chomp $f;
|
||||
open(G, "git show $tag:$f 2>/dev/null|");
|
||||
# start counting file jobs
|
||||
undef %job;
|
||||
$job{'file'} = $f;
|
||||
$job{'service'} = "gha";
|
||||
my @cc;
|
||||
my $os;
|
||||
my $topname;
|
||||
my $line = 1;
|
||||
while(<G>) {
|
||||
$job{'line'} = $line;
|
||||
if($_ =~ /^name: (.*)/) {
|
||||
$topname=$1;
|
||||
}
|
||||
elsif($_ =~ /runs-on: (.*)/) {
|
||||
my $r = $1;
|
||||
#print "runs-on: $r\n";
|
||||
if($r =~ /ubuntu/) {
|
||||
$os = "linux";
|
||||
}
|
||||
elsif($r =~ /macos/) {
|
||||
$os = "macos";
|
||||
}
|
||||
elsif($r =~ /windows/) {
|
||||
$os = "windows";
|
||||
}
|
||||
|
||||
# commit previously counted jobs
|
||||
$c += $j;
|
||||
# non-matrix job
|
||||
$j = 1;
|
||||
}
|
||||
elsif($_ =~ /^\s*matrix:/) {
|
||||
# switch to matrix mode
|
||||
$m = 0;
|
||||
$j = 0;
|
||||
}
|
||||
elsif($_ =~ /^ - run: .* apt-get install (.*)/) {
|
||||
$job{'install'} = $1;
|
||||
}
|
||||
elsif($m >= 0) {
|
||||
if($_ =~ /^ - name: (.*)/) {
|
||||
# matrix job
|
||||
#print "name: $1\n";
|
||||
$job{'name'} = $1;
|
||||
$j += ($m?$m:1);
|
||||
}
|
||||
elsif($_ =~ /install: (.*)/) {
|
||||
$job{'install'} = $1;
|
||||
}
|
||||
elsif($_ =~ /( |curl-)configure: (.*)/) {
|
||||
$job{'configure'} = $2;
|
||||
$job{'os'}=$os;
|
||||
submit(\%job);
|
||||
$done++;
|
||||
}
|
||||
elsif($_ =~ /generate: (.*)/) {
|
||||
$job{'cmake'} = $1;
|
||||
if($m) {
|
||||
# matrix mode, multiple copies
|
||||
my %dupe = %job;
|
||||
for my $cc (@cc) {
|
||||
%job = %dupe;
|
||||
$job{'cc'} = $cc;
|
||||
$job{'os'}=$os;
|
||||
submit(\%job);
|
||||
$done++;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$job{'os'}=$os;
|
||||
submit(\%job);
|
||||
$done++;
|
||||
}
|
||||
}
|
||||
elsif($_ =~ /- CC: (.*)/) {
|
||||
# matrix multiplier
|
||||
push @cc, $1;
|
||||
$m++;
|
||||
}
|
||||
elsif($_ =~ /^\s*steps:/) {
|
||||
# disable matrix mode
|
||||
$m = -1;
|
||||
}
|
||||
}
|
||||
$line++;
|
||||
}
|
||||
close(G);
|
||||
# commit final counted jobs
|
||||
$c += $j;
|
||||
|
||||
if(!$done) {
|
||||
$job{'name'} = $topname? $topname : '[unnamed]';
|
||||
$job{'os'}=$os;
|
||||
submit(\%job);
|
||||
$done++;
|
||||
}
|
||||
# reset internal job counter
|
||||
$j = 0;
|
||||
}
|
||||
#print "Jobs: $c\n";
|
||||
return $c;
|
||||
}
|
||||
|
||||
sub azurepipelines {
|
||||
my ($tag)=@_;
|
||||
open(G, "git show $tag:.azure-pipelines.yml 2>/dev/null|");
|
||||
my $c = 0;
|
||||
my $j = 0;
|
||||
my $m = -1;
|
||||
my $image;
|
||||
my %job;
|
||||
my $line = 1;
|
||||
my $os;
|
||||
$job{'file'} = ".azure-pipelines.yml";
|
||||
$job{'service'} = "azure";
|
||||
while(<G>) {
|
||||
if($_ =~ /^ vmImage: (.*)/) {
|
||||
my $i = $1;
|
||||
if($i =~ /ubuntu/) {
|
||||
$os = "linux";
|
||||
}
|
||||
elsif($i =~ /windows/) {
|
||||
$os = "windows";
|
||||
}
|
||||
}
|
||||
elsif($_ =~ /^- stage: (.*)/) {
|
||||
my $topname = $1;
|
||||
if($topname !~ /(windows|linux)/) {
|
||||
$job{'name'} = $topname;
|
||||
$job{'line'}=$line;
|
||||
submit(\%job);
|
||||
}
|
||||
}
|
||||
elsif($_ =~ /job:/) {
|
||||
# commit previously counted jobs
|
||||
$c += $j;
|
||||
# initial value for non-matrix job
|
||||
$j = 1;
|
||||
}
|
||||
elsif($_ =~ /matrix:/) {
|
||||
# start of new matrix list(!)
|
||||
$m = 0;
|
||||
$j = 0;
|
||||
}
|
||||
elsif($m >= 0) {
|
||||
if($_ =~ /^ name: (.*)/) {
|
||||
# single matrix list entry job
|
||||
$j++;
|
||||
$job{'name'} = $1;
|
||||
}
|
||||
# azure matrix is a simple list,
|
||||
# therefore no multiplier needed
|
||||
elsif($_ =~ /steps:/) {
|
||||
# disable matrix mode
|
||||
$m = -1;
|
||||
}
|
||||
elsif($_ =~ /^ configure: (.*)/) {
|
||||
$job{'configure'} = $1;
|
||||
$job{'line'}=$line;
|
||||
$job{'os'}=$os;
|
||||
submit(\%job);
|
||||
}
|
||||
}
|
||||
$line++;
|
||||
}
|
||||
close(G);
|
||||
# commit final counted jobs
|
||||
$c += $j;
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
sub appveyor {
|
||||
my ($tag)=@_;
|
||||
open(G, "git show $tag:appveyor.yml 2>/dev/null|");
|
||||
my $c = 0;
|
||||
my %job;
|
||||
my $line=0;
|
||||
$job{'file'} = "appveyor.yml";
|
||||
$job{'service'} = "appveyor";
|
||||
|
||||
while(<G>) {
|
||||
$line++;
|
||||
if($_ =~ /^( - |install)/) {
|
||||
if($job{'image'}) {
|
||||
$job{'os'} = "windows";
|
||||
submit(\%job);
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
$job{'line'} = $line;
|
||||
if($_ =~ /^ APPVEYOR_BUILD_WORKER_IMAGE: \'(.*)\'/) {
|
||||
$job{'image'}= $1;
|
||||
}
|
||||
elsif($_ =~ /^ BUILD_SYSTEM: (.*)/) {
|
||||
$job{'build'} = lc($1);
|
||||
}
|
||||
elsif($_ =~ /^ PRJ_GEN: \'(.*)\'/) {
|
||||
$job{'compiler'} = $1;
|
||||
}
|
||||
elsif($_ =~ /^ PRJ_CFG: (.*)/) {
|
||||
$job{'config'} = $1;
|
||||
}
|
||||
elsif($_ =~ /^ OPENSSL: \'(.*)\'/) {
|
||||
$job{'openssl'} = $1 eq "ON" ? "true": "false";
|
||||
}
|
||||
elsif($_ =~ /^ SCHANNEL: \'(.*)\'/) {
|
||||
$job{'schannel'} = $1 eq "ON" ? "true": "false";
|
||||
}
|
||||
elsif($_ =~ /^ ENABLE_UNICODE: \'(.*)\'/) {
|
||||
$job{'unicode'} = $1 eq "ON" ? "true": "false";
|
||||
}
|
||||
elsif($_ =~ /^ HTTP_ONLY: \'(.*)\'/) {
|
||||
$job{'http-only'} = $1 eq "ON" ? "true": "false";
|
||||
}
|
||||
elsif($_ =~ /^ TESTING: \'(.*)\'/) {
|
||||
$job{'testing'} = $1 eq "ON" ? "true": "false";
|
||||
}
|
||||
elsif($_ =~ /^ SHARED: \'(.*)\'/) {
|
||||
$job{'shared'} = $1 eq "ON" ? "true": "false";
|
||||
}
|
||||
elsif($_ =~ /^ TARGET: \'-A (.*)\'/) {
|
||||
$job{'target'} = $1;
|
||||
}
|
||||
}
|
||||
close(G);
|
||||
|
||||
return $c;
|
||||
}
|
||||
|
||||
sub cirrus {
|
||||
my ($tag)=@_;
|
||||
open(G, "git show $tag:.cirrus.yml 2>/dev/null|");
|
||||
my $c = 0;
|
||||
my %job;
|
||||
my $line=0;
|
||||
my $name = 0;
|
||||
my $os;
|
||||
$job{'file'} = ".cirrus.yml";
|
||||
$job{'service'} = "cirrus";
|
||||
while(<G>) {
|
||||
$line++;
|
||||
if($_ =~ /^ ( |-) (name|image_family|image):/) {
|
||||
$c++;
|
||||
}
|
||||
if($_ =~ /^ - name:/) {
|
||||
if($name) {
|
||||
$job{'os'} = $os;
|
||||
$job{'line'} = $line;
|
||||
submit(\%job);
|
||||
$name = 0;
|
||||
}
|
||||
}
|
||||
if($_ =~ /^ - name: (.*)/) {
|
||||
$job{'name'} = $1;
|
||||
$name = 1;
|
||||
}
|
||||
elsif($_ =~ /^ image_family: (.*)/) {
|
||||
$os = "freebsd";
|
||||
}
|
||||
elsif($_ =~ /^windows_task:/) {
|
||||
$os = "windows";
|
||||
}
|
||||
elsif($_ =~ /^ prepare: pacman -S --needed --noconfirm --noprogressbar (.*)/) {
|
||||
$job{'install'} = $1;
|
||||
}
|
||||
elsif($_ =~ /^ configure: (.*)/) {
|
||||
$job{'configure'} = $1;
|
||||
}
|
||||
}
|
||||
close(G);
|
||||
if($name) {
|
||||
$job{'os'} = $os;
|
||||
$job{'line'} = $line;
|
||||
submit(\%job);
|
||||
}
|
||||
return $c;
|
||||
}
|
||||
|
||||
sub circle {
|
||||
my ($tag)=@_;
|
||||
open(G, "git show $tag:.circleci/config.yml 2>/dev/null|");
|
||||
my $c = 0;
|
||||
my $wf = 0;
|
||||
my %job;
|
||||
my %cmd;
|
||||
my %configure;
|
||||
my %target;
|
||||
my $line=0;
|
||||
my $cmds;
|
||||
my $jobs;
|
||||
my $workflow;
|
||||
$job{'file'} = ".circleci/config.yml";
|
||||
$job{'service'} = "circleci";
|
||||
while(<G>) {
|
||||
$line++;
|
||||
if($_ =~ /^commands:/) {
|
||||
# we record configure lines in this state
|
||||
$cmds = 1;
|
||||
}
|
||||
elsif($cmds) {
|
||||
if($_ =~ /^ ([^ ]*):/) {
|
||||
$cmdname = $1;
|
||||
}
|
||||
elsif($_ =~ /^ .*.\/configure (.*)/) {
|
||||
$cmd{$cmdname}=$1;
|
||||
}
|
||||
}
|
||||
if($_ =~ /^jobs:/) {
|
||||
# we record which job runs with configure here
|
||||
$jobs = 1;
|
||||
$cmds = 0;
|
||||
}
|
||||
elsif($jobs) {
|
||||
if($_ =~ /^ ([^ ]*):/) {
|
||||
$jobname = $1;
|
||||
}
|
||||
elsif($_ =~ /^ - (configure.*)/) {
|
||||
$configure{$jobname}=$1;
|
||||
}
|
||||
elsif($_ =~ /^ resource_class: arm.medium/) {
|
||||
$target{$jobname}="arm";
|
||||
}
|
||||
}
|
||||
if($_ =~ /^workflows:/) {
|
||||
$wf = 1;
|
||||
$cmds = 0;
|
||||
}
|
||||
elsif($wf) {
|
||||
if($_ =~ /^ ([^ ]+):/) {
|
||||
$workflow = $1;
|
||||
}
|
||||
elsif($_ =~ /^ - (.*)\n/) {
|
||||
my $jb = $1;
|
||||
my $cnfgure = $configure{$jb};
|
||||
my $trgt = $target{$jb};
|
||||
$job{'configure'} = $cmd{$cnfgure};
|
||||
$job{'name' }=$workflow;
|
||||
$job{'os'} = "linux";
|
||||
$job{'line'} = $line;
|
||||
$job{'target'} = $trgt if($trgt);
|
||||
submit(\%job);
|
||||
}
|
||||
if($_ =~ / *jobs:/) {
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(G);
|
||||
return $c;
|
||||
}
|
||||
|
||||
sub zuul {
|
||||
my ($tag)=@_;
|
||||
open(G, "git show $tag:zuul.d/jobs.yaml 2>/dev/null|");
|
||||
my $c = 0;
|
||||
my %job;
|
||||
my $line=0;
|
||||
my $type;
|
||||
$job{'file'} = "zuul.d/jobs.yaml";
|
||||
$job{'service'} = "zuul";
|
||||
while(<G>) {
|
||||
$line++;
|
||||
#print "L: ($jobmode / $env) $_";
|
||||
if($_ =~ /^- job:/) {
|
||||
$jobmode = 1; # start a new
|
||||
$type="configure";
|
||||
}
|
||||
if($jobmode) {
|
||||
if($apt) {
|
||||
if($_ =~ /^ - (.*)/) {
|
||||
my $value = $1;
|
||||
$job{'install'} .= "$value ";
|
||||
}
|
||||
else {
|
||||
$apt = 0; # end of curl_apt_packages
|
||||
}
|
||||
}
|
||||
if($env) {
|
||||
if($envcont) {
|
||||
if($_ =~ /^ (.*)/) {
|
||||
$job{$envcont} .= "$1 ";
|
||||
}
|
||||
else {
|
||||
$envcont = "";
|
||||
}
|
||||
}
|
||||
if($_ =~ /^ ([^:]+): (.*)/) {
|
||||
my ($var, $value) = ($1, $2);
|
||||
|
||||
if($var eq "C") {
|
||||
$var = $type;
|
||||
}
|
||||
elsif($var eq "T") {
|
||||
$var = "tests";
|
||||
if($value eq "cmake") {
|
||||
# otherwise it remains configure
|
||||
$type = "cmake";
|
||||
}
|
||||
}
|
||||
elsif($var eq "CC") {
|
||||
$var = "compiler";
|
||||
}
|
||||
elsif($var eq "CHECKSRC") {
|
||||
$job{'checksrc'} = $value ? "true": "false";
|
||||
$var = "";
|
||||
}
|
||||
else {
|
||||
$var = "";
|
||||
}
|
||||
if($value eq ">-") {
|
||||
$envcont = $var;
|
||||
}
|
||||
elsif($var) {
|
||||
$job{$var} = $value;
|
||||
}
|
||||
}
|
||||
elsif($_ !~ /^ /) {
|
||||
# end of envs
|
||||
$env = 0;
|
||||
}
|
||||
}
|
||||
if($_ =~ /^ curl_env:/) {
|
||||
$env = 1; # start of envs
|
||||
}
|
||||
elsif($_ =~ /^ curl_apt_packages:/) {
|
||||
$apt = 1; # start of apt packages
|
||||
}
|
||||
elsif($_ =~ /^ name: (.*)/) {
|
||||
my $n = $1;
|
||||
if($n eq "curl-base") {
|
||||
# not counted
|
||||
$jobmode = 0;
|
||||
next;
|
||||
}
|
||||
$job{'name'} = $n;
|
||||
}
|
||||
elsif($_ =~ /^\n\z/) {
|
||||
# a job is complete
|
||||
$job{'line'}=$line;
|
||||
$job{'os'}="linux";
|
||||
submit(\%job);
|
||||
$jobmode = 0;
|
||||
$c++;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(G);
|
||||
return $c;
|
||||
}
|
||||
|
||||
my $tag = `git rev-parse --abbrev-ref HEAD 2>/dev/null` || "master";
|
||||
chomp $tag;
|
||||
githubactions($tag);
|
||||
azurepipelines($tag);
|
||||
appveyor($tag);
|
||||
zuul($tag);
|
||||
cirrus($tag);
|
||||
circle($tag);
|
125
deps/curl/scripts/cmp-config.pl
vendored
Normal file
125
deps/curl/scripts/cmp-config.pl
vendored
Normal file
@ -0,0 +1,125 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
my $autotools = $ARGV[0];
|
||||
my $cmake = $ARGV[1];
|
||||
|
||||
if(!$cmake) {
|
||||
print "Usage: cmp-config <config1> <config2.h>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# this lists complete lines that will be removed from the the output if
|
||||
# matching
|
||||
my %remove = (
|
||||
'#define _FILE_OFFSET_BITS 64' => 1,
|
||||
'#define CURL_EXTERN_SYMBOL' => 1,
|
||||
'#define CURL_SA_FAMILY_T sa_family_t' => 1,
|
||||
'#define GETHOSTNAME_TYPE_ARG2 size_t' => 1,
|
||||
'#define HAVE_BROTLI 1' => 1,
|
||||
'#define HAVE_BROTLI_DECODE_H 1' => 1,
|
||||
'#define HAVE_DECL_GETPWUID_R 1' => 1,
|
||||
'#define HAVE_DLFCN_H 1' => 1,
|
||||
'#define HAVE_GETHOSTBYNAME 1' => 1,
|
||||
'#define HAVE_INTTYPES_H 1' => 1,
|
||||
'#define HAVE_IOCTL 1' => 1,
|
||||
'#define HAVE_LDAP_SSL 1' => 1,
|
||||
'#define HAVE_LIBBROTLIDEC 1' => 1,
|
||||
'#define HAVE_LIBSSL 1' => 1,
|
||||
'#define HAVE_LIBZSTD 1' => 1,
|
||||
'#define HAVE_OPENSSL3 1' => 1,
|
||||
'#define HAVE_OPENSSL_CRYPTO_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_ERR_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_PEM_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_RSA_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_SSL_H 1' => 1,
|
||||
'#define HAVE_OPENSSL_X509_H 1' => 1,
|
||||
'#define HAVE_SA_FAMILY_T 1' => 1,
|
||||
'#define HAVE_SETJMP_H 1' => 1,
|
||||
'#define HAVE_STDINT_H 1' => 1,
|
||||
'#define HAVE_STDIO_H 1' => 1,
|
||||
'#define HAVE_STDLIB_H 1' => 1,
|
||||
'#define HAVE_STRING_H 1' => 1,
|
||||
'#define HAVE_SYS_XATTR_H 1' => 1,
|
||||
'#define HAVE_ZSTD 1' => 1,
|
||||
'#define HAVE_ZSTD_H 1' => 1,
|
||||
'#define LT_OBJDIR ".libs/"' => 1,
|
||||
'#define OS "Linux"' => 1,
|
||||
'#define OS "x86_64-pc-linux-gnu"' => 1,
|
||||
'#define PACKAGE "curl"' => 1,
|
||||
'#define PACKAGE_BUGREPORT "a suitable curl mailing list: https://curl.se/mail/"' => 1,
|
||||
'#define PACKAGE_NAME "curl"' => 1,
|
||||
'#define PACKAGE_STRING "curl -"' => 1,
|
||||
'#define PACKAGE_TARNAME "curl"' => 1,
|
||||
'#define PACKAGE_URL ""' => 1,
|
||||
'#define PACKAGE_VERSION "-"' => 1,
|
||||
'#define SIZEOF_LONG_LONG 8' => 1,
|
||||
'#define USE_MANUAL 1' => 1,
|
||||
'#define VERSION "-"' => 1,
|
||||
);
|
||||
|
||||
sub filter {
|
||||
my ($line) = @_;
|
||||
if(!$remove{$line}) {
|
||||
return "$line\n";
|
||||
}
|
||||
$remove{$line}++;
|
||||
return "";
|
||||
}
|
||||
|
||||
sub grepit {
|
||||
my ($input, $output) = @_;
|
||||
my @defines;
|
||||
# first get all the #define lines
|
||||
open(F, "<$input");
|
||||
while(<F>) {
|
||||
if($_ =~ /^#def/) {
|
||||
chomp;
|
||||
push @defines, $_;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
|
||||
open(O, ">$output");
|
||||
|
||||
# output the sorted list through the filter
|
||||
foreach my $d(sort @defines) {
|
||||
print O filter($d);
|
||||
}
|
||||
close(O);
|
||||
}
|
||||
|
||||
grepit($autotools, "/tmp/autotools");
|
||||
grepit($cmake, "/tmp/cmake");
|
||||
|
||||
foreach my $v (keys %remove) {
|
||||
if($remove{$v} == 1) {
|
||||
print "Ignored, never matched line: $v\n";
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
# return the exit code from diff
|
||||
exit system("diff -u /tmp/autotools /tmp/cmake") >> 8;
|
166
deps/curl/scripts/completion.pl
vendored
Normal file
166
deps/curl/scripts/completion.pl
vendored
Normal file
@ -0,0 +1,166 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Getopt::Long();
|
||||
use Pod::Usage();
|
||||
|
||||
my $curl = 'curl';
|
||||
my $shell = 'zsh';
|
||||
my $help = 0;
|
||||
Getopt::Long::GetOptions(
|
||||
'curl=s' => \$curl,
|
||||
'shell=s' => \$shell,
|
||||
'help' => \$help,
|
||||
) or Pod::Usage::pod2usage();
|
||||
Pod::Usage::pod2usage() if $help;
|
||||
|
||||
my $regex = '\s+(?:(-[^\s]+),\s)?(--[^\s]+)\s*(\<.+?\>)?\s+(.*)';
|
||||
my @opts = parse_main_opts('--help all', $regex);
|
||||
|
||||
if ($shell eq 'fish') {
|
||||
print "# curl fish completion\n\n";
|
||||
print qq{$_ \n} foreach (@opts);
|
||||
} elsif ($shell eq 'zsh') {
|
||||
my $opts_str;
|
||||
|
||||
$opts_str .= qq{ $_ \\\n} foreach (@opts);
|
||||
chomp $opts_str;
|
||||
|
||||
my $tmpl = <<"EOS";
|
||||
#compdef curl
|
||||
|
||||
# curl zsh completion
|
||||
|
||||
local curcontext="\$curcontext" state state_descr line
|
||||
typeset -A opt_args
|
||||
|
||||
local rc=1
|
||||
|
||||
_arguments -C -S \\
|
||||
$opts_str
|
||||
'*:URL:_urls' && rc=0
|
||||
|
||||
return rc
|
||||
EOS
|
||||
|
||||
print $tmpl;
|
||||
} else {
|
||||
die("Unsupported shell: $shell");
|
||||
}
|
||||
|
||||
sub parse_main_opts {
|
||||
my ($cmd, $regex) = @_;
|
||||
|
||||
my @list;
|
||||
my @lines = call_curl($cmd);
|
||||
|
||||
foreach my $line (@lines) {
|
||||
my ($short, $long, $arg, $desc) = ($line =~ /^$regex/) or next;
|
||||
|
||||
my $option = '';
|
||||
|
||||
$arg =~ s/\:/\\\:/g if defined $arg;
|
||||
|
||||
$desc =~ s/'/'\\''/g if defined $desc;
|
||||
$desc =~ s/\[/\\\[/g if defined $desc;
|
||||
$desc =~ s/\]/\\\]/g if defined $desc;
|
||||
$desc =~ s/\:/\\\:/g if defined $desc;
|
||||
|
||||
if ($shell eq 'fish') {
|
||||
$option .= "complete --command curl";
|
||||
$option .= " --short-option '" . strip_dash(trim($short)) . "'"
|
||||
if defined $short;
|
||||
$option .= " --long-option '" . strip_dash(trim($long)) . "'"
|
||||
if defined $long;
|
||||
$option .= " --description '" . strip_dash(trim($desc)) . "'"
|
||||
if defined $desc;
|
||||
} elsif ($shell eq 'zsh') {
|
||||
$option .= '{' . trim($short) . ',' if defined $short;
|
||||
$option .= trim($long) if defined $long;
|
||||
$option .= '}' if defined $short;
|
||||
$option .= '\'[' . trim($desc) . ']\'' if defined $desc;
|
||||
|
||||
if (defined $arg) {
|
||||
$option .= ":'$arg'";
|
||||
if ($arg =~ /<file ?(name)?>|<path>/) {
|
||||
$option .= ':_files';
|
||||
} elsif ($arg =~ /<dir>/) {
|
||||
$option .= ":'_path_files -/'";
|
||||
} elsif ($arg =~ /<url>/i) {
|
||||
$option .= ':_urls';
|
||||
} elsif ($long =~ /ftp/ && $arg =~ /<method>/) {
|
||||
$option .= ":'(multicwd nocwd singlecwd)'";
|
||||
} elsif ($arg =~ /<method>/) {
|
||||
$option .= ":'(DELETE GET HEAD POST PUT)'";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
push @list, $option;
|
||||
}
|
||||
|
||||
# Sort longest first, because zsh won't complete an option listed
|
||||
# after one that's a prefix of it.
|
||||
@list = sort {
|
||||
$a =~ /([^=]*)/; my $ma = $1;
|
||||
$b =~ /([^=]*)/; my $mb = $1;
|
||||
|
||||
length($mb) <=> length($ma)
|
||||
} @list if $shell eq 'zsh';
|
||||
|
||||
return @list;
|
||||
}
|
||||
|
||||
sub trim { my $s = shift; $s =~ s/^\s+|\s+$//g; return $s };
|
||||
sub strip_dash { my $s = shift; $s =~ s/^-+//g; return $s };
|
||||
|
||||
sub call_curl {
|
||||
my ($cmd) = @_;
|
||||
my $output = `"$curl" $cmd`;
|
||||
if ($? == -1) {
|
||||
die "Could not run curl: $!";
|
||||
} elsif ((my $exit_code = $? >> 8) != 0) {
|
||||
die "curl returned $exit_code with output:\n$output";
|
||||
}
|
||||
return split /\n/, $output;
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=head1 NAME
|
||||
|
||||
completion.pl - Generates tab-completion files for various shells
|
||||
|
||||
=head1 SYNOPSIS
|
||||
|
||||
completion.pl [options...]
|
||||
|
||||
--curl path to curl executable
|
||||
--shell zsh/fish
|
||||
--help prints this help
|
||||
|
||||
=cut
|
101
deps/curl/scripts/contributors.sh
vendored
Normal file
101
deps/curl/scripts/contributors.sh
vendored
Normal file
@ -0,0 +1,101 @@
|
||||
#!/bin/sh
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# This script shows all mentioned contributors from the given <hash>/<tag>
|
||||
# until HEAD and adds the contributors already mentioned in the existing
|
||||
# RELEASE-NOTES.
|
||||
#
|
||||
|
||||
start=$1
|
||||
|
||||
if test "$start" = "-h"; then
|
||||
echo "Usage: $0 <since this tag/hash> [--releasenotes]"
|
||||
exit
|
||||
fi
|
||||
if test -z "$start"; then
|
||||
start=`git tag --sort=taggerdate | grep "^curl-" | tail -1`;
|
||||
echo "Since $start:"
|
||||
fi
|
||||
|
||||
# We also include curl-www if possible. Override by setting CURLWWW
|
||||
if [ -z "$CURLWWW" ] ; then
|
||||
CURLWWW=../curl-www
|
||||
fi
|
||||
|
||||
# filter out Author:, Commit: and *by: lines
|
||||
# cut off the email parts
|
||||
# split list of names at comma
|
||||
# split list of names at " and "
|
||||
# cut off spaces first and last on the line
|
||||
# filter alternatives through THANKS-filter
|
||||
# only count names with a space (ie more than one word)
|
||||
# sort all unique names
|
||||
# awk them into RELEASE-NOTES format
|
||||
|
||||
(
|
||||
(
|
||||
git log --pretty=full --use-mailmap $start..HEAD
|
||||
if [ -d "$CURLWWW" ]
|
||||
then
|
||||
git -C "$CURLWWW" log --pretty=full --use-mailmap $start..HEAD
|
||||
fi
|
||||
) | \
|
||||
grep -Eai '(^Author|^Commit|by):' | \
|
||||
cut -d: -f2- | \
|
||||
cut '-d(' -f1 | \
|
||||
cut '-d<' -f1 | \
|
||||
tr , '\012' | \
|
||||
sed 's/ at github/ on github/' | \
|
||||
sed 's/ and /\n/' | \
|
||||
sed -e 's/^ *//' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
|
||||
|
||||
grep -a "^ [^ \(]" RELEASE-NOTES| \
|
||||
sed 's/, */\n/g'| \
|
||||
sed 's/^ *//'
|
||||
|
||||
)| \
|
||||
sed -f ./docs/THANKS-filter | \
|
||||
sort -fu | \
|
||||
awk '{
|
||||
if(length($0)) {
|
||||
num++;
|
||||
n = sprintf("%s%s%s,", n, length(n)?" ":"", $0);
|
||||
#print n;
|
||||
if(length(n) > 77) {
|
||||
printf(" %s\n", p);
|
||||
n=sprintf("%s,", $0);
|
||||
}
|
||||
p=n;
|
||||
}
|
||||
}
|
||||
|
||||
END {
|
||||
pp=substr(p,1,length(p)-1);
|
||||
printf(" %s\n", pp);
|
||||
printf(" (%d contributors)\n", num);
|
||||
}
|
||||
|
||||
'
|
77
deps/curl/scripts/contrithanks.sh
vendored
Normal file
77
deps/curl/scripts/contrithanks.sh
vendored
Normal file
@ -0,0 +1,77 @@
|
||||
#!/bin/sh
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
#
|
||||
# This script shows all mentioned contributors from <hash> until HEAD and
|
||||
# puts them at the end of the THANKS document on stdout
|
||||
#
|
||||
|
||||
start=$1
|
||||
|
||||
if test "$start" = "-h"; then
|
||||
echo "Usage: $0 <since this tag/hash>"
|
||||
exit
|
||||
fi
|
||||
if test -z "$start"; then
|
||||
start=`git tag --sort=taggerdate | grep "^curl-" | tail -1`;
|
||||
fi
|
||||
|
||||
|
||||
# We also include curl-www if possible. Override by setting CURLWWW
|
||||
if [ -z "$CURLWWW" ] ; then
|
||||
CURLWWW=../curl-www
|
||||
fi
|
||||
|
||||
cat ./docs/THANKS
|
||||
|
||||
(
|
||||
(
|
||||
git log --use-mailmap $start..HEAD
|
||||
if [ -d "$CURLWWW" ]
|
||||
then
|
||||
git -C ../curl-www log --use-mailmap $start..HEAD
|
||||
fi
|
||||
) | \
|
||||
|
||||
grep -Eai '(^Author|^Commit|by):' | \
|
||||
cut -d: -f2- | \
|
||||
cut '-d(' -f1 | \
|
||||
cut '-d<' -f1 | \
|
||||
tr , '\012' | \
|
||||
sed 's/ at github/ on github/' | \
|
||||
sed 's/ and /\n/' | \
|
||||
sed -e 's/^ //' -e 's/ $//g' -e 's/@users.noreply.github.com$/ on github/'
|
||||
|
||||
# grep out the list of names from RELEASE-NOTES
|
||||
# split on ", "
|
||||
# remove leading whitespace
|
||||
grep -a "^ [^ (]" RELEASE-NOTES| \
|
||||
sed 's/, */\n/g'| \
|
||||
sed 's/^ *//'
|
||||
|
||||
)| \
|
||||
sed -f ./docs/THANKS-filter | \
|
||||
sort -fu | \
|
||||
grep -aixvf ./docs/THANKS
|
227
deps/curl/scripts/copyright.pl
vendored
Normal file
227
deps/curl/scripts/copyright.pl
vendored
Normal file
@ -0,0 +1,227 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# Invoke script in the root of the git checkout. Scans all files in git unless
|
||||
# given a specific single file.
|
||||
#
|
||||
# Usage: copyright.pl [file]
|
||||
#
|
||||
|
||||
my %skips;
|
||||
|
||||
# file names
|
||||
my %skiplist = (
|
||||
# REUSE-specific file
|
||||
".reuse/dep5" => "<built-in>",
|
||||
|
||||
# License texts
|
||||
"LICENSES/BSD-3-Clause.txt" => "<built-in>",
|
||||
"LICENSES/BSD-4-Clause-UC.txt" => "<built-in>",
|
||||
"LICENSES/ISC.txt" => "<built-in>",
|
||||
"LICENSES/curl.txt" => "<built-in>",
|
||||
"COPYING" => "<built-in>",
|
||||
|
||||
);
|
||||
|
||||
sub scanfile {
|
||||
my ($f) = @_;
|
||||
my $line=1;
|
||||
my $found = 0;
|
||||
open(F, "<$f") || return -1;
|
||||
while (<F>) {
|
||||
chomp;
|
||||
my $l = $_;
|
||||
# check for a copyright statement and save the years
|
||||
if($l =~ /.* ?copyright .* (\d\d\d\d|)/i) {
|
||||
my $count = 0;
|
||||
while($l =~ /([\d]{4})/g) {
|
||||
push @copyright, {
|
||||
year => $1,
|
||||
line => $line,
|
||||
col => index($l, $1),
|
||||
code => $l
|
||||
};
|
||||
$count++;
|
||||
}
|
||||
if(!$count) {
|
||||
# year-less
|
||||
push @copyright, {
|
||||
year => -1,
|
||||
line => $line,
|
||||
col => index($l, $1),
|
||||
code => $l
|
||||
};
|
||||
$count++;
|
||||
}
|
||||
$found = $count;
|
||||
}
|
||||
if($l =~ /SPDX-License-Identifier:/) {
|
||||
$spdx = 1;
|
||||
}
|
||||
# allow within the first 100 lines
|
||||
if(++$line > 100) {
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
return $found;
|
||||
}
|
||||
|
||||
sub checkfile {
|
||||
my ($file, $skipped, $pattern) = @_;
|
||||
$spdx = 0;
|
||||
my $found = scanfile($file);
|
||||
|
||||
if($found < 1) {
|
||||
if($skipped) {
|
||||
# just move on
|
||||
$skips{$pattern}++;
|
||||
return 0;
|
||||
}
|
||||
if(!$found) {
|
||||
print "$file:1: missing copyright range\n";
|
||||
return 2;
|
||||
}
|
||||
# this means the file couldn't open - it might not exist, consider
|
||||
# that fine
|
||||
return 1;
|
||||
}
|
||||
if(!$spdx) {
|
||||
if($skipped) {
|
||||
# move on
|
||||
$skips{$pattern}++;
|
||||
return 0;
|
||||
}
|
||||
print "$file:1: missing SPDX-License-Identifier\n";
|
||||
return 2;
|
||||
}
|
||||
|
||||
if($skipped) {
|
||||
print "$file:1: ignored superfluously by $pattern\n" if($verbose);
|
||||
$superf{$pattern}++;
|
||||
}
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
sub dep5 {
|
||||
my ($file) = @_;
|
||||
my @files;
|
||||
my $copy;
|
||||
open(F, "<$file") || die "can't open $file";
|
||||
my $line = 0;
|
||||
while(<F>) {
|
||||
$line++;
|
||||
if(/^Files: (.*)/i) {
|
||||
push @files, `git ls-files $1`;
|
||||
}
|
||||
elsif(/^Copyright: (.*)/i) {
|
||||
$copy = $1;
|
||||
}
|
||||
elsif(/^License: (.*)/i) {
|
||||
my $license = $1;
|
||||
for my $f (@files) {
|
||||
chomp $f;
|
||||
if($f =~ /\.gitignore\z/) {
|
||||
# ignore .gitignore
|
||||
}
|
||||
else {
|
||||
if($skiplist{$f}) {
|
||||
print STDERR "$f already skipped at $skiplist{$f}\n";
|
||||
}
|
||||
$skiplist{$f} = "dep5:$line";
|
||||
}
|
||||
}
|
||||
undef @files;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
}
|
||||
|
||||
dep5(".reuse/dep5");
|
||||
|
||||
my $checkall = 0;
|
||||
my @all;
|
||||
my $verbose;
|
||||
if($ARGV[0] eq "-v") {
|
||||
$verbose = 1;
|
||||
shift @ARGV;
|
||||
}
|
||||
if($ARGV[0]) {
|
||||
push @all, @ARGV;
|
||||
}
|
||||
else {
|
||||
@all = `git ls-files`;
|
||||
$checkall = 1;
|
||||
}
|
||||
|
||||
for my $f (@all) {
|
||||
chomp $f;
|
||||
my $skipped = 0;
|
||||
my $miss;
|
||||
my $wro;
|
||||
my $pattern;
|
||||
if($skiplist{$f}) {
|
||||
$pattern = $skip;
|
||||
$skiplisted++;
|
||||
$skipped = 1;
|
||||
$skip{$f}++;
|
||||
}
|
||||
|
||||
my $r = checkfile($f, $skipped, $pattern);
|
||||
$mis=1 if($r == 2);
|
||||
$wro=1 if(!$r);
|
||||
|
||||
if(!$skipped) {
|
||||
$missing += $mis;
|
||||
$wrong += $wro;
|
||||
}
|
||||
}
|
||||
|
||||
if($verbose) {
|
||||
print STDERR "$missing files have no copyright\n" if($missing);
|
||||
print STDERR "$wrong files have wrong copyright year\n" if ($wrong);
|
||||
print STDERR "$skiplisted files are skipped\n" if ($skiplisted);
|
||||
|
||||
for my $s (@skiplist) {
|
||||
if(!$skips{$s}) {
|
||||
printf ("Never skipped pattern: %s\n", $s);
|
||||
}
|
||||
if($superf{$s}) {
|
||||
printf ("%s was skipped superfluously %u times and legitimately %u times\n",
|
||||
$s, $superf{$s}, $skips{$s});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($checkall) {
|
||||
for(keys %skiplist) {
|
||||
if(!$skip{$_}) {
|
||||
printf STDERR "$_ is marked for SKIP but is missing!\n";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit 1 if($missing || $wrong);
|
39
deps/curl/scripts/coverage.sh
vendored
Normal file
39
deps/curl/scripts/coverage.sh
vendored
Normal file
@ -0,0 +1,39 @@
|
||||
#!/bin/sh
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
autoreconf -fi
|
||||
mkdir -p cvr
|
||||
cd cvr
|
||||
../configure --disable-shared --enable-debug --enable-maintainer-mode --enable-code-coverage
|
||||
make -sj
|
||||
# the regular test run
|
||||
make TFLAGS=-n test-nonflaky
|
||||
# make all allocs/file operations fail
|
||||
#make TFLAGS=-n test-torture
|
||||
# do everything event-based
|
||||
make TFLAGS=-n test-event
|
||||
lcov -d . -c -o cov.lcov
|
||||
genhtml cov.lcov --output-directory coverage --title "curl code coverage"
|
||||
tar -cjf curl-coverage.tar.bz2 coverage
|
168
deps/curl/scripts/delta
vendored
Normal file
168
deps/curl/scripts/delta
vendored
Normal file
@ -0,0 +1,168 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# Display changes done in the repository from [tag] until now.
|
||||
#
|
||||
# Uses git for repo data.
|
||||
# Uses docs/THANKS and RELEASE-NOTES for current status.
|
||||
#
|
||||
# In the git clone root, invoke 'scripts/delta [release tag]'
|
||||
|
||||
$start = $ARGV[0];
|
||||
|
||||
if($start eq "-h") {
|
||||
print "Usage: summary [tag]\n";
|
||||
exit;
|
||||
}
|
||||
elsif($start eq "") {
|
||||
$start = `git tag --sort=taggerdate | grep "^curl-" | tail -1`;
|
||||
chomp $start;
|
||||
}
|
||||
|
||||
$commits = `git log --oneline $start.. | wc -l`;
|
||||
$committers = `git shortlog -s $start.. | wc -l`;
|
||||
$bcommitters = `git shortlog -s $start | wc -l`;
|
||||
|
||||
$acommits = `git log --oneline | wc -l`;
|
||||
$acommitters = `git shortlog -s | wc -l`;
|
||||
|
||||
# delta from now compared to before
|
||||
$ncommitters = $acommitters - $bcommitters;
|
||||
|
||||
# number of contributors right now
|
||||
$acontribs = `./scripts/contrithanks.sh | grep -c '^[^ ]'`;
|
||||
# number when the tag was set
|
||||
$bcontribs = `git show $start:docs/THANKS | grep -c '^[^ ]'`;
|
||||
# delta
|
||||
$contribs = $acontribs - $bcontribs;
|
||||
|
||||
# number of setops:
|
||||
sub setopts {
|
||||
my ($f)=@_;
|
||||
open(H, "$f");
|
||||
my $opts;
|
||||
while(<H>) {
|
||||
if(/^ CURLOPT(|DEPRECATED)\(/ && ($_ !~ /OBSOLETE/)) {
|
||||
$opts++;
|
||||
}
|
||||
}
|
||||
close(H);
|
||||
return $opts;
|
||||
}
|
||||
$asetopts = setopts("<include/curl/curl.h");
|
||||
$bsetopts = setopts("git show $start:include/curl/curl.h|");
|
||||
$nsetopts = $asetopts - $bsetopts;
|
||||
|
||||
# Number of command line options:
|
||||
$aoptions=`grep -c '{"....--' src/tool_listhelp.c`;
|
||||
$boptions=`git show $start:src/tool_listhelp.c 2>/dev/null | grep -c '{"....--'`;
|
||||
$noptions=$aoptions - $boptions;
|
||||
|
||||
# current local branch
|
||||
$branch=`git rev-parse --abbrev-ref HEAD 2>/dev/null`;
|
||||
chomp $branch;
|
||||
# Number of files in git
|
||||
$afiles=`git ls-files | wc -l`;
|
||||
$deletes=`git diff-tree --diff-filter=A -r --summary origin/$branch $start 2>/dev/null | wc -l`;
|
||||
$creates=`git diff-tree --diff-filter=D -r --summary origin/$branch $start 2>/dev/null| wc -l`;
|
||||
|
||||
# Time since that tag
|
||||
$tagged=`git for-each-ref --format="%(refname:short) | %(taggerdate:unix)" refs/tags/* | grep ^$start | cut "-d|" -f2`; # unix timestamp
|
||||
$taggednice=`git for-each-ref --format="%(refname:short) | %(creatordate)" refs/tags/* | grep ^$start | cut '-d|' -f2`; # human readable time
|
||||
chomp $taggednice;
|
||||
$now=`date +%s`;
|
||||
$elapsed=$now - $tagged; # number of seconds since tag
|
||||
$total=$now - `date -d 19980320 +%s`;
|
||||
|
||||
# Number of public functions in libcurl
|
||||
$apublic=`git grep ^CURL_EXTERN -- include/curl | wc -l`;
|
||||
$bpublic=`git grep ^CURL_EXTERN $start -- include/curl | wc -l`;
|
||||
$public = $apublic - $bpublic;
|
||||
|
||||
# diffstat
|
||||
$diffstat=`git diff --stat $start.. | tail -1`;
|
||||
if($diffstat =~ /^ *(\d+) files changed, (\d+) insertions\(\+\), (\d+)/) {
|
||||
($fileschanged, $insertions, $deletions)=($1, $2, $3);
|
||||
}
|
||||
|
||||
# Changes/bug-fixes currently logged
|
||||
open(F, "<RELEASE-NOTES");
|
||||
while(<F>) {
|
||||
if($_ =~ /following changes:/) {
|
||||
$mode=1;
|
||||
}
|
||||
elsif($_ =~ /following bugfixes:/) {
|
||||
$mode=2;
|
||||
}
|
||||
elsif($_ =~ /known bugs:/) {
|
||||
$mode=3;
|
||||
}
|
||||
elsif($_ =~ /like these:/) {
|
||||
$mode=4;
|
||||
}
|
||||
if($_ =~ /^ o /) {
|
||||
if($mode == 1) {
|
||||
$numchanges++;
|
||||
}
|
||||
elsif($mode == 2) {
|
||||
$numbugfixes++;
|
||||
}
|
||||
}
|
||||
if(($mode == 4) && ($_ =~ /^ \((\d+) contributors/)) {
|
||||
$numcontributors = $1;
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
|
||||
########################################################################
|
||||
# Produce the summary
|
||||
|
||||
print "== Since $start $taggednice ==\n";
|
||||
printf "Elapsed time: %.1f days (total %d)\n",
|
||||
$elapsed / 3600 / 24,
|
||||
$total / 3600 / 24;
|
||||
printf "Commits: %d (total %d)\n",
|
||||
$commits, $acommits;
|
||||
printf "Commit authors: %d, %d new (total %d)\n",
|
||||
$committers, $ncommitters, $acommitters;
|
||||
printf "Contributors: %d, %d new (total %d)\n",
|
||||
$numcontributors, $contribs, $acontribs;
|
||||
printf "New public functions: %d (total %d)\n",
|
||||
$public, $apublic;
|
||||
printf "New curl_easy_setopt() options: %d (total %d)\n",
|
||||
$nsetopts, $asetopts;
|
||||
printf "New command line options: %d (total %d)\n",
|
||||
$noptions, $aoptions;
|
||||
printf "Changes logged: %d\n", $numchanges;
|
||||
printf "Bugfixes logged: %d\n", $numbugfixes;
|
||||
printf "Added files: %d (total %d)\n",
|
||||
$creates, $afiles;
|
||||
printf "Deleted files: %d (delta: %d)\n", $deletes,
|
||||
$creates - $deletes;
|
||||
print "Diffstat:$diffstat" if(!$fileschanged);
|
||||
printf "Files changed: %d (%.2f%%)\n", $fileschanged, $fileschanged*100/$afiles;
|
||||
printf "Lines inserted: %d\n", $insertions;
|
||||
printf "Lines deleted: %d (delta: %d)\n", $deletions,
|
||||
$insertions - $deletions;
|
55
deps/curl/scripts/firefox-db2pem.sh
vendored
Normal file
55
deps/curl/scripts/firefox-db2pem.sh
vendored
Normal file
@ -0,0 +1,55 @@
|
||||
#!/bin/sh
|
||||
# ***************************************************************************
|
||||
# * _ _ ____ _
|
||||
# * Project ___| | | | _ \| |
|
||||
# * / __| | | | |_) | |
|
||||
# * | (__| |_| | _ <| |___
|
||||
# * \___|\___/|_| \_\_____|
|
||||
# *
|
||||
# * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# *
|
||||
# * This software is licensed as described in the file COPYING, which
|
||||
# * you should have received as part of this distribution. The terms
|
||||
# * are also available at https://curl.se/docs/copyright.html.
|
||||
# *
|
||||
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# * copies of the Software, and permit persons to whom the Software is
|
||||
# * furnished to do so, under the terms of the COPYING file.
|
||||
# *
|
||||
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# * KIND, either express or implied.
|
||||
# *
|
||||
# * SPDX-License-Identifier: curl
|
||||
# *
|
||||
# ***************************************************************************
|
||||
# This shell script creates a fresh ca-bundle.crt file for use with libcurl.
|
||||
# It extracts all ca certs it finds in the local Firefox database and converts
|
||||
# them all into PEM format.
|
||||
#
|
||||
db=$(ls -1d $HOME/.mozilla/firefox/*default*)
|
||||
out=$1
|
||||
|
||||
if test -z "$out"; then
|
||||
out="ca-bundle.crt" # use a sensible default
|
||||
fi
|
||||
|
||||
currentdate=$(date)
|
||||
|
||||
cat >$out <<EOF
|
||||
##
|
||||
## Bundle of CA Root Certificates
|
||||
##
|
||||
## Converted at: ${currentdate}
|
||||
## These were converted from the local Firefox directory by the db2pem script.
|
||||
##
|
||||
EOF
|
||||
|
||||
|
||||
certutil -L -h 'Builtin Object Token' -d "$db" | \
|
||||
grep ' *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$' | \
|
||||
sed -e 's/ *[CcGTPpu]*,[CcGTPpu]*,[CcGTPpu]* *$//' -e 's/\(.*\)/"\1"/' | \
|
||||
sort | \
|
||||
while read -r nickname; \
|
||||
do echo "$nickname" | sed -e "s/Builtin Object Token://g"; \
|
||||
eval certutil -d "$db" -L -n "$nickname" -a ; \
|
||||
done >> $out
|
50
deps/curl/scripts/installcheck.sh
vendored
Normal file
50
deps/curl/scripts/installcheck.sh
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
#!/bin/bash
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
PREFIX=$1
|
||||
|
||||
# Run this script in the root of the git clone. Point out the install prefix
|
||||
# where 'make install' has already installed curl.
|
||||
|
||||
if test -z "$1"; then
|
||||
echo "scripts/installcheck.sh [PREFIX]"
|
||||
exit
|
||||
fi
|
||||
|
||||
diff -u <(find docs/libcurl/ -name "*.3" -printf "%f\n" | grep -v template| sort) <(find $PREFIX/share/man/ -name "*.3" -printf "%f\n" | sort)
|
||||
|
||||
if test "$?" -ne "0"; then
|
||||
echo "ERROR: installed libcurl docs mismatch"
|
||||
exit 2
|
||||
fi
|
||||
|
||||
diff -u <(find include/ -name "*.h" -printf "%f\n" | sort) <(find $PREFIX/include/ -name "*.h" -printf "%f\n" | sort)
|
||||
|
||||
if test "$?" -ne "0"; then
|
||||
echo "ERROR: installed include files mismatch"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
echo "installcheck: installed libcurl docs and include files look good"
|
103
deps/curl/scripts/log2changes.pl
vendored
Normal file
103
deps/curl/scripts/log2changes.pl
vendored
Normal file
@ -0,0 +1,103 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# git log --pretty=fuller --no-color --date=short --decorate=full
|
||||
|
||||
my @mname = ('Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun',
|
||||
'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' );
|
||||
|
||||
sub nicedate {
|
||||
my ($date)=$_;
|
||||
|
||||
if($date =~ /(\d\d\d\d)-(\d\d)-(\d\d)/) {
|
||||
return sprintf("%d %s %4d", $3, $mname[$2-1], $1);
|
||||
}
|
||||
return $date;
|
||||
}
|
||||
|
||||
sub printmsg {
|
||||
my ($p, $msg)=@_;
|
||||
while(length($msg) > 77) {
|
||||
print $p.substr($msg, 0, 77, "")."\n";
|
||||
$p=" ";
|
||||
}
|
||||
if($msg eq "") {
|
||||
$p = "";
|
||||
}
|
||||
print "$p$msg\n";
|
||||
}
|
||||
|
||||
print
|
||||
' _ _ ____ _
|
||||
___| | | | _ \| |
|
||||
/ __| | | | |_) | |
|
||||
| (__| |_| | _ <| |___
|
||||
\___|\___/|_| \_\_____|
|
||||
|
||||
Changelog
|
||||
';
|
||||
|
||||
my $tag;
|
||||
while(<STDIN>) {
|
||||
my $l = $_;
|
||||
|
||||
if($l =~/^commit ([[:xdigit:]]*) ?(.*)/) {
|
||||
$co = $1;
|
||||
my $ref = $2;
|
||||
if ($ref =~ /refs\/tags\/curl-([0-9_]*)/) {
|
||||
$tag = $1;
|
||||
$tag =~ tr/_/./;
|
||||
}
|
||||
}
|
||||
elsif($l =~ /^Author: *(.*) +</) {
|
||||
$c = $1;
|
||||
}
|
||||
elsif($l =~ /^CommitDate: (.*)/) {
|
||||
$date = nicedate($1);
|
||||
}
|
||||
elsif($l =~ /^( )(.*)/) {
|
||||
my $pref = " ";
|
||||
if ($tag) {
|
||||
# Version entries have a special format
|
||||
print "\nVersion " . $tag." ($date)\n";
|
||||
$oldc = "";
|
||||
$tag = "";
|
||||
}
|
||||
if($co ne $oldco) {
|
||||
if($c ne $oldc) {
|
||||
print "\n$c ($date)\n\n";
|
||||
}
|
||||
else {
|
||||
print "\n";
|
||||
}
|
||||
$pref = "- ";
|
||||
}
|
||||
|
||||
$oldco = $co;
|
||||
$oldc = $c;
|
||||
$olddate = $date;
|
||||
printmsg($pref, $2);
|
||||
}
|
||||
}
|
713
deps/curl/scripts/mk-ca-bundle.pl
vendored
Normal file
713
deps/curl/scripts/mk-ca-bundle.pl
vendored
Normal file
@ -0,0 +1,713 @@
|
||||
#!/usr/bin/env perl
|
||||
# ***************************************************************************
|
||||
# * _ _ ____ _
|
||||
# * Project ___| | | | _ \| |
|
||||
# * / __| | | | |_) | |
|
||||
# * | (__| |_| | _ <| |___
|
||||
# * \___|\___/|_| \_\_____|
|
||||
# *
|
||||
# * Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
# *
|
||||
# * This software is licensed as described in the file COPYING, which
|
||||
# * you should have received as part of this distribution. The terms
|
||||
# * are also available at https://curl.se/docs/copyright.html.
|
||||
# *
|
||||
# * You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# * copies of the Software, and permit persons to whom the Software is
|
||||
# * furnished to do so, under the terms of the COPYING file.
|
||||
# *
|
||||
# * This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# * KIND, either express or implied.
|
||||
# *
|
||||
# * SPDX-License-Identifier: curl
|
||||
# *
|
||||
# ***************************************************************************
|
||||
# This Perl script creates a fresh ca-bundle.crt file for use with libcurl.
|
||||
# It downloads certdata.txt from Mozilla's source tree (see URL below),
|
||||
# then parses certdata.txt and extracts CA Root Certificates into PEM format.
|
||||
# These are then processed with the OpenSSL commandline tool to produce the
|
||||
# final ca-bundle.crt file.
|
||||
# The script is based on the parse-certs script written by Roland Krikava.
|
||||
# This Perl script works on almost any platform since its only external
|
||||
# dependency is the OpenSSL commandline tool for optional text listing.
|
||||
# Hacked by Guenter Knauf.
|
||||
#
|
||||
use Encode;
|
||||
use Getopt::Std;
|
||||
use MIME::Base64;
|
||||
use strict;
|
||||
use warnings;
|
||||
use vars qw($opt_b $opt_d $opt_f $opt_h $opt_i $opt_k $opt_l $opt_m $opt_n $opt_p $opt_q $opt_s $opt_t $opt_u $opt_v $opt_w);
|
||||
use List::Util;
|
||||
use Text::Wrap;
|
||||
use Time::Local;
|
||||
my $MOD_SHA = "Digest::SHA";
|
||||
eval "require $MOD_SHA";
|
||||
if ($@) {
|
||||
$MOD_SHA = "Digest::SHA::PurePerl";
|
||||
eval "require $MOD_SHA";
|
||||
}
|
||||
eval "require LWP::UserAgent";
|
||||
|
||||
my %urls = (
|
||||
'nss' =>
|
||||
'https://hg.mozilla.org/projects/nss/raw-file/default/lib/ckfw/builtins/certdata.txt',
|
||||
'central' =>
|
||||
'https://hg.mozilla.org/mozilla-central/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
|
||||
'beta' =>
|
||||
'https://hg.mozilla.org/releases/mozilla-beta/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
|
||||
'release' =>
|
||||
'https://hg.mozilla.org/releases/mozilla-release/raw-file/default/security/nss/lib/ckfw/builtins/certdata.txt',
|
||||
);
|
||||
|
||||
$opt_d = 'release';
|
||||
|
||||
# If the OpenSSL commandline is not in search path you can configure it here!
|
||||
my $openssl = 'openssl';
|
||||
|
||||
my $version = '1.29';
|
||||
|
||||
$opt_w = 76; # default base64 encoded lines length
|
||||
|
||||
# default cert types to include in the output (default is to include CAs which
|
||||
# may issue SSL server certs)
|
||||
my $default_mozilla_trust_purposes = "SERVER_AUTH";
|
||||
my $default_mozilla_trust_levels = "TRUSTED_DELEGATOR";
|
||||
$opt_p = $default_mozilla_trust_purposes . ":" . $default_mozilla_trust_levels;
|
||||
|
||||
my @valid_mozilla_trust_purposes = (
|
||||
"DIGITAL_SIGNATURE",
|
||||
"NON_REPUDIATION",
|
||||
"KEY_ENCIPHERMENT",
|
||||
"DATA_ENCIPHERMENT",
|
||||
"KEY_AGREEMENT",
|
||||
"KEY_CERT_SIGN",
|
||||
"CRL_SIGN",
|
||||
"SERVER_AUTH",
|
||||
"CLIENT_AUTH",
|
||||
"CODE_SIGNING",
|
||||
"EMAIL_PROTECTION",
|
||||
"IPSEC_END_SYSTEM",
|
||||
"IPSEC_TUNNEL",
|
||||
"IPSEC_USER",
|
||||
"TIME_STAMPING",
|
||||
"STEP_UP_APPROVED"
|
||||
);
|
||||
|
||||
my @valid_mozilla_trust_levels = (
|
||||
"TRUSTED_DELEGATOR", # CAs
|
||||
"NOT_TRUSTED", # Don't trust these certs.
|
||||
"MUST_VERIFY_TRUST", # This explicitly tells us that it ISN'T a CA but is
|
||||
# otherwise ok. In other words, this should tell the
|
||||
# app to ignore any other sources that claim this is
|
||||
# a CA.
|
||||
"TRUSTED" # This cert is trusted, but only for itself and not
|
||||
# for delegates (i.e. it is not a CA).
|
||||
);
|
||||
|
||||
my $default_signature_algorithms = $opt_s = "MD5";
|
||||
|
||||
my @valid_signature_algorithms = (
|
||||
"MD5",
|
||||
"SHA1",
|
||||
"SHA256",
|
||||
"SHA384",
|
||||
"SHA512"
|
||||
);
|
||||
|
||||
$0 =~ s@.*(/|\\)@@;
|
||||
$Getopt::Std::STANDARD_HELP_VERSION = 1;
|
||||
getopts('bd:fhiklmnp:qs:tuvw:');
|
||||
|
||||
if(!defined($opt_d)) {
|
||||
# to make plain "-d" use not cause warnings, and actually still work
|
||||
$opt_d = 'release';
|
||||
}
|
||||
|
||||
# Use predefined URL or else custom URL specified on command line.
|
||||
my $url;
|
||||
if(defined($urls{$opt_d})) {
|
||||
$url = $urls{$opt_d};
|
||||
if(!$opt_k && $url !~ /^https:\/\//i) {
|
||||
die "The URL for '$opt_d' is not HTTPS. Use -k to override (insecure).\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$url = $opt_d;
|
||||
}
|
||||
|
||||
my $curl = `curl -V`;
|
||||
|
||||
if ($opt_i) {
|
||||
print ("=" x 78 . "\n");
|
||||
print "Script Version : $version\n";
|
||||
print "Perl Version : $]\n";
|
||||
print "Operating System Name : $^O\n";
|
||||
print "Getopt::Std.pm Version : ${Getopt::Std::VERSION}\n";
|
||||
print "Encode::Encoding.pm Version : ${Encode::Encoding::VERSION}\n";
|
||||
print "MIME::Base64.pm Version : ${MIME::Base64::VERSION}\n";
|
||||
print "LWP::UserAgent.pm Version : ${LWP::UserAgent::VERSION}\n" if($LWP::UserAgent::VERSION);
|
||||
print "LWP.pm Version : ${LWP::VERSION}\n" if($LWP::VERSION);
|
||||
print "Digest::SHA.pm Version : ${Digest::SHA::VERSION}\n" if ($Digest::SHA::VERSION);
|
||||
print "Digest::SHA::PurePerl.pm Version : ${Digest::SHA::PurePerl::VERSION}\n" if ($Digest::SHA::PurePerl::VERSION);
|
||||
print ("=" x 78 . "\n");
|
||||
}
|
||||
|
||||
sub warning_message() {
|
||||
if ( $opt_d =~ m/^risk$/i ) { # Long Form Warning and Exit
|
||||
print "Warning: Use of this script may pose some risk:\n";
|
||||
print "\n";
|
||||
print " 1) If you use HTTP URLs they are subject to a man in the middle attack\n";
|
||||
print " 2) Default to 'release', but more recent updates may be found in other trees\n";
|
||||
print " 3) certdata.txt file format may change, lag time to update this script\n";
|
||||
print " 4) Generally unwise to blindly trust CAs without manual review & verification\n";
|
||||
print " 5) Mozilla apps use additional security checks aren't represented in certdata\n";
|
||||
print " 6) Use of this script will make a security engineer grind his teeth and\n";
|
||||
print " swear at you. ;)\n";
|
||||
exit;
|
||||
} else { # Short Form Warning
|
||||
print "Warning: Use of this script may pose some risk, -d risk for more details.\n";
|
||||
}
|
||||
}
|
||||
|
||||
sub HELP_MESSAGE() {
|
||||
print "Usage:\t${0} [-b] [-d<certdata>] [-f] [-i] [-k] [-l] [-n] [-p<purposes:levels>] [-q] [-s<algorithms>] [-t] [-u] [-v] [-w<l>] [<outputfile>]\n";
|
||||
print "\t-b\tbackup an existing version of ca-bundle.crt\n";
|
||||
print "\t-d\tspecify Mozilla tree to pull certdata.txt or custom URL\n";
|
||||
print "\t\t Valid names are:\n";
|
||||
print "\t\t ", join( ", ", map { ( $_ =~ m/$opt_d/ ) ? "$_ (default)" : "$_" } sort keys %urls ), "\n";
|
||||
print "\t-f\tforce rebuild even if certdata.txt is current\n";
|
||||
print "\t-i\tprint version info about used modules\n";
|
||||
print "\t-k\tallow URLs other than HTTPS, enable HTTP fallback (insecure)\n";
|
||||
print "\t-l\tprint license info about certdata.txt\n";
|
||||
print "\t-m\tinclude meta data in output\n";
|
||||
print "\t-n\tno download of certdata.txt (to use existing)\n";
|
||||
print wrap("\t","\t\t", "-p\tlist of Mozilla trust purposes and levels for certificates to include in output. Takes the form of a comma separated list of purposes, a colon, and a comma separated list of levels. (default: $default_mozilla_trust_purposes:$default_mozilla_trust_levels)"), "\n";
|
||||
print "\t\t Valid purposes are:\n";
|
||||
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_purposes ) ), "\n";
|
||||
print "\t\t Valid levels are:\n";
|
||||
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_mozilla_trust_levels ) ), "\n";
|
||||
print "\t-q\tbe really quiet (no progress output at all)\n";
|
||||
print wrap("\t","\t\t", "-s\tcomma separated list of certificate signatures/hashes to output in plain text mode. (default: $default_signature_algorithms)\n");
|
||||
print "\t\t Valid signature algorithms are:\n";
|
||||
print wrap("\t\t ","\t\t ", join( ", ", "ALL", @valid_signature_algorithms ) ), "\n";
|
||||
print "\t-t\tinclude plain text listing of certificates\n";
|
||||
print "\t-u\tunlink (remove) certdata.txt after processing\n";
|
||||
print "\t-v\tbe verbose and print out processed CAs\n";
|
||||
print "\t-w <l>\twrap base64 output lines after <l> chars (default: ${opt_w})\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub VERSION_MESSAGE() {
|
||||
print "${0} version ${version} running Perl ${]} on ${^O}\n";
|
||||
}
|
||||
|
||||
warning_message() unless ($opt_q || $url =~ m/^(ht|f)tps:/i );
|
||||
HELP_MESSAGE() if ($opt_h);
|
||||
|
||||
sub report($@) {
|
||||
my $output = shift;
|
||||
|
||||
print STDERR $output . "\n" unless $opt_q;
|
||||
}
|
||||
|
||||
sub is_in_list($@) {
|
||||
my $target = shift;
|
||||
|
||||
return defined(List::Util::first { $target eq $_ } @_);
|
||||
}
|
||||
|
||||
# Parses $param_string as a case insensitive comma separated list with optional
|
||||
# whitespace validates that only allowed parameters are supplied
|
||||
sub parse_csv_param($$@) {
|
||||
my $description = shift;
|
||||
my $param_string = shift;
|
||||
my @valid_values = @_;
|
||||
|
||||
my @values = map {
|
||||
s/^\s+//; # strip leading spaces
|
||||
s/\s+$//; # strip trailing spaces
|
||||
uc $_ # return the modified string as upper case
|
||||
} split( ',', $param_string );
|
||||
|
||||
# Find all values which are not in the list of valid values or "ALL"
|
||||
my @invalid = grep { !is_in_list($_,"ALL",@valid_values) } @values;
|
||||
|
||||
if ( scalar(@invalid) > 0 ) {
|
||||
# Tell the user which parameters were invalid and print the standard help
|
||||
# message which will exit
|
||||
print "Error: Invalid ", $description, scalar(@invalid) == 1 ? ": " : "s: ", join( ", ", map { "\"$_\"" } @invalid ), "\n";
|
||||
HELP_MESSAGE();
|
||||
}
|
||||
|
||||
@values = @valid_values if ( is_in_list("ALL",@values) );
|
||||
|
||||
return @values;
|
||||
}
|
||||
|
||||
sub sha256 {
|
||||
my $result;
|
||||
if ($Digest::SHA::VERSION || $Digest::SHA::PurePerl::VERSION) {
|
||||
open(FILE, $_[0]) or die "Can't open '$_[0]': $!";
|
||||
binmode(FILE);
|
||||
$result = $MOD_SHA->new(256)->addfile(*FILE)->hexdigest;
|
||||
close(FILE);
|
||||
} else {
|
||||
# Use OpenSSL command if Perl Digest::SHA modules not available
|
||||
$result = `"$openssl" dgst -r -sha256 "$_[0]"`;
|
||||
$result =~ s/^([0-9a-f]{64}) .+/$1/is;
|
||||
}
|
||||
return $result;
|
||||
}
|
||||
|
||||
|
||||
sub oldhash {
|
||||
my $hash = "";
|
||||
open(C, "<$_[0]") || return 0;
|
||||
while(<C>) {
|
||||
chomp;
|
||||
if($_ =~ /^\#\# SHA256: (.*)/) {
|
||||
$hash = $1;
|
||||
last;
|
||||
}
|
||||
}
|
||||
close(C);
|
||||
return $hash;
|
||||
}
|
||||
|
||||
if ( $opt_p !~ m/:/ ) {
|
||||
print "Error: Mozilla trust identifier list must include both purposes and levels\n";
|
||||
HELP_MESSAGE();
|
||||
}
|
||||
|
||||
(my $included_mozilla_trust_purposes_string, my $included_mozilla_trust_levels_string) = split( ':', $opt_p );
|
||||
my @included_mozilla_trust_purposes = parse_csv_param( "trust purpose", $included_mozilla_trust_purposes_string, @valid_mozilla_trust_purposes );
|
||||
my @included_mozilla_trust_levels = parse_csv_param( "trust level", $included_mozilla_trust_levels_string, @valid_mozilla_trust_levels );
|
||||
|
||||
my @included_signature_algorithms = parse_csv_param( "signature algorithm", $opt_s, @valid_signature_algorithms );
|
||||
|
||||
sub should_output_cert(%) {
|
||||
my %trust_purposes_by_level = @_;
|
||||
|
||||
foreach my $level (@included_mozilla_trust_levels) {
|
||||
# for each level we want to output, see if any of our desired purposes are
|
||||
# included
|
||||
return 1 if ( defined( List::Util::first { is_in_list( $_, @included_mozilla_trust_purposes ) } @{$trust_purposes_by_level{$level}} ) );
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
my $crt = $ARGV[0] || 'ca-bundle.crt';
|
||||
(my $txt = $url) =~ s@(.*/|\?.*)@@g;
|
||||
|
||||
my $stdout = $crt eq '-';
|
||||
my $resp;
|
||||
my $fetched;
|
||||
|
||||
my $oldhash = oldhash($crt);
|
||||
|
||||
report "SHA256 of old file: $oldhash";
|
||||
|
||||
if(!$opt_n) {
|
||||
report "Downloading $txt ...";
|
||||
|
||||
# If we have an HTTPS URL then use curl
|
||||
if($url =~ /^https:\/\//i) {
|
||||
if($curl) {
|
||||
if($curl =~ /^Protocols:.* https( |$)/m) {
|
||||
report "Get certdata with curl!";
|
||||
my $proto = !$opt_k ? "--proto =https" : "";
|
||||
my $quiet = $opt_q ? "-s" : "";
|
||||
my @out = `curl -w %{response_code} $proto $quiet -o "$txt" "$url"`;
|
||||
if(!$? && @out && $out[0] == 200) {
|
||||
$fetched = 1;
|
||||
report "Downloaded $txt";
|
||||
}
|
||||
else {
|
||||
report "Failed downloading via HTTPS with curl";
|
||||
if(-e $txt && !unlink($txt)) {
|
||||
report "Failed to remove '$txt': $!";
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
report "curl lacks https support";
|
||||
}
|
||||
}
|
||||
else {
|
||||
report "curl not found";
|
||||
}
|
||||
}
|
||||
|
||||
# If nothing was fetched then use LWP
|
||||
if(!$fetched) {
|
||||
if($url =~ /^https:\/\//i) {
|
||||
report "Falling back to HTTP";
|
||||
$url =~ s/^https:\/\//http:\/\//i;
|
||||
}
|
||||
if(!$opt_k) {
|
||||
report "URLs other than HTTPS are disabled by default, to enable use -k";
|
||||
exit 1;
|
||||
}
|
||||
report "Get certdata with LWP!";
|
||||
if(!defined(${LWP::UserAgent::VERSION})) {
|
||||
report "LWP is not available (LWP::UserAgent not found)";
|
||||
exit 1;
|
||||
}
|
||||
my $ua = new LWP::UserAgent(agent => "$0/$version");
|
||||
$ua->env_proxy();
|
||||
$resp = $ua->mirror($url, $txt);
|
||||
if($resp && $resp->code eq '304') {
|
||||
report "Not modified";
|
||||
exit 0 if -e $crt && !$opt_f;
|
||||
}
|
||||
else {
|
||||
$fetched = 1;
|
||||
report "Downloaded $txt";
|
||||
}
|
||||
if(!$resp || $resp->code !~ /^(?:200|304)$/) {
|
||||
report "Unable to download latest data: "
|
||||
. ($resp? $resp->code . ' - ' . $resp->message : "LWP failed");
|
||||
exit 1 if -e $crt || ! -r $txt;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
my $filedate = $resp ? $resp->last_modified : (stat($txt))[9];
|
||||
my $datesrc = "as of";
|
||||
if(!$filedate) {
|
||||
# mxr.mozilla.org gave us a time, hg.mozilla.org does not!
|
||||
$filedate = time();
|
||||
$datesrc="downloaded on";
|
||||
}
|
||||
|
||||
# get the hash from the download file
|
||||
my $newhash= sha256($txt);
|
||||
|
||||
if(!$opt_f && $oldhash eq $newhash) {
|
||||
report "Downloaded file identical to previous run\'s source file. Exiting";
|
||||
if($opt_u && -e $txt && !unlink($txt)) {
|
||||
report "Failed to remove $txt: $!\n";
|
||||
}
|
||||
exit;
|
||||
}
|
||||
|
||||
report "SHA256 of new file: $newhash";
|
||||
|
||||
my $currentdate = scalar gmtime($filedate);
|
||||
|
||||
my $format = $opt_t ? "plain text and " : "";
|
||||
if( $stdout ) {
|
||||
open(CRT, '> -') or die "Couldn't open STDOUT: $!\n";
|
||||
} else {
|
||||
open(CRT,">$crt.~") or die "Couldn't open $crt.~: $!\n";
|
||||
}
|
||||
print CRT <<EOT;
|
||||
##
|
||||
## Bundle of CA Root Certificates
|
||||
##
|
||||
## Certificate data from Mozilla ${datesrc}: ${currentdate} GMT
|
||||
##
|
||||
## This is a bundle of X.509 certificates of public Certificate Authorities
|
||||
## (CA). These were automatically extracted from Mozilla's root certificates
|
||||
## file (certdata.txt). This file can be found in the mozilla source tree:
|
||||
## ${url}
|
||||
##
|
||||
## It contains the certificates in ${format}PEM format and therefore
|
||||
## can be directly used with curl / libcurl / php_curl, or with
|
||||
## an Apache+mod_ssl webserver for SSL client authentication.
|
||||
## Just configure this file as the SSLCACertificateFile.
|
||||
##
|
||||
## Conversion done with mk-ca-bundle.pl version $version.
|
||||
## SHA256: $newhash
|
||||
##
|
||||
|
||||
EOT
|
||||
|
||||
report "Processing '$txt' ...";
|
||||
my $caname;
|
||||
my $certnum = 0;
|
||||
my $skipnum = 0;
|
||||
my $start_of_cert = 0;
|
||||
my $main_block = 0;
|
||||
my $main_block_name;
|
||||
my $trust_block = 0;
|
||||
my $trust_block_name;
|
||||
my @precert;
|
||||
my $cka_value;
|
||||
my $valid = 0;
|
||||
|
||||
open(TXT,"$txt") or die "Couldn't open $txt: $!\n";
|
||||
while (<TXT>) {
|
||||
if (/\*\*\*\*\* BEGIN LICENSE BLOCK \*\*\*\*\*/) {
|
||||
print CRT;
|
||||
print if ($opt_l);
|
||||
while (<TXT>) {
|
||||
print CRT;
|
||||
print if ($opt_l);
|
||||
last if (/\*\*\*\*\* END LICENSE BLOCK \*\*\*\*\*/);
|
||||
}
|
||||
next;
|
||||
}
|
||||
# The input file format consists of blocks of Mozilla objects.
|
||||
# The blocks are separated by blank lines but may be related.
|
||||
elsif(/^\s*$/) {
|
||||
$main_block = 0;
|
||||
$trust_block = 0;
|
||||
next;
|
||||
}
|
||||
# Each certificate has a main block.
|
||||
elsif(/^# Certificate "(.*)"/) {
|
||||
(!$main_block && !$trust_block) or die "Unexpected certificate block";
|
||||
$main_block = 1;
|
||||
$main_block_name = $1;
|
||||
# Reset all other certificate variables.
|
||||
$trust_block = 0;
|
||||
$trust_block_name = "";
|
||||
$valid = 0;
|
||||
$start_of_cert = 0;
|
||||
$caname = "";
|
||||
$cka_value = "";
|
||||
undef @precert;
|
||||
next;
|
||||
}
|
||||
# Each certificate's main block is followed by a trust block.
|
||||
elsif(/^# Trust for (?:Certificate )?"(.*)"/) {
|
||||
(!$main_block && !$trust_block) or die "Unexpected trust block";
|
||||
$trust_block = 1;
|
||||
$trust_block_name = $1;
|
||||
if($main_block_name ne $trust_block_name) {
|
||||
die "cert name \"$main_block_name\" != trust name \"$trust_block_name\"";
|
||||
}
|
||||
next;
|
||||
}
|
||||
# Ignore other blocks.
|
||||
#
|
||||
# There is a documentation comment block, a BEGINDATA block, and a bunch of
|
||||
# blocks starting with "# Explicitly Distrust <certname>".
|
||||
#
|
||||
# The latter is for certificates that have already been removed and are not
|
||||
# included. Not all explicitly distrusted certificates are ignored at this
|
||||
# point, just those without an actual certificate.
|
||||
elsif(!$main_block && !$trust_block) {
|
||||
next;
|
||||
}
|
||||
elsif(/^#/) {
|
||||
# The commented lines in a main block are plaintext metadata that describes
|
||||
# the certificate. Issuer, Subject, Fingerprint, etc.
|
||||
if($main_block) {
|
||||
push @precert, $_ if not /^#$/;
|
||||
if(/^# Not Valid After : (.*)/) {
|
||||
my $stamp = $1;
|
||||
use Time::Piece;
|
||||
# Not Valid After : Thu Sep 30 14:01:15 2021
|
||||
my $t = Time::Piece->strptime($stamp, "%a %b %d %H:%M:%S %Y");
|
||||
my $delta = ($t->epoch - time()); # negative means no longer valid
|
||||
if($delta < 0) {
|
||||
$skipnum++;
|
||||
report "Skipping: $main_block_name is not valid anymore" if ($opt_v);
|
||||
$valid = 0;
|
||||
}
|
||||
else {
|
||||
$valid = 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif(!$valid) {
|
||||
next;
|
||||
}
|
||||
|
||||
chomp;
|
||||
|
||||
if($main_block) {
|
||||
if(/^CKA_CLASS CK_OBJECT_CLASS CKO_CERTIFICATE/) {
|
||||
!$start_of_cert or die "Duplicate CKO_CERTIFICATE object";
|
||||
$start_of_cert = 1;
|
||||
next;
|
||||
}
|
||||
elsif(!$start_of_cert) {
|
||||
next;
|
||||
}
|
||||
elsif(/^CKA_LABEL UTF8 \"(.*)\"/) {
|
||||
($caname eq "") or die "Duplicate CKA_LABEL attribute";
|
||||
$caname = $1;
|
||||
if($caname ne $main_block_name) {
|
||||
die "caname \"$caname\" != cert name \"$main_block_name\"";
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif(/^CKA_VALUE MULTILINE_OCTAL/) {
|
||||
($cka_value eq "") or die "Duplicate CKA_VALUE attribute";
|
||||
while (<TXT>) {
|
||||
last if (/^END/);
|
||||
chomp;
|
||||
my @octets = split(/\\/);
|
||||
shift @octets;
|
||||
for (@octets) {
|
||||
$cka_value .= chr(oct);
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
elsif (/^CKA_NSS_SERVER_DISTRUST_AFTER (CK_BBOOL CK_FALSE|MULTILINE_OCTAL)/) {
|
||||
# Example:
|
||||
# CKA_NSS_SERVER_DISTRUST_AFTER MULTILINE_OCTAL
|
||||
# \062\060\060\066\061\067\060\060\060\060\060\060\132
|
||||
# END
|
||||
if($1 eq "MULTILINE_OCTAL") {
|
||||
my @timestamp;
|
||||
while (<TXT>) {
|
||||
last if (/^END/);
|
||||
chomp;
|
||||
my @octets = split(/\\/);
|
||||
shift @octets;
|
||||
for (@octets) {
|
||||
push @timestamp, chr(oct);
|
||||
}
|
||||
}
|
||||
scalar(@timestamp) == 13 or die "Failed parsing timestamp";
|
||||
# A trailing Z in the timestamp signifies UTC
|
||||
if($timestamp[12] ne "Z") {
|
||||
report "distrust date stamp is not using UTC";
|
||||
}
|
||||
# Example date: 200617000000Z
|
||||
# Means 2020-06-17 00:00:00 UTC
|
||||
my $distrustat =
|
||||
timegm($timestamp[10] . $timestamp[11], # second
|
||||
$timestamp[8] . $timestamp[9], # minute
|
||||
$timestamp[6] . $timestamp[7], # hour
|
||||
$timestamp[4] . $timestamp[5], # day
|
||||
($timestamp[2] . $timestamp[3]) - 1, # month
|
||||
"20" . $timestamp[0] . $timestamp[1]); # year
|
||||
if(time >= $distrustat) {
|
||||
# not trusted anymore
|
||||
$skipnum++;
|
||||
report "Skipping: $main_block_name is not trusted anymore" if ($opt_v);
|
||||
$valid = 0;
|
||||
}
|
||||
else {
|
||||
# still trusted
|
||||
}
|
||||
}
|
||||
next;
|
||||
}
|
||||
else {
|
||||
next;
|
||||
}
|
||||
}
|
||||
|
||||
if(!$trust_block || !$start_of_cert || $caname eq "" || $cka_value eq "") {
|
||||
die "Certificate extraction failed";
|
||||
}
|
||||
|
||||
my %trust_purposes_by_level;
|
||||
|
||||
if(/^CKA_CLASS CK_OBJECT_CLASS CKO_NSS_TRUST/) {
|
||||
# now scan the trust part to determine how we should trust this cert
|
||||
while (<TXT>) {
|
||||
if(/^\s*$/) {
|
||||
$trust_block = 0;
|
||||
last;
|
||||
}
|
||||
if (/^CKA_TRUST_([A-Z_]+)\s+CK_TRUST\s+CKT_NSS_([A-Z_]+)\s*$/) {
|
||||
if ( !is_in_list($1,@valid_mozilla_trust_purposes) ) {
|
||||
report "Warning: Unrecognized trust purpose for cert: $caname. Trust purpose: $1. Trust Level: $2";
|
||||
} elsif ( !is_in_list($2,@valid_mozilla_trust_levels) ) {
|
||||
report "Warning: Unrecognized trust level for cert: $caname. Trust purpose: $1. Trust Level: $2";
|
||||
} else {
|
||||
push @{$trust_purposes_by_level{$2}}, $1;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
# Sanity check that an explicitly distrusted certificate only has trust
|
||||
# purposes with a trust level of NOT_TRUSTED.
|
||||
#
|
||||
# Certificate objects that are explicitly distrusted are in a certificate
|
||||
# block that starts # Certificate "Explicitly Distrust(ed) <certname>",
|
||||
# where "Explicitly Distrust(ed) " was prepended to the original cert name.
|
||||
if($caname =~ /distrust/i ||
|
||||
$main_block_name =~ /distrust/i ||
|
||||
$trust_block_name =~ /distrust/i) {
|
||||
my @levels = keys %trust_purposes_by_level;
|
||||
if(scalar(@levels) != 1 || $levels[0] ne "NOT_TRUSTED") {
|
||||
die "\"$caname\" must have all trust purposes at level NOT_TRUSTED.";
|
||||
}
|
||||
}
|
||||
|
||||
if ( !should_output_cert(%trust_purposes_by_level) ) {
|
||||
$skipnum ++;
|
||||
report "Skipping: $caname lacks acceptable trust level" if ($opt_v);
|
||||
} else {
|
||||
my $encoded = MIME::Base64::encode_base64($cka_value, '');
|
||||
$encoded =~ s/(.{1,${opt_w}})/$1\n/g;
|
||||
my $pem = "-----BEGIN CERTIFICATE-----\n"
|
||||
. $encoded
|
||||
. "-----END CERTIFICATE-----\n";
|
||||
print CRT "\n$caname\n";
|
||||
my $maxStringLength = length(decode('UTF-8', $caname, Encode::FB_CROAK | Encode::LEAVE_SRC));
|
||||
print CRT ("=" x $maxStringLength . "\n");
|
||||
if ($opt_t) {
|
||||
foreach my $key (sort keys %trust_purposes_by_level) {
|
||||
my $string = $key . ": " . join(", ", @{$trust_purposes_by_level{$key}});
|
||||
print CRT $string . "\n";
|
||||
}
|
||||
}
|
||||
if($opt_m) {
|
||||
print CRT for @precert;
|
||||
}
|
||||
if (!$opt_t) {
|
||||
print CRT $pem;
|
||||
} else {
|
||||
my $pipe = "";
|
||||
foreach my $hash (@included_signature_algorithms) {
|
||||
$pipe = "|$openssl x509 -" . $hash . " -fingerprint -noout -inform PEM";
|
||||
if (!$stdout) {
|
||||
$pipe .= " >> $crt.~";
|
||||
close(CRT) or die "Couldn't close $crt.~: $!";
|
||||
}
|
||||
open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
|
||||
print TMP $pem;
|
||||
close(TMP) or die "Couldn't close openssl pipe: $!";
|
||||
if (!$stdout) {
|
||||
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
|
||||
}
|
||||
}
|
||||
$pipe = "|$openssl x509 -text -inform PEM";
|
||||
if (!$stdout) {
|
||||
$pipe .= " >> $crt.~";
|
||||
close(CRT) or die "Couldn't close $crt.~: $!";
|
||||
}
|
||||
open(TMP, $pipe) or die "Couldn't open openssl pipe: $!";
|
||||
print TMP $pem;
|
||||
close(TMP) or die "Couldn't close openssl pipe: $!";
|
||||
if (!$stdout) {
|
||||
open(CRT, ">>$crt.~") or die "Couldn't open $crt.~: $!";
|
||||
}
|
||||
}
|
||||
report "Processed: $caname" if ($opt_v);
|
||||
$certnum ++;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(TXT) or die "Couldn't close $txt: $!\n";
|
||||
close(CRT) or die "Couldn't close $crt.~: $!\n";
|
||||
unless( $stdout ) {
|
||||
if ($opt_b && -e $crt) {
|
||||
my $bk = 1;
|
||||
while (-e "$crt.~${bk}~") {
|
||||
$bk++;
|
||||
}
|
||||
rename $crt, "$crt.~${bk}~" or die "Failed to create backup $crt.~$bk}~: $!\n";
|
||||
} elsif( -e $crt ) {
|
||||
unlink( $crt ) or die "Failed to remove $crt: $!\n";
|
||||
}
|
||||
rename "$crt.~", $crt or die "Failed to rename $crt.~ to $crt: $!\n";
|
||||
}
|
||||
if($opt_u && -e $txt && !unlink($txt)) {
|
||||
report "Failed to remove $txt: $!\n";
|
||||
}
|
||||
report "Done ($certnum CA certs processed, $skipnum skipped).";
|
243
deps/curl/scripts/release-notes.pl
vendored
Normal file
243
deps/curl/scripts/release-notes.pl
vendored
Normal file
@ -0,0 +1,243 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
###############################################
|
||||
#
|
||||
# ==== How to use this script ====
|
||||
#
|
||||
# 1. Get recent commits added to RELEASE-NOTES:
|
||||
#
|
||||
# $ ./scripts/release-notes.pl
|
||||
#
|
||||
# 2. Edit RELEASE-NOTES and remove all entries that don't belong. Unused
|
||||
# references below will be cleaned up in the next step. Make sure to move
|
||||
# "changes" up to the changes section. All entries will by default be listed
|
||||
# under bug-fixes as this script can't know where to put them.
|
||||
#
|
||||
# 3. Run the cleanup script and let it sort the entries and remove unused
|
||||
# references from lines you removed in step (2):
|
||||
#
|
||||
# $ ./scripts/release-notes.pl cleanup
|
||||
#
|
||||
# 4. Reload RELEASE-NOTES and verify that things look okay. The cleanup
|
||||
# procedure can and should be re-run when lines are removed or rephrased.
|
||||
#
|
||||
# 5. Run ./scripts/contributors.sh and update the contributor list of names
|
||||
# The list can also be extended or edited manually.
|
||||
#
|
||||
# 6. Run ./scripts/delta and update the contributor count at the top, and
|
||||
# double-check/update the other counters.
|
||||
#
|
||||
# 7. Commit the file using "RELEASE-NOTES: synced" as commit message.
|
||||
#
|
||||
################################################
|
||||
|
||||
my $cleanup = ($ARGV[0] eq "cleanup");
|
||||
my @gitlog=`git log @^{/RELEASE-NOTES:.synced}..` if(!$cleanup);
|
||||
my @releasenotes=`cat RELEASE-NOTES`;
|
||||
|
||||
my @o; # the entire new RELEASE-NOTES
|
||||
my @refused; # [num] = [2 bits of use info]
|
||||
my @refs; # [number] = [URL]
|
||||
for my $l (@releasenotes) {
|
||||
if($l =~ /^ o .*\[(\d+)\]/) {
|
||||
# referenced, set bit 0
|
||||
$refused[$1]=1;
|
||||
}
|
||||
elsif($l =~ /^ \[(\d+)\] = (.*)/) {
|
||||
# listed in a reference, set bit 1
|
||||
$refused[$1] |= 2;
|
||||
$refs[$1] = $2;
|
||||
}
|
||||
}
|
||||
|
||||
# Return a new fresh reference number
|
||||
sub getref {
|
||||
for my $r (1 .. $#refs) {
|
||||
if(!$refused[$r] & 1) {
|
||||
return $r;
|
||||
}
|
||||
}
|
||||
# add at the end
|
||||
return $#refs + 1;
|
||||
}
|
||||
|
||||
# '#num'
|
||||
# 'num'
|
||||
# 'https://github.com/curl/curl/issues/6939'
|
||||
# 'https://github.com/curl/curl-www/issues/69'
|
||||
# 'https://elsewhere.example.com/discussion'
|
||||
|
||||
sub extract {
|
||||
my ($ref)=@_;
|
||||
if($ref =~ /^(\#|)(\d+)/) {
|
||||
# return the plain number
|
||||
return $2;
|
||||
}
|
||||
elsif($ref =~ /^https:\/\/github.com\/curl\/curl\/.*\/(\d+)/) {
|
||||
# return the plain number
|
||||
return $1;
|
||||
}
|
||||
elsif($ref =~ /:\/\//) {
|
||||
# contains a '://', return the URL
|
||||
return $ref;
|
||||
}
|
||||
# false alarm, not a valid line
|
||||
}
|
||||
|
||||
my $short;
|
||||
my $first;
|
||||
for my $l (@gitlog) {
|
||||
chomp $l;
|
||||
if($l =~ /^commit/) {
|
||||
if($first) {
|
||||
onecommit($short);
|
||||
}
|
||||
# starts a new commit
|
||||
undef @fixes;
|
||||
undef @closes;
|
||||
undef @bug;
|
||||
$short = "";
|
||||
$first = 0;
|
||||
}
|
||||
elsif(($l =~ /^ (.*)/) && !$first) {
|
||||
# first line
|
||||
$short = $1;
|
||||
$short =~ s/ ?\[(ci skip|skip ci)\]//g;
|
||||
$first = 1;
|
||||
push @line, $short;
|
||||
}
|
||||
elsif(($l =~ /^ (.*)/) && $first) {
|
||||
# not the first
|
||||
my $line = $1;
|
||||
|
||||
if($line =~ /^Fixes(:|) *(.*)/i) {
|
||||
my $ref = extract($2);
|
||||
push @fixes, $ref if($ref);
|
||||
}
|
||||
elsif($line =~ /^Clo(s|)es(:|) *(.*)/i) {
|
||||
my $ref = extract($3);
|
||||
push @closes, $ref if($ref);
|
||||
}
|
||||
elsif($line =~ /^Bug: (.*)/i) {
|
||||
my $ref = extract($1);
|
||||
push @bug, $ref if($ref);
|
||||
}
|
||||
}
|
||||
}
|
||||
if($first) {
|
||||
onecommit($short);
|
||||
}
|
||||
|
||||
# call at the end of a parsed commit
|
||||
sub onecommit {
|
||||
my ($short)=@_;
|
||||
my $ref;
|
||||
|
||||
if($bug[0]) {
|
||||
$ref = $bug[0];
|
||||
}
|
||||
elsif($fixes[0]) {
|
||||
$ref = $fixes[0];
|
||||
}
|
||||
elsif($closes[0]) {
|
||||
$ref = $closes[0];
|
||||
}
|
||||
|
||||
if($ref =~ /^#?(\d+)/) {
|
||||
$ref = "https://curl.se/bug/?i=$1"
|
||||
}
|
||||
if($ref) {
|
||||
my $r = getref();
|
||||
$refs[$r] = $ref;
|
||||
$moreinfo{$short}=$r;
|
||||
$refused[$r] |= 1;
|
||||
}
|
||||
}
|
||||
|
||||
#### Output the new RELEASE-NOTES
|
||||
|
||||
my @bullets;
|
||||
for my $l (@releasenotes) {
|
||||
if(($l =~ /^This release includes the following bugfixes:/) && !$cleanup) {
|
||||
push @o, $l;
|
||||
push @o, "\n";
|
||||
for my $f (@line) {
|
||||
push @o, sprintf " o %s%s\n", $f,
|
||||
$moreinfo{$f}? sprintf(" [%d]", $moreinfo{$f}): "";
|
||||
$refused[$moreinfo{$f}]=3;
|
||||
}
|
||||
push @o, " --- new entries are listed above this ---";
|
||||
next;
|
||||
}
|
||||
elsif($cleanup) {
|
||||
if($l =~ /^ --- new entries are listed/) {
|
||||
# ignore this if still around
|
||||
next;
|
||||
}
|
||||
elsif($l =~ /^ o .*/) {
|
||||
push @bullets, $l;
|
||||
next;
|
||||
}
|
||||
elsif($bullets[0]) {
|
||||
# output them case insensitively
|
||||
for my $b (sort { "\L$a" cmp "\L$b" } @bullets) {
|
||||
push @o, $b;
|
||||
}
|
||||
undef @bullets;
|
||||
}
|
||||
}
|
||||
if($l =~ /^ \[(\d+)\] = /) {
|
||||
# stop now
|
||||
last;
|
||||
}
|
||||
else {
|
||||
push @o, $l;
|
||||
}
|
||||
}
|
||||
|
||||
my @srefs;
|
||||
my $ln;
|
||||
for my $n (1 .. $#refs) {
|
||||
my $r = $refs[$n];
|
||||
if($r && ($refused[$n] & 1)) {
|
||||
push @o, sprintf " [%d] = %s\n", $n, $r;
|
||||
}
|
||||
}
|
||||
|
||||
open(O, ">RELEASE-NOTES");
|
||||
for my $l (@o) {
|
||||
print O $l;
|
||||
}
|
||||
close(O);
|
||||
|
||||
exit;
|
||||
|
||||
# Debug: show unused references
|
||||
for my $r (1 .. $#refs) {
|
||||
if($refused[$r] != 3) {
|
||||
printf "%s is %d!\n", $r, $refused[$r];
|
||||
}
|
||||
}
|
207
deps/curl/scripts/schemetable.c
vendored
Normal file
207
deps/curl/scripts/schemetable.c
vendored
Normal file
@ -0,0 +1,207 @@
|
||||
/***************************************************************************
|
||||
* _ _ ____ _
|
||||
* Project ___| | | | _ \| |
|
||||
* / __| | | | |_) | |
|
||||
* | (__| |_| | _ <| |___
|
||||
* \___|\___/|_| \_\_____|
|
||||
*
|
||||
* Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
*
|
||||
* This software is licensed as described in the file COPYING, which
|
||||
* you should have received as part of this distribution. The terms
|
||||
* are also available at https://curl.se/docs/copyright.html.
|
||||
*
|
||||
* You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
* copies of the Software, and permit persons to whom the Software is
|
||||
* furnished to do so, under the terms of the COPYING file.
|
||||
*
|
||||
* This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
* KIND, either express or implied.
|
||||
*
|
||||
* SPDX-License-Identifier: curl
|
||||
*
|
||||
***************************************************************************/
|
||||
#include <stdio.h>
|
||||
#include <curl/curl.h>
|
||||
|
||||
/*
|
||||
* Use this tool to generate an updated table for the Curl_getn_scheme_handler
|
||||
* function in url.c.
|
||||
*/
|
||||
|
||||
struct detail {
|
||||
const char *n;
|
||||
const char *ifdef;
|
||||
};
|
||||
|
||||
static const struct detail scheme[] = {
|
||||
{"dict", "#ifndef CURL_DISABLE_DICT" },
|
||||
{"file", "#ifndef CURL_DISABLE_FILE" },
|
||||
{"ftp", "#ifndef CURL_DISABLE_FTP" },
|
||||
{"ftps", "#if defined(USE_SSL) && !defined(CURL_DISABLE_FTP)" },
|
||||
{"gopher", "#ifndef CURL_DISABLE_GOPHER" },
|
||||
{"gophers", "#if defined(USE_SSL) && !defined(CURL_DISABLE_GOPHER)" },
|
||||
{"http", "#ifndef CURL_DISABLE_HTTP" },
|
||||
{"https", "#if defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)" },
|
||||
{"imap", "#ifndef CURL_DISABLE_IMAP" },
|
||||
{"imaps", "#if defined(USE_SSL) && !defined(CURL_DISABLE_IMAP)" },
|
||||
{"ldap", "#ifndef CURL_DISABLE_LDAP" },
|
||||
{"ldaps", "#if !defined(CURL_DISABLE_LDAP) && \\\n"
|
||||
" !defined(CURL_DISABLE_LDAPS) && \\\n"
|
||||
" ((defined(USE_OPENLDAP) && defined(USE_SSL)) || \\\n"
|
||||
" (!defined(USE_OPENLDAP) && defined(HAVE_LDAP_SSL)))" },
|
||||
{"mqtt", "#ifndef CURL_DISABLE_MQTT" },
|
||||
{"pop3", "#ifndef CURL_DISABLE_POP3" },
|
||||
{"pop3s", "#if defined(USE_SSL) && !defined(CURL_DISABLE_POP3)" },
|
||||
{"rtmp", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpt", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpe", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpte", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmps", "#ifdef USE_LIBRTMP" },
|
||||
{"rtmpts", "#ifdef USE_LIBRTMP" },
|
||||
{"rtsp", "#ifndef CURL_DISABLE_RTSP" },
|
||||
{"scp", "#if defined(USE_SSH) && !defined(USE_WOLFSSH)" },
|
||||
{"sftp", "#if defined(USE_SSH)" },
|
||||
{"smb", "#if !defined(CURL_DISABLE_SMB) && defined(USE_CURL_NTLM_CORE) && \\\n"
|
||||
" (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smbs", "#if defined(USE_SSL) && !defined(CURL_DISABLE_SMB) && \\\n"
|
||||
" defined(USE_CURL_NTLM_CORE) && (SIZEOF_CURL_OFF_T > 4)" },
|
||||
{"smtp", "#ifndef CURL_DISABLE_SMTP" },
|
||||
{"smtps", "#if defined(USE_SSL) && !defined(CURL_DISABLE_SMTP)" },
|
||||
{"telnet", "#ifndef CURL_DISABLE_TELNET" },
|
||||
{"tftp", "#ifndef CURL_DISABLE_TFTP" },
|
||||
{"ws", "#if defined(USE_WEBSOCKETS) && !defined(CURL_DISABLE_HTTP)" },
|
||||
{"wss", "#if defined(USE_WEBSOCKETS) && \\\n"
|
||||
" defined(USE_SSL) && !defined(CURL_DISABLE_HTTP)" },
|
||||
{ NULL, NULL }
|
||||
};
|
||||
|
||||
unsigned int calc(const char *s, int add, int shift)
|
||||
{
|
||||
const char *so = s;
|
||||
unsigned int c = add;
|
||||
while(*s) {
|
||||
c <<= shift;
|
||||
c += *s;
|
||||
s++;
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
||||
unsigned int num[100];
|
||||
unsigned int ix[100];
|
||||
|
||||
static void showtable(int try, int init, int shift)
|
||||
{
|
||||
int nulls = 0;
|
||||
int i;
|
||||
for(i = 0; scheme[i].n; ++i)
|
||||
num[i] = calc(scheme[i].n, init, shift);
|
||||
for(i = 0; scheme[i].n; ++i)
|
||||
ix[i] = num[i] % try;
|
||||
printf("/*\n"
|
||||
" unsigned int c = %d\n"
|
||||
" while(l) {\n"
|
||||
" c <<= %d;\n"
|
||||
" c += Curl_raw_tolower(*s);\n"
|
||||
" s++;\n"
|
||||
" l--;\n"
|
||||
" }\n"
|
||||
"*/\n", init, shift);
|
||||
|
||||
printf(" static const struct Curl_handler * const protocols[%d] = {", try);
|
||||
|
||||
/* generate table */
|
||||
for(i=0; i < try; i++) {
|
||||
int match = 0;
|
||||
int j;
|
||||
for(j=0; scheme[j].n; j++) {
|
||||
if(ix[j] == i) {
|
||||
printf("\n");
|
||||
printf("%s\n", scheme[j].ifdef);
|
||||
printf(" &Curl_handler_%s,\n", scheme[j].n);
|
||||
printf("#else\n NULL,\n");
|
||||
printf("#endif");
|
||||
match = 1;
|
||||
nulls = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(!match) {
|
||||
if(!nulls || (nulls>10)) {
|
||||
printf("\n ");
|
||||
nulls = 0;
|
||||
}
|
||||
printf(" NULL,", nulls);
|
||||
nulls++;
|
||||
}
|
||||
}
|
||||
printf("\n };\n");
|
||||
}
|
||||
|
||||
int main(void)
|
||||
{
|
||||
int i;
|
||||
int try;
|
||||
int besttry = 9999;
|
||||
int bestadd = 0;
|
||||
int bestshift = 0;
|
||||
int add;
|
||||
int shift;
|
||||
for(shift = 0; shift < 8; shift++) {
|
||||
for(add = 0; add < 999; add++) {
|
||||
for(i = 0; scheme[i].n; ++i) {
|
||||
unsigned int v = calc(scheme[i].n, add, shift);
|
||||
int j;
|
||||
int badcombo = 0;
|
||||
for(j=0; j < i; j++) {
|
||||
|
||||
if(num[j] == v) {
|
||||
/*
|
||||
printf("NOPE: %u is a dupe (%s and %s)\n",
|
||||
v, scheme[i], scheme[j]);
|
||||
*/
|
||||
badcombo = 1;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if(badcombo)
|
||||
break;
|
||||
num[i] = v;
|
||||
}
|
||||
#if 0
|
||||
for(i = 0; scheme[i].n; ++i) {
|
||||
printf("%u - %s\n", num[i], scheme[i].n);
|
||||
}
|
||||
#endif
|
||||
/* try different remainders to find smallest possible table */
|
||||
for(try = 28; try < 199; try++) {
|
||||
int good = 1;
|
||||
for(i = 0; scheme[i].n; ++i) {
|
||||
ix[i] = num[i] % try;
|
||||
}
|
||||
/* check for dupes */
|
||||
for(i = 0; scheme[i].n && good; ++i) {
|
||||
int j;
|
||||
for(j=0; j < i; j++) {
|
||||
if(ix[j] == ix[i]) {
|
||||
/* printf("NOPE, try %u causes dupes (%d and %d)\n", try, j, i); */
|
||||
good = 0;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(good) {
|
||||
if(try < besttry) {
|
||||
besttry = try;
|
||||
bestadd = add;
|
||||
bestshift = shift;
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
showtable(besttry, bestadd, bestshift);
|
||||
}
|
234
deps/curl/scripts/singleuse.pl
vendored
Normal file
234
deps/curl/scripts/singleuse.pl
vendored
Normal file
@ -0,0 +1,234 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
#
|
||||
# This script is aimed to help scan for and detect globally declared functions
|
||||
# that are not used from other source files.
|
||||
#
|
||||
# Use it like this:
|
||||
#
|
||||
# $ ./scripts/singleuse.pl [--unit] lib/.libs/libcurl.a
|
||||
#
|
||||
# --unit : built to support unit tests
|
||||
#
|
||||
|
||||
my $unittests;
|
||||
if($ARGV[0] eq "--unit") {
|
||||
$unittests = "tests/unit ";
|
||||
shift @ARGV;
|
||||
}
|
||||
|
||||
my $file = $ARGV[0];
|
||||
|
||||
my %wl = (
|
||||
'curlx_uztoso' => 'cmdline tool use',
|
||||
);
|
||||
|
||||
my %api = (
|
||||
'curl_easy_cleanup' => 'API',
|
||||
'curl_easy_duphandle' => 'API',
|
||||
'curl_easy_escape' => 'API',
|
||||
'curl_easy_getinfo' => 'API',
|
||||
'curl_easy_init' => 'API',
|
||||
'curl_easy_pause' => 'API',
|
||||
'curl_easy_perform' => 'API',
|
||||
'curl_easy_recv' => 'API',
|
||||
'curl_easy_reset' => 'API',
|
||||
'curl_easy_send' => 'API',
|
||||
'curl_easy_setopt' => 'API',
|
||||
'curl_easy_strerror' => 'API',
|
||||
'curl_easy_unescape' => 'API',
|
||||
'curl_easy_upkeep' => 'API',
|
||||
'curl_easy_option_by_id' => 'API',
|
||||
'curl_easy_option_by_name' => 'API',
|
||||
'curl_easy_option_next' => 'API',
|
||||
'curl_escape' => 'API',
|
||||
'curl_formadd' => 'API',
|
||||
'curl_formfree' => 'API',
|
||||
'curl_formget' => 'API',
|
||||
'curl_free' => 'API',
|
||||
'curl_getdate' => 'API',
|
||||
'curl_getenv' => 'API',
|
||||
'curl_global_cleanup' => 'API',
|
||||
'curl_global_init' => 'API',
|
||||
'curl_global_init_mem' => 'API',
|
||||
'curl_global_sslset' => 'API',
|
||||
'curl_global_trace' => 'API',
|
||||
'curl_maprintf' => 'API',
|
||||
'curl_mfprintf' => 'API',
|
||||
'curl_mime_addpart' => 'API',
|
||||
'curl_mime_data' => 'API',
|
||||
'curl_mime_data_cb' => 'API',
|
||||
'curl_mime_encoder' => 'API',
|
||||
'curl_mime_filedata' => 'API',
|
||||
'curl_mime_filename' => 'API',
|
||||
'curl_mime_free' => 'API',
|
||||
'curl_mime_headers' => 'API',
|
||||
'curl_mime_init' => 'API',
|
||||
'curl_mime_name' => 'API',
|
||||
'curl_mime_subparts' => 'API',
|
||||
'curl_mime_type' => 'API',
|
||||
'curl_mprintf' => 'API',
|
||||
'curl_msnprintf' => 'API',
|
||||
'curl_msprintf' => 'API',
|
||||
'curl_multi_add_handle' => 'API',
|
||||
'curl_multi_assign' => 'API',
|
||||
'curl_multi_cleanup' => 'API',
|
||||
'curl_multi_fdset' => 'API',
|
||||
'curl_multi_get_handles' => 'API',
|
||||
'curl_multi_info_read' => 'API',
|
||||
'curl_multi_init' => 'API',
|
||||
'curl_multi_perform' => 'API',
|
||||
'curl_multi_remove_handle' => 'API',
|
||||
'curl_multi_setopt' => 'API',
|
||||
'curl_multi_socket' => 'API',
|
||||
'curl_multi_socket_action' => 'API',
|
||||
'curl_multi_socket_all' => 'API',
|
||||
'curl_multi_poll' => 'API',
|
||||
'curl_multi_strerror' => 'API',
|
||||
'curl_multi_timeout' => 'API',
|
||||
'curl_multi_wait' => 'API',
|
||||
'curl_multi_wakeup' => 'API',
|
||||
'curl_mvaprintf' => 'API',
|
||||
'curl_mvfprintf' => 'API',
|
||||
'curl_mvprintf' => 'API',
|
||||
'curl_mvsnprintf' => 'API',
|
||||
'curl_mvsprintf' => 'API',
|
||||
'curl_pushheader_byname' => 'API',
|
||||
'curl_pushheader_bynum' => 'API',
|
||||
'curl_share_cleanup' => 'API',
|
||||
'curl_share_init' => 'API',
|
||||
'curl_share_setopt' => 'API',
|
||||
'curl_share_strerror' => 'API',
|
||||
'curl_slist_append' => 'API',
|
||||
'curl_slist_free_all' => 'API',
|
||||
'curl_strequal' => 'API',
|
||||
'curl_strnequal' => 'API',
|
||||
'curl_unescape' => 'API',
|
||||
'curl_url' => 'API',
|
||||
'curl_url_cleanup' => 'API',
|
||||
'curl_url_dup' => 'API',
|
||||
'curl_url_get' => 'API',
|
||||
'curl_url_set' => 'API',
|
||||
'curl_url_strerror' => 'API',
|
||||
'curl_version' => 'API',
|
||||
'curl_version_info' => 'API',
|
||||
'curl_easy_header' => 'API',
|
||||
'curl_easy_nextheader' => 'API',
|
||||
'curl_ws_meta' => 'API',
|
||||
'curl_ws_recv' => 'API',
|
||||
'curl_ws_send' => 'API',
|
||||
|
||||
# the following functions are provided globally in debug builds
|
||||
'curl_easy_perform_ev' => 'debug-build',
|
||||
);
|
||||
|
||||
sub doublecheck {
|
||||
my ($f, $used) = @_;
|
||||
open(F, "git grep -le '$f\\W' -- lib ${unittests}packages|");
|
||||
my @also;
|
||||
while(<F>) {
|
||||
my $e = $_;
|
||||
chomp $e;
|
||||
if($e =~ /\.[c]$/) {
|
||||
if($e !~ /^lib\/${used}\.c/) {
|
||||
push @also, $e;
|
||||
}
|
||||
}
|
||||
}
|
||||
close(F);
|
||||
return @also;
|
||||
}
|
||||
|
||||
open(N, "nm $file|") ||
|
||||
die;
|
||||
|
||||
my %exist;
|
||||
my %uses;
|
||||
my $file;
|
||||
while (<N>) {
|
||||
my $l = $_;
|
||||
chomp $l;
|
||||
|
||||
if($l =~ /^([0-9a-z_-]+)\.o:/) {
|
||||
$file = $1;
|
||||
}
|
||||
if($l =~ /^([0-9a-f]+) T (.*)/) {
|
||||
my ($name)=($2);
|
||||
#print "Define $name in $file\n";
|
||||
$file =~ s/^libcurl_la-//;
|
||||
$exist{$name} = $file;
|
||||
}
|
||||
elsif($l =~ /^ U (.*)/) {
|
||||
my ($name)=($1);
|
||||
#print "Uses $name in $file\n";
|
||||
$uses{$name} .= "$file, ";
|
||||
}
|
||||
}
|
||||
close(N);
|
||||
|
||||
my $err;
|
||||
for(sort keys %exist) {
|
||||
#printf "%s is defined in %s, used by: %s\n", $_, $exist{$_}, $uses{$_};
|
||||
if(!$uses{$_}) {
|
||||
# this is a symbol with no "global" user
|
||||
if($_ =~ /^curl_dbg_/) {
|
||||
# we ignore the memdebug symbols
|
||||
}
|
||||
elsif($_ =~ /^curl_/) {
|
||||
if(!$api{$_}) {
|
||||
# not present in the API, or for debug-builds
|
||||
print STDERR "Bad curl-prefix: $_\n";
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
elsif($wl{$_}) {
|
||||
#print "$_ is WL\n";
|
||||
}
|
||||
else {
|
||||
my $c = $_;
|
||||
my @also = doublecheck($c, $exist{$c});
|
||||
if(!scalar(@also)) {
|
||||
printf "%s in %s\n", $c, $exist{$c};
|
||||
$err++;
|
||||
}
|
||||
# foreach my $a (@also) {
|
||||
# print " $a\n";
|
||||
# }
|
||||
}
|
||||
}
|
||||
elsif($_ =~ /^curl_/) {
|
||||
# global prefix, make sure it is "blessed"
|
||||
if(!$api{$_}) {
|
||||
# not present in the API, or for debug-builds
|
||||
if($_ !~ /^curl_dbg_/) {
|
||||
# ignore the memdebug symbols
|
||||
print STDERR "Bad curl-prefix $_\n";
|
||||
$err++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
exit $err;
|
357
deps/curl/scripts/updatemanpages.pl
vendored
Normal file
357
deps/curl/scripts/updatemanpages.pl
vendored
Normal file
@ -0,0 +1,357 @@
|
||||
#!/usr/bin/env perl
|
||||
#***************************************************************************
|
||||
# _ _ ____ _
|
||||
# Project ___| | | | _ \| |
|
||||
# / __| | | | |_) | |
|
||||
# | (__| |_| | _ <| |___
|
||||
# \___|\___/|_| \_\_____|
|
||||
#
|
||||
# Copyright (C) Daniel Stenberg, <daniel@haxx.se>, et al.
|
||||
#
|
||||
# This software is licensed as described in the file COPYING, which
|
||||
# you should have received as part of this distribution. The terms
|
||||
# are also available at https://curl.se/docs/copyright.html.
|
||||
#
|
||||
# You may opt to use, copy, modify, merge, publish, distribute and/or sell
|
||||
# copies of the Software, and permit persons to whom the Software is
|
||||
# furnished to do so, under the terms of the COPYING file.
|
||||
#
|
||||
# This software is distributed on an "AS IS" basis, WITHOUT WARRANTY OF ANY
|
||||
# KIND, either express or implied.
|
||||
#
|
||||
# SPDX-License-Identifier: curl
|
||||
#
|
||||
###########################################################################
|
||||
|
||||
# Update man pages.
|
||||
|
||||
use strict;
|
||||
use warnings;
|
||||
use Tie::File;
|
||||
|
||||
# Data from the command line.
|
||||
|
||||
my $curlver = $ARGV[0];
|
||||
my $curldate = $ARGV[1];
|
||||
|
||||
# Directories and extensions.
|
||||
|
||||
my @dirlist = ("docs/", "docs/libcurl/", "docs/libcurl/opts/", "tests/");
|
||||
my @extlist = (".1", ".3");
|
||||
my @excludelist = ("mk-ca-bundle.1", "template.3");
|
||||
|
||||
# Subroutines
|
||||
|
||||
sub printargs{
|
||||
# Print arguments and exit.
|
||||
|
||||
print "usage: updatemanpages.pl <version> <date>\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
sub getthline{
|
||||
# Process file looking for .TH section.
|
||||
|
||||
my $filename = shift;
|
||||
my $file_handle;
|
||||
my $file_line;
|
||||
|
||||
# Open the file.
|
||||
|
||||
open($file_handle, $filename);
|
||||
|
||||
# Look for the .TH section, process it into an array,
|
||||
# modify it and write to file.
|
||||
|
||||
tie(my @file_data, 'Tie::File', $filename);
|
||||
foreach my $file_data_line(@file_data) {
|
||||
if($file_data_line =~ /^.TH/) {
|
||||
$file_line = $file_data_line;
|
||||
last;
|
||||
}
|
||||
}
|
||||
|
||||
# Close the file.
|
||||
|
||||
close($file_handle);
|
||||
return $file_line;
|
||||
}
|
||||
|
||||
sub extractth{
|
||||
# Extract .TH section as an array.
|
||||
|
||||
my $input = shift;
|
||||
|
||||
# Split the line into an array.
|
||||
|
||||
my @tharray;
|
||||
my $inputsize = length($input);
|
||||
my $inputcurrent = "";
|
||||
my $quotemode = 0;
|
||||
|
||||
for(my $inputseek = 0; $inputseek < $inputsize; $inputseek++) {
|
||||
|
||||
if(substr($input, $inputseek, 1) eq " " && $quotemode eq 0) {
|
||||
push(@tharray, $inputcurrent);
|
||||
$inputcurrent = "";
|
||||
next;
|
||||
}
|
||||
|
||||
$inputcurrent = $inputcurrent . substr($input, $inputseek, 1);
|
||||
|
||||
if(substr($input, $inputseek, 1) eq "\"") {
|
||||
if($quotemode eq 0) {
|
||||
$quotemode = 1;
|
||||
}
|
||||
else {
|
||||
$quotemode = 0;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if($inputcurrent ne "") {
|
||||
push(@tharray, $inputcurrent);
|
||||
}
|
||||
|
||||
return @tharray;
|
||||
}
|
||||
|
||||
sub getdate{
|
||||
# Get the date from the .TH section.
|
||||
|
||||
my $filename = shift;
|
||||
my $thline;
|
||||
my @tharray;
|
||||
my $date = "";
|
||||
|
||||
$thline = getthline($filename);
|
||||
|
||||
# Return nothing if there is no .TH section found.
|
||||
|
||||
if(!$thline || $thline eq "") {
|
||||
return "";
|
||||
}
|
||||
|
||||
@tharray = extractth($thline);
|
||||
|
||||
# Remove the quotes at the start and end.
|
||||
|
||||
$date = substr($tharray[3], 1, -1);
|
||||
return $date;
|
||||
}
|
||||
|
||||
sub processth{
|
||||
# Process .TH section.
|
||||
|
||||
my $input = shift;
|
||||
my $date = shift;
|
||||
|
||||
# Split the line into an array.
|
||||
|
||||
my @tharray = extractth($input);
|
||||
|
||||
# Alter the date.
|
||||
|
||||
my $itemdate = "\"";
|
||||
$itemdate .= $date;
|
||||
$itemdate .= "\"";
|
||||
$tharray[3] = $itemdate;
|
||||
|
||||
# Alter the item version.
|
||||
|
||||
my $itemver = $tharray[4];
|
||||
my $itemname = "";
|
||||
|
||||
for(my $itemnameseek = 1;
|
||||
$itemnameseek < length($itemver);
|
||||
$itemnameseek++) {
|
||||
if(substr($itemver, $itemnameseek, 1) eq " " ||
|
||||
substr($itemver, $itemnameseek, 1) eq "\"") {
|
||||
last;
|
||||
}
|
||||
$itemname .= substr($itemver, $itemnameseek, 1);
|
||||
}
|
||||
|
||||
$itemver = "\"";
|
||||
$itemver .= $itemname;
|
||||
$itemver .= " ";
|
||||
$itemver .= $curlver;
|
||||
$itemver .= "\"";
|
||||
|
||||
$tharray[4] = $itemver;
|
||||
|
||||
my $thoutput = "";
|
||||
|
||||
foreach my $thvalue (@tharray) {
|
||||
$thoutput .= $thvalue;
|
||||
$thoutput .= " ";
|
||||
}
|
||||
$thoutput =~ s/\s+$//;
|
||||
$thoutput .= "\n";
|
||||
|
||||
# Return updated string.
|
||||
|
||||
return $thoutput;
|
||||
}
|
||||
|
||||
sub processfile{
|
||||
# Process file looking for .TH section.
|
||||
|
||||
my $filename = shift;
|
||||
my $date = shift;
|
||||
my $file_handle;
|
||||
my $file_dist_handle;
|
||||
my $filename_dist;
|
||||
|
||||
# Open a handle for the original file and a second file handle
|
||||
# for the dist file.
|
||||
|
||||
$filename_dist = $filename . ".dist";
|
||||
|
||||
open($file_handle, $filename);
|
||||
open($file_dist_handle, ">" . $filename_dist);
|
||||
|
||||
# Look for the .TH section, process it into an array,
|
||||
# modify it and write to file.
|
||||
|
||||
tie(my @file_data, 'Tie::File', $filename);
|
||||
foreach my $file_data_line (@file_data) {
|
||||
if($file_data_line =~ /^.TH/) {
|
||||
my $file_dist_line = processth($file_data_line, $date);
|
||||
print $file_dist_handle $file_dist_line . "\n";
|
||||
}
|
||||
else {
|
||||
print $file_dist_handle $file_data_line . "\n";
|
||||
}
|
||||
}
|
||||
|
||||
# Close the file.
|
||||
|
||||
close($file_handle);
|
||||
close($file_dist_handle);
|
||||
}
|
||||
|
||||
# Check that $curlver is set, otherwise print arguments and exit.
|
||||
|
||||
if(!$curlver) {
|
||||
printargs();
|
||||
}
|
||||
|
||||
# check to see that the git command works, it requires git 2.6 something
|
||||
my $gitcheck = `git log -1 --date="format:%B %d, %Y" $dirlist[0] 2>/dev/null`;
|
||||
if(length($gitcheck) < 1) {
|
||||
print "git version too old or $dirlist[0] is a bad argument\n";
|
||||
exit;
|
||||
}
|
||||
|
||||
# Look in each directory.
|
||||
|
||||
my $dir_handle;
|
||||
|
||||
foreach my $dirname (@dirlist) {
|
||||
foreach my $extname (@extlist) {
|
||||
# Go through the directory looking for files ending with
|
||||
# the current extension.
|
||||
|
||||
opendir($dir_handle, $dirname);
|
||||
my @filelist = grep(/.$extname$/i, readdir($dir_handle));
|
||||
|
||||
foreach my $file (@filelist) {
|
||||
# Skip if file is in exclude list.
|
||||
|
||||
if(grep(/^$file$/, @excludelist)) {
|
||||
next;
|
||||
}
|
||||
|
||||
# Load the file and get the date.
|
||||
|
||||
my $filedate;
|
||||
|
||||
# Check if dist version exists and load date from that
|
||||
# file if it does.
|
||||
|
||||
if(-e ($dirname . $file . ".dist")) {
|
||||
$filedate = getdate(($dirname . $file . ".dist"));
|
||||
}
|
||||
else {
|
||||
$filedate = getdate(($dirname . $file));
|
||||
}
|
||||
|
||||
# Skip if value is empty.
|
||||
|
||||
if(!$filedate || $filedate eq "") {
|
||||
next;
|
||||
}
|
||||
|
||||
# Check the man page in the git repository.
|
||||
|
||||
my $repodata = `LC_TIME=C git log -1 --date="format:%B %d, %Y" \\
|
||||
--since="$filedate" $dirname$file | grep ^Date:`;
|
||||
|
||||
# If there is output then update the man page
|
||||
# with the new date/version.
|
||||
|
||||
# Process the file if there is output.
|
||||
|
||||
if($repodata) {
|
||||
my $thisdate;
|
||||
if(!$curldate) {
|
||||
if($repodata =~ /^Date: +(.*)/) {
|
||||
$thisdate = $1;
|
||||
}
|
||||
else {
|
||||
print STDERR "Warning: " . ($dirname . $file) . ": found no " .
|
||||
"date\n";
|
||||
}
|
||||
}
|
||||
else {
|
||||
$thisdate = $curldate;
|
||||
}
|
||||
processfile(($dirname . $file), $thisdate);
|
||||
print $dirname . $file . " page updated to $thisdate\n";
|
||||
}
|
||||
}
|
||||
closedir($dir_handle);
|
||||
}
|
||||
}
|
||||
|
||||
__END__
|
||||
|
||||
=pod
|
||||
|
||||
=head1 updatemanpages.pl
|
||||
|
||||
Updates the man pages with the version number and optional date. If the date
|
||||
isn't provided, the last modified date from git is used.
|
||||
|
||||
=head2 USAGE
|
||||
|
||||
updatemanpages.pl version [date]
|
||||
|
||||
=head3 version
|
||||
|
||||
Specifies version (required)
|
||||
|
||||
=head3 date
|
||||
|
||||
Specifies date (optional)
|
||||
|
||||
=head2 SETTINGS
|
||||
|
||||
=head3 @dirlist
|
||||
|
||||
Specifies the list of directories to look for files in.
|
||||
|
||||
=head3 @extlist
|
||||
|
||||
Specifies the list of files with extensions to process.
|
||||
|
||||
=head3 @excludelist
|
||||
|
||||
Specifies the list of files to not process.
|
||||
|
||||
=head2 NOTES
|
||||
|
||||
This script is used during maketgz.
|
||||
|
||||
=cut
|
Reference in New Issue
Block a user