BPackageResolvable: Add compatibleVersion property
This commit is contained in:
parent
ea754ce710
commit
4438ef7a2c
@ -23,10 +23,11 @@ using BHPKG::BPackageResolvableData;
|
|||||||
|
|
||||||
/*
|
/*
|
||||||
* Defines a resolvable (something other packages can depend upon).
|
* Defines a resolvable (something other packages can depend upon).
|
||||||
* Each resolvable is defined as a name (with an optional type prefix)
|
* Each resolvable is defined as a name (with an optional type prefix),
|
||||||
* and an optional version.
|
* an optional version, and an optional compatibility version (the least
|
||||||
|
* version the resolvable is backwards compatible with).
|
||||||
*
|
*
|
||||||
* resolvable ::= <name>['='<version>]
|
* resolvable ::= <name>['='<version>]['compat' '>=' <version>]
|
||||||
* name ::= [<type>':']<word>
|
* name ::= [<type>':']<word>
|
||||||
* type ::= 'lib' | 'cmd' | 'app' | 'add_on'
|
* type ::= 'lib' | 'cmd' | 'app' | 'add_on'
|
||||||
*
|
*
|
||||||
@ -39,7 +40,7 @@ using BHPKG::BPackageResolvableData;
|
|||||||
* String examples:
|
* String examples:
|
||||||
* haiku=r1
|
* haiku=r1
|
||||||
* lib:libssl=0.9.8i
|
* lib:libssl=0.9.8i
|
||||||
* subversion=1.5
|
* subversion=1.5 compat>=1.0
|
||||||
* cmd:svn
|
* cmd:svn
|
||||||
*/
|
*/
|
||||||
class BPackageResolvable {
|
class BPackageResolvable {
|
||||||
@ -51,6 +52,8 @@ public:
|
|||||||
BPackageResolvableType type
|
BPackageResolvableType type
|
||||||
= B_PACKAGE_RESOLVABLE_TYPE_DEFAULT,
|
= B_PACKAGE_RESOLVABLE_TYPE_DEFAULT,
|
||||||
const BPackageVersion& version
|
const BPackageVersion& version
|
||||||
|
= BPackageVersion(),
|
||||||
|
const BPackageVersion& compatibleVersion
|
||||||
= BPackageVersion());
|
= BPackageVersion());
|
||||||
|
|
||||||
status_t InitCheck() const;
|
status_t InitCheck() const;
|
||||||
@ -58,6 +61,7 @@ public:
|
|||||||
const BString& Name() const;
|
const BString& Name() const;
|
||||||
BPackageResolvableType Type() const;
|
BPackageResolvableType Type() const;
|
||||||
const BPackageVersion& Version() const;
|
const BPackageVersion& Version() const;
|
||||||
|
const BPackageVersion& CompatibleVersion() const;
|
||||||
|
|
||||||
BString ToString() const;
|
BString ToString() const;
|
||||||
|
|
||||||
@ -65,6 +69,8 @@ public:
|
|||||||
BPackageResolvableType type
|
BPackageResolvableType type
|
||||||
= B_PACKAGE_RESOLVABLE_TYPE_DEFAULT,
|
= B_PACKAGE_RESOLVABLE_TYPE_DEFAULT,
|
||||||
const BPackageVersion& version
|
const BPackageVersion& version
|
||||||
|
= BPackageVersion(),
|
||||||
|
const BPackageVersion& compatibleVersion
|
||||||
= BPackageVersion());
|
= BPackageVersion());
|
||||||
void Clear();
|
void Clear();
|
||||||
|
|
||||||
@ -75,6 +81,7 @@ private:
|
|||||||
BString fName;
|
BString fName;
|
||||||
BPackageResolvableType fType;
|
BPackageResolvableType fType;
|
||||||
BPackageVersion fVersion;
|
BPackageVersion fVersion;
|
||||||
|
BPackageVersion fCompatibleVersion;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -33,17 +33,20 @@ BPackageResolvable::BPackageResolvable(const BPackageResolvableData& data)
|
|||||||
:
|
:
|
||||||
fName(data.name),
|
fName(data.name),
|
||||||
fType(data.type),
|
fType(data.type),
|
||||||
fVersion(data.version)
|
fVersion(data.version),
|
||||||
|
fCompatibleVersion(data.compatibleVersion)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
BPackageResolvable::BPackageResolvable(const BString& name,
|
BPackageResolvable::BPackageResolvable(const BString& name,
|
||||||
BPackageResolvableType type, const BPackageVersion& version)
|
BPackageResolvableType type, const BPackageVersion& version,
|
||||||
|
const BPackageVersion& compatibleVersion)
|
||||||
:
|
:
|
||||||
fName(name),
|
fName(name),
|
||||||
fType(type),
|
fType(type),
|
||||||
fVersion(version)
|
fVersion(version),
|
||||||
|
fCompatibleVersion(compatibleVersion)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -76,6 +79,13 @@ BPackageResolvable::Version() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
const BPackageVersion&
|
||||||
|
BPackageResolvable::CompatibleVersion() const
|
||||||
|
{
|
||||||
|
return fCompatibleVersion;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
BString
|
BString
|
||||||
BPackageResolvable::ToString() const
|
BPackageResolvable::ToString() const
|
||||||
{
|
{
|
||||||
@ -85,17 +95,21 @@ BPackageResolvable::ToString() const
|
|||||||
if (fVersion.InitCheck() == B_OK)
|
if (fVersion.InitCheck() == B_OK)
|
||||||
string << '=' << fVersion.ToString();
|
string << '=' << fVersion.ToString();
|
||||||
|
|
||||||
|
if (fCompatibleVersion.InitCheck() == B_OK)
|
||||||
|
string << " compat>=" << fCompatibleVersion.ToString();
|
||||||
|
|
||||||
return string;
|
return string;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
void
|
void
|
||||||
BPackageResolvable::SetTo(const BString& name, BPackageResolvableType type,
|
BPackageResolvable::SetTo(const BString& name, BPackageResolvableType type,
|
||||||
const BPackageVersion& version)
|
const BPackageVersion& version, const BPackageVersion& compatibleVersion)
|
||||||
{
|
{
|
||||||
fName = name;
|
fName = name;
|
||||||
fType = type;
|
fType = type;
|
||||||
fVersion = version;
|
fVersion = version;
|
||||||
|
fCompatibleVersion = compatibleVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -104,6 +118,7 @@ BPackageResolvable::Clear()
|
|||||||
{
|
{
|
||||||
fName.Truncate(0);
|
fName.Truncate(0);
|
||||||
fVersion.Clear();
|
fVersion.Clear();
|
||||||
|
fCompatibleVersion.Clear();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user