rel update
Some checks failed
ci/woodpecker/push/build Pipeline failed

This commit is contained in:
JMARyA 2025-04-27 20:42:37 +02:00
parent e488955e7a
commit 4d3c50c5fc
Signed by: jmarya
GPG key ID: 901B2ADDF27C2263
3 changed files with 6 additions and 13 deletions

View file

@ -3,7 +3,7 @@ CREATE TABLE IF NOT EXISTS package_meta (
name TEXT NOT NULL, name TEXT NOT NULL,
arch TEXT NOT NULL, arch TEXT NOT NULL,
version TEXT NOT NULL, version TEXT NOT NULL,
rel INTEGER NOT NULL, rel TEXT NOT NULL,
download_count INTEGER NOT NULL DEFAULT 1, download_count INTEGER NOT NULL DEFAULT 1,
PRIMARY KEY (repo, name, arch, version, rel) PRIMARY KEY (repo, name, arch, version, rel)
); );

View file

@ -19,7 +19,7 @@ pub struct Package {
pub arch: Architecture, pub arch: Architecture,
/// Name of the package /// Name of the package
pub name: String, pub name: String,
pub rel: i32, pub rel: String,
/// Version of the package /// Version of the package
pub version: Option<String>, pub version: Option<String>,
/// Compression used /// Compression used
@ -33,7 +33,7 @@ impl Package {
arch: Architecture, arch: Architecture,
pkg_name: &str, pkg_name: &str,
version: &str, version: &str,
rel: i32, rel: String,
compression: Compression, compression: Compression,
) -> Self { ) -> Self {
let pkg = Package { let pkg = Package {
@ -49,7 +49,7 @@ impl Package {
pkg pkg
} }
pub fn version(ver: &str) -> (String, i32) { pub fn version(ver: &str) -> (String, String) {
let mut splitted = ver.split('-').collect::<Vec<_>>(); let mut splitted = ver.split('-').collect::<Vec<_>>();
let rel = splitted.pop().unwrap(); let rel = splitted.pop().unwrap();
let ver = splitted.join("-"); let ver = splitted.join("-");
@ -226,7 +226,7 @@ impl Package {
repo: repo.to_string(), repo: repo.to_string(),
arch, arch,
name: pkg_name.to_string(), name: pkg_name.to_string(),
rel: 1, rel: 1.to_string(),
version: None, version: None,
compression, compression,
}; };

View file

@ -164,14 +164,7 @@ impl Repository {
pub fn get_pkg(&self, pkg_name: &str) -> Option<Package> { pub fn get_pkg(&self, pkg_name: &str) -> Option<Package> {
// Find package // Find package
let (name, version, rel, arch, compress) = Package::extract_pkg_name(pkg_name).unwrap(); let (name, version, rel, arch, compress) = Package::extract_pkg_name(pkg_name).unwrap();
let pkg = Package::new( let pkg = Package::new(&self.name, arch, &name, &version, rel, compress);
&self.name,
arch,
&name,
&version,
rel.parse().unwrap(),
compress,
);
// Return if exists // Return if exists
if pkg.exists() { Some(pkg) } else { None } if pkg.exists() { Some(pkg) } else { None }