added architectures test to test.py, PKGBUILD for arch distros

This commit is contained in:
Lynne Megido 2021-04-07 05:20:49 +10:00
parent e83ac778d6
commit 0f2f408c09
Signed by: lynnesbian
GPG key ID: F0A184B5213D9F90
7 changed files with 84 additions and 12 deletions

1
.gitignore vendored
View file

@ -8,3 +8,4 @@ fif_*
!clippy.sh
cargo-timing*.html
todo.txt
/pkg/fif.spec

View file

@ -10,6 +10,27 @@
</Attribute>
</value>
</entry>
<entry key="/README.md">
<value>
<Attribute>
<option name="separator" value="," />
</Attribute>
</value>
</entry>
<entry key="/pkg/PKGBUILD">
<value>
<Attribute>
<option name="separator" value="&#9;" />
</Attribute>
</value>
</entry>
<entry key="/pkg/fif.spec">
<value>
<Attribute>
<option name="separator" value=":" />
</Attribute>
</value>
</entry>
<entry key="/src/formats.rs">
<value>
<Attribute>

View file

@ -13,6 +13,7 @@
<excludeFolder url="file://$MODULE_DIR$/old" />
<excludeFolder url="file://$MODULE_DIR$/awful" />
<excludeFolder url="file://$MODULE_DIR$/.mypy_cache" />
<excludeFolder url="file://$MODULE_DIR$/pkg" />
</content>
<orderEntry type="inheritedJdk" />
<orderEntry type="sourceFolder" forTests="false" />

View file

@ -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

View file

@ -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"

26
pkg/PKGBUILD Normal file
View file

@ -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"
}

43
test.py
View file

@ -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()