Skip to content

Add Lua rockspec package handler for LuaRocks dependencies - #4743

Open
SLASH217 wants to merge 29 commits into
aboutcode-org:developfrom
SLASH217:support_rockspec
Open

SLASH217 wants to merge 29 commits into
aboutcode-org:developfrom
SLASH217:support_rockspec

Conversation

@SLASH217

@SLASH217 SLASH217 commented Feb 13, 2026 •

Copy link
Copy Markdown

Add Lua rockspec package handler for LuaRocks dependencies

Fixes #3526

Changes

  • Register RockspecHandler to detect LuaRocks .rockspec manifests and parse them with luaparser.
  • Report package metadata, including name, version, description, license, and URLs, along with declared dependencies.
  • Add nine tests covering handler registration, file detection, and parsed package data.
  • Update the supported package formats documentation, CHANGELOG.rst, and AUTHORS.rst.

Validation

  • pytest tests/packagedcode/test_rockspec.py -q: 9 passed locally.

Tasks

  • Reviewed contribution guidelines
  • PR is descriptively titled 📑 and links the original issue above 🔗
  • Tests pass -- look for a green checkbox ✔️ a few minutes after opening your PR
    Run tests locally to check for errors.
  • Commits are in uniquely-named feature branch and has no merge conflicts 📁
  • Updated documentation pages (if applicable)
  • Updated CHANGELOG.rst (if applicable)

Signed-off-by: Prashanna Dahal prashanna217@gmail.com

@SLASH217
SLASH217 force-pushed the support_rockspec branch 2 times, most recently from c84c872 to 3b359de Compare February 13, 2026 16:57

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks++ @SLASH217 for the PR, looking good already, but you need to modify the tests so we can see the full output and verify the functionality added before I can do an in depth review. Added some other feedback you also need to address.

Comment thread tests/packagedcode/test_rockspec.py Resolved
Comment thread src/packagedcode/rockspec.py Resolved
Comment thread src/packagedcode/rockspec.py Resolved
Comment thread src/packagedcode/rockspec.py Resolved
Comment thread setup.cfg Resolved
Comment thread requirements.txt Resolved
Comment thread CONTRIBUTING.rst Resolved
@AyanSinhaMahapatra AyanSinhaMahapatra added the need-changes PR needs to be updated with feedback label Feb 18, 2026
@SLASH217

Copy link
Copy Markdown
Author

Thank you for your feedback and valuable time.
I will diligently make the updates and push as soon as possible.

@SLASH217
SLASH217 force-pushed the support_rockspec branch 5 times, most recently from 127f3fc to 21ca2ff Compare February 20, 2026 21:13
@SLASH217

Copy link
Copy Markdown
Author

@AyanSinhaMahapatra I have updated the PR, adding all the fixes you have requested.
Please do review it!

@AyanSinhaMahapatra AyanSinhaMahapatra left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Thanks @SLASH217, almost there. A couple small changes suggested for your consideration.

Could you also check if #3249 is fixed by this? See #3249 (comment) for the input.

Comment thread tests/packagedcode/test_rockspec.py Resolved
Comment thread tests/packagedcode/test_rockspec.py Resolved
Comment thread requirements.txt Resolved
@SLASH217

Copy link
Copy Markdown
Author

Understood! I will get to work as soon my exams end.

SLASH217 added 14 commits June 1, 2026 14:31
Implement base handler class and Lua rockspec parser
using luaparser for AST-based dependency extraction.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Extract package metadata and dependencies from
rockspec files with version specification parsing.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
* Test parser with real Kong rockspec file
* Test handler integration with patterns

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Register handler in APPLICATION_PACKAGE_DATAFILE_HANDLERS
to enable automatic .rockspec file detection.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
* Update contributing-docs link to new structure
* Ensure both documentation links work correctly
* Point to getting-started/contribute path

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Change luaparser from == to match project's version pinning pattern:
* requirements.txt: luaparser==1.4.3 (exact pinning)
* setup.cfg: luaparser == 1.4.3 (exact pinning)

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
- This was causing a test to fail in CI/CD
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
- Extra "/n" causing failure of CI/CD
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
-- Added links for source of .rockspec files used in testing.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
-- Modules not required to be parsed
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
SLASH217 added 5 commits June 1, 2026 14:38
-- updated to be lower bound

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
-- use check_packages_data
-- instead of manually asserting data one by one.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
-- Causing the CI/CD to fail.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
@SLASH217
SLASH217 force-pushed the support_rockspec branch from c843ee1 to 57bf647 Compare June 1, 2026 09:03
SLASH217 added 5 commits June 1, 2026 17:03
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
…e version in purl if it is not pinned

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
…ames as original file names were changed

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
@SLASH217
SLASH217 force-pushed the support_rockspec branch from f785c99 to b9be3b5 Compare June 1, 2026 11:38
@SLASH217

SLASH217 commented Jun 1, 2026

Copy link
Copy Markdown
Author

Thanks @SLASH217, almost there. A couple small changes suggested for your consideration.

Could you also check if #3249 is fixed by this? See #3249 (comment) for the input.

I have made the changes as requested.
Yes, I believe that this pull request fixes #3249 as well.

@KraMorK

KraMorK commented Dec 2, 2026

Copy link
Copy Markdown

Hi @SLASH217, thanks for working on this! LuaRocks/rockspec support is something we need
(we'd like to use ScanCode to check licenses of Lua packages, and the current release
v33.0.0 doesn't parse .rockspec).

Could you tell us where this stands?

  • Do you plan to finish and update this PR, or is anything still pending on your side?
  • If you have already addressed the latest review comments (the last commit is from 2026-06-01),
    it may be waiting for a re-review.

@AyanSinhaMahapatra, is there anything left that blocks merging?

If the author has no time to continue, we'd be glad to take it over: we would fork your branch,
keep your commits and authorship, address the remaining review comments and open a follow-up PR.
Please let us know which you'd prefer so we don't duplicate work.

@AyanSinhaMahapatra

Copy link
Copy Markdown
Member

@KraMorK thank you for your interest, let me do another pass of review to check what is remaining. In any case, forking, using the original commits and adding changes on top is perfectly fine and exactly what we want. Please go ahead if you want to add more changes. Let's get this merged (we will have another release in a week so this could be released soon too) 😊

@SLASH217

SLASH217 commented Dec 2, 2026

Copy link
Copy Markdown
Author

Thanks @KraMorK and @AyanSinhaMahapatra, and apologies for the slow updates on my side.

@KraMorK, I'd like to keep working on this PR, so please hold off on forking it for now.

@AyanSinhaMahapatra, I addressed your Apr 15 comments on Jun 1. Since you're doing another pass, could you let me know if anything else needs to change, including any docs or CHANGELOG updates? I'll make the changes promptly.

Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
Signed-off-by: Prashanna Dahal <prashanna217@gmail.com>
@SLASH217

SLASH217 commented Dec 2, 2026

Copy link
Copy Markdown
Author

@AyanSinhaMahapatra I merged upstream develop into this branch and pushed the update. I added the LuaRocks docs and changelog entry here, and moved the unrelated CONTRIBUTING.rst link fixes to #5583.

I also rechecked #3249. The Yocto sample you linked contains no .rockspec, so this PR doesn’t change its scan results. Later in the same thread, Kong came up as an example where ScanCode didn’t recognize the .rockspec. This PR fixes that part: ScanCode now detects Kong from its manifest and includes it as a CycloneDX component. So my earlier claim was too broad : this addresses #3526, but doesn’t close #3249.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

need-changes PR needs to be updated with feedback

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for luarocks spec

3 participants