Skip to content

Commit 6c7c7cb

Browse files
committed
update
1 parent 7f881bf commit 6c7c7cb

6 files changed

Lines changed: 31 additions & 14 deletions

File tree

sbuild-linter/src/build_config/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -128,6 +128,10 @@ impl BuildConfig {
128128
if let Some(val) = values.get("app_id") {
129129
config.app_id = val.as_str().map(String::from);
130130
}
131+
// Support both pkgver and version field names
132+
if let Some(val) = values.get("pkgver").or_else(|| values.get("version")) {
133+
config.pkgver = val.as_str().map(String::from);
134+
}
131135
if let Some(val) = values.get("build_util") {
132136
config.build_util = to_string_vec(val);
133137
}

sbuild-linter/src/validator.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1402,6 +1402,7 @@ pub const FIELD_VALIDATORS: &[FieldValidator] = &[
14021402
FieldValidator::new("app_id", FieldType::String, false),
14031403
FieldValidator::new("pkg_type", FieldType::String, false),
14041404
FieldValidator::new("pkgver", FieldType::String, false),
1405+
FieldValidator::new("version", FieldType::String, false), // Alias for pkgver
14051406
FieldValidator::new("build_util", FieldType::StringArray, false),
14061407
FieldValidator::new("build_asset", FieldType::BuildAsset, false),
14071408
FieldValidator::new("category", FieldType::StringArray, false),

sbuild-meta/src/main.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -372,7 +372,7 @@ async fn cmd_should_rebuild(
372372
}
373373

374374
// Check if version field exists
375-
if recipe.version.is_none() {
375+
if recipe.pkgver.is_none() {
376376
info!("No version field in recipe, should rebuild (new package)");
377377
std::process::exit(0);
378378
}
@@ -426,7 +426,7 @@ async fn cmd_check_updates(
426426

427427
for (path, recipe) in enabled_recipes {
428428
// Only check recipes that have both version and pkgver
429-
let current_version = match &recipe.version {
429+
let current_version = match &recipe.pkgver {
430430
Some(v) => v.clone(),
431431
None => continue, // Skip recipes without explicit version
432432
};

sbuild-meta/src/metadata.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,7 @@ impl PackageMetadata {
195195
pkg_family: Some(recipe.pkg.clone()),
196196
pkg_type: recipe.pkg_type.clone(),
197197
description: recipe.description.0.clone(),
198-
version: recipe.version.clone().unwrap_or_default(),
198+
version: recipe.pkgver.clone().unwrap_or_default(),
199199
src_url: if recipe.src_url.is_empty() {
200200
None
201201
} else {

sbuild-meta/src/recipe.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,9 +218,9 @@ pub struct SBuildRecipe {
218218
#[serde(default)]
219219
pub pkg_type: Option<String>,
220220

221-
/// Explicit version (managed by bot)
222-
#[serde(default)]
223-
pub version: Option<String>,
221+
/// Explicit version (managed by bot) - supports both "version" and "pkgver" field names
222+
#[serde(default, alias = "version")]
223+
pub pkgver: Option<String>,
224224

225225
/// Package categories
226226
#[serde(default)]
@@ -487,7 +487,7 @@ pkg_id: example.com.test
487487
version: "1.2.3"
488488
"#;
489489
let recipe = SBuildRecipe::from_yaml(yaml).unwrap();
490-
assert_eq!(recipe.version, Some("1.2.3".to_string()));
490+
assert_eq!(recipe.pkgver, Some("1.2.3".to_string()));
491491
}
492492

493493
#[test]

sbuild/src/ghcr.rs

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -101,21 +101,33 @@ impl GhcrClient {
101101
// Add target
102102
cmd.arg(&target);
103103

104-
// Add files with just the filename (not full path)
105-
// Format: /full/path/to/file:filename
104+
// Collect files and determine working directory
105+
// We need to cd to the directory so oras stores just filenames, not full paths
106+
let mut work_dir: Option<&Path> = None;
107+
let mut filenames: Vec<String> = Vec::new();
108+
106109
for file in files {
107110
let path = file.as_ref();
108111
if path.exists() {
112+
if work_dir.is_none() {
113+
work_dir = path.parent();
114+
}
109115
if let Some(filename) = path.file_name() {
110-
// Use oras syntax: local_path:remote_name
111-
let file_arg = format!("{}:{}", path.display(), filename.to_string_lossy());
112-
cmd.arg(file_arg);
113-
} else {
114-
cmd.arg(path);
116+
filenames.push(filename.to_string_lossy().to_string());
115117
}
116118
}
117119
}
118120

121+
// Add filenames (relative to work_dir)
122+
for filename in &filenames {
123+
cmd.arg(filename);
124+
}
125+
126+
// Set working directory if we have one
127+
if let Some(dir) = work_dir {
128+
cmd.current_dir(dir);
129+
}
130+
119131
let output = cmd.output()?;
120132

121133
if !output.status.success() {

0 commit comments

Comments
 (0)