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

Update validate and versions, refactor metadata and urls #305

Merged
merged 7 commits into from
Mar 8, 2024

Conversation

johnmhoran
Copy link
Contributor

Reference: #247

Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran johnmhoran marked this pull request as draft February 24, 2024 23:33
…d code and tests #247

Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
…247

Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran johnmhoran marked this pull request as ready for review March 5, 2024 23:31
@johnmhoran johnmhoran requested a review from JonoYang March 5, 2024 23:32
@johnmhoran
Copy link
Contributor Author

@JonoYang Please review when you have the chance. Looking forward to your suggestions and questions. This comprises my work (subject to input from you and colleagues) on the first four commands: metadata, urls, validate and versions.

I've substantially updated, refactored and supplemented purlcli.py, test_purlcli.py and the related test files. All make test tests passed, all GH checks passed, no apparent merge conflict with main per GH.

Copy link
Contributor

@JonoYang JonoYang left a comment

Choose a reason for hiding this comment

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

@johnmhoran I have some suggestions for you.

purldb-toolkit/src/purldb_toolkit/purlcli.py Show resolved Hide resolved
purldb-toolkit/src/purldb_toolkit/purlcli.py Outdated Show resolved Hide resolved
purldb-toolkit/src/purldb_toolkit/purlcli.py Outdated Show resolved Hide resolved
purldb-toolkit/src/purldb_toolkit/purlcli.py Outdated Show resolved Hide resolved
purldb-toolkit/src/purldb_toolkit/purlcli.py Outdated Show resolved Hide resolved
purldb-toolkit/src/purldb_toolkit/purlcli.py Outdated Show resolved Hide resolved
purldb-toolkit/src/purldb_toolkit/purlcli.py Outdated Show resolved Hide resolved
Reference: #305
Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran
Copy link
Contributor Author

@JonoYang I've addressed all of your comments and committed and pushed; all GH checks passed (I had to rerun a 3.10 push check that failed initially -- transitory validation warning for one of the PURLs in one of the tests).

@johnmhoran
Copy link
Contributor Author

@JonoYang I'm taking a closer look at this, which doesn't look quite right. Maybe a copy-paste error on my part? Unable to find the possible source for that approach. This appears twice in purlcli.py.

log_file = Path(log_file=os.path.join(os.path.expanduser("~"), "app.log"))

Maybe it should be

log_file = Path(os.path.join(os.path.expanduser("~"), "app.log"))

Testing manually....

@johnmhoran
Copy link
Contributor Author

@JonoYang Unable so far to manually trigger a pkg:deb/debian/* error, which is the only way I know to test the try/except. ;-) Will keep trying because I'm sure that example had excess text (which I've removed and am testing). The error will surely occur again ....

@johnmhoran
Copy link
Contributor Author

@JonoYang I've replicated two rounds of the error followed by no error and see the app.log file gets created (in my Ubuntu-20.04 home/jmh/ directory) and populated properly and deleted in the next round as intended. I'll take care of running the main tests, commit and push this correction, and watch the GH checks run.

Reference: #305
Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran
Copy link
Contributor Author

@JonoYang All GH checks passed.

@johnmhoran johnmhoran requested a review from JonoYang March 7, 2024 03:07
Copy link
Contributor

@JonoYang JonoYang left a comment

Choose a reason for hiding this comment

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

@johnmhoran Looking good, I have a comment about setting the log file location as a constant at the top of the file, under the import statements.

if command_name == "urls" and urls_purl == "not_in_upstream_repo":
warnings.append(f"'{purl}' does not exist in the upstream repo")
continue
log_file = Path(os.path.join(os.path.expanduser("~"), "app.log"))
Copy link
Contributor

Choose a reason for hiding this comment

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

I see os.path.join(os.path.expanduser("~"), "app.log") referenced a few times through the code. I think it would be better to have this as a constant at the top of the file, like LOG_FILE_LOCATION = os.path.join(os.path.expanduser("~"), "app.log") and then use LOG_FILE_LOCATION in the necessary places.

I also think the log file should be named purlcli.log, or something that would indicate the log was created by purlcli

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Thank you @JonoYang -- I'll implement these improvements shortly. 👍

Reference: #305
Reference: #247

Signed-off-by: John M. Horan <johnmhoran@gmail.com>
@johnmhoran
Copy link
Contributor Author

@JonoYang Changes implemented, just one local failure with make test -- the usual minecode/tests/test_maven.py::MavenEnd2EndTest::test_visit_and_map_with_index -- and all GH checks passed.

@JonoYang
Copy link
Contributor

JonoYang commented Mar 8, 2024

Thanks! Merging this now

@JonoYang JonoYang merged commit c3c703a into main Mar 8, 2024
7 checks passed
@JonoYang JonoYang deleted the 247-purlcli-update-validate-and-versions branch March 8, 2024 00:00
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