Skip to content

Commit d38a14d

Browse files
authored
Merge pull request #2 from cvvergara/main
Creating v0.1.0
2 parents 561a13c + a065c87 commit d38a14d

File tree

224 files changed

+32178
-41
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

224 files changed

+32178
-41
lines changed

.clang-tidy

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
Checks: >
2+
google-*,
3+
-google-readability-braces-around-statements,
4+
-google-readability-casting,
5+
clang-analyzer-*,
6+
-clang-analyzer-unix.Malloc,
7+
clang-diagnostic-*,
8+
-clang-diagnostic-sign-conversion,
9+
cppcoreguidelines-avoid-capturing-lambda-coroutines,
10+
cppcoreguidelines-avoid-goto,
11+
cppcoreguidelines-avoid-non-const-global-variables,
12+
cppcoreguidelines-avoid-reference-coroutine-parameters
13+
14+
WarningsAsErrors: ''
15+
HeaderFilterRegex: './include'
16+
FormatStyle: none
17+
InheritParentConfig: true

.editorconfig

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
# http://editorconfig.org
2+
3+
# top-most EditorConfig file
4+
root = true
5+
6+
# Defaults if not specified later
7+
[*]
8+
indent_size = 4
9+
indent_style = space
10+
charset = utf-8
11+
end_of_line = lf
12+
insert_final_newline = true
13+
trim_trailing_whitespace = true
14+
15+
# SQL files want space indentation
16+
[*.sql]
17+
indent_style = space
18+
indent_size = 2
19+
20+
# C++ files want space indentation
21+
[*.{c,h,cpp,hpp,inl}]
22+
indent_style = space
23+
indent_size = 4
24+
25+
# Makefiles want tab indentation
26+
[Makefile]
27+
indent_style = tab
28+
indent_size = 8
29+
30+
# YML files want space indentation
31+
[*.yml]
32+
indent_style = space
33+
34+
[.github/workflow/*.yml]
35+
indent_style = space
36+
indent_size = 2
37+
end_of_line = lf
38+
charset = utf-8
39+
trim_trailing_whitespace = true
40+
insert_final_newline = true
41+
42+
# CMake configuration files
43+
[{CMakeLists.txt,*.cmake}]
44+
indent_size = 2
45+
indent_style = space
46+
47+
# RST files
48+
[*.rst]
49+
indent_size = 3
50+
indent_style = space
51+
52+
# RST files
53+
[*.html]
54+
indent_size = 2
55+
indent_style = space

.github/scripts/notes2news.pl

Lines changed: 176 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,176 @@
1+
#!/usr/bin/perl -w
2+
=pod
3+
/*PGR-GNU*****************************************************************
4+
File: notes2news.pl
5+
Copyright (c) 2017 pgRouting developers
6+
Mail: project@pgrouting.org
7+
------
8+
This program is free software; you can redistribute it and/or modify
9+
it under the terms of the GNU General Public License as published by
10+
the Free Software Foundation; either version 2 of the License, or
11+
(at your option) any later version.
12+
This program is distributed in the hope that it will be useful,
13+
but WITHOUT ANY WARRANTY; without even the implied warranty of
14+
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15+
GNU General Public License for more details.
16+
You should have received a copy of the GNU General Public License
17+
along with this program; if not, write to the Free Software
18+
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
19+
********************************************************************PGR-GNU*/
20+
=cut
21+
use strict;
22+
use warnings;
23+
use File::Find;
24+
use Data::Dumper;
25+
26+
sub Usage {
27+
die "Usage: notes2news.pl (from the root of the repository or pre-commit hook)\n";
28+
}
29+
30+
my $DEBUG = '';
31+
my $in_file = "doc/general/release_notes.rst";
32+
my $out_file = "NEWS.md";
33+
34+
my $ofh;
35+
open($ofh, ">$out_file") || die "ERROR: failed to open '$out_file' for write! : $!\n";
36+
37+
my $ifh;
38+
open($ifh, "$in_file") || die "ERROR: failed to open '$in_file' for read! : $!\n";
39+
40+
my %conversions = get_substitutions();
41+
my $check = join '|', keys %conversions;
42+
print Dumper(\%conversions) if $DEBUG;
43+
44+
45+
my $skipping = 1;
46+
my $file = '';
47+
my $start = '';
48+
my $end = '';
49+
while (my $line = <$ifh>) {
50+
next if $skipping and $line !~ /^pgvroom/;
51+
$skipping = 0;
52+
53+
next if $line =~ /contents|:local:|:depth:|\*\*\*\*\*\*\*|\=\=\=\=\=\=\=|\-\-\-\-\-\-\-|\+\+\+\+\+\+\+\+/;
54+
55+
$line =~ s/[\|]+//g;
56+
$line =~ s/($check)/$conversions{$1}/go;
57+
58+
# Handling the headers
59+
if ($line =~ m/^pgvroom [0-9]$/i) {
60+
print $ofh "# $line";
61+
next;
62+
};
63+
if ($line =~ m/^pgvroom [0-9].[0-9]$/i) {
64+
print $ofh "## $line";
65+
next;
66+
};
67+
if ($line =~ m/^pgvroom [0-9].[0-9].[0-9] Release Notes$/i) {
68+
print $ofh "### $line";
69+
next;
70+
};
71+
72+
# get include filename
73+
if ($line =~ /include/) {
74+
$line =~ s/^.*include\:\: (.*)/$1/;
75+
chomp $line;
76+
$line =~ s/^\s+//;
77+
$file = $line;
78+
my @wanted_files;
79+
find(
80+
sub{
81+
-f $_ && $_ =~ /$file/
82+
&& push @wanted_files,$File::Find::name
83+
}, "doc"
84+
);
85+
foreach(@wanted_files){
86+
print "wanted: $_\n" if $DEBUG;
87+
}
88+
$file = $wanted_files[0];
89+
print "rewanted: $file\n" if $DEBUG;
90+
next;
91+
};
92+
93+
if ($line =~ /start\-after/) {
94+
$line =~ s/start\-after\:\ (.*)/$1/;
95+
$line =~ tr/://d;
96+
chomp $line;
97+
$line =~ s/^\s+//;
98+
$start = $line;
99+
next;
100+
};
101+
102+
if ($line =~ /end\-before/) {
103+
$line =~ s/end\-before\:\ (.*)/$1/;
104+
$line =~ tr/://d;
105+
chomp $line;
106+
$line =~ s/^\s+//;
107+
$end = $line;
108+
print "---> $file from $start to $end \n" if $DEBUG;
109+
find_stuff($file, $start, $end);
110+
next;
111+
}
112+
113+
114+
115+
# convert urls to markdown
116+
$line =~ s/`([^<]+?)\s*<([^>]+)>`_*/\[$1\]($2)/g;
117+
118+
$line =~ s/`(Git closed)/\[$1/g;
119+
$line =~ s/<([^>]+)>`_*/\]($1)/g;
120+
121+
# convert rubric to bold
122+
$line =~ s/^\.\. rubric::\s*(.+)$/**$1**/;
123+
124+
next if $line =~ /^\.\. _changelog/;
125+
126+
print $ofh $line;
127+
}
128+
129+
130+
close($ifh);
131+
close($ofh);
132+
133+
sub find_stuff {
134+
my ($file, $mstart, $mend) = @_;
135+
print "find_stuff $file from $mstart to $mend \n" if $DEBUG;
136+
my $fh;
137+
open($fh, "$file") || die "ERROR: failed to open '$file' for read! : $!\n";
138+
139+
my $skipping = 1;
140+
while (my $line = <$fh>) {
141+
next if $skipping and $line !~ /$mstart/;
142+
$skipping = 0;
143+
next if $line =~ /$mstart/;
144+
$line =~ s/[\|]+//g;
145+
$line =~ s/($check)/$conversions{$1}/go;
146+
print $ofh " $line" if $line !~ /$mend/;
147+
last if $line =~ /$mend/;
148+
}
149+
close($fh);
150+
}
151+
152+
sub get_substitutions {
153+
my $file = "doc/conf.py.in";
154+
my $mstart = "rst_epilog";
155+
my $mend = "epilog_end";
156+
print "get_substitutions $file from $mstart to $mend \n" if $DEBUG;
157+
my $fh;
158+
open($fh, "$file") || die "ERROR: failed to open '$file' for read! : $!\n";
159+
my %data;
160+
161+
my $skipping = 1;
162+
while (my $line = <$fh>) {
163+
next if $skipping and $line !~ /$mstart/;
164+
last if $line =~ /\|br\|/;
165+
$skipping = 0;
166+
next if $line =~ /$mstart/;
167+
last if $line =~ /$mend/;
168+
my ($key) = substr($line, 4, index(substr($line, 4), "|"));
169+
my ($value) = substr($line, index($line,"`"));
170+
$value =~ s/\R//g;
171+
$data{$key} = $value;
172+
print "$key $data{$key} \n" if $DEBUG;
173+
}
174+
close($fh);
175+
return %data;
176+
}
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
# ------------------------------------------------------------------------------
3+
# pgvroom Scripts
4+
# Copyright(c) pgvroom Contributors
5+
#
6+
# Remove all the obsolete entries, i.e. lines starting with #~ from .po files
7+
# ------------------------------------------------------------------------------
8+
9+
# For all the chapter files
10+
for file in locale/en/LC_MESSAGES/*.po; do
11+
if grep -q '#~' "$file"; then
12+
perl -pi -0777 -e 's/#~.*//s' "$file"
13+
git add "$file"
14+
fi
15+
done
16+

