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

Hackage and GHC version enumeration (#1418) #1463

Merged

Conversation

frasertweedale
Copy link
Contributor

Add version enumeration for the Haskell ecosystems: Hackage (the main package index) and GHC (the toolchain).

Fixes: #1418

@google-cla
Copy link

google-cla bot commented Jul 14, 2023

Thanks for your pull request! It looks like this may be your first contribution to a Google open source project. Before we can look at your pull request, you'll need to sign a Contributor License Agreement (CLA).

View this failed invocation of the CLA check for more information.

For the most up to date status, view the checks section at the bottom of the pull request.

Copy link
Member

@michaelkedar michaelkedar left a comment

Choose a reason for hiding this comment

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

Thanks for doing this!

Looks mostly good to me, just a few small things

osv/ecosystems/hackage.py Outdated Show resolved Hide resolved
osv/ecosystems/hackage.py Outdated Show resolved Hide resolved
@frasertweedale frasertweedale force-pushed the ecosystem/hackage-ghc-enumeration branch from a7fb10c to 53c0b75 Compare July 18, 2023 01:54
Copy link
Member

@michaelkedar michaelkedar left a comment

Choose a reason for hiding this comment

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

LGTM, just one typo

osv/ecosystems/haskell.py Outdated Show resolved Hide resolved
osv/ecosystems/haskell.py Outdated Show resolved Hide resolved
@frasertweedale frasertweedale force-pushed the ecosystem/hackage-ghc-enumeration branch 4 times, most recently from b43ac22 to e3355e4 Compare July 20, 2023 04:22
@michaelkedar
Copy link
Member

/gcbrun

@michaelkedar
Copy link
Member

I got this error when running the tests

ERROR: test_next_version (osv.ecosystems.haskell_test.GHCEcosystemTest.test_next_version)
Test next_version.
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/workspace/osv/ecosystems/haskell_test.py", line 41, in test_next_version
    self.assertEqual('0.29', ecosystem.next_version('GHC', '0'))
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/osv/ecosystems/helper_base.py", line 46, in next_version
    versions = self.enumerate_versions(package, version, fixed=None)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/osv/ecosystems/haskell.py", line 143, in enumerate_versions
    self.sort_versions(versions)
  File "/workspace/osv/ecosystems/helper_base.py", line 65, in sort_versions
    versions.sort(key=self.sort_key)
  File "/workspace/osv/ecosystems/haskell.py", line 96, in sort_key
    return semver_index.parse(version)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/workspace/osv/semver_index.py", line 104, in parse
    return semver.Version.parse(coerce(version))
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/builder/home/.local/share/virtualenvs/workspace-dqq3IVyd/lib/python3.11/site-packages/semver/version.py", line 646, in parse
    raise ValueError(f"{version} is not valid SemVer string")
ValueError: 7.10.3a is not valid SemVer string

----------------------------------------------------------------------

@frasertweedale
Copy link
Contributor Author

Thanks, looking into it.

@frasertweedale frasertweedale force-pushed the ecosystem/hackage-ghc-enumeration branch from e3355e4 to e22b57e Compare July 21, 2023 01:59
@frasertweedale
Copy link
Contributor Author

There was one tag with an unexpected format that snuck through the checks and caused this failure. I made the tag processing more strict.

@frasertweedale frasertweedale force-pushed the ecosystem/hackage-ghc-enumeration branch from e22b57e to aca59d6 Compare July 21, 2023 02:54
Add version enumeration for the Haskell ecosystems: Hackage (the
main package index) and GHC (the toolchain).

Fixes: google#1418
@frasertweedale frasertweedale force-pushed the ecosystem/hackage-ghc-enumeration branch from aca59d6 to 42813fb Compare July 21, 2023 03:13
@michaelkedar
Copy link
Member

/gcbrun

Copy link
Member

@michaelkedar michaelkedar left a comment

Choose a reason for hiding this comment

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

This all LGTM. Thanks again for working on this!

I'm going to merge this now and trigger a reimport on our staging instance. We should start to see the affected versions being populated.

If everything's working, this will go into production when we do a release next week.

@michaelkedar michaelkedar merged commit 05d02d2 into google:master Jul 21, 2023
8 checks passed
@frasertweedale frasertweedale deleted the ecosystem/hackage-ghc-enumeration branch July 21, 2023 05:20
@frasertweedale
Copy link
Contributor Author

Thanks for your reviews!

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.

add HSEC (Haskell) security advisories data source
2 participants