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:
parent
bd59e0d00d
commit
202c1daaed
@ -221,7 +221,7 @@ if $(TARGET_ARCH) != x86 {
|
||||
Echo "Libsolv not available for $(TARGET_ARCH)." ;
|
||||
} else if $(HAIKU_GCC_VERSION[1]) = 2 {
|
||||
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 {
|
||||
Echo "Libsolv not available for gcc4." ;
|
||||
}
|
||||
|
@ -152,7 +152,7 @@ public:
|
||||
BPackageArchitecture& _architecture);
|
||||
|
||||
static status_t ParseVersionString(const BString& string,
|
||||
bool releaseIsOptional,
|
||||
bool revisionIsOptional,
|
||||
BPackageVersion& _version,
|
||||
ParseErrorListener* listener = NULL);
|
||||
|
||||
|
@ -16,7 +16,8 @@ enum BPackageInfoAttributeID {
|
||||
B_PACKAGE_INFO_VENDOR, // e.g. "Haiku Project"
|
||||
B_PACKAGE_INFO_PACKAGER, // e-mail address preferred
|
||||
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_LICENSES, // list
|
||||
B_PACKAGE_INFO_PROVIDES, // list of resolvables this package provides,
|
||||
|
@ -24,10 +24,10 @@ public:
|
||||
BPackageVersion(
|
||||
const BPackageVersionData& data);
|
||||
explicit BPackageVersion(const BString& versionString,
|
||||
bool releaseIsOptional = true);
|
||||
bool revisionIsOptional = true);
|
||||
BPackageVersion(const BString& major,
|
||||
const BString& minor, const BString& micro,
|
||||
const BString& preRelease, uint8 release);
|
||||
const BString& preRelease, uint32 revision);
|
||||
|
||||
status_t InitCheck() const;
|
||||
|
||||
@ -36,27 +36,27 @@ public:
|
||||
const BString& Micro() const;
|
||||
const BString& PreRelease() const;
|
||||
// "alpha3", "beta2", "rc1" or "" if final
|
||||
uint8 Release() const;
|
||||
uint32 Revision() const;
|
||||
|
||||
BString ToString() const;
|
||||
|
||||
void SetTo(const BString& major,
|
||||
const BString& minor, const BString& micro,
|
||||
const BString& preRelease, uint8 release);
|
||||
const BString& preRelease, uint32 revision);
|
||||
status_t SetTo(const BString& versionString,
|
||||
bool releaseIsOptional = true);
|
||||
bool revisionIsOptional = true);
|
||||
void Clear();
|
||||
|
||||
int Compare(const BPackageVersion& other) const;
|
||||
// does a natural compare over major, minor
|
||||
// and micro, finally comparing release
|
||||
// and micro, finally comparing revision
|
||||
|
||||
private:
|
||||
BString fMajor;
|
||||
BString fMinor;
|
||||
BString fMicro;
|
||||
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_MINOR = 26,
|
||||
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_LICENSE = 30,
|
||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_PROVIDES = 31,
|
||||
|
@ -24,7 +24,7 @@ struct BPackageVersionData {
|
||||
const char* minor;
|
||||
const char* micro;
|
||||
const char* preRelease;
|
||||
uint8 release;
|
||||
uint32 revision;
|
||||
};
|
||||
|
||||
|
||||
|
@ -183,7 +183,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
||||
::Version* version;
|
||||
status_t error = Version::Create(value.version.major,
|
||||
value.version.minor, value.version.micro,
|
||||
value.version.preRelease, value.version.release, version);
|
||||
value.version.preRelease, value.version.revision, version);
|
||||
if (error != B_OK)
|
||||
RETURN_ERROR(error);
|
||||
|
||||
@ -209,7 +209,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
||||
= value.resolvable.version;
|
||||
status_t error = Version::Create(versionInfo.major,
|
||||
versionInfo.minor, versionInfo.micro,
|
||||
versionInfo.preRelease, versionInfo.release, version);
|
||||
versionInfo.preRelease, versionInfo.revision, version);
|
||||
if (error != B_OK)
|
||||
RETURN_ERROR(error);
|
||||
}
|
||||
@ -222,7 +222,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
||||
= value.resolvable.compatibleVersion;
|
||||
status_t error = Version::Create(versionInfo.major,
|
||||
versionInfo.minor, versionInfo.micro,
|
||||
versionInfo.preRelease, versionInfo.release,
|
||||
versionInfo.preRelease, versionInfo.revision,
|
||||
compatibleVersion);
|
||||
if (error != B_OK)
|
||||
RETURN_ERROR(error);
|
||||
@ -266,7 +266,7 @@ struct Package::LoaderContentHandler : BPackageContentHandler {
|
||||
= value.resolvableExpression.version;
|
||||
status_t error = Version::Create(versionInfo.major,
|
||||
versionInfo.minor, versionInfo.micro,
|
||||
versionInfo.preRelease, versionInfo.release, version);
|
||||
versionInfo.preRelease, versionInfo.revision, version);
|
||||
if (error != B_OK)
|
||||
RETURN_ERROR(error);
|
||||
|
||||
|
@ -39,7 +39,7 @@ Version::Version()
|
||||
fMinor(NULL),
|
||||
fMicro(NULL),
|
||||
fPreRelease(NULL),
|
||||
fRelease(0)
|
||||
fRevision(0)
|
||||
{
|
||||
}
|
||||
|
||||
@ -55,7 +55,7 @@ Version::~Version()
|
||||
|
||||
status_t
|
||||
Version::Init(const char* major, const char* minor, const char* micro,
|
||||
const char* preRelease, uint8 release)
|
||||
const char* preRelease, uint32 revision)
|
||||
{
|
||||
if (major != NULL) {
|
||||
fMajor = strdup(major);
|
||||
@ -81,7 +81,7 @@ Version::Init(const char* major, const char* minor, const char* micro,
|
||||
return B_NO_MEMORY;
|
||||
}
|
||||
|
||||
fRelease = release;
|
||||
fRevision = revision;
|
||||
|
||||
return B_OK;
|
||||
}
|
||||
@ -89,13 +89,13 @@ Version::Init(const char* major, const char* minor, const char* micro,
|
||||
|
||||
/*static*/ status_t
|
||||
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;
|
||||
if (version == NULL)
|
||||
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) {
|
||||
delete version;
|
||||
return error;
|
||||
@ -136,7 +136,8 @@ Version::Compare(const Version& other) const
|
||||
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);
|
||||
}
|
||||
|
||||
if (fRelease != 0) {
|
||||
if (fRevision != 0) {
|
||||
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;
|
||||
|
@ -20,11 +20,11 @@ public:
|
||||
|
||||
status_t Init(const char* major, const char* minor,
|
||||
const char* micro, const char* preRelease,
|
||||
uint8 release);
|
||||
uint32 revision);
|
||||
|
||||
static status_t Create(const char* major, const char* minor,
|
||||
const char* micro, const char* preRelease,
|
||||
uint8 release, Version*& _version);
|
||||
uint32 revision, Version*& _version);
|
||||
|
||||
int Compare(const Version& other) const;
|
||||
bool Compare(BPackageResolvableOperator op,
|
||||
@ -39,7 +39,7 @@ private:
|
||||
char* fMinor;
|
||||
char* fMicro;
|
||||
char* fPreRelease;
|
||||
uint8 fRelease;
|
||||
uint32 fRevision;
|
||||
};
|
||||
|
||||
|
||||
|
@ -272,8 +272,8 @@ private:
|
||||
printf(".%s", version.micro);
|
||||
if (version.preRelease != NULL && version.preRelease[0] != '\0')
|
||||
printf("-%s", version.preRelease);
|
||||
if (version.release > 0)
|
||||
printf("-%d", version.release);
|
||||
if (version.revision > 0)
|
||||
printf("-%" B_PRIu32, version.revision);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -238,8 +238,8 @@ private:
|
||||
printf(".%s", version.micro);
|
||||
if (version.preRelease != NULL && version.preRelease[0] != '\0')
|
||||
printf("-%s", version.preRelease);
|
||||
if (version.release > 0)
|
||||
printf("-%d", version.release);
|
||||
if (version.revision > 0)
|
||||
printf("-%" B_PRIu32, version.revision);
|
||||
}
|
||||
|
||||
private:
|
||||
|
@ -73,7 +73,7 @@ public:
|
||||
BPackageInfo* packageInfo);
|
||||
|
||||
status_t ParseVersion(const BString& versionString,
|
||||
bool releaseIsOptional,
|
||||
bool revisionIsOptional,
|
||||
BPackageVersion& _version);
|
||||
|
||||
private:
|
||||
@ -89,10 +89,10 @@ private:
|
||||
void _ParseArchitectureValue(
|
||||
BPackageArchitecture* value);
|
||||
void _ParseVersionValue(BPackageVersion* value,
|
||||
bool releaseIsOptional);
|
||||
bool revisionIsOptional);
|
||||
static void _ParseVersionValue(Token& word,
|
||||
BPackageVersion* value,
|
||||
bool releaseIsOptional);
|
||||
bool revisionIsOptional);
|
||||
void _ParseList(ListElementParser& elementParser,
|
||||
bool allowSingleNonListElement);
|
||||
void _ParseStringList(BStringList* value,
|
||||
@ -219,13 +219,13 @@ BPackageInfo::Parser::Parse(const BString& packageInfoString,
|
||||
|
||||
status_t
|
||||
BPackageInfo::Parser::ParseVersion(const BString& versionString,
|
||||
bool releaseIsOptional, BPackageVersion& _version)
|
||||
bool revisionIsOptional, BPackageVersion& _version)
|
||||
{
|
||||
fPos = versionString.String();
|
||||
|
||||
try {
|
||||
Token token(TOKEN_WORD, fPos, versionString.Length());
|
||||
_ParseVersionValue(token, &_version, releaseIsOptional);
|
||||
_ParseVersionValue(token, &_version, revisionIsOptional);
|
||||
} catch (const ParseError& error) {
|
||||
if (fListener != NULL) {
|
||||
int32 offset = error.pos - versionString.String();
|
||||
@ -393,41 +393,41 @@ BPackageInfo::Parser::_ParseArchitectureValue(BPackageArchitecture* value)
|
||||
|
||||
void
|
||||
BPackageInfo::Parser::_ParseVersionValue(BPackageVersion* value,
|
||||
bool releaseIsOptional)
|
||||
bool revisionIsOptional)
|
||||
{
|
||||
Token word = _NextToken();
|
||||
_ParseVersionValue(word, value, releaseIsOptional);
|
||||
_ParseVersionValue(word, value, revisionIsOptional);
|
||||
}
|
||||
|
||||
|
||||
/*static*/ void
|
||||
BPackageInfo::Parser::_ParseVersionValue(Token& word, BPackageVersion* value,
|
||||
bool releaseIsOptional)
|
||||
bool revisionIsOptional)
|
||||
{
|
||||
if (word.type != TOKEN_WORD)
|
||||
throw ParseError("expected word (a version)", word.pos);
|
||||
|
||||
// get the release number
|
||||
uint8 release = 0;
|
||||
// get the revision number
|
||||
uint32 revision = 0;
|
||||
int32 lastDashPos = word.text.FindLast('-');
|
||||
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
|
||||
// non-digit.
|
||||
if (isdigit(word.text[lastDashPos + 1])) {
|
||||
int number = atoi(word.text.String() + lastDashPos + 1);
|
||||
if (number <= 0 || number > 99) {
|
||||
throw ParseError("release number must be from 1-99",
|
||||
if (number <= 0) {
|
||||
throw ParseError("revision number must be > 0",
|
||||
word.pos + word.text.Length());
|
||||
}
|
||||
release = number;
|
||||
revision = number;
|
||||
word.text.Truncate(lastDashPos);
|
||||
lastDashPos = word.text.FindLast('-');
|
||||
}
|
||||
}
|
||||
|
||||
if (release == 0 && !releaseIsOptional) {
|
||||
throw ParseError("expected release number (-<number> suffix)",
|
||||
if (revision == 0 && !revisionIsOptional) {
|
||||
throw ParseError("expected revision number (-<number> suffix)",
|
||||
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
|
||||
BPackageInfo::ParseVersionString(const BString& string, bool releaseIsOptional,
|
||||
BPackageInfo::ParseVersionString(const BString& string, bool revisionIsOptional,
|
||||
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"))
|
||||
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"))
|
||||
return B_BAD_VALUE;
|
||||
|
||||
uint8 revision;
|
||||
error = archive->FindUInt8(fieldName, index, &revision);
|
||||
uint32 revision;
|
||||
error = archive->FindUInt32(fieldName, index, &revision);
|
||||
if (error != B_OK)
|
||||
return error;
|
||||
|
||||
|
@ -20,28 +20,28 @@ namespace BPackageKit {
|
||||
|
||||
BPackageVersion::BPackageVersion()
|
||||
:
|
||||
fRelease(0)
|
||||
fRevision(0)
|
||||
{
|
||||
}
|
||||
|
||||
|
||||
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,
|
||||
bool releaseIsOptional)
|
||||
bool revisionIsOptional)
|
||||
{
|
||||
SetTo(versionString, releaseIsOptional);
|
||||
SetTo(versionString, revisionIsOptional);
|
||||
}
|
||||
|
||||
|
||||
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
|
||||
BPackageVersion::Release() const
|
||||
uint32
|
||||
BPackageVersion::Revision() const
|
||||
{
|
||||
return fRelease;
|
||||
return fRevision;
|
||||
}
|
||||
|
||||
|
||||
@ -117,7 +117,7 @@ BPackageVersion::Compare(const BPackageVersion& other) const
|
||||
return diff;
|
||||
}
|
||||
|
||||
return (int)fRelease - (int)other.fRelease;
|
||||
return (int)fRevision - (int)other.fRevision;
|
||||
}
|
||||
|
||||
|
||||
@ -135,8 +135,8 @@ BPackageVersion::ToString() const
|
||||
if (!fPreRelease.IsEmpty())
|
||||
string << '-' << fPreRelease;
|
||||
|
||||
if (fRelease > 0)
|
||||
string << '-' << fRelease;
|
||||
if (fRevision > 0)
|
||||
string << '-' << fRevision;
|
||||
|
||||
return string;
|
||||
}
|
||||
@ -144,13 +144,13 @@ BPackageVersion::ToString() const
|
||||
|
||||
void
|
||||
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;
|
||||
fMinor = minor;
|
||||
fMicro = micro;
|
||||
fPreRelease = preRelease;
|
||||
fRelease = release;
|
||||
fRevision = revision;
|
||||
|
||||
fMajor.ToLower();
|
||||
fMinor.ToLower();
|
||||
@ -160,10 +160,10 @@ BPackageVersion::SetTo(const BString& major, const BString& minor,
|
||||
|
||||
|
||||
status_t
|
||||
BPackageVersion::SetTo(const BString& versionString, bool releaseIsOptional)
|
||||
BPackageVersion::SetTo(const BString& versionString, bool revisionIsOptional)
|
||||
{
|
||||
Clear();
|
||||
return BPackageInfo::ParseVersionString(versionString, releaseIsOptional,
|
||||
return BPackageInfo::ParseVersionString(versionString, revisionIsOptional,
|
||||
*this);
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ BPackageVersion::Clear()
|
||||
fMinor.Truncate(0);
|
||||
fMicro.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.minor",
|
||||
"package:version.micro",
|
||||
"package:version.release",
|
||||
"package:version.revision",
|
||||
"package:copyright",
|
||||
"package:license",
|
||||
"package:provides",
|
||||
|
@ -135,8 +135,8 @@ ReaderImplBase::PackageVersionAttributeHandler::HandleAttribute(
|
||||
fPackageVersionData.preRelease = value.string;
|
||||
break;
|
||||
|
||||
case B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE:
|
||||
fPackageVersionData.release = value.unsignedInt;
|
||||
case B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION:
|
||||
fPackageVersionData.revision = value.unsignedInt;
|
||||
break;
|
||||
|
||||
default:
|
||||
|
@ -577,12 +577,12 @@ WriterImplBase::RegisterPackageVersion(PackageAttributeList& attributeList,
|
||||
versionMajor->children.Add(preRelease);
|
||||
}
|
||||
|
||||
if (version.Release() != 0) {
|
||||
PackageAttribute* versionRelease = new PackageAttribute(
|
||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_RELEASE,
|
||||
B_HPKG_ATTRIBUTE_TYPE_UINT, B_HPKG_ATTRIBUTE_ENCODING_INT_8_BIT);
|
||||
versionRelease->unsignedInt = version.Release();
|
||||
versionMajor->children.Add(versionRelease);
|
||||
if (version.Revision() != 0) {
|
||||
PackageAttribute* versionRevision = new PackageAttribute(
|
||||
B_HPKG_ATTRIBUTE_ID_PACKAGE_VERSION_REVISION,
|
||||
B_HPKG_ATTRIBUTE_TYPE_UINT, B_HPKG_ATTRIBUTE_ENCODING_INT_32_BIT);
|
||||
versionRevision->unsignedInt = version.Revision();
|
||||
versionMajor->children.Add(versionRevision);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user