Boards Manager: platforms listed in non-signed package index files goes under "Contributed" category

This commit is contained in:
Federico Fissore 2015-05-04 12:05:11 +02:00
parent cddfa2891e
commit a214564952
2 changed files with 13 additions and 3 deletions

View File

@ -39,6 +39,8 @@ public abstract class ContributedPlatform extends DownloadableContribution {
public abstract String getCategory();
public abstract void setCategory(String category);
public abstract String getArchitecture();
public abstract String getChecksum();

View File

@ -97,13 +97,21 @@ public class ContributionsIndexer {
}
private void mergeContributions(ContributionsIndex contributionsIndex, File indexFile) {
boolean signed = isSigned(indexFile);
for (ContributedPackage contributedPackage : contributionsIndex.getPackages()) {
if (!signed) {
for (ContributedPlatform contributedPlatform : contributedPackage.getPlatforms()) {
contributedPlatform.setCategory("Contributed");
}
}
ContributedPackage targetPackage = index.getPackage(contributedPackage.getName());
if (targetPackage == null) {
index.getPackages().add(contributedPackage);
} else {
if (mergeAllowed(contributedPackage, indexFile)) {
if (signed || !isPackageNameProtected(contributedPackage)) {
List<ContributedPlatform> platforms = contributedPackage.getPlatforms();
if (platforms == null) {
platforms = new LinkedList<ContributedPlatform>();
@ -131,8 +139,8 @@ public class ContributionsIndexer {
}
}
private boolean mergeAllowed(ContributedPackage contributedPackage, File indexFile) {
return !Constants.PROTECTED_PACKAGE_NAMES.contains(contributedPackage.getName()) || isSigned(indexFile);
private boolean isPackageNameProtected(ContributedPackage contributedPackage) {
return Constants.PROTECTED_PACKAGE_NAMES.contains(contributedPackage.getName());
}
private boolean isSigned(File indexFile) {