Initial preparations for CURL and Discord integration.

This commit is contained in:
Sandu Liviu Catalin
2021-01-27 07:27:48 +02:00
parent 8257eb61d6
commit 95705e87c8
1751 changed files with 440547 additions and 854 deletions
+57
View File
@@ -0,0 +1,57 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
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
+155
View File
@@ -0,0 +1,155 @@
#!/usr/bin/env perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
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;
$option .= ":'$arg'" if defined $arg;
$option .= ':_files'
if defined $arg and ($arg eq '<file>' || $arg eq '<filename>'
|| $arg eq '<dir>');
}
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
+98
View File
@@ -0,0 +1,98 @@
#!/bin/sh
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2013-2020, 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.
#
###########################################################################
#
# 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 ../curl-www log --pretty=full --use-mailmap $start..HEAD
fi
) | \
egrep -ai '(^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 | \
grep -a ' ' | \
sort -fu | \
awk '{
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 {
printf(" %s\n", p);
printf(" (%d contributors)\n", num);
}
'
+76
View File
@@ -0,0 +1,76 @@
#!/bin/sh
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2013 - 2020, 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.
#
###########################################################################
#
# 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
) | \
egrep -ai '(^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 | \
grep -a ' ' | \
sort -fu | \
grep -aixvf ./docs/THANKS
+183
View File
@@ -0,0 +1,183 @@
#!/usr/bin/perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2021, 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.
#
###########################################################################
#
# Invoke script in the root of the git checkout. Scans all files in git unless
# given a specific single file.
#
# Usage: copyright.pl [file]
#
# regexes of files to not scan
my @skiplist=(
'^tests\/data\/test(\d+)$', # test case data
'^docs\/cmdline-opts\/[a-z]+(.*)\.d$', # curl.1 pieces
'(\/|^)[A-Z0-9_.-]+$', # all uppercase file name, possibly with dot and dash
'(\/|^)[A-Z0-9_-]+\.md$', # all uppercase file name with .md extension
'.gitignore', # wherever they are
'.gitattributes', # wherever they are
'^tests/certs/.*', # generated certs
'^tests/stunnel.pem', # generated cert
'^tests/valgrind.supp', # valgrind suppressions
'^projects/Windows/.*.dsw$', # generated MSVC file
'^projects/Windows/.*.sln$', # generated MSVC file
'^projects/Windows/.*.tmpl$', # generated MSVC file
'^projects/Windows/.*.vcxproj.filters$', # generated MSVC file
'^m4/ax_compile_check_sizeof.m4$', # imported, leave be
'^.mailmap', # git control file
'\/readme',
'^.github/', # github instruction files
'^.dcignore', # deepcode.ai instruction file
'^.muse/', # muse-CI control files
"buildconf", # its nothing to copyright
# docs/ files we're okay with without copyright
'INSTALL.cmake',
'TheArtOfHttpScripting',
'page-footer',
'curl_multi_socket_all.3',
'curl_strnequal.3',
'symbols-in-versions',
'options-in-versions',
# macos-framework files
'^lib\/libcurl.plist',
'^lib\/libcurl.vers.in',
# vms files
'^packages\/vms\/build_vms.com',
'^packages\/vms\/curl_release_note_start.txt',
'^packages\/vms\/curlmsg.sdl',
'^packages\/vms\/macro32_exactcase.patch',
# XML junk
'^projects\/wolfssl_override.props',
# macos framework generated files
'^src\/macos\/curl.mcp.xml.sit.hqx',
'^src\/macos\/src\/curl_GUSIConfig.cpp',
# checksrc control files
'\.checksrc$',
);
sub scanfile {
my ($f) = @_;
my $line=1;
my $found = 0;
open(F, "<$f") ||
print ERROR "can't open $f\n";
while (<F>) {
chomp;
my $l = $_;
# check for a copyright statement and save the years
if($l =~ /.* +copyright .* *\d\d\d\d/i) {
while($l =~ /([\d]{4})/g) {
push @copyright, {
year => $1,
line => $line,
col => index($l, $1),
code => $l
};
$found++;
}
}
# allow within the first 100 lines
if(++$line > 100) {
last;
}
}
close(F);
return $found;
}
sub checkfile {
my ($file) = @_;
my $fine = 0;
@copyright=();
my $found = scanfile($file);
if(!$found) {
print "$file:1: missing copyright range\n";
return 2;
}
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) {
printf "$file:%d: copyright year out of date, should be $commityear, " .
"is $copyright[0]{year}\n",
$copyright[0]{line};
}
else {
$fine = 1;
}
return $fine;
}
my @all;
if($ARGV[0]) {
push @all, $ARGV[0];
}
else {
@all = `git ls-files`;
}
for my $f (@all) {
chomp $f;
my $skipped = 0;
for my $skip (@skiplist) {
#print "$f matches $skip ?\n";
if($f =~ /$skip/) {
$skiplisted++;
$skipped = 1;
#print "$f: SKIPPED ($skip)\n";
last;
}
}
if(!$skipped) {
my $r = checkfile($f);
$missing++ if($r == 2);
$wrong++ if(!$r);
}
}
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);
exit 1 if($missing || $wrong);
+37
View File
@@ -0,0 +1,37 @@
#!/bin/sh
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
./buildconf
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
+140
View File
@@ -0,0 +1,140 @@
#!/usr/bin/perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2018-2020, 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.
#
###########################################################################
# 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 tag was set
$bcontribs = `git show $start:docs/THANKS | grep -c '^[^ ]'`;
# delta
$contribs = $acontribs - $bcontribs;
# number of setops:
$asetopts=`grep '^ CURLOPT(' include/curl/curl.h | grep -cv OBSOLETE`;
$bsetopts=`git show $start:include/curl/curl.h | grep '^ CURLOPT(' | grep -cv OBSOLETE`;
$nsetopts = $asetopts - $bsetopts;
# Number of command line options:
$aoptions=`grep -c '{"....--' src/tool_help.c`;
$boptions=`git show $start:src/tool_help.c | grep -c '{"....--'`;
$noptions=$aoptions - $boptions;
# Number of files in git
$afiles=`git ls-files | wc -l`;
$deletes=`git diff-tree --diff-filter=A -r --summary origin/master $start | wc -l`;
$creates=`git diff-tree --diff-filter=D -r --summary origin/master $start | 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
# 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`;
# 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\n",
$elapsed / 3600 / 24;
printf "Commits: %d (out of %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 "Deleted %d files, added %d files (total %d)\n",
$deletes, $creates, $afiles;
print "Diffstat:$diffstat";
+48
View File
@@ -0,0 +1,48 @@
#!/bin/bash
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
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"
+102
View File
@@ -0,0 +1,102 @@
#!/usr/bin/env perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
# 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;
}
print
' _ _ ____ _
___| | | | _ \| |
/ __| | | | |_) | |
| (__| |_| | _ <| |___
\___|\___/|_| \_\_____|
Changelog
';
my $line;
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: *(.*) +</) {
$a = $1;
}
elsif($l =~ /^Commit: *(.*) +</) {
$c = $1;
}
elsif($l =~ /^CommitDate: (.*)/) {
$date = nicedate($1);
}
elsif($l =~ /^( )(.*)/) {
my $extra;
if ($tag) {
# Version entries have a special format
print "\nVersion " . $tag." ($date)\n";
$oldc = "";
$tag = "";
}
if($a ne $c) {
$extra=sprintf("\n- [%s brought this change]\n\n ", $a);
}
else {
$extra="\n- ";
}
if($co ne $oldco) {
if($c ne $oldc) {
print "\n$c ($date)$extra";
}
else {
print "$extra";
}
$line =0;
}
$oldco = $co;
$oldc = $c;
$olddate = $date;
if($line++) {
print " ";
}
print $2."\n";
}
}
+214
View File
@@ -0,0 +1,214 @@
#!/usr/bin/perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2020, 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.
#
###########################################################################
###############################################
#
# ==== 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):
#
# $ ./script/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;
}
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;
$first = 1;
push @line, $short;
}
elsif(($l =~ /^ (.*)/) && $first) {
# not the first
my $line = $1;
if($line =~ /^Fixes(:|) .*[^0-9](\d+)/i) {
push @fixes, $2;
}
elsif($line =~ /^Closes(:|) .*[^0-9](\d+)/i) {
push @closes, $2;
}
elsif($line =~ /^Bug: (.*)/i) {
push @bug, $1;
}
}
}
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];
}
}
+218
View File
@@ -0,0 +1,218 @@
#!/usr/bin/perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 2019 - 2021, 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.
#
###########################################################################
#
# 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 lib/.libs/libcurl.a
#
# Be aware that it might cause false positives due to various build options.
#
my $file = $ARGV[0];
my %wl = (
'Curl_none_cert_status_request' => 'multiple TLS backends',
'Curl_none_check_cxn' => 'multiple TLS backends',
'Curl_none_cleanup' => 'multiple TLS backends',
'Curl_none_close_all' => 'multiple TLS backends',
'Curl_none_data_pending' => 'multiple TLS backends',
'Curl_none_engines_list' => 'multiple TLS backends',
'Curl_none_init' => 'multiple TLS backends',
'Curl_none_md5sum' => 'multiple TLS backends',
'Curl_none_random' => 'multiple TLS backends',
'Curl_none_session_free' => 'multiple TLS backends',
'Curl_none_set_engine' => 'multiple TLS backends',
'Curl_none_set_engine_default' => 'multiple TLS backends',
'Curl_none_shutdown' => 'multiple TLS backends',
'Curl_multi_dump' => 'debug build only',
'Curl_parse_port' => 'UNITTEST',
'Curl_shuffle_addr' => 'UNITTEST',
'de_cleanup' => 'UNITTEST',
'doh_decode' => 'UNITTEST',
'doh_encode' => 'UNITTEST',
'Curl_auth_digest_get_pair' => 'by digest_sspi',
'curlx_uztoso' => 'cmdline tool use',
'curlx_uztoul' => 'by krb5_sspi',
'curlx_uitous' => 'by schannel',
'Curl_islower' => 'by curl_fnmatch',
'getaddressinfo' => 'UNITTEST',
);
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_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_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_version' => 'API',
'curl_version_info' => 'API',
# the following functions are provided globally in debug builds
'curl_easy_perform_ev' => 'debug-build',
);
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 {
printf "%s is defined in %s, but not used outside\n", $_, $exist{$_};
$err++;
}
}
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;
+176
View File
@@ -0,0 +1,176 @@
#!/bin/bash
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2021, 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.
#
###########################################################################
set -eo pipefail
./buildconf
if [ "$NGTCP2" = yes ]; then
if [ "$TRAVIS_OS_NAME" = linux -a "$GNUTLS" ]; then
cd $HOME
git clone --depth 1 https://gitlab.com/gnutls/nettle.git
cd nettle
./.bootstrap
./configure LDFLAGS="-Wl,-rpath,$HOME/ngbuild/lib" --disable-documentation --prefix=$HOME/ngbuild
make
make install
cd $HOME
git clone --depth 1 https://gitlab.com/gnutls/gnutls.git pgtls
cd pgtls
./bootstrap
./configure PKG_CONFIG_PATH=$HOME/ngbuild/lib/pkgconfig LDFLAGS="-Wl,-rpath,$HOME/ngbuild/lib" --with-included-libtasn1 --with-included-unistring --disable-guile --disable-doc --prefix=$HOME/ngbuild
make
make install
else
cd $HOME
git clone --depth 1 -b OpenSSL_1_1_1g-quic-draft-29 https://github.com/tatsuhiro-t/openssl possl
cd possl
./config enable-tls1_3 --prefix=$HOME/ngbuild
make
make install_sw
fi
cd $HOME
git clone --depth 1 https://github.com/ngtcp2/nghttp3
cd nghttp3
autoreconf -i
./configure --prefix=$HOME/ngbuild --enable-lib-only
make
make install
cd $HOME
git clone --depth 1 https://github.com/ngtcp2/ngtcp2
cd ngtcp2
autoreconf -i
if test -n "$GNUTLS"; then
WITHGNUTLS="--with-gnutls"
fi
./configure PKG_CONFIG_PATH=$HOME/ngbuild/lib/pkgconfig LDFLAGS="-Wl,-rpath,$HOME/ngbuild/lib" --prefix=$HOME/ngbuild --enable-lib-only $WITHGNUTLS
make
make install
fi
if [ "$TRAVIS_OS_NAME" = linux -a "$BORINGSSL" ]; then
cd $HOME
git clone --depth=1 https://boringssl.googlesource.com/boringssl
cd boringssl
CXX="g++" CC="gcc" cmake -H. -Bbuild -GNinja -DCMAKE_BUILD_TYPE=release -DBUILD_SHARED_LIBS=1
cmake --build build
mkdir lib
cp ./build/crypto/libcrypto.so ./lib/
cp ./build/ssl/libssl.so ./lib/
echo "BoringSSL lib dir: "`pwd`"/lib"
cmake --build build --target clean
rm -f build/CMakeCache.txt
CXX="g++" CC="gcc" cmake -H. -Bbuild -GNinja -DCMAKE_POSITION_INDEPENDENT_CODE=on
cmake --build build
export LIBS=-lpthread
fi
if [ "$TRAVIS_OS_NAME" = linux -a "$OPENSSL3" ]; then
cd $HOME
git clone --depth=1 https://github.com/openssl/openssl
cd openssl
./config enable-tls1_3 --prefix=$HOME/openssl3
make
make install_sw
fi
if [ "$TRAVIS_OS_NAME" = linux -a "$LIBRESSL" ]; then
cd $HOME
git clone --depth=1 -b v3.1.4 https://github.com/libressl-portable/portable.git libressl-git
cd libressl-git
./autogen.sh
./configure --prefix=$HOME/libressl
make
make install
fi
if [ "$TRAVIS_OS_NAME" = linux -a "$HYPER" ]; then
cd $HOME
git clone --depth=1 https://github.com/hyperium/hyper.git
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
cd $HOME/hyper
RUSTFLAGS="--cfg hyper_unstable_ffi" cargo build --features client,http1,http2,ffi
fi
if [ "$TRAVIS_OS_NAME" = linux -a "$QUICHE" ]; then
cd $HOME
git clone --depth=1 --recursive https://github.com/cloudflare/quiche.git
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
cd $HOME/quiche
cargo build -v --release --features pkg-config-meta,qlog
mkdir -v deps/boringssl/src/lib
ln -vnf $(find target/release -name libcrypto.a -o -name libssl.a) deps/boringssl/src/lib/
fi
# Install common libraries.
# The library build directories are set to be cached by .travis.yml. If you are
# changing a build directory name below (eg a version change) then you must
# change it in .travis.yml `cache: directories:` as well.
if [ $TRAVIS_OS_NAME = linux ]; then
if [ ! -e $HOME/wolfssl-4.4.0-stable/Makefile ]; then
cd $HOME
curl -LO https://github.com/wolfSSL/wolfssl/archive/v4.4.0-stable.tar.gz
tar -xzf v4.4.0-stable.tar.gz
cd wolfssl-4.4.0-stable
./autogen.sh
./configure --enable-tls13 --enable-all
touch wolfssl/wolfcrypt/fips.h
make
fi
cd $HOME/wolfssl-4.4.0-stable
sudo make install
if [ "$MESALINK" = "yes" ]; then
if [ ! -e $HOME/mesalink-1.0.0/Makefile ]; then
cd $HOME
curl https://sh.rustup.rs -sSf | sh -s -- -y
source $HOME/.cargo/env
curl -LO https://github.com/mesalock-linux/mesalink/archive/v1.0.0.tar.gz
tar -xzf v1.0.0.tar.gz
cd mesalink-1.0.0
./autogen.sh
./configure --enable-tls13
make
fi
cd $HOME/mesalink-1.0.0
sudo make install
fi
if [ ! -e $HOME/nghttp2-1.39.2/Makefile ]; then
cd $HOME
curl -LO https://github.com/nghttp2/nghttp2/releases/download/v1.39.2/nghttp2-1.39.2.tar.gz
tar -xzf nghttp2-1.39.2.tar.gz
cd nghttp2-1.39.2
CXX="g++-8" CC="gcc-8" CFLAGS="" LDFLAGS="" LIBS="" ./configure --disable-threads --enable-app
make
fi
cd $HOME/nghttp2-1.39.2
sudo make install
fi
+22
View File
@@ -0,0 +1,22 @@
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
export CPPFLAGS="-DCURL_DOES_CONVERSIONS -DHAVE_ICONV -DCURL_ICONV_CODESET_OF_HOST='\"ISO8859-1\"'"
+165
View File
@@ -0,0 +1,165 @@
#!/bin/bash
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2021, 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.
#
###########################################################################
set -eo pipefail
./buildconf
if [ "$T" = "coverage" ]; then
./configure --enable-debug --disable-shared --disable-threaded-resolver --enable-code-coverage --enable-werror --with-libssh2
make
make TFLAGS=-n test-nonflaky
make "TFLAGS=-n -e" test-nonflaky
tests="1 200 300 500 700 800 900 1000 1100 1200 1302 1400 1502 3000"
make "TFLAGS=-n -t $tests" test-nonflaky
coveralls --gcov /usr/bin/gcov-8 --gcov-options '\-lp' -i src -e lib -e tests -e docs -b $PWD/src
coveralls --gcov /usr/bin/gcov-8 --gcov-options '\-lp' -e src -i lib -e tests -e docs -b $PWD/lib
fi
if [ "$T" = "torture" ]; then
./configure --enable-debug --disable-shared --disable-threaded-resolver --enable-code-coverage --enable-werror --with-libssh2
make
make TFLAGS=-n test-nonflaky
make "TFLAGS=-n -e" test-nonflaky
tests="1 200 300 500 700 800 900 1000 1100 1200 1302 1400 1502 3000"
make "TFLAGS=-n --shallow=40 -t $tests" test-nonflaky
fi
if [ "$T" = "debug" ]; then
./configure --enable-debug --enable-werror $C
make
make examples
if [ -z $NOTESTS ]; then
make test-nonflaky
fi
fi
if [ "$T" = "debug-wolfssl" ]; then
./configure --enable-debug --enable-werror $C
make
make "TFLAGS=-n !313" test-nonflaky
fi
if [ "$T" = "debug-mesalink" ]; then
./configure --enable-debug --enable-werror $C
make
make "TFLAGS=-n !313 !410 !3001" test-nonflaky
fi
if [ "$T" = "novalgrind" ]; then
./configure --enable-werror $C
make
make examples
make TFLAGS=-n test-nonflaky
fi
if [ "$T" = "normal" ]; then
if [ $TRAVIS_OS_NAME = linux ]; then
# Remove system curl to make sure we don't rely on it.
# Only done on Linux since we're not permitted to on mac.
sudo rm -f /usr/bin/curl
fi
./configure --enable-warnings --enable-werror $C
make
make examples
if [ -z $NOTESTS ]; then
make test-nonflaky
fi
if [ -n "$CHECKSRC" ]; then
make checksrc
fi
fi
if [ "$T" = "tidy" ]; then
./configure --enable-warnings --enable-werror $C
make
make tidy
fi
if [ "$T" = "iconv" ]; then
source scripts/travis/iconv-env.sh
./configure --enable-debug --enable-werror $C
make
make examples
make test-nonflaky
fi
if [ "$T" = "cmake" ]; then
cmake -H. -Bbuild -DCURL_WERROR=ON $C
cmake --build build
env TFLAGS="!1139 $TFLAGS" cmake --build build --target test-nonflaky
fi
if [ "$T" = "distcheck" ]; then
# find BOM markers and exit if we do
! git grep `printf '\xef\xbb\xbf'`
./configure
make
./maketgz 99.98.97
# verify in-tree build - and install it
tar xf curl-99.98.97.tar.gz
cd curl-99.98.97
./configure --prefix=$HOME/temp
make
make TFLAGS=1 test
make install
# basic check of the installed files
cd ..
bash scripts/installcheck.sh $HOME/temp
rm -rf curl-99.98.97
# verify out-of-tree build
tar xf curl-99.98.97.tar.gz
touch curl-99.98.97/docs/{cmdline-opts,libcurl}/Makefile.inc
mkdir build
cd build
../curl-99.98.97/configure
make
make TFLAGS='-p 1 1139' test
# verify cmake build
cd ..
rm -rf curl-99.98.97
tar xf curl-99.98.97.tar.gz
cd curl-99.98.97
mkdir build
cd build
cmake ..
make
cd ../..
fi
if [ "$T" = "fuzzer" ]; then
# Download the fuzzer to a temporary folder
./tests/fuzz/download_fuzzer.sh /tmp/curl_fuzzer
export CURLSRC=$PWD
# Run the mainline fuzzer test
pushd /tmp/curl_fuzzer
./mainline.sh ${CURLSRC}
popd
fi
if [ "$T" = "scan-build" ]; then
scan-build ./configure --enable-debug --enable-werror $C
scan-build --status-bugs make
scan-build --status-bugs make examples
fi
+355
View File
@@ -0,0 +1,355 @@
#!/usr/bin/env perl
#***************************************************************************
# _ _ ____ _
# Project ___| | | | _ \| |
# / __| | | | |_) | |
# | (__| |_| | _ <| |___
# \___|\___/|_| \_\_____|
#
# Copyright (C) 1998 - 2020, 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.
#
###########################################################################
# 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