.github/scripts/test_license.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/usr/bin/env bash
2+
3+
# This test checks that all source files correctly have license headers
4+
5+
EXCLUDE_LIST="txt|sig|png|jpeg|_static|md|control|html|cfg"
6+
7+
mylicensecheck() {
8+
licensecheck -r --copyright -l 30 --tail 0 -i "$EXCLUDE_LIST" "$1"
9+
}
10+
11+
DIR=$(git rev-parse --show-toplevel)
12+
13+
pushd "${DIR}" > /dev/null || exit
14+
missing=$(! { mylicensecheck src & mylicensecheck sql & mylicensecheck include;} | grep "No copyright\|UNKNOWN")
15+
missing1=$(mylicensecheck doc | grep "No copyright")
16+
missing2=$(grep --files-without-match 'Creative Commons' doc/*/*.rst)
17+
popd > /dev/null || exit
18+
19+
#mylicensecheck doc
20+
error=0
21+
if [[ $missing ]]; then
22+
echo " ****************************************************"
23+
echo " *** Found source files without valid license headers"
24+
echo " ****************************************************"
25+
echo "$missing"
26+
error=1
27+
fi
28+
29+
if [[ $missing1 ]]; then
30+
echo " ****************************************************"
31+
echo " *** Found documentation files without copyright"
32+
echo " ****************************************************"
33+
echo "$missing1"
34+
error=1
35+
fi
36+
37+
if [[ $missing2 ]]; then
38+
echo " ****************************************************"
39+
echo " *** Found documentation files without valid license headers"
40+
echo " ****************************************************"
41+
echo "$missing2"
42+
error=1
43+
fi
44+
exit $error
45+

.github/scripts/test_shell.sh

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
# This runs shellcheck on all sh files
4+
5+
6+
DIR=$(git rev-parse --show-toplevel)
7+
8+
pushd "${DIR}" > /dev/null || exit
9+
code=0
10+
11+
for f in $(git ls-files | grep '\.sh')
12+
do
13+
result=$(shellcheck "${f}")
14+
15+
if [[ $result ]]; then
16+
echo "$result"
17+
echo " *** shellcheck found script errors while processing $f"
18+
code=1
19+
fi
20+
done
21+
popd > /dev/null || exit 1
22+
exit $code

.github/scripts/test_signatures.sh

Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
#!/bin/bash
2+
3+
# This test checks that signatures within mayors
4+
# Call from the root of the repository
5+
6+
DIR=$(git rev-parse --show-toplevel)/sql/sigs
7+
8+
pushd "${DIR}" > /dev/null || exit
9+
# For bash, uses temporary files
10+
mapfile -t SIGNATURES < <(git ls-files "*.sig" | perl -pe 's/pgvroom--(.*)\.sig/$1/')
11+
12+
for s1 in "${SIGNATURES[@]}"
13+
do
14+
for s2 in "${SIGNATURES[@]}"
15+
do
16+
# only comparing lower version with higher version
17+
if (( $(echo "$s1 >= $s2" | bc -l) )); then continue; fi
18+
19+
mayor1=$(echo "$s1" | perl -pe 's/([0-9]+).*/$1/')
20+
mayor2=$(echo "$s2" | perl -pe 's/([0-9]+).*/$1/')
21+
22+
# comparing within same mayors only
23+
if [ "$mayor1" != "$mayor2" ]; then continue; fi
24+
25+
# ignoring any signature changes made on v0
26+
if [ "$mayor1" == 0 ]; then continue; fi
27+
28+
missing+=$(diff "pgvroom--$s1.sig" "pgvroom--$s2.sig" | grep '<')
29+
done
30+
done
31+
32+
popd > /dev/null || exit
33+
34+
#mylicensecheck doc
35+
error=0
36+
if [[ $missing ]]; then
37+
echo " ****************************************************"
38+
echo " *** Found removed signatures"
39+
echo " ****************************************************"
40+
echo "$missing"
41+
error=1
42+
fi
43+
44+
exit $error
45+

0 commit comments

Comments
 (0)