mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-05 09:15:34 +08:00
Fixes an issue reported by @rphohl that XSwiftBus is not found
* only download non-restricted versions * utility functions to find non-restricted versions
This commit is contained in:
@@ -56,6 +56,11 @@ namespace BlackMisc
|
||||
return m_platform.matchesAny(platform);
|
||||
}
|
||||
|
||||
bool CArtifact::hasUnrestrictedDistribution() const
|
||||
{
|
||||
return m_distributions.containsUnrestricted();
|
||||
}
|
||||
|
||||
bool CArtifact::isWithDistribution(const CDistribution &distribution, bool acceptMoreStableDistributions) const
|
||||
{
|
||||
if (distribution.isEmpty() || !this->hasDistributions()) { return false; }
|
||||
@@ -73,6 +78,7 @@ namespace BlackMisc
|
||||
CRemoteFile rf(this->getName(), this->getFileSize());
|
||||
const CDistribution d = this->getMostStableDistribution();
|
||||
const CUrl url = d.getDownloadUrls().getRandomUrl();
|
||||
if (url.isEmpty()) { return CRemoteFile(); }
|
||||
rf.setUtcTimestamp(this->getUtcTimestamp());
|
||||
rf.setUrl(url);
|
||||
rf.setDescription(this->getPlatform().toQString() + " " + d.getChannel());
|
||||
|
||||
@@ -123,6 +123,9 @@ namespace BlackMisc
|
||||
//! Has distributions?
|
||||
bool hasDistributions() const { return !m_distributions.isEmpty(); }
|
||||
|
||||
//! Has unrestricted distribution
|
||||
bool hasUnrestrictedDistribution() const;
|
||||
|
||||
//! Is distributed with given distribution?
|
||||
bool isWithDistribution(const CDistribution &distribution, bool acceptMoreStableDistributions) const;
|
||||
|
||||
|
||||
@@ -77,6 +77,17 @@ namespace BlackMisc
|
||||
return al;
|
||||
}
|
||||
|
||||
CArtifactList CArtifactList::findWithUnrestrictedDistributions() const
|
||||
{
|
||||
CArtifactList al;
|
||||
for (const CArtifact &artifact : *this)
|
||||
{
|
||||
if (!artifact.hasUnrestrictedDistribution()) { continue; }
|
||||
al.push_back(artifact);
|
||||
}
|
||||
return al;
|
||||
}
|
||||
|
||||
CArtifactList CArtifactList::findByDistributionAndPlatform(const CDistribution &distribution, const CPlatform &platform, bool findMoreStableDistributions) const
|
||||
{
|
||||
return this->findByMatchingPlatform(platform).findByDistribution(distribution, findMoreStableDistributions);
|
||||
|
||||
@@ -64,6 +64,9 @@ namespace BlackMisc
|
||||
//! Find by distribution
|
||||
CArtifactList findByDistribution(const CDistribution &distribution, bool findMoreStableDistribution = false) const;
|
||||
|
||||
//! Find artifacts with public (unrestricted) distributions
|
||||
CArtifactList findWithUnrestrictedDistributions() const;
|
||||
|
||||
//! Find by distribution and platform
|
||||
CArtifactList findByDistributionAndPlatform(const CDistribution &distribution, const CPlatform &platform, bool findMoreStableDistributions = false) const;
|
||||
|
||||
|
||||
@@ -48,7 +48,7 @@ namespace BlackMisc
|
||||
|
||||
bool CDistributionList::containsUnrestricted() const
|
||||
{
|
||||
return this->contains(&CDistribution::isRestricted, true);
|
||||
return this->contains(&CDistribution::isRestricted, false);
|
||||
}
|
||||
|
||||
bool CDistributionList::containsChannel(const QString &channel) const
|
||||
|
||||
Reference in New Issue
Block a user