haiku/headers/os/package/RepositoryInfo.h
Andrew Lindesay 3b17d8dd7f HaikuDepot / PackageKit: Repositories 'Identifier' URL
Repositories are identified with a 'url' in the
remote 'repo.info' file.  There is also a
'base url' which is the URL locally with which
the system is able to access the repository
data on.  There is some confusion between these
two terms in the source.  This change aims to
separate the two out and consistently name them.
The settings for the repository locally also was
not storing these values and that has been fixed.
Debug info about the repositories also did not
display the two urls consistently and will now
also do so.  Finally, HaikuDepot now correlates
locally configured repositories with the data in
HaikuDepotServer using the identifier URL; this
makes the use of mirrors with HaikuDepot possible.

Fixes #13888
Change-Id: I66dfe589b05c24e1ab123a6945352e0f24b60bf1
2018-07-05 20:06:54 +00:00

98 lines
2.5 KiB
C++

/*
* Copyright 2011-2018, Haiku, Inc.
* Distributed under the terms of the MIT License.
*/
#ifndef _PACKAGE__REPOSITORY_INFO_H_
#define _PACKAGE__REPOSITORY_INFO_H_
#include <Archivable.h>
#include <Entry.h>
#include <StringList.h>
#include <String.h>
#include <package/PackageArchitecture.h>
namespace BPackageKit {
class BRepositoryInfo : public BArchivable {
typedef BArchivable inherited;
public:
BRepositoryInfo();
BRepositoryInfo(BMessage* data);
BRepositoryInfo(const BEntry& entry);
virtual ~BRepositoryInfo();
virtual status_t Archive(BMessage* data, bool deep = true) const;
status_t SetTo(const BMessage* data);
status_t SetTo(const BEntry& entry);
status_t InitCheck() const;
const BString& Name() const;
const BString& BaseURL() const;
const BString& URL() const;
const BString& Vendor() const;
const BString& Summary() const;
uint8 Priority() const;
BPackageArchitecture Architecture() const;
const BStringList& LicenseNames() const;
const BStringList& LicenseTexts() const;
void SetName(const BString& name);
void SetBaseURL(const BString& url);
void SetURL(const BString& url);
void SetVendor(const BString& vendor);
void SetSummary(const BString& summary);
void SetPriority(uint8 priority);
void SetArchitecture(BPackageArchitecture arch);
status_t AddLicense(const BString& licenseName,
const BString& licenseText);
void ClearLicenses();
public:
static BRepositoryInfo* Instantiate(BMessage* data);
static const uint8 kDefaultPriority;
static const char* const kNameField;
static const char* const kURLField;
static const char* const kBaseURLField;
static const char* const kVendorField;
static const char* const kSummaryField;
static const char* const kPriorityField;
static const char* const kArchitectureField;
static const char* const kLicenseNameField;
static const char* const kLicenseTextField;
private:
status_t _SetTo(const BMessage* data);
status_t _SetTo(const BEntry& entry);
private:
status_t fInitStatus;
BString fName;
BString fBaseURL;
// This is the URL to a single mirror. This field is optional.
BString fURL;
// This is an identifier for the repository that applies
// across mirrors.
BString fVendor;
BString fSummary;
uint8 fPriority;
BPackageArchitecture fArchitecture;
BStringList fLicenseNames;
BStringList fLicenseTexts;
};
} // namespace BPackageKit
#endif // _PACKAGE__REPOSITORY_INFO_H_