diff --git a/.gitignore b/.gitignore index 3002a4d..83fb5d0 100644 --- a/.gitignore +++ b/.gitignore @@ -8,3 +8,4 @@ fif_* !clippy.sh cargo-timing*.html todo.txt +/pkg/fif.spec \ No newline at end of file diff --git a/.idea/csv-plugin.xml b/.idea/csv-plugin.xml index b2eb9b1..5c6cd6e 100644 --- a/.idea/csv-plugin.xml +++ b/.idea/csv-plugin.xml @@ -10,6 +10,27 @@ + + + + + + + + + + + + + + + + + + diff --git a/.idea/fif.iml b/.idea/fif.iml index e9eb8f3..b22d9da 100644 --- a/.idea/fif.iml +++ b/.idea/fif.iml @@ -13,6 +13,7 @@ + diff --git a/CHANGELOG.md b/CHANGELOG.md index 93e35dc..8ecf3b4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,8 @@ Dates are given in YYYY-MM-DD format. ### v0.2.12 (2021-???) - Much better README.md - Better documentation for command line arguments +- Added more stuff to test.py +- PKGBUILD for Arch-based distros ### v0.2.11 (2021-04-04) #### Features diff --git a/Cargo.toml b/Cargo.toml index daca21a..1d54139 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -10,7 +10,7 @@ repository = "https://git.bune.city/lynnesbian/fif" readme = "README.md" keywords = ["mime", "mimetype", "utilities", "tools"] categories = ["command-line-utilities"] -exclude = [".idea/", "Cross.toml", "*.sh", "*.py", ".drone.yml"] +exclude = [".idea/", "Cross.toml", "*.sh", "*.py", ".drone.yml", "pkg/"] #resolver = "2" #license-file = "LICENSE" diff --git a/pkg/PKGBUILD b/pkg/PKGBUILD new file mode 100644 index 0000000..913dae0 --- /dev/null +++ b/pkg/PKGBUILD @@ -0,0 +1,26 @@ +pkgname=fif +pkgver=0.2.11 +pkgrel=1 +pkgdesc="A command-line tool for detecting and optionally correcting files with incorrect extensions." +# tier 1 rust linux targets +arch=('x86_64' 'i686' 'aarch64') +url="https://git.bune.city/lynnesbian/fif" +license=('GPLv3+') +depends=('shared-mime-info') +source=("$pkgname-$pkgver.tar.gz::https://git.bune.city/lynnesbian/$pkgname/archive/v${pkgver}.tar.gz") +sha256sums=("fd2b3133fabf8ad1993c6d16a9bf1ad645b1eff8fd30a4a9227ef5a157f56183") + +build() { + cd "$pkgname" + cargo build --release --locked +} + +check() { + cd "$pkgname" + cargo build --release --locked +} + +package() { + cd "$pkgname" + install -Dm 755 target/release/${pkgname} -t "${pkgdir}/usr/bin" +} \ No newline at end of file diff --git a/test.py b/test.py index 1b49df9..e664628 100755 --- a/test.py +++ b/test.py @@ -2,8 +2,19 @@ import re import subprocess +import sys -def main(): +def test_archs(): + archs = ["aarch64", "powerpc"] + upto = 1 + target = len(archs) + + for arch in archs: + print(f"Testing {arch} ({upto} of {target})") + subprocess.run(f"cross test --features=infer-backend --target {arch}-unknown-linux-gnu".split(" ")) + upto += 1 + +def test_versions(): match = re.search( r'rust-version ?= ?"([\d.]+)"', open("Cargo.toml", "r").read(-1) @@ -13,26 +24,36 @@ def main(): print("Couldn't find rust-version") exit(1) - versions = [match.group(1), "stable", "beta", "nightly"] + versions = [match.group(1), "stable", "nightly"] backends = ["xdg-mime", "infer"] - done = 0 + upto = 1 target = len(versions) * len(backends) * 2 for version in versions: for backend in backends: - print(f"[{version}, {backend}] Tests") + print(f"[{version}, {backend}] Tests ({upto} of {target})") subprocess.run(f"cargo +{version} test --features={backend}-backend".split(" ")) - done += 1 - print(f"Success - {done} of {target} complete") + upto += 1 - print(f"[{version}, {backend}] Scanning imgs") - subprocess.run(f"cargo +{version} run --release --features={backend}-backend -- -E images imgs".split(" ")) - done += 1 - print(f"Success - {done} of {target} complete") + print(f"[{version}, {backend}] Scanning imgs ({upto} of {target})") + subprocess.run(f"cargo +{version} run --release --features={backend}-backend -- imgs".split(" ")) + upto += 1 + +def main(): + done_something = False + if "versions" in sys.argv: + test_versions() + done_something = True + if "archs" in sys.argv: + test_archs() + done_something = True + + if not done_something: + print("You must supply at least one of `versions` or `archs` as an argument! 0uo") + sys.exit(2) print("Done! You might want to run cargo clean...") if __name__ == "__main__": main() -