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,
arch TEXT NOT NULL,
version TEXT NOT NULL,
rel INTEGER NOT NULL,
rel TEXT NOT NULL,
download_count INTEGER NOT NULL DEFAULT 1,
PRIMARY KEY (repo, name, arch, version, rel)
);

View file

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

View file

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