mirror of
https://github.com/RGBCube/serenity
synced 2025-07-27 03:17:35 +00:00
Utilities/pkg: Integrate LibSemVer for update information
Along with this, Port.h is include which helps generalising common information for the port package, like it's name and version. With SemVer complaint versions, it is possible to show positive change (upgrade) or negative change (downgrade) in the installed ports. However, for some non-complaint versions (eg. using git commit hash), non-equality (`!=`) is used to notify upgrade. Since there is no algorithm (without git history) to check the order of commits, it is not possible to inform whether it is an upgrade or downgrade.
This commit is contained in:
parent
ee639fa1df
commit
fc8f6c07b4
7 changed files with 176 additions and 83 deletions
|
@ -12,25 +12,20 @@
|
|||
#include <AK/StringView.h>
|
||||
#include <AK/Types.h>
|
||||
|
||||
class AvailablePort {
|
||||
class AvailablePort : public Port {
|
||||
public:
|
||||
static ErrorOr<int> query_details_for_package(HashMap<String, AvailablePort>& available_ports, HashMap<String, InstalledPort>& installed_ports, StringView package_name, bool verbose);
|
||||
static void query_details_for_package(HashMap<String, AvailablePort>& available_ports, HashMap<String, InstalledPort> const& installed_ports, StringView package_name, bool verbose);
|
||||
static ErrorOr<HashMap<String, AvailablePort>> read_available_ports_list();
|
||||
static ErrorOr<int> update_available_ports_list_file();
|
||||
|
||||
AvailablePort(String name, String version, String website)
|
||||
: m_name(name)
|
||||
, m_website(move(website))
|
||||
, m_version(move(version))
|
||||
AvailablePort(String const& name, String const& version, String const& website)
|
||||
: Port(name, version)
|
||||
, m_website(website)
|
||||
{
|
||||
}
|
||||
|
||||
StringView name() const { return m_name.bytes_as_string_view(); }
|
||||
StringView version() const { return m_version.bytes_as_string_view(); }
|
||||
StringView website() const { return m_website.bytes_as_string_view(); }
|
||||
|
||||
private:
|
||||
String m_name;
|
||||
String m_website;
|
||||
String m_version;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue