880 lines
22 KiB
C++
880 lines
22 KiB
C++
#ifndef ALPM_PACKAGE_H
|
|
#define ALPM_PACKAGE_H
|
|
|
|
#include <c++utilities/chrono/datetime.h>
|
|
|
|
#include <QString>
|
|
#include <QHash>
|
|
#include <QJsonArray>
|
|
|
|
#include <map>
|
|
#include <functional>
|
|
|
|
QT_FORWARD_DECLARE_CLASS(QJsonObject)
|
|
QT_FORWARD_DECLARE_CLASS(QJsonValue)
|
|
|
|
namespace RepoIndex {
|
|
|
|
class Repository;
|
|
|
|
/*!
|
|
* \brief The PackageVersionComparsion enum defines possible results of packages version comparison.
|
|
*/
|
|
enum class PackageVersionComparsion
|
|
{
|
|
Equal, /*!< The version of this package is the same as the version of the package from the sync db. */
|
|
SoftwareUpgrade, /*!< The software version of the package from the sync db is newer. */
|
|
PackageUpgradeOnly, /*!< The package release number of the package from the sync db is newer. */
|
|
NewerThenSyncVersion /*!< The version of this package is NEWER then the version of the package from the sync db. */
|
|
};
|
|
|
|
/*!
|
|
* \brief The ComparsionResult enum defines possible results of package version part comparsion.
|
|
*/
|
|
enum class PackageVersionPartComparsion
|
|
{
|
|
Equal, /*!< Both parts are equal. */
|
|
Newer, /*!< Part 1 is newer then part 2. */
|
|
Older /*!< Part 2 is newer then part 1. */
|
|
};
|
|
|
|
/*!
|
|
* \brief The PackageOrigin enum describes where a Package instance comes from.
|
|
* \remarks ALPM type: alpm_pkgfrom_t
|
|
*/
|
|
enum class PackageOrigin
|
|
{
|
|
Unknown = 20, /*! The origin is unknown. */
|
|
File = 1, /*!< The instance has been created from a package file; source() returns nullptr in this case. */
|
|
LocalDb = 2, /*! The instance is from the local data base; source() is an AlpmDataBase instance. */
|
|
SyncDb = 3, /*! The instance is from a sync data base; source() is an AlpmDataBase instance. */
|
|
Aur = 21 /*! The instance is from the AUR; source() is a UserRepository instance. */
|
|
};
|
|
|
|
/*!
|
|
* \brief The InstallStatus enum specifies whether a package has been installed explicitely or as dependency.
|
|
*/
|
|
enum class InstallStatus
|
|
{
|
|
Explicit = 0,
|
|
AsDependency = 1,
|
|
None = 20
|
|
};
|
|
|
|
/*!
|
|
* \brief The PackageValidation enum specifies methods used to validate a package.
|
|
* \remarks ALMP type: alpm_pkgvalidation_t
|
|
*/
|
|
enum class PackageValidation {
|
|
Unknown = 0,
|
|
None = (1 << 0),
|
|
Md5Sum = (1 << 1),
|
|
Sha256Sum = (1 << 2),
|
|
PgpSignature = (1 << 3)
|
|
};
|
|
|
|
constexpr PackageValidation operator |(PackageValidation lhs, PackageValidation rhs)
|
|
{
|
|
return static_cast<PackageValidation>(static_cast<int>(lhs) | static_cast<int>(rhs));
|
|
}
|
|
|
|
constexpr bool operator &(PackageValidation lhs, PackageValidation rhs)
|
|
{
|
|
return (static_cast<int>(lhs) & static_cast<int>(rhs)) != 0;
|
|
}
|
|
|
|
constexpr int operator ~(PackageValidation lhs)
|
|
{
|
|
return ~static_cast<int>(lhs);
|
|
}
|
|
|
|
inline PackageValidation &operator |=(PackageValidation &lhs, PackageValidation rhs)
|
|
{
|
|
lhs = static_cast<PackageValidation>(static_cast<int>(lhs) | static_cast<int>(rhs));
|
|
return lhs;
|
|
}
|
|
|
|
inline PackageValidation &operator &=(PackageValidation &lhs, int rhs)
|
|
{
|
|
lhs = static_cast<PackageValidation>(static_cast<int>(lhs) & rhs);
|
|
return lhs;
|
|
}
|
|
|
|
/*!
|
|
* \brief The SignatureLevel enum specifies PGP signature verification options.
|
|
*/
|
|
enum class SignatureLevel {
|
|
Package = (1 << 0),
|
|
PackageOptional = (1 << 1),
|
|
PackageMarginalOk = (1 << 2),
|
|
PackageUnknownOk = (1 << 3),
|
|
|
|
Database = (1 << 10),
|
|
DatabaseOptional = (1 << 11),
|
|
DatabaseMarginalOk = (1 << 12),
|
|
DatabaseUnknownOk = (1 << 13),
|
|
|
|
UseDefault = (1 << 31)
|
|
};
|
|
|
|
constexpr SignatureLevel operator |(SignatureLevel lhs, SignatureLevel rhs)
|
|
{
|
|
return static_cast<SignatureLevel>(static_cast<int>(lhs) | static_cast<int>(rhs));
|
|
}
|
|
|
|
constexpr bool operator &(SignatureLevel lhs, SignatureLevel rhs)
|
|
{
|
|
return (static_cast<int>(lhs) & static_cast<int>(rhs)) != 0;
|
|
}
|
|
|
|
constexpr int operator ~(SignatureLevel lhs)
|
|
{
|
|
return ~static_cast<int>(lhs);
|
|
}
|
|
|
|
inline SignatureLevel &operator &=(SignatureLevel &lhs, int rhs)
|
|
{
|
|
lhs = static_cast<SignatureLevel>(static_cast<int>(lhs) & rhs);
|
|
return lhs;
|
|
}
|
|
|
|
inline SignatureLevel &operator |=(SignatureLevel &lhs, SignatureLevel rhs)
|
|
{
|
|
lhs = static_cast<SignatureLevel>(static_cast<int>(lhs) | static_cast<int>(rhs));
|
|
return lhs;
|
|
}
|
|
|
|
/*!
|
|
* \brief The SigStatus enum specifies PGP signature verification status return codes.
|
|
*/
|
|
enum class SignatureStatus {
|
|
Valid,
|
|
KeyExpired,
|
|
SigExpired,
|
|
KeyUnknown,
|
|
KeyDisabled,
|
|
InvalidId
|
|
};
|
|
|
|
class PackageVersion
|
|
{
|
|
public:
|
|
explicit PackageVersion(const QString &versionStr);
|
|
explicit PackageVersion();
|
|
|
|
static PackageVersionPartComparsion compareParts(const QString &part1, const QString &part2);
|
|
PackageVersionComparsion compare(const PackageVersion &other) const;
|
|
QString toString() const;
|
|
|
|
QString epoch;
|
|
QString version;
|
|
QString release;
|
|
};
|
|
|
|
/*!
|
|
* \brief The DependencyMode enum specifies the version constraints in dependency specs.
|
|
* \remarks ALPM: alpm_depmod_t
|
|
*/
|
|
enum class DependencyMode {
|
|
Any = 1, /*! No version constraint */
|
|
Equal, /*! Test version equality (package=x.y.z) */
|
|
GreatherEqual, /*! Test for at least a version (package>=x.y.z) */
|
|
LessEqual, /*! Test for at most a version (package<=x.y.z) */
|
|
GreatherThen, /*! Test for greater than some version (package>x.y.z) */
|
|
LessThen /*! Test for less than some version (package<x.y.z) */
|
|
};
|
|
|
|
class Dependency
|
|
{
|
|
public:
|
|
explicit Dependency(const QString &name, const QString &version, DependencyMode mode = DependencyMode::Any, const QString &description = QString());
|
|
explicit Dependency(const QString &dependency);
|
|
|
|
bool operator ==(const Dependency &other) const;
|
|
|
|
QString toString() const;
|
|
QJsonObject toJson() const;
|
|
|
|
QString name;
|
|
QString version;
|
|
DependencyMode mode;
|
|
QString description;
|
|
};
|
|
|
|
inline Dependency::Dependency(const QString &name, const QString &version, DependencyMode mode, const QString &description) :
|
|
name(name),
|
|
version(version),
|
|
mode(mode),
|
|
description(description)
|
|
{}
|
|
|
|
inline bool Dependency::operator ==(const Dependency &other) const
|
|
{
|
|
return other.name == name && other.description == description && other.mode == mode;
|
|
}
|
|
|
|
inline uint qHash(const Dependency &dependency, uint seed)
|
|
{
|
|
return qHash(dependency.name, seed) ^ qHash(dependency.version, seed) ^ static_cast<uint>(dependency.mode) ^ seed ^ qHash(dependency.description, seed);
|
|
}
|
|
|
|
class Manager;
|
|
|
|
class Package
|
|
{
|
|
public:
|
|
virtual ~Package();
|
|
|
|
// general package meta data
|
|
PackageOrigin origin() const;
|
|
Repository *repository() const;
|
|
ChronoUtilities::DateTime timeStamp() const;
|
|
void setTimeStamp(ChronoUtilities::DateTime timeStamp);
|
|
bool hasGeneralInfo() const;
|
|
bool hasAllGeneralInfo() const;
|
|
const QString &name() const;
|
|
const QString &version() const;
|
|
const QString &description() const;
|
|
const QString &upstreamUrl() const;
|
|
const QStringList &licenses() const;
|
|
const QStringList &groups() const;
|
|
const QList<Dependency> &dependencies() const;
|
|
const QList<Dependency> &optionalDependencies() const;
|
|
const QList<Dependency> &conflicts() const;
|
|
const QList<Dependency> &provides() const;
|
|
const QList<Dependency> &replaces() const;
|
|
bool isRequiredByComputed() const;
|
|
void computeRequiredBy(const QList<Repository *> &relevantRepositories);
|
|
const QStringList &requiredBy() const;
|
|
QStringList &requiredBy();
|
|
const QStringList &optionalFor() const;
|
|
QStringList &optionalFor();
|
|
bool hasInstallScript() const;
|
|
void setHasInstallScript(bool hasInstallScript);
|
|
|
|
// build related meta data
|
|
bool hasBuildRelatedMetaData() const;
|
|
const QString &fileName() const;
|
|
const QJsonArray &files() const;
|
|
ChronoUtilities::DateTime buildDate() const;
|
|
const QString &packager() const;
|
|
const QString &md5() const;
|
|
const QString &sha256() const;
|
|
const QString &buildArchitecture() const;
|
|
uint32 packageSize() const;
|
|
const QList<Dependency> &makeDependencies() const;
|
|
const QList<Dependency> &checkDependencies() const;
|
|
|
|
// installation related meta data
|
|
bool hasInstallRelatedMetaData() const;
|
|
ChronoUtilities::DateTime installDate() const;
|
|
uint32 installedSize() const;
|
|
const QStringList &backupFiles() const;
|
|
PackageValidation validationMethods() const;
|
|
InstallStatus installReason() const;
|
|
|
|
// source related meta data
|
|
bool hasSourceRelatedMetaData() const;
|
|
const QString &baseName() const;
|
|
const QStringList &architectures() const;
|
|
int32 id() const;
|
|
int32 categoryId() const;
|
|
int32 votes() const;
|
|
ChronoUtilities::DateTime outOfDate() const;
|
|
const QString &maintainer() const;
|
|
ChronoUtilities::DateTime firstSubmitted() const;
|
|
ChronoUtilities::DateTime lastModified() const;
|
|
const QString &tarUrl() const;
|
|
const std::map<QString, QByteArray> &sourceFiles() const;
|
|
QList<const QList<Dependency> *> allDependencies() const;
|
|
|
|
// version comparsion
|
|
PackageVersionComparsion compareVersion(const Package *syncPackage) const;
|
|
PackageVersionComparsion compareVersion(const Dependency &dependency) const;
|
|
static bool matches(const QString &name, const QString &version, const Dependency &dependency);
|
|
bool matches(const Dependency &dependency);
|
|
|
|
// JSON serialization
|
|
QJsonObject basicInfo(bool includeRepoAndName = false) const;
|
|
QJsonObject detailedInfo() const;
|
|
QJsonObject simpleInfo() const;
|
|
|
|
// caching
|
|
void writeToCacheStream(QDataStream &out);
|
|
void restoreFromCacheStream(QDataStream &in);
|
|
void reinitEntries();
|
|
|
|
// parsing .SRCINFO/.PKGINFO/desc/depends/files info
|
|
void putInfo(const QList<QPair<QString, QString> > &baseInfo, const QList<QPair<QString, QString> > &pkgInfo, bool includesSourceRelatedMetaData = false, bool includesBuildRelatedMetaData = false);
|
|
void putDescription(const QString &name, const QList<QPair<QString, QStringList> > &description, PackageOrigin origin);
|
|
void putSourceFile(const QString &path, const QByteArray &data);
|
|
|
|
protected:
|
|
explicit Package(const QString &name, Repository *repository);
|
|
virtual void writeSpecificCacheHeader(QDataStream &out);
|
|
virtual void restoreSpecificCacheHeader(QDataStream &in);
|
|
|
|
PackageOrigin m_origin;
|
|
Repository *m_repository;
|
|
ChronoUtilities::DateTime m_timeStamp;
|
|
|
|
// general package meta data
|
|
bool m_hasGeneralInfo;
|
|
bool m_hasAllGeneralInfo;
|
|
QString m_name;
|
|
QString m_version;
|
|
QString m_description;
|
|
QString m_upstreamUrl;
|
|
QStringList m_licenses;
|
|
QStringList m_groups;
|
|
QList<Dependency> m_dependencies;
|
|
QList<Dependency> m_optionalDependencies;
|
|
QList<Dependency> m_conflicts;
|
|
QList<Dependency> m_provides;
|
|
QList<Dependency> m_replaces;
|
|
bool m_requiredByComputed;
|
|
QStringList m_requiredBy;
|
|
QStringList m_optionalFor;
|
|
bool m_hasInstallScript;
|
|
|
|
// build related meta data
|
|
bool m_hasBuildRelatedMetaData;
|
|
QString m_fileName;
|
|
QJsonArray m_files;
|
|
ChronoUtilities::DateTime m_buildDate;
|
|
QString m_packager;
|
|
QString m_md5;
|
|
QString m_sha256;
|
|
QString m_pgpSignature;
|
|
QString m_buildArchitecture;
|
|
uint32 m_packageSize;
|
|
QList<Dependency> m_makeDependencies;
|
|
QList<Dependency> m_checkDependencies;
|
|
|
|
// installation related meta data
|
|
bool m_hasInstallRelatedMetaData;
|
|
ChronoUtilities::DateTime m_installDate;
|
|
uint32 m_installedSize;
|
|
QStringList m_backupFiles;
|
|
PackageValidation m_validationMethods;
|
|
InstallStatus m_installReason;
|
|
|
|
// source related meta data
|
|
bool m_hasSourceRelatedMetaData;
|
|
QString m_baseName;
|
|
QStringList m_architectures;
|
|
int32 m_id;
|
|
int32 m_categoryId;
|
|
int32 m_votes;
|
|
ChronoUtilities::DateTime m_outOfDate;
|
|
QString m_maintainer;
|
|
ChronoUtilities::DateTime m_firstSubmitted;
|
|
ChronoUtilities::DateTime m_lastModified;
|
|
QString m_tarUrl;
|
|
std::map<QString, QByteArray> m_sourceFiles;
|
|
|
|
// setter used in putDescription
|
|
static const std::map<QString, void(Package::*)(const QStringList &)> m_descMap;
|
|
void setName(const QStringList &values);
|
|
void setVersion(const QStringList &values);
|
|
void setDescription(const QStringList &values);
|
|
void setUrl(const QStringList &values);
|
|
void setArch(const QStringList &values);
|
|
void setLicenses(const QStringList &values);
|
|
void setDepends(const QStringList &values);
|
|
void setMakeDepends(const QStringList &values);
|
|
void setCheckDepends(const QStringList &values);
|
|
void setOptDepends(const QStringList &values);
|
|
void setConflicts(const QStringList &values);
|
|
void setProvides(const QStringList &values);
|
|
void setReplaces(const QStringList &values);
|
|
void setBuildDate(const QStringList &values);
|
|
void setInstallDate(const QStringList &values);
|
|
void setInstalledSize(const QStringList &values);
|
|
void setPackageSize(const QStringList &values);
|
|
void setPackager(const QStringList &values);
|
|
void setMd5(const QStringList &values);
|
|
void setSha256(const QStringList &values);
|
|
void setPgpSignature(const QStringList &values);
|
|
void setFiles(const QStringList &values);
|
|
void setValidation(const QStringList &values);
|
|
void setGroups(const QStringList &values);
|
|
void setFileName(const QStringList &values);
|
|
void setInstallReason(const QStringList &values);
|
|
};
|
|
|
|
/*!
|
|
* \brief Returns where the package instance comes from (local db, sync db, pkg file, AUR).
|
|
*/
|
|
inline PackageOrigin Package::origin() const
|
|
{
|
|
return m_origin;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the repository.
|
|
* \remarks Might be nullptr if no repository is associated.
|
|
*/
|
|
inline Repository *Package::repository() const
|
|
{
|
|
return m_repository;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the package's timestamp.
|
|
*/
|
|
inline ChronoUtilities::DateTime Package::timeStamp() const
|
|
{
|
|
return m_timeStamp;
|
|
}
|
|
|
|
/*!
|
|
* \brief Sets the package's timestamp.
|
|
*/
|
|
inline void Package::setTimeStamp(ChronoUtilities::DateTime timeStamp)
|
|
{
|
|
m_timeStamp = timeStamp;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether general information is available for the package.
|
|
*/
|
|
inline bool Package::hasGeneralInfo() const
|
|
{
|
|
return m_hasGeneralInfo;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether all general information is available for the package.
|
|
*/
|
|
inline bool Package::hasAllGeneralInfo() const
|
|
{
|
|
return m_hasAllGeneralInfo;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the name.
|
|
*/
|
|
inline const QString &Package::name() const
|
|
{
|
|
return m_name;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the version.
|
|
*/
|
|
inline const QString &Package::version() const
|
|
{
|
|
return m_version;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the description.
|
|
*/
|
|
inline const QString &Package::description() const
|
|
{
|
|
return m_description;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the upstream URL.
|
|
*/
|
|
inline const QString &Package::upstreamUrl() const
|
|
{
|
|
return m_upstreamUrl;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the licenses.
|
|
*/
|
|
inline const QStringList &Package::licenses() const
|
|
{
|
|
return m_licenses;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the groups.
|
|
*/
|
|
inline const QStringList &Package::groups() const
|
|
{
|
|
return m_groups;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the dependencies.
|
|
*/
|
|
inline const QList<Dependency> &Package::dependencies() const
|
|
{
|
|
return m_dependencies;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the optional dependencies.
|
|
*/
|
|
inline const QList<Dependency> &Package::optionalDependencies() const
|
|
{
|
|
return m_optionalDependencies;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns conflicting packages.
|
|
*/
|
|
inline const QList<Dependency> &Package::conflicts() const
|
|
{
|
|
return m_conflicts;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns provides.
|
|
*/
|
|
inline const QList<Dependency> &Package::provides() const
|
|
{
|
|
return m_provides;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns packages which are replaced by this package.
|
|
*/
|
|
inline const QList<Dependency> &Package::replaces() const
|
|
{
|
|
return m_replaces;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether required-by and optional-for have been computed.
|
|
*/
|
|
inline bool Package::isRequiredByComputed() const
|
|
{
|
|
return m_requiredByComputed;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns packages requiring this packages.
|
|
*/
|
|
inline const QStringList &Package::requiredBy() const
|
|
{
|
|
return m_requiredBy;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns packages requiring this packages.
|
|
*/
|
|
inline QStringList &Package::requiredBy()
|
|
{
|
|
return m_requiredBy;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns packages having this package as optional dependency.
|
|
*/
|
|
inline const QStringList &Package::optionalFor() const
|
|
{
|
|
return m_optionalFor;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns packages having this package as optional dependency.
|
|
*/
|
|
inline QStringList &Package::optionalFor()
|
|
{
|
|
return m_optionalFor;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether the package has an install script.
|
|
*/
|
|
inline bool Package::hasInstallScript() const
|
|
{
|
|
return m_hasInstallScript;
|
|
}
|
|
|
|
/*!
|
|
* \brief Sets whether the package has an install script.
|
|
*/
|
|
inline void Package::setHasInstallScript(bool hasInstallScript)
|
|
{
|
|
m_hasInstallScript = hasInstallScript;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether the package has build-related meta data.
|
|
*
|
|
* Build-related meta data is information about a particular package file such
|
|
* as architecture, file name, build date, ....
|
|
*/
|
|
inline bool Package::hasBuildRelatedMetaData() const
|
|
{
|
|
return m_hasBuildRelatedMetaData;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the file name of the package file.
|
|
*/
|
|
inline const QString &Package::fileName() const
|
|
{
|
|
return m_fileName;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the paths of the files of the binary package as JSON array.
|
|
* \remarks For source files see \a sourceFiles().
|
|
*/
|
|
inline const QJsonArray &Package::files() const
|
|
{
|
|
return m_files;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the build date of the package file.
|
|
*/
|
|
inline ChronoUtilities::DateTime Package::buildDate() const
|
|
{
|
|
return m_buildDate;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the packager of the package file.
|
|
*/
|
|
inline const QString &Package::packager() const
|
|
{
|
|
return m_packager;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the MD5 hash of the package file.
|
|
*/
|
|
inline const QString &Package::md5() const
|
|
{
|
|
return m_md5;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the SHA-256 hash of the package file.
|
|
*/
|
|
inline const QString &Package::sha256() const
|
|
{
|
|
return m_sha256;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the architecture of the package file.
|
|
*/
|
|
inline const QString &Package::buildArchitecture() const
|
|
{
|
|
return m_buildArchitecture;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the size of the package file.
|
|
*/
|
|
inline uint32 Package::packageSize() const
|
|
{
|
|
return m_packageSize;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns dependencies required to make the package.
|
|
*/
|
|
inline const QList<Dependency> &Package::makeDependencies() const
|
|
{
|
|
return m_makeDependencies;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns dependencies required to run tests when making the package.
|
|
*/
|
|
inline const QList<Dependency> &Package::checkDependencies() const
|
|
{
|
|
return m_checkDependencies;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether install-related meta data is available.
|
|
*
|
|
* Install-related meta data is information such as the install date,
|
|
* the installed size, files backuped during installation, ...
|
|
*
|
|
* Most of the install-related meta data is only available for packages
|
|
* from the local data base (see origin()).
|
|
*/
|
|
inline bool Package::hasInstallRelatedMetaData() const
|
|
{
|
|
return m_hasInstallRelatedMetaData;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the install date.
|
|
*/
|
|
inline ChronoUtilities::DateTime Package::installDate() const
|
|
{
|
|
return m_installDate;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the installed size.
|
|
*/
|
|
inline uint32 Package::installedSize() const
|
|
{
|
|
return m_installedSize;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the files which have been backued up during installation.
|
|
*/
|
|
inline const QStringList &Package::backupFiles() const
|
|
{
|
|
return m_backupFiles;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the validation methods used during installation.
|
|
*/
|
|
inline PackageValidation Package::validationMethods() const
|
|
{
|
|
return m_validationMethods;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether the package has been installed explicitely or as a dependency.
|
|
*/
|
|
inline InstallStatus Package::installReason() const
|
|
{
|
|
return m_installReason;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns whether source-related meta data is available.
|
|
*
|
|
* Source-related meta data is information about the PKGBUILD file such has
|
|
* its AUR IDs, AUR votes, maintainer, flag date, ...
|
|
*/
|
|
inline bool Package::hasSourceRelatedMetaData() const
|
|
{
|
|
return m_hasSourceRelatedMetaData;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the base name.
|
|
*/
|
|
inline const QString &Package::baseName() const
|
|
{
|
|
return m_baseName;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the architecutes (from the PKGBUILD file).
|
|
* \remarks For the architecture of the particular package file
|
|
* see buildArchitecture().
|
|
*/
|
|
inline const QStringList &Package::architectures() const
|
|
{
|
|
return m_architectures;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the ID.
|
|
*/
|
|
inline int32 Package::id() const
|
|
{
|
|
return m_id;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the category ID.
|
|
*/
|
|
inline int32 Package::categoryId() const
|
|
{
|
|
return m_categoryId;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the votes of the package.
|
|
*/
|
|
inline int32 Package::votes() const
|
|
{
|
|
return m_votes;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the flag date.
|
|
*/
|
|
inline ChronoUtilities::DateTime Package::outOfDate() const
|
|
{
|
|
return m_outOfDate;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the maintainer.
|
|
*/
|
|
inline const QString &Package::maintainer() const
|
|
{
|
|
return m_maintainer;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns when the package was first submitted.
|
|
*/
|
|
inline ChronoUtilities::DateTime Package::firstSubmitted() const
|
|
{
|
|
return m_firstSubmitted;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the last time when the package was modified.
|
|
*/
|
|
inline ChronoUtilities::DateTime Package::lastModified() const
|
|
{
|
|
return m_lastModified;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns a URL to a tar file with the sources.
|
|
*/
|
|
inline const QString &Package::tarUrl() const
|
|
{
|
|
return m_tarUrl;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns the available source files.
|
|
*
|
|
* Contains usually the PKGBUILD/.SRCINFO file and patches.
|
|
*/
|
|
inline const std::map<QString, QByteArray> &Package::sourceFiles() const
|
|
{
|
|
return m_sourceFiles;
|
|
}
|
|
|
|
/*!
|
|
* \brief Returns all dependencies.
|
|
*/
|
|
inline QList<const QList<Dependency> *> Package::allDependencies() const
|
|
{
|
|
return {&dependencies(), &makeDependencies(), &checkDependencies()};
|
|
}
|
|
|
|
/*!
|
|
* \brief Compares the version of the package with the specified sync package.
|
|
*/
|
|
inline PackageVersionComparsion Package::compareVersion(const Package *syncPackage) const
|
|
{
|
|
return PackageVersion(version()).compare(PackageVersion(syncPackage->version()));
|
|
}
|
|
|
|
/*!
|
|
* \brief Compares the version of the package with the version of the specified \a dependency.
|
|
*/
|
|
inline PackageVersionComparsion Package::compareVersion(const Dependency &dependency) const
|
|
{
|
|
return PackageVersion(version()).compare(PackageVersion(dependency.version));
|
|
}
|
|
|
|
inline uint qHash(const Package &package, uint seed)
|
|
{
|
|
return static_cast<uint>(((reinterpret_cast<quint64>(package.repository()) >> (8 * sizeof(uint) - 1)) ^ reinterpret_cast<quint64>(package.repository())) & (~0U)) ^ seed ^ qHash(package.name(), seed);
|
|
}
|
|
|
|
}
|
|
|
|
#endif // ALPM_PACKAGE_H
|