Skip non-FSDG-compliant apps on Replicant during repo data parsing

Replicant is committed to follow the GNU Free System Distribution
Guidelines (FSDG)[1]. Apps with certain anti-feature flags in F-Droid
violate these guidelines and thus shouldn't be available in the
F-Droid client on Replicant[2].

Issue #564 discusses this, although only the case of having apps with
anti-features optionally filtered. To be compliant with the FSDG
guidelines, all violating apps must not be accessible and there
shouldn't be a setting to make them visible. Not all anti-features in
F-Droid violate the FSDG guidelines, so no need to filter all of them.

Signed-off-by: Wolfgang Wiedmeyer <wolfgit@wiedmeyer.de>

[1]  https://www.gnu.org/distros/free-system-distribution-guidelines.html

[2]  https://redmine.replicant.us/issues/1629
This commit is contained in:
Wolfgang Wiedmeyer 2017-03-21 21:03:52 +01:00
parent a7828bcb9e
commit 8f8afdb10d
No known key found for this signature in database
GPG Key ID: 5816A24C10757FC4

View File

@ -303,7 +303,9 @@ public class RepoXMLHandler extends DefaultHandler {
}
private void onApplicationParsed() {
receiver.receiveApp(curapp, apksList);
if (!replicantFSDGviolation()) {
receiver.receiveApp(curapp, apksList);
}
curapp = null;
apksList = new ArrayList<>();
// If the app packageName is already present in this apps list, then it
@ -402,4 +404,27 @@ public class RepoXMLHandler extends DefaultHandler {
}
return result;
}
private final String osVersion = System.getProperty("os.version");
/**
* Checks if an app fails to comply with the GNU Free System Distribution
* Guidelines in the case that F-Droid is installed on Replicant.
* Currently, all apps that have at least one of the following anti-features
* violate the guidelines: Tracking, NonFreeAdd, NonFreeDep and NonFreeAssets.
*/
private boolean replicantFSDGviolation() {
if (osVersion == null || !osVersion.contains("replicant")) {
return false;
}
if (curapp.antiFeatures != null && curapp.antiFeatures.length > 0) {
for (String af : curapp.antiFeatures) {
if ("Tracking".equals(af) || "NonFreeAdd".equals(af)
|| "NonFreeDep".equals(af) || "NonFreeAssets".equals(af)) {
return true;
}
}
}
return false;
}
}