BPackageVersion: Rename property release to revision
* ... to avoid confusion with the preRelease property. It's also called "revision" in the HaikuPorts recipes. * Update libsolv package. Was necessary due to the BPackageVersion change, but also includes a few more changes.
This commit is contained in:
@@ -221,7 +221,7 @@ if $(TARGET_ARCH) != x86 {
|
|||||||
Echo "Libsolv not available for $(TARGET_ARCH)." ;
|
Echo "Libsolv not available for $(TARGET_ARCH)." ;
|
||||||
} else if $(HAIKU_GCC_VERSION[1]) = 2 {
|
} else if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||||
HAIKU_LIBSOLV_PACKAGE
|
HAIKU_LIBSOLV_PACKAGE
|
||||||
= libsolv-0.3.0_haiku_2013_04_01-1-x86_gcc2.hpkg ;
|
= libsolv-0.3.0_haiku_2013_04_15-1-x86_gcc2.hpkg ;
|
||||||
} else {
|
} else {
|
||||||
Echo "Libsolv not available for gcc4." ;
|
Echo "Libsolv not available for gcc4." ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -152,7 +152,7 @@ public:
|
|||||||
BPackageArchitecture& _architecture);
|
BPackageArchitecture& _architecture);
|
||||||
|
|
||||||
static status_t ParseVersionString(const BString& string,
|
static status_t ParseVersionString(const BString& string,
|
||||||
bool releaseIsOptional,
|
bool revisionIsOptional,
|
||||||
BPackageVersion& _version,
|
BPackageVersion& _version,
|
||||||
ParseErrorListener* listener = NULL);
|
ParseErrorListener* listener = NULL);
|
||||||
|
|
||||||
|
|||||||
@@ -16,7 +16,8 @@ enum BPackageInfoAttributeID {
|
|||||||
B_PACKAGE_INFO_VENDOR, // e.g. "Haiku Project"
|
B_PACKAGE_INFO_VENDOR, // e.g. "Haiku Project"
|
||||||
B_PACKAGE_INFO_PACKAGER, // e-mail address preferred
|
B_PACKAGE_INFO_PACKAGER, // e-mail address preferred
|
||||||
B_PACKAGE_INFO_ARCHITECTURE,
|
B_PACKAGE_INFO_ARCHITECTURE,
|
||||||
B_PACKAGE_INFO_VERSION, // <major>[.<minor>[.<micro>]][-<pre>]-<release>
|
B_PACKAGE_INFO_VERSION, // <major>[.<minor>[.<micro>]][-<pre>]
|
||||||
|
// -<revision>
|
||||||
B_PACKAGE_INFO_COPYRIGHTS, // list
|
B_PACKAGE_INFO_COPYRIGHTS, // list
|
||||||
B_PACKAGE_INFO_LICENSES, // list
|
B_PACKAGE_INFO_LICENSES, // list
|
||||||
B_PACKAGE_INFO_PROVIDES, // list of resolvables this package provides,
|
B_PACKAGE_INFO_PROVIDES, // list of resolvables this package provides,
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ public:
|
|||||||
BPackageVersion(
|
BPackageVersion(
|
||||||
const BPackageVersionData& data);
|
const BPackageVersionData& data);
|
||||||
explicit BPackageVersion(const BString& versionString,
|
explicit BPackageVersion(const BString& versionString,
|
||||||
bool releaseIsOptional = true);
|
bool revisionIsOptional = true);
|
||||||
BPackageVersion(const BString& major,
|
BPackageVersion(const BString& major,
|
||||||
const BString& minor, const BString& micro,
|
const BString& minor, const BString& micro,
|
||||||
const BString& preRelease, uint8 release);
|
const BString& preRelease, uint32 revision);
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
|
|
||||||
@@ -36,27 +36,27 @@ public:
|
|||||||
const BString& Micro() const;
|
const BString& Micro() const;
|
||||||
const BString& PreRelease() const;
|
const BString& PreRelease() const;
|
||||||
// "alpha3", "beta2", "rc1" or "" if final
|
// "alpha3", "beta2", "rc1" or "" if final
|
||||||
uint8 Release() const;
|
uint32 Revision() const;
|
||||||
|
|
||||||
BString ToString() const;
|
BString ToString() const;
|
||||||
|
|
||||||
void SetTo(const BString& major,
|
void SetTo(const BString& major,
|
||||||
const BString& minor, const BString& micro,
|
const BString& minor, const BString& micro,
|
||||||
const BString& preRelease, uint8 release);
|
const BString& preRelease, uint32 revision);
|
||||||
status_t SetTo(const BString& versionString,
|
status_t SetTo(const BString& versionString,
|
||||||
bool releaseIsOptional = true);
|
bool revisionIsOptional = true);
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
int Compare(const BPackageVersion& other) const;
|
int Compare(const BPackageVersion& other) const;
|
||||||
// does a natural compare over major, minor
|
// does a natural compare over major, minor
|
||||||
// and micro, finally comparing release
|
// and micro, finally comparing revision
|
||||||
|
|
||||||
private:
|
private:
|
||||||
BString fMajor;
|
BString fMajor;
|
||||||
BString fMinor;
|
BString fMinor;
|
||||||
BString fMicro;
|
BString fMicro;
|
||||||
BString fPreRelease;
|
BString fPreRelease;
|
||||||
uint8 fRelease;
|
uint32 fRevision;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -110,7 +110,7 @@ enum BHPKGAttributeID {
|
|||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR = 25,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MAJOR = 25,
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR = 26,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MINOR = 26,
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO = 27,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_MICRO = 27,
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE = 28,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION = 28,
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT = 29,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_COPYRIGHT = 29,
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE = 30,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_LICENSE = 30,
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 31,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 31,
|
||||||
|
|||||||
@@ -24,7 +24,7 @@ struct BPackageVersionData {
|
|||||||
const char* minor;
|
const char* minor;
|
||||||
const char* micro;
|
const char* micro;
|
||||||
const char* preRelease;
|
const char* preRelease;
|
||||||
uint8 release;
|
uint32 revision;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -183,7 +183,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
|||||||
::Version* version;
|
::Version* version;
|
||||||
status_t error = Version::Create(value.version.major,
|
status_t error = Version::Create(value.version.major,
|
||||||
value.version.minor, value.version.micro,
|
value.version.minor, value.version.micro,
|
||||||
value.version.preRelease, value.version.release, version);
|
value.version.preRelease, value.version.revision, version);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
|
|
||||||
@@ -209,7 +209,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
|||||||
= value.resolvable.version;
|
= value.resolvable.version;
|
||||||
status_t error = Version::Create(versionInfo.major,
|
status_t error = Version::Create(versionInfo.major,
|
||||||
versionInfo.minor, versionInfo.micro,
|
versionInfo.minor, versionInfo.micro,
|
||||||
versionInfo.preRelease, versionInfo.release, version);
|
versionInfo.preRelease, versionInfo.revision, version);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
}
|
}
|
||||||
@@ -222,7 +222,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
|||||||
= value.resolvable.compatibleVersion;
|
= value.resolvable.compatibleVersion;
|
||||||
status_t error = Version::Create(versionInfo.major,
|
status_t error = Version::Create(versionInfo.major,
|
||||||
versionInfo.minor, versionInfo.micro,
|
versionInfo.minor, versionInfo.micro,
|
||||||
versionInfo.preRelease, versionInfo.release,
|
versionInfo.preRelease, versionInfo.revision,
|
||||||
compatibleVersion);
|
compatibleVersion);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
@@ -266,7 +266,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
|||||||
= value.resolvableExpression.version;
|
= value.resolvableExpression.version;
|
||||||
status_t error = Version::Create(versionInfo.major,
|
status_t error = Version::Create(versionInfo.major,
|
||||||
versionInfo.minor, versionInfo.micro,
|
versionInfo.minor, versionInfo.micro,
|
||||||
versionInfo.preRelease, versionInfo.release, version);
|
versionInfo.preRelease, versionInfo.revision, version);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
RETURN_ERROR(error);
|
RETURN_ERROR(error);
|
||||||
|
|
||||||
|
|||||||
@@ -39,7 +39,7 @@ Version::Version()
|
|||||||
fMinor(NULL),
|
fMinor(NULL),
|
||||||
fMicro(NULL),
|
fMicro(NULL),
|
||||||
fPreRelease(NULL),
|
fPreRelease(NULL),
|
||||||
fRelease(0)
|
fRevision(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -55,7 +55,7 @@ Version::~Version()
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
Version::Init(const char* major, const char* minor, const char* micro,
|
Version::Init(const char* major, const char* minor, const char* micro,
|
||||||
const char* preRelease, uint8 release)
|
const char* preRelease, uint32 revision)
|
||||||
{
|
{
|
||||||
if (major != NULL) {
|
if (major != NULL) {
|
||||||
fMajor = strdup(major);
|
fMajor = strdup(major);
|
||||||
@@ -81,7 +81,7 @@ Version::Init(const char* major, const char* minor, const char* micro,
|
|||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
}
|
}
|
||||||
|
|
||||||
fRelease = release;
|
fRevision = revision;
|
||||||
|
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
@@ -89,13 +89,13 @@ Version::Init(const char* major, const char* minor, const char* micro,
|
|||||||
|
|
||||||
/*static*/ status_t
|
/*static*/ status_t
|
||||||
Version::Create(const char* major, const char* minor, const char* micro,
|
Version::Create(const char* major, const char* minor, const char* micro,
|
||||||
const char* preRelease, uint8 release, Version*& _version)
|
const char* preRelease, uint32 revision, Version*& _version)
|
||||||
{
|
{
|
||||||
Version* version = new(std::nothrow) Version;
|
Version* version = new(std::nothrow) Version;
|
||||||
if (version == NULL)
|
if (version == NULL)
|
||||||
return B_NO_MEMORY;
|
return B_NO_MEMORY;
|
||||||
|
|
||||||
status_t error = version->Init(major, minor, micro, preRelease, release);
|
status_t error = version->Init(major, minor, micro, preRelease, revision);
|
||||||
if (error != B_OK) {
|
if (error != B_OK) {
|
||||||
delete version;
|
delete version;
|
||||||
return error;
|
return error;
|
||||||
@@ -136,7 +136,8 @@ Version::Compare(const Version& other) const
|
|||||||
return cmp;
|
return cmp;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)fRelease - other.fRelease;
|
return fRevision == other.fRevision
|
||||||
|
? 0 : (fRevision < other.fRevision ? -1 : 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -200,9 +201,10 @@ Version::ToString(char* buffer, size_t bufferSize) const
|
|||||||
fPreRelease);
|
fPreRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (fRelease != 0) {
|
if (fRevision != 0) {
|
||||||
size_t offset = std::min(bufferSize, size);
|
size_t offset = std::min(bufferSize, size);
|
||||||
size += snprintf(buffer + offset, bufferSize - offset, "-%u", fRelease);
|
size += snprintf(buffer + offset, bufferSize - offset, "-%" B_PRIu32,
|
||||||
|
fRevision);
|
||||||
}
|
}
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
|
|||||||
@@ -20,11 +20,11 @@ public:
|
|||||||
|
|
||||||
status_t Init(const char* major, const char* minor,
|
status_t Init(const char* major, const char* minor,
|
||||||
const char* micro, const char* preRelease,
|
const char* micro, const char* preRelease,
|
||||||
uint8 release);
|
uint32 revision);
|
||||||
|
|
||||||
static status_t Create(const char* major, const char* minor,
|
static status_t Create(const char* major, const char* minor,
|
||||||
const char* micro, const char* preRelease,
|
const char* micro, const char* preRelease,
|
||||||
uint8 release, Version*& _version);
|
uint32 revision, Version*& _version);
|
||||||
|
|
||||||
int Compare(const Version& other) const;
|
int Compare(const Version& other) const;
|
||||||
bool Compare(BPackageResolvableOperator op,
|
bool Compare(BPackageResolvableOperator op,
|
||||||
@@ -39,7 +39,7 @@ private:
|
|||||||
char* fMinor;
|
char* fMinor;
|
||||||
char* fMicro;
|
char* fMicro;
|
||||||
char* fPreRelease;
|
char* fPreRelease;
|
||||||
uint8 fRelease;
|
uint32 fRevision;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -272,8 +272,8 @@ private:
|
|||||||
printf(".%s", version.micro);
|
printf(".%s", version.micro);
|
||||||
if (version.preRelease != NULL && version.preRelease[0] != '\0')
|
if (version.preRelease != NULL && version.preRelease[0] != '\0')
|
||||||
printf("-%s", version.preRelease);
|
printf("-%s", version.preRelease);
|
||||||
if (version.release > 0)
|
if (version.revision > 0)
|
||||||
printf("-%d", version.release);
|
printf("-%" B_PRIu32, version.revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -238,8 +238,8 @@ private:
|
|||||||
printf(".%s", version.micro);
|
printf(".%s", version.micro);
|
||||||
if (version.preRelease != NULL && version.preRelease[0] != '\0')
|
if (version.preRelease != NULL && version.preRelease[0] != '\0')
|
||||||
printf("-%s", version.preRelease);
|
printf("-%s", version.preRelease);
|
||||||
if (version.release > 0)
|
if (version.revision > 0)
|
||||||
printf("-%d", version.release);
|
printf("-%" B_PRIu32, version.revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|||||||
@@ -73,7 +73,7 @@ public:
|
|||||||
BPackageInfo* packageInfo);
|
BPackageInfo* packageInfo);
|
||||||
|
|
||||||
status_t ParseVersion(const BString& versionString,
|
status_t ParseVersion(const BString& versionString,
|
||||||
bool releaseIsOptional,
|
bool revisionIsOptional,
|
||||||
BPackageVersion& _version);
|
BPackageVersion& _version);
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@@ -89,10 +89,10 @@ private:
|
|||||||
void _ParseArchitectureValue(
|
void _ParseArchitectureValue(
|
||||||
BPackageArchitecture* value);
|
BPackageArchitecture* value);
|
||||||
void _ParseVersionValue(BPackageVersion* value,
|
void _ParseVersionValue(BPackageVersion* value,
|
||||||
bool releaseIsOptional);
|
bool revisionIsOptional);
|
||||||
static void _ParseVersionValue(Token& word,
|
static void _ParseVersionValue(Token& word,
|
||||||
BPackageVersion* value,
|
BPackageVersion* value,
|
||||||
bool releaseIsOptional);
|
bool revisionIsOptional);
|
||||||
void _ParseList(ListElementParser& elementParser,
|
void _ParseList(ListElementParser& elementParser,
|
||||||
bool allowSingleNonListElement);
|
bool allowSingleNonListElement);
|
||||||
void _ParseStringList(BStringList* value,
|
void _ParseStringList(BStringList* value,
|
||||||
@@ -219,13 +219,13 @@ BPackageInfo::Parser::Parse(const BString& packageInfoString,
|
|||||||
|
|
||||||
status_t
|
status_t
|
||||||
BPackageInfo::Parser::ParseVersion(const BString& versionString,
|
BPackageInfo::Parser::ParseVersion(const BString& versionString,
|
||||||
bool releaseIsOptional, BPackageVersion& _version)
|
bool revisionIsOptional, BPackageVersion& _version)
|
||||||
{
|
{
|
||||||
fPos = versionString.String();
|
fPos = versionString.String();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
Token token(TOKEN_WORD, fPos, versionString.Length());
|
Token token(TOKEN_WORD, fPos, versionString.Length());
|
||||||
_ParseVersionValue(token, &_version, releaseIsOptional);
|
_ParseVersionValue(token, &_version, revisionIsOptional);
|
||||||
} catch (const ParseError& error) {
|
} catch (const ParseError& error) {
|
||||||
if (fListener != NULL) {
|
if (fListener != NULL) {
|
||||||
int32 offset = error.pos - versionString.String();
|
int32 offset = error.pos - versionString.String();
|
||||||
@@ -393,41 +393,41 @@ BPackageInfo::Parser::_ParseArchitectureValue(BPackageArchitecture* value)
|
|||||||
|
|
||||||
void
|
void
|
||||||
BPackageInfo::Parser::_ParseVersionValue(BPackageVersion* value,
|
BPackageInfo::Parser::_ParseVersionValue(BPackageVersion* value,
|
||||||
bool releaseIsOptional)
|
bool revisionIsOptional)
|
||||||
{
|
{
|
||||||
Token word = _NextToken();
|
Token word = _NextToken();
|
||||||
_ParseVersionValue(word, value, releaseIsOptional);
|
_ParseVersionValue(word, value, revisionIsOptional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/*static*/ void
|
/*static*/ void
|
||||||
BPackageInfo::Parser::_ParseVersionValue(Token& word, BPackageVersion* value,
|
BPackageInfo::Parser::_ParseVersionValue(Token& word, BPackageVersion* value,
|
||||||
bool releaseIsOptional)
|
bool revisionIsOptional)
|
||||||
{
|
{
|
||||||
if (word.type != TOKEN_WORD)
|
if (word.type != TOKEN_WORD)
|
||||||
throw ParseError("expected word (a version)", word.pos);
|
throw ParseError("expected word (a version)", word.pos);
|
||||||
|
|
||||||
// get the release number
|
// get the revision number
|
||||||
uint8 release = 0;
|
uint32 revision = 0;
|
||||||
int32 lastDashPos = word.text.FindLast('-');
|
int32 lastDashPos = word.text.FindLast('-');
|
||||||
if (lastDashPos >= 0) {
|
if (lastDashPos >= 0) {
|
||||||
// Might be either the release number or, if that is optional, a
|
// Might be either the revision number or, if that is optional, a
|
||||||
// pre-release. The former always is a number, the latter starts with a
|
// pre-release. The former always is a number, the latter starts with a
|
||||||
// non-digit.
|
// non-digit.
|
||||||
if (isdigit(word.text[lastDashPos + 1])) {
|
if (isdigit(word.text[lastDashPos + 1])) {
|
||||||
int number = atoi(word.text.String() + lastDashPos + 1);
|
int number = atoi(word.text.String() + lastDashPos + 1);
|
||||||
if (number <= 0 || number > 99) {
|
if (number <= 0) {
|
||||||
throw ParseError("release number must be from 1-99",
|
throw ParseError("revision number must be > 0",
|
||||||
word.pos + word.text.Length());
|
word.pos + word.text.Length());
|
||||||
}
|
}
|
||||||
release = number;
|
revision = number;
|
||||||
word.text.Truncate(lastDashPos);
|
word.text.Truncate(lastDashPos);
|
||||||
lastDashPos = word.text.FindLast('-');
|
lastDashPos = word.text.FindLast('-');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (release == 0 && !releaseIsOptional) {
|
if (revision == 0 && !revisionIsOptional) {
|
||||||
throw ParseError("expected release number (-<number> suffix)",
|
throw ParseError("expected revision number (-<number> suffix)",
|
||||||
word.pos + word.text.Length());
|
word.pos + word.text.Length());
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -465,7 +465,7 @@ BPackageInfo::Parser::_ParseVersionValue(Token& word, BPackageVersion* value,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
value->SetTo(major, minor, micro, preRelease, release);
|
value->SetTo(major, minor, micro, preRelease, revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1831,10 +1831,10 @@ BPackageInfo::GetArchitectureByName(const BString& name,
|
|||||||
|
|
||||||
|
|
||||||
/*static*/ status_t
|
/*static*/ status_t
|
||||||
BPackageInfo::ParseVersionString(const BString& string, bool releaseIsOptional,
|
BPackageInfo::ParseVersionString(const BString& string, bool revisionIsOptional,
|
||||||
BPackageVersion& _version, ParseErrorListener* listener)
|
BPackageVersion& _version, ParseErrorListener* listener)
|
||||||
{
|
{
|
||||||
return Parser(listener).ParseVersion(string, releaseIsOptional, _version);
|
return Parser(listener).ParseVersion(string, revisionIsOptional, _version);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -1884,7 +1884,7 @@ BPackageInfo::_AddVersion(BMessage* archive, const char* field,
|
|||||||
if (!fieldName.ReplaceSuffix(fieldLength, ":revision"))
|
if (!fieldName.ReplaceSuffix(fieldLength, ":revision"))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
return archive->AddUInt8(fieldName, version.Release());
|
return archive->AddUInt32(fieldName, version.Revision());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -2016,8 +2016,8 @@ BPackageInfo::_ExtractVersion(BMessage* archive, const char* field, int32 index,
|
|||||||
if (!fieldName.ReplaceSuffix(fieldLength, ":revision"))
|
if (!fieldName.ReplaceSuffix(fieldLength, ":revision"))
|
||||||
return B_BAD_VALUE;
|
return B_BAD_VALUE;
|
||||||
|
|
||||||
uint8 revision;
|
uint32 revision;
|
||||||
error = archive->FindUInt8(fieldName, index, &revision);
|
error = archive->FindUInt32(fieldName, index, &revision);
|
||||||
if (error != B_OK)
|
if (error != B_OK)
|
||||||
return error;
|
return error;
|
||||||
|
|
||||||
|
|||||||
@@ -20,28 +20,28 @@ namespace BPackageKit {
|
|||||||
|
|
||||||
BPackageVersion::BPackageVersion()
|
BPackageVersion::BPackageVersion()
|
||||||
:
|
:
|
||||||
fRelease(0)
|
fRevision(0)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BPackageVersion::BPackageVersion(const BPackageVersionData& data)
|
BPackageVersion::BPackageVersion(const BPackageVersionData& data)
|
||||||
{
|
{
|
||||||
SetTo(data.major, data.minor, data.micro, data.preRelease, data.release);
|
SetTo(data.major, data.minor, data.micro, data.preRelease, data.revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BPackageVersion::BPackageVersion(const BString& versionString,
|
BPackageVersion::BPackageVersion(const BString& versionString,
|
||||||
bool releaseIsOptional)
|
bool revisionIsOptional)
|
||||||
{
|
{
|
||||||
SetTo(versionString, releaseIsOptional);
|
SetTo(versionString, revisionIsOptional);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BPackageVersion::BPackageVersion(const BString& major, const BString& minor,
|
BPackageVersion::BPackageVersion(const BString& major, const BString& minor,
|
||||||
const BString& micro, const BString& preRelease, uint8 release)
|
const BString& micro, const BString& preRelease, uint32 revision)
|
||||||
{
|
{
|
||||||
SetTo(major, minor, micro, preRelease, release);
|
SetTo(major, minor, micro, preRelease, revision);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -80,10 +80,10 @@ BPackageVersion::PreRelease() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint8
|
uint32
|
||||||
BPackageVersion::Release() const
|
BPackageVersion::Revision() const
|
||||||
{
|
{
|
||||||
return fRelease;
|
return fRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -117,7 +117,7 @@ BPackageVersion::Compare(const BPackageVersion& other) const
|
|||||||
return diff;
|
return diff;
|
||||||
}
|
}
|
||||||
|
|
||||||
return (int)fRelease - (int)other.fRelease;
|
return (int)fRevision - (int)other.fRevision;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@@ -135,8 +135,8 @@ BPackageVersion::ToString() const
|
|||||||
if (!fPreRelease.IsEmpty())
|
if (!fPreRelease.IsEmpty())
|
||||||
string << '-' << fPreRelease;
|
string << '-' << fPreRelease;
|
||||||
|
|
||||||
if (fRelease > 0)
|
if (fRevision > 0)
|
||||||
string << '-' << fRelease;
|
string << '-' << fRevision;
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
@@ -144,13 +144,13 @@ BPackageVersion::ToString() const
|
|||||||
|
|
||||||
void
|
void
|
||||||
BPackageVersion::SetTo(const BString& major, const BString& minor,
|
BPackageVersion::SetTo(const BString& major, const BString& minor,
|
||||||
const BString& micro, const BString& preRelease, uint8 release)
|
const BString& micro, const BString& preRelease, uint32 revision)
|
||||||
{
|
{
|
||||||
fMajor = major;
|
fMajor = major;
|
||||||
fMinor = minor;
|
fMinor = minor;
|
||||||
fMicro = micro;
|
fMicro = micro;
|
||||||
fPreRelease = preRelease;
|
fPreRelease = preRelease;
|
||||||
fRelease = release;
|
fRevision = revision;
|
||||||
|
|
||||||
fMajor.ToLower();
|
fMajor.ToLower();
|
||||||
fMinor.ToLower();
|
fMinor.ToLower();
|
||||||
@@ -160,10 +160,10 @@ BPackageVersion::SetTo(const BString& major, const BString& minor,
|
|||||||
|
|
||||||
|
|
||||||
status_t
|
status_t
|
||||||
BPackageVersion::SetTo(const BString& versionString, bool releaseIsOptional)
|
BPackageVersion::SetTo(const BString& versionString, bool revisionIsOptional)
|
||||||
{
|
{
|
||||||
Clear();
|
Clear();
|
||||||
return BPackageInfo::ParseVersionString(versionString, releaseIsOptional,
|
return BPackageInfo::ParseVersionString(versionString, revisionIsOptional,
|
||||||
*this);
|
*this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -175,7 +175,7 @@ BPackageVersion::Clear()
|
|||||||
fMinor.Truncate(0);
|
fMinor.Truncate(0);
|
||||||
fMicro.Truncate(0);
|
fMicro.Truncate(0);
|
||||||
fPreRelease.Truncate(0);
|
fPreRelease.Truncate(0);
|
||||||
fRelease = 0;
|
fRevision = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -44,7 +44,7 @@ static const char* kAttributeNames[B_HPKG_ATTRIBUTE_ID_ENUM_COUNT + 1] = {
|
|||||||
"package:version.major",
|
"package:version.major",
|
||||||
"package:version.minor",
|
"package:version.minor",
|
||||||
"package:version.micro",
|
"package:version.micro",
|
||||||
"package:version.release",
|
"package:version.revision",
|
||||||
"package:copyright",
|
"package:copyright",
|
||||||
"package:license",
|
"package:license",
|
||||||
"package:provides",
|
"package:provides",
|
||||||
|
|||||||
@@ -135,8 +135,8 @@ ReaderImplBase::PackageVersionAttributeHandler::HandleAttribute(
|
|||||||
fPackageVersionData.preRelease = value.string;
|
fPackageVersionData.preRelease = value.string;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE:
|
case B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION:
|
||||||
fPackageVersionData.release = value.unsignedInt;
|
fPackageVersionData.revision = value.unsignedInt;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
default:
|
default:
|
||||||
|
|||||||
@@ -577,12 +577,12 @@ WriterImplBase::RegisterPackageVersion(PackageAttributeList& attributeList,
|
|||||||
versionMajor->children.Add(preRelease);
|
versionMajor->children.Add(preRelease);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (version.Release() != 0) {
|
if (version.Revision() != 0) {
|
||||||
PackageAttribute* versionRelease = new PackageAttribute(
|
PackageAttribute* versionRevision = new PackageAttribute(
|
||||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE,
|
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION,
|
||||||
B_HPKG_ATTRIBUTE_TYPE_UINT, B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
|
B_HPKG_ATTRIBUTE_TYPE_UINT, B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT);
|
||||||
versionRelease->unsignedInt = version.Release();
|
versionRevision->unsignedInt = version.Revision();
|
||||||
versionMajor->children.Add(versionRelease);
|
versionMajor->children.Add(versionRevision);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user