Merge pull request #495 from betrusted-io/fix-remote-pkgs

Fix remote pkgs
This commit is contained in:
bunnie 2024-02-01 02:19:10 +08:00 committed by GitHub
commit 71c567fe25
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 16 additions and 23 deletions

View file

@ -78,9 +78,9 @@ impl CrateSpec {
}
impl From<&str> for CrateSpec {
fn from(spec: &str) -> CrateSpec {
// remote crates are specified as "name@version", i.e. "xous-names@0.9.9"
if spec.contains('@') {
let (name, version) = spec.split_once('@').expect("couldn't parse crate specifier");
// remote crates are specified as "name^version", i.e. "xous-names^0.9.9"
if spec.contains('^') {
let (name, version) = spec.split_once('^').expect("couldn't parse crate specifier");
CrateSpec::CratesIo(name.to_string(), version.to_string(), false)
// prebuilt crates are specified as "name#url"
// i.e. "espeak-embedded#https://ci.betrusted.io/job/espeak-embedded/lastSuccessfulBuild/artifact/target/riscv32imac-unknown-xous-elf/release/"
@ -331,27 +331,18 @@ impl Builder {
false
}
/// Add just one service. Services can only be local.
/// Add just one service
pub fn add_service<'a>(&'a mut self, service_spec: &str, xip: bool) -> &'a mut Builder {
let spec = CrateSpec::Local(service_spec.to_owned(), xip);
self.services.push(spec);
self
}
/// Add just one service. This one, if it contains the `@` specifier, will be interpreted as a crates.io
/// domiciled service
#[allow(dead_code)]
pub fn add_remote_service<'a>(&'a mut self, service_spec: &str, xip: bool) -> &'a mut Builder {
let mut spec: CrateSpec = service_spec.into();
spec.set_xip(xip);
self.services.push(spec);
self
}
/// Add a list of services. Services can only be local.
/// Add a list of services
pub fn add_services<'a>(&'a mut self, service_list: &Vec<String>) -> &'a mut Builder {
for service in service_list {
self.services.push(CrateSpec::Local(service.to_string(), false));
self.services.push(service.as_str().into());
}
self
}

View file

@ -482,6 +482,7 @@ fn print_help() {
[--no-verify]
[--gdb-stub]
[--debug-loader]
[--offline]
[cratespecs] is a list of 0 or more items of the following syntax:
[name] crate 'name' to be built from local source
@ -504,6 +505,7 @@ be merged in with explicit app/service treatment with the following flags:
[--no-verify] Do not verify that local sources match crates.io downloaded sources
[--gdb-stub] Build the kernel with GDB support
[--debug-loader] Enable debug printing in the loader
[--offline] Avoid network traffic
- An 'app' must be enumerated in apps/manifest.json.
A pre-processor configures the launch menu based on the list of specified apps.

View file

@ -12,20 +12,20 @@ pub fn check_project_consistency() -> Result<(), DynError> {
// TODO: retire utralib/svd2utra from publication as well
let check_pkgs = [
// this set updates with kernel API changes
"xous@0.9.57",
"xous-ipc@0.9.57",
"xous-api-log@0.1.53",
"xous-api-names@0.9.55",
"xous-api-susres@0.9.53",
"xous-api-ticktimer@0.9.53",
"xous^0.9.57",
"xous-ipc^0.9.57",
"xous-api-log^0.1.53",
"xous-api-names^0.9.55",
"xous-api-susres^0.9.53",
"xous-api-ticktimer^0.9.53",
];
// utra/svd2utra changes are downgraded to warnings because these now prefer to pull
// from the local patch version, so any inconsistency simply indicates we forgot to
// publish the packages, rather than something nefarious has happened.
let warn_pkgs = [
// this set is only updated if the utralib changes
"utralib@0.1.24",
"svd2utra@0.1.22",
"utralib^0.1.24",
"svd2utra^0.1.22",
];
for pkg in check_pkgs {
verify(pkg.into(), true)?;