Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

lestarch: fixing versioning #1474

Merged
merged 3 commits into from
May 24, 2022
Merged

Conversation

LeStarch
Copy link
Collaborator

Originating Project/Creator
Affected Component
Affected Architectures(s)
Related Issue(s)
Has Unit Tests (y/n)
Builds Without Errors (y/n)
Unit Tests Pass (y/n)
Documentation Included (y/n)

Change Description

Makes several changes:

  1. Adds versions.json to track our versions so they are more usable than "just python" versions
  2. Adds in improved error messages with installation hints
  3. Fixes setup.py to work with fprime-fpp and install various versions.

@LeStarch LeStarch requested a review from bocchino May 24, 2022 02:43
@LeStarch
Copy link
Collaborator Author

@bocchino this should fix CI for you. Versions are written in top-level versions.json.

@github-actions
Copy link

github-actions bot commented May 24, 2022

@check-spelling-bot Report

Unrecognized words, please review:

  • getppid
  • gettempdir
  • ppid
  • temproray
  • VID
Previously acknowledged words that are now absent aadl Accu adoc alignedallocator asciidoctor autodetect autonumbering awt bavail bbd bc bithacks BLSP bootup capout chown cinttypes Classloader classpath compat componentaction compositestructures concat configurator creatingdocsetswithdoxygen deserializer Dinstall dll doall Donatas donsim ecore eps errstr esac fprim FPRIMEPROTOCOL getenv gethostbyname getmtime gmail Gnd GNDIF groupadd groupmod hdp HOMEPAGE hostent ifchange IFXML IJET includefile inorder INSTALLDIR instanceof interoperability Inttype isfgen isfpluginexec isfxmlwriter itcl javabuilder javac javanature javax jdt jf JFile jmi JOption junit kevensen magicdraw mcternan mdbasiccomponents mdinternalstructures mdkernel mdports mdprofiles mdxml mdzip memoization memoize mngr mpmcs mscgen nasafprime netdb Netscape's NGAT nh nio nomagic nondetached nroff OMG's OS'es ovrTrace peeker placeholders PLUGINDIR Prepends println propvals PROTOCOLINTERFACE PYPI refman RHEL RPISCHEDCONTEXTS saikiranra sbt seander Simkunas SOCKETIPDRIVERTYPES SQL's sramanan startword strcat strcpy submenu tcl templating textui tgz tkgui tmpd tmpdir toclevels toolbar ubuntu uk ul uml useradd usermod ve virtualenv vmsize vn watney wget workaround workspaces Xmx Xss Xvfb
Some files were were automatically ignored

These sample patterns would exclude them:

^Drv/BlockDriver/BlockDriver\.hpp$
^Drv/LinuxGpioDriver/LinuxGpioDriver\.hpp$
^Drv/LinuxSpiDriver/LinuxSpiDriver\.hpp$
^Drv/TcpClient/TcpClient\.hpp$
^Fw/Types/Linux/StandardTypes\.hpp$
^Svc/LinuxTime/LinuxTime\.hpp$
^Svc/PrmDb/PrmDb\.hpp$
^Svc/TlmChan/TlmChan\.hpp$

You should consider adding them to:

.github/actions/spelling/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:LeStarch/fprime.git repository
on the update/better-versioning branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spelling/excludes.txt' - <<EOF
$should_exclude_patterns
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spelling/excludes.txt.temp' &&
mv '.github/actions/spelling/excludes.txt.temp' '.github/actions/spelling/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/nasa/fprime/issues/comments/1135340140" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  

should_exclude_patterns=$(perl -e '$/=undef;
$_=<>;
exit unless s{(?:You should consider excluding directory paths|You should consider adding them to).*}{}s;
s{.*These sample patterns would exclude them:}{}s;
s{.*\`\`\`([^`]*)\`\`\`.*}{$1}m;
print' < "$comment_body" | grep . || true)

update_files
rm $comment_body
git add -u

Copy link
Collaborator

@bocchino bocchino left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@github-actions
Copy link

github-actions bot commented May 24, 2022

@check-spelling-bot Report

Unrecognized words, please review:

  • ppid
Previously acknowledged words that are now absent aadl Accu adoc alignedallocator asciidoctor autodetect autonumbering awt bavail bbd bc bithacks BLSP bootup capout chown cinttypes Classloader classpath compat componentaction compositestructures concat configurator creatingdocsetswithdoxygen deserializer Dinstall dll doall Donatas donsim ecore eps errstr esac fprim FPRIMEPROTOCOL getenv gethostbyname getmtime gmail Gnd GNDIF groupadd groupmod hdp HOMEPAGE hostent ifchange IFXML IJET includefile inorder INSTALLDIR instanceof interoperability Inttype isfgen isfpluginexec isfxmlwriter itcl javabuilder javac javanature javax jdt jf JFile jmi JOption junit kevensen magicdraw mcternan mdbasiccomponents mdinternalstructures mdkernel mdports mdprofiles mdxml mdzip memoization memoize mngr mpmcs mscgen nasafprime netdb Netscape's NGAT nh nio nomagic nondetached nroff OMG's OS'es ovrTrace peeker placeholders PLUGINDIR Prepends println propvals PROTOCOLINTERFACE PYPI refman RHEL RPISCHEDCONTEXTS saikiranra sbt seander Simkunas SOCKETIPDRIVERTYPES SQL's sramanan startword strcat strcpy submenu tcl templating textui tgz tkgui tmpd tmpdir toclevels toolbar ubuntu uk ul uml useradd usermod ve virtualenv vmsize vn watney wget workaround workspaces Xmx Xss Xvfb
Some files were were automatically ignored

These sample patterns would exclude them:

^Drv/BlockDriver/BlockDriver\.hpp$
^Drv/LinuxGpioDriver/LinuxGpioDriver\.hpp$
^Drv/LinuxSpiDriver/LinuxSpiDriver\.hpp$
^Drv/TcpClient/TcpClient\.hpp$
^Fw/Types/Linux/StandardTypes\.hpp$
^Svc/LinuxTime/LinuxTime\.hpp$
^Svc/PrmDb/PrmDb\.hpp$
^Svc/TlmChan/TlmChan\.hpp$

You should consider adding them to:

.github/actions/spelling/excludes.txt

File matching is via Perl regular expressions.

To check these files, more of their words need to be in the dictionary than not. You can use patterns.txt to exclude portions, add items to the dictionary (e.g. by adding them to allow.txt), or fix typos.

To accept these unrecognized words as correct (and remove the previously acknowledged and now absent words), run the following commands

... in a clone of the git@github.com:LeStarch/fprime.git repository
on the update/better-versioning branch:

update_files() {
perl -e '
my @expect_files=qw('".github/actions/spelling/expect.txt"');
@ARGV=@expect_files;
my @stale=qw('"$patch_remove"');
my $re=join "|", @stale;
my $suffix=".".time();
my $previous="";
sub maybe_unlink { unlink($_[0]) if $_[0]; }
while (<>) {
if ($ARGV ne $old_argv) { maybe_unlink($previous); $previous="$ARGV$suffix"; rename($ARGV, $previous); open(ARGV_OUT, ">$ARGV"); select(ARGV_OUT); $old_argv = $ARGV; }
next if /^(?:$re)(?:(?:\r|\n)*$| .*)/; print;
}; maybe_unlink($previous);'
perl -e '
my $new_expect_file=".github/actions/spelling/expect.txt";
use File::Path qw(make_path);
use File::Basename qw(dirname);
make_path (dirname($new_expect_file));
open FILE, q{<}, $new_expect_file; chomp(my @words = <FILE>); close FILE;
my @add=qw('"$patch_add"');
my %items; @items{@words} = @words x (1); @items{@add} = @add x (1);
@words = sort {lc($a)."-".$a cmp lc($b)."-".$b} keys %items;
open FILE, q{>}, $new_expect_file; for my $word (@words) { print FILE "$word\n" if $word =~ /\w/; };
close FILE;
system("git", "add", $new_expect_file);
'
(cat '.github/actions/spelling/excludes.txt' - <<EOF
$should_exclude_patterns
EOF
) |grep .|
sort -f |
uniq > '.github/actions/spelling/excludes.txt.temp' &&
mv '.github/actions/spelling/excludes.txt.temp' '.github/actions/spelling/excludes.txt'
}

comment_json=$(mktemp)
curl -L -s -S \
  --header "Content-Type: application/json" \
  "https://api.github.com/repos/nasa/fprime/issues/comments/1135343563" > "$comment_json"
comment_body=$(mktemp)
jq -r .body < "$comment_json" > $comment_body
rm $comment_json

patch_remove=$(perl -ne 'next unless s{^</summary>(.*)</details>$}{$1}; print' < "$comment_body")
  

patch_add=$(perl -e '$/=undef;
$_=<>;
s{<details>.*}{}s;
s{^#.*}{};
s{\n##.*}{};
s{(?:^|\n)\s*\*}{}g;
s{\s+}{ }g;
print' < "$comment_body")
  

should_exclude_patterns=$(perl -e '$/=undef;
$_=<>;
exit unless s{(?:You should consider excluding directory paths|You should consider adding them to).*}{}s;
s{.*These sample patterns would exclude them:}{}s;
s{.*\`\`\`([^`]*)\`\`\`.*}{$1}m;
print' < "$comment_body" | grep . || true)

update_files
rm $comment_body
git add -u

@LeStarch LeStarch merged commit 959bff8 into nasa:devel May 24, 2022
LeStarch added a commit that referenced this pull request Jun 29, 2022
* lestarch: fixing versioning

* lestarch: sp

* lstarch: sp
@LeStarch LeStarch deleted the update/better-versioning branch October 4, 2022 18:33
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants