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

Add lua/rockspec cataloger #2613

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LaurentGoderre
Copy link
Contributor

No description provided.

@LaurentGoderre LaurentGoderre marked this pull request as ready for review February 16, 2024 19:07
@LaurentGoderre LaurentGoderre changed the title Add lua/rockspec cataloguer Add lua/rockspec cataloger Feb 16, 2024
@LaurentGoderre
Copy link
Contributor Author

Depends on anchore/packageurl-go#18

This comment has been minimized.

@LaurentGoderre LaurentGoderre force-pushed the lua-lang branch 5 times, most recently from a9cdb1b to afda7a1 Compare March 13, 2024 17:47
Copy link
Contributor

@kzantow kzantow left a comment

Choose a reason for hiding this comment

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

Sorry for the delay here, @LaurentGoderre. I left some feedback inline. I'll also note that this can be rebased to get rid of some duplicate changes from the packageurl lib upgrade. That said, one thing I'd like to make sure about is in fact, the luarock string in the packageurl that doesn't seem to match the notes in the spec types of just lua. EDIT: I see the discussion here about it, so luarock seems to be fine.

@@ -109,6 +110,7 @@ func DefaultPackageTaskFactories() PackageTaskFactories {
),
newSimplePackageTaskFactory(java.NewNativeImageCataloger, pkgcataloging.DirectoryTag, pkgcataloging.InstalledTag, pkgcataloging.ImageTag, pkgcataloging.LanguageTag, "java"),
newSimplePackageTaskFactory(nix.NewStoreCataloger, pkgcataloging.DirectoryTag, pkgcataloging.InstalledTag, pkgcataloging.ImageTag, pkgcataloging.LanguageTag, "nix"),
newSimplePackageTaskFactory(lua.NewPackageCataloger, pkgcataloging.DirectoryTag, pkgcataloging.InstalledTag, pkgcataloging.ImageTag, pkgcataloging.LanguageTag, "lua"),
Copy link
Contributor

Choose a reason for hiding this comment

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

Is it typical to find lua rockspec files in images (and "installed")?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't know about typical but the image that prompted this changed (Kong DOI) has them.

Copy link
Contributor

Choose a reason for hiding this comment

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

Indeed it does

root@9568d1a22c40:/# find / | grep rockspec | grep cjson
root@9568d1a22c40:/# luarocks install lua-cjson

Installing https://luarocks.org/lua-cjson-2.1.0.10-1.src.rock
lua-cjson 2.1.0.10-1 depends on lua >= 5.1 (5.4-1 provided by VM: success)
gcc -O2 -fPIC -I/usr/local/include -c lua_cjson.c -o lua_cjson.o
gcc -O2 -fPIC -I/usr/local/include -c strbuf.c -o strbuf.o
gcc -O2 -fPIC -I/usr/local/include -c fpconv.c -o fpconv.o
gcc  -shared -o /tmp/luarocks_build-lua-cjson-2.1.0.10-1-2704986/cjson.so lua_cjson.o strbuf.o fpconv.o
lua-cjson 2.1.0.10-1 is now installed in /usr/local (license: MIT)

root@9568d1a22c40:/# find / | grep rockspec | grep cjson
/usr/local/lib/luarocks/rocks-5.4/lua-cjson/2.1.0.10-1/lua-cjson-2.1.0.10-1.rockspec

I don't know if it's actively needed at runtime or if it is metadata that could be scrubbed and the lib still used. But the luarocks install command will leave rockspecs behind 👍 .

syft/pkg/cataloger/lua/package.go Outdated Show resolved Hide resolved
syft/pkg/cataloger/lua/package.go Outdated Show resolved Hide resolved
syft/pkg/cataloger/lua/package_test.go Outdated Show resolved Hide resolved
syft/pkg/cataloger/lua/package.go Outdated Show resolved Hide resolved
syft/pkg/cataloger/lua/parse_rockspec.go Outdated Show resolved Hide resolved
syft/pkg/cataloger/lua/parse_rockspec.go Outdated Show resolved Hide resolved
syft/pkg/type.go Outdated Show resolved Hide resolved
Comment on lines 4 to 10
Name string
Version string
License string
Homepage string
Description string
URL string
Dependencies map[string]string
Copy link
Contributor

Choose a reason for hiding this comment

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

These all need json tags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Better?

syft/pkg/cataloger/lua/rockspec_parser.go Show resolved Hide resolved

This comment has been minimized.

@LaurentGoderre LaurentGoderre force-pushed the lua-lang branch 4 times, most recently from c71f8f0 to cd4cac9 Compare April 9, 2024 13:46
Signed-off-by: Laurent Goderre <laurent.goderre@docker.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
json-schema Changes the json schema
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants