haiku/headers/os/package/RepositoryConfig.h
Adrien Destugues aa272ca35c Package Kit: reduce identifer/base-url confusion
For historical reasons, the package kit has an "url" field that is not
actually meant to be used as an URL. Rename it in the API and user
facing output as "identifier" to make it clear what the file is used
for. This change preserves the "url" key in on-disk and online storage
(hpkr files, stored settings, etc) in an attempt to not break anything.

Fix one remaining misuse of the "url" field as an URL in
get_package_dependencies.

Add an unit test showing that BUrl does parse "tab" URIs properly (there
is just a protocol and a path segment).

Change-Id: I339ce526e5798d42d78ae650855d7e988dbb4a1a
Reviewed-on: https://review.haiku-os.org/c/haiku/+/2542
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
2020-05-09 20:04:50 +00:00

69 lines
1.6 KiB
C++

/*
* Copyright 2011-2018, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__REPOSITORY_CONFIG_H_
#define _PACKAGE__REPOSITORY_CONFIG_H_
#include <Entry.h>
#include <String.h>
namespace BPackageKit {
class BRepositoryConfig {
public:
BRepositoryConfig();
BRepositoryConfig(const BString& name,
const BString& url, uint8 priority);
BRepositoryConfig(const BEntry& entry);
virtual ~BRepositoryConfig();
status_t Store(const BEntry& entry) const;
status_t SetTo(const BEntry& entry);
status_t InitCheck() const;
const BString& Name() const;
const BString& BaseURL() const;
const BString& Identifier() const;
uint8 Priority() const;
bool IsUserSpecific() const;
const BEntry& Entry() const;
BString PackagesURL() const;
void SetName(const BString& name);
void SetBaseURL(const BString& url);
void SetIdentifier(const BString& url);
void SetPriority(uint8 priority);
void SetIsUserSpecific(bool isUserSpecific);
public:
static const uint8 kUnsetPriority = 0;
private:
status_t fInitStatus;
BString fName;
BString fBaseURL;
// this URL is the URL that can be used to access the data of
// the repository - it points to a single mirror.
BString fIdentifier;
// an identifier for the repository that is consistent across
// mirrors. Usually a tag: or uuid: URI.
uint8 fPriority;
bool fIsUserSpecific;
BEntry fEntry;
};
} // namespace BPackageKit
#endif // _PACKAGE__REPOSITORY_CONFIG_H_