NixOS / nixpkgs

Nix Packages collection & NixOS
MIT License
18.06k stars 14.1k forks source link

Package request: namcap #241911

Open Freed-Wu opened 1 year ago

Freed-Wu commented 1 year ago

Project description

Namcap is a lint tool pacman packages that checks binary packages and source PKGBUILDs for common packaging errors.

Metadata

SamLukeYes commented 1 year ago

I tried to package namcap in https://github.com/NixOS/nixpkgs/pull/242319, but it seems to provide useless warnings in my system.

$ ./result/bin/namcap -m ~/paru-repo/nbmerge-0.0.4-2-any.pkg.tar.zst    # NixOS host
nbmerge W: python-module-no-package-associated pkg_resources.load_entry_point ['usr/bin/nbmerge']
nbmerge W: python-module-no-package-associated nbformat.read ['usr/lib/python3.11/site-packages/nbmerge/__init__.py']
nbmerge W: python-module-no-package-associated importlib_metadata.distribution ['usr/bin/nbmerge']
nbmerge W: python-module-no-package-associated nbformat.write ['usr/lib/python3.11/site-packages/nbmerge/__init__.py']
nbmerge W: library-no-package-associated python ['usr/bin/nbmerge']
nbmerge W: dependency-not-needed jupyter-nbformat

$ namcap -m ~/paru-repo/nbmerge-0.0.4-2-any.pkg.tar.zst    # Arch container
nbmerge E: dependency-detected-not-included python-setuptools (python-modules-needed ['pkg_resources.load_entry_point'] ['usr/bin/nbmerge'])
nbmerge E: dependency-detected-not-included python-importlib-metadata (python-modules-needed ['importlib_metadata.distribution'] ['usr/bin/nbmerge'])

Maybe it's still better to run namcap on Arch to provide information that is actually helpful. I've already packaged devtools, which can run namcap after packaging in a clean chroot, in Archix.

mediocregopher commented 4 months ago

I also took a stab at this, using @SamLukeYes 's work as a base, but was also unable to make it work. Nevertheless, if someone more capable than me is feeling brave, this would be a great addition for those of us using nix to build Arch packages. It would allow adding an automatic check to ensure a package is well-formed prior to releasing it, without the builder needing to be running Arch.