gardenappl / vrms-arch

Virtual Richard M. Stallman for Arch Linux
BSD 3-Clause "New" or "Revised" License
13 stars 6 forks source link

Feature Request: Highlight offending non-free licenses #16

Open IsaacGerma opened 5 months ago

IsaacGerma commented 5 months ago

When VRMS detects a package that seems to be non-free, it will currently list the non-free packages and all of the licenses associated with each one.

The main problem is that in the output, VRMS does not make a distinction between the free packages and the non-free packages, which can make it tedious to figure out why VRMS flagged a package.

This could be fixed by having color or some other form of highlighting in the output to indicate the status of a package and the associated license.

gardenappl commented 5 months ago

If we're handling the 'AND' operator and filtering out the known free licenses, it's probably easier to just display the licenses that are left afterwards.

IsaacGerma commented 5 months ago

Not exactly the solution you mentioned, but re-writing list_all_nonfree_packages() like this would highlight the non-free licenses:

    def list_all_nonfree_packages(self):
        for nfpackage in sorted(self.nonfree_packages, key=lambda pkg: pkg.name):
            print("%s: [" % (nfpackage.name), end="")
            for license in nfpackage.licenses:
                clean_license = clean_license_name(license)
                if clean_license in FREE_LICENSES:
                    print(license, ", ", end="", sep="")
                else:
                    print("\033[91m{}, \033[00m" .format(license), end="")
            print("]"

image

gardenappl commented 5 months ago

I don't want to rely on color codes. The previous maintainer made the output machine-readable, maybe just because that's the simpler method, but in theory that output could be used in scripting, so to accommodate that we should specify which licenses are non-free without the use of ANSI color codes.