Proposal: Include the Application Name in Ports and Packages

From: probono <probono_at_puredarwin.org>
Date: Thu, 08 Jul 2021 20:35:12 UTC
Hello,

This is a proposal to include the Application Name in Ports and Packages.
Happy to hear your thoughts on this.

Kind regards,
probono


Terminology
-----------

Application Port: A port that contains a graphical application and
hence has an Exec= key in its share/applications/*.desktop file

Application Name: The application name (as intended by the application
author). It may contain uppercase characters, whitespace, and special
characters. Examples: "Qalculate!", "KTurtle", "SpeedCrunch".

Port Name: The package name is lowercase and does not contain special
characters. Most frequently it is not identical to the Application
Name. Examples: Examples: "math/qalculate", "lang/kturtle",
"math/speedcrunch".

Package Name: Same as with the Port Name. Examples: "qalculate",
"kturtle", "speedcrunch".

Situation
---------

The Application Name is the #1 metadata that should be shown to users
in application catalogs, package managers, app centers, app stores,
and so on.
Basic tasks should be simple. Knowing the Application Name is a very
basic task yet suprisingly nether Ports nor Packages contain this
information: Currently there is no way to know the Application Name
from looking at the files in /usr/ports/, and pkg only displays the
Package Name but not the Application Name.
App centers like freshports.org, OctoPkg, and GhostBSD Software
Station hence also cannot show the Application Name but have to resort
to showing Port Names without having to download all packages first,
which defeats the purpose of having Ports/Packages metadata outside of
the packages themselves.
When BSD was started, it was centered mostly around command line
tools, which usually have names equal to the Package Name, so in the
beginning this was not an issue. But with graphical applications, this
is no longer the case.

Heuristics
----------

1. In most cases, the Application Name is contained in the value of
the Name= key in the share/applications/*.desktop file of the main
application contained in the port.

2. If one of the first few words in the pkg-desc file is the word
"is", then the word(s) appearing before "is" in the pkg-desc file
often contain the Application Name. But this heuristic breaks for
descriptions that do not follow the "X is a Y" structure.

3. If the port contains an AppStream metainfo file in share/metainfo/,
then the "name" key in the first "component" element often contains
the Application Name. But over 1,200 ports with share/applications/*
are currently lacking a share/applications/* file.

Proposal
--------

1. For Application Ports, include the Application Name as a mandatory
key in the Makefile.

2. Add checks to Ports tooling in order to ensure consistency of the
Application Name across the desktop file, the pkg-desc file, and the
AppStream metainfo file.

3. Populate the Application Name for all Application Ports (doing this
initialy can largely be automated using the heuristics described
above)
4. Once this is implemented, adjust pkg(8) metadata and tooling to
bring the Application Name into Packages and their repositories as
well

4. Once this is implemented, adjust pkg(8) metadata and tooling to
bring the Application Name into Packages and their repositories as
well

5. Update App centers like freshports.org, OctoPkg, and GhostBSD
Software Station to display (and make searchable) the Application Name

Best Practice
-------------

HaikuDepot, the app center in Haiku, is using Application Names:
https://www.haiku-os.org/docs/userguide/en/applications/haikudepot.html

Interested parties
------------------

* GhostBSD: https://github.com/ghostbsd/software-station (confirmed)
* helloSystem: https://github.com/helloSystem/hello/issues/173 (confirmed)
* Potentially FreshPorts
* Potentially NomadBSD
* Potentially OctoPkg