summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatthias Beyer <mail@beyermatthias.de>2019-05-02 16:42:48 +0200
committerGitHub <noreply@github.com>2019-05-02 16:42:48 +0200
commit797529f4bbc114fe67911e111ee49f102e13d929 (patch)
tree87972eda4c6ad63248e3374d5e83d632cca9a244
parent4c26f98c6de843d9c35ba8a5ec1a3ba3d066b99d (diff)
parent6bf5171c648fda224a24a8ca69d4ab155ebdb629 (diff)
Merge pull request #15 from matthiasbeyer/strip
Strip code
-rw-r--r--Cargo.toml2
-rw-r--r--librepology/Cargo.toml9
-rw-r--r--librepology/src/lib.rs9
-rw-r--r--librepology/src/packagefilters.rs81
-rw-r--r--repolocli.toml16
-rw-r--r--src/config.rs30
-rw-r--r--src/main.rs1
7 files changed, 2 insertions, 146 deletions
diff --git a/Cargo.toml b/Cargo.toml
index c86f8b0..4fd13cb 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -11,7 +11,6 @@ readme = "./README.md"
keywords = ["cli", "repology"]
categories = ["command-line-interface", "command-line-utilities"]
license = "GPL-2.0-only"
-license-file = "./LICENSE"
[badges]
maintenance = { status = "actively-developed" }
@@ -23,7 +22,6 @@ serde = "1"
serde_derive = "1"
serde_json = "1"
toml = "0.5"
-toml-query = "0.8"
url = "1.7"
url_serde = "0.2"
xdg = "2"
diff --git a/librepology/Cargo.toml b/librepology/Cargo.toml
index 7dadd2f..51afe45 100644
--- a/librepology/Cargo.toml
+++ b/librepology/Cargo.toml
@@ -11,7 +11,6 @@ readme = "./README.md"
keywords = ["api", "repology"]
categories = ["data-structures", "api-bindings"]
license = "MPL-2.0"
-license-file = "./LICENSE"
[badges]
maintenance = { status = "actively-developed" }
@@ -25,12 +24,6 @@ url_serde = "0.2"
failure = "0.1"
log = "0.4"
derive_more = "0.14"
+derive-new = "0.5"
curl = "0.4"
-filters = { version = "0.3", optional = true }
-derive-new = { version = "0.5", optional = true }
-
-[features]
-# By default, we include the filters functionality
-default = [ "packagefilters" ]
-packagefilters = ["filters", "derive-new"]
diff --git a/librepology/src/lib.rs b/librepology/src/lib.rs
index 76992fd..d0904a4 100644
--- a/librepology/src/lib.rs
+++ b/librepology/src/lib.rs
@@ -5,16 +5,9 @@ extern crate url;
extern crate url_serde;
extern crate curl;
-#[cfg(feature = "packagefilters")]
-extern crate filters;
-#[cfg(feature = "packagefilters")]
-#[macro_use] extern crate derive_new;
-
#[macro_use] extern crate serde_derive;
#[macro_use] extern crate log;
#[macro_use] extern crate derive_more;
+#[macro_use] extern crate derive_new;
pub mod v1;
-
-#[cfg(feature = "packagefilters")]
-pub mod packagefilters;
diff --git a/librepology/src/packagefilters.rs b/librepology/src/packagefilters.rs
deleted file mode 100644
index d1293d4..0000000
--- a/librepology/src/packagefilters.rs
+++ /dev/null
@@ -1,81 +0,0 @@
-use filters::filter::Filter;
-
-use crate::v1::types::{Package, Repo, Name, Status, Version, License, Maintainer};
-
-
-#[derive(new, Debug)]
-pub struct PackageRepoNameFilter(Repo);
-
-/// Filter implementation for PackageRepoNameFilter
-///
-/// filters based on _equality_!
-impl Filter<Package> for PackageRepoNameFilter {
- fn filter(&self, package: &Package) -> bool {
- self.0 == *package.repo()
- }
-}
-
-
-#[derive(new, Debug)]
-pub struct PackageNameFilter(Name);
-
-/// Filter implementation for PackageNameFilter
-///
-/// filters based on _equality_!
-impl Filter<Package> for PackageNameFilter {
- fn filter(&self, package: &Package) -> bool {
- self.0 == *package.name()
- }
-}
-
-
-#[derive(new, Debug)]
-pub struct PackageVersionFilter(Version);
-
-/// Filter implementation for PackageVersionFilter
-///
-/// filters based on _equality_!
-impl Filter<Package> for PackageVersionFilter {
- fn filter(&self, package: &Package) -> bool {
- self.0 == *package.version()
- }
-}
-
-
-#[derive(new, Debug)]
-pub struct PackageStatusFilter(Status);
-
-/// Filter implementation for PackageStatusFilter
-///
-/// filters based on _equality_!
-impl Filter<Package> for PackageStatusFilter {
- fn filter(&self, package: &Package) -> bool {
- package.status().map(|s| self.0 == *s).unwrap_or(false)
- }
-}
-
-
-#[derive(new, Debug)]
-pub struct PackageLicenseFilter(License);
-
-/// Filter implementation for PackageLicenseFilter
-///
-/// filters based on _equality_!
-impl Filter<Package> for PackageLicenseFilter {
- fn filter(&self, package: &Package) -> bool {
- package.licenses().map(|lcs| lcs.iter().any(|l| self.0 == *l)).unwrap_or(false)
- }
-}
-
-
-#[derive(new, Debug)]
-pub struct PackageMaintainerFilter(Maintainer);
-
-/// Filter implementation for PackageMaintainerFilter
-///
-/// filters based on _equality_!
-impl Filter<Package> for PackageMaintainerFilter {
- fn filter(&self, package: &Package) -> bool {
- package.maintainers().map(|mts| mts.iter().any(|m| self.0 == *m)).unwrap_or(false)
- }
-}
diff --git a/repolocli.toml b/repolocli.toml
index d414a57..c25f7ce 100644
--- a/repolocli.toml
+++ b/repolocli.toml
@@ -12,19 +12,3 @@ blacklist = [
"Arch", # sorry Archers!
"scientific_7x",
]
-
-
-# If you're a packager, and you have packages locally you care about,
-# repolocli can show you differences between your packages and "upstream" packages, if you want that.
-# For that, you have to list these packages here (in repology manner, so you have to use the
-# same names as repology!
-#
-# Yes, you have to manually keep that list up to date, sorry about that.
-
-[[local_packages]]
-name = "jq" # if you don't know jq, go check it out NOW!
-local_version = "1.5"
-
-[[local_packages]]
-name = "languagetool"
-local_version = "4.4.1"
diff --git a/src/config.rs b/src/config.rs
index 7d47004..fde6c1e 100644
--- a/src/config.rs
+++ b/src/config.rs
@@ -1,5 +1,3 @@
-use std::ops::Deref;
-
use url::Url;
#[derive(Debug, Serialize, Deserialize)]
@@ -13,9 +11,6 @@ pub struct Configuration {
#[serde(rename = "blacklist")]
blacklist: Vec<String>,
-
- #[serde(rename = "local_packages")]
- local_packages: Option<Vec<Package>>,
}
impl Configuration {
@@ -31,30 +26,5 @@ impl Configuration {
&self.blacklist
}
- // unused
- //pub fn local_packages(&self) -> Option<&Vec<Package>> {
- // self.local_packages.as_ref()
- //}
-
-}
-
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Package {
- #[serde(rename = "name")]
- name: String,
-
- #[serde(rename = "local_version")]
- local_version: Version,
}
-/// Not reusing the librepology type here because it might change
-#[derive(Debug, Serialize, Deserialize)]
-pub struct Version(String);
-
-impl Deref for Version {
- type Target = String;
-
- fn deref(&self) -> &Self::Target {
- &self.0
- }
-}
diff --git a/src/main.rs b/src/main.rs
index a45ebb7..6190324 100644
--- a/src/main.rs
+++ b/src/main.rs
@@ -1,7 +1,6 @@
extern crate serde;
extern crate serde_json;
extern crate toml;
-extern crate toml_query;
extern crate url;
extern crate xdg;
extern crate flexi_logger;