Skip to content

Commit

Permalink
[spr] initial version
Browse files Browse the repository at this point in the history
Created using spr 1.3.6-beta.1
  • Loading branch information
sunshowers committed Dec 21, 2024
1 parent 6672f1f commit 06f7d73
Show file tree
Hide file tree
Showing 10 changed files with 102 additions and 113 deletions.
60 changes: 19 additions & 41 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -498,7 +498,7 @@ omicron-rpaths = { path = "rpaths" }
omicron-sled-agent = { path = "sled-agent" }
omicron-test-utils = { path = "test-utils" }
omicron-workspace-hack = "0.1.0"
omicron-zone-package = "0.11.1"
omicron-zone-package = { git = "https://github.com/oxidecomputer/omicron-package", branch = "main" }
oxide-client = { path = "clients/oxide-client" }
oxide-vpc = { git = "https://github.com/oxidecomputer/opte", rev = "b56afeeb14e0042cbd7bda85b166ed86ee17820e", features = [ "api", "std" ] }
oxlog = { path = "dev-tools/oxlog" }
Expand Down
6 changes: 5 additions & 1 deletion clients/dpd-client/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,16 @@ use anyhow::bail;
use anyhow::Context;
use anyhow::Result;
use omicron_zone_package::config::Config;
use omicron_zone_package::config::PackageName;
use omicron_zone_package::package::PackageSource;
use quote::quote;
use std::env;
use std::fs;
use std::path::Path;

const DENDRITE_ASIC_PACKAGE: PackageName =
PackageName::new_const("dendrite-asic");

fn main() -> Result<()> {
// Find the current dendrite repo commit from our package manifest.
let manifest = fs::read_to_string("../../package-manifest.toml")
Expand All @@ -31,7 +35,7 @@ fn main() -> Result<()> {

let dendrite = config
.packages
.get("dendrite-asic")
.get(&DENDRITE_ASIC_PACKAGE)
.context("missing dendrite package in ../../package-manifest.toml")?;

let local_path = match &dendrite.source {
Expand Down
66 changes: 34 additions & 32 deletions dev-tools/releng/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ use chrono::Utc;
use clap::Parser;
use fs_err::tokio as fs;
use omicron_zone_package::config::Config;
use omicron_zone_package::config::PackageName;
use once_cell::sync::Lazy;
use semver::Version;
use slog::debug;
Expand Down Expand Up @@ -56,34 +57,33 @@ enum InstallMethod {
}

/// Packages to install or bundle in the host OS image.
const HOST_IMAGE_PACKAGES: [(&str, InstallMethod); 8] = [
("mg-ddm-gz", InstallMethod::Install),
("omicron-sled-agent", InstallMethod::Install),
("overlay", InstallMethod::Bundle),
("oxlog", InstallMethod::Install),
("propolis-server", InstallMethod::Bundle),
("pumpkind-gz", InstallMethod::Install),
("crucible-dtrace", InstallMethod::Install),
("switch-asic", InstallMethod::Bundle),
const HOST_IMAGE_PACKAGES: [(&PackageName, InstallMethod); 8] = [
(&PackageName::new_const("mg-ddm-gz"), InstallMethod::Install),
(&PackageName::new_const("omicron-sled-agent"), InstallMethod::Install),
(&PackageName::new_const("overlay"), InstallMethod::Bundle),
(&PackageName::new_const("oxlog"), InstallMethod::Install),
(&PackageName::new_const("propolis-server"), InstallMethod::Bundle),
(&PackageName::new_const("pumpkind-gz"), InstallMethod::Install),
(&PackageName::new_const("crucible-dtrace"), InstallMethod::Install),
(&PackageName::new_const("switch-asic"), InstallMethod::Bundle),
];
/// Packages to install or bundle in the recovery (trampoline) OS image.
const RECOVERY_IMAGE_PACKAGES: [(&str, InstallMethod); 2] = [
("installinator", InstallMethod::Install),
("mg-ddm-gz", InstallMethod::Install),
const RECOVERY_IMAGE_PACKAGES: [(&PackageName, InstallMethod); 2] = [
(&PackageName::new_const("installinator"), InstallMethod::Install),
(&PackageName::new_const("mg-ddm-gz"), InstallMethod::Install),
];
/// Packages to ship with the TUF repo.
const TUF_PACKAGES: [&str; 11] = [
"clickhouse_keeper",
"clickhouse",
"cockroachdb",
"crucible-pantry-zone",
"crucible-zone",
"external-dns",
"internal-dns",
"nexus",
"ntp",
"oximeter",
"probe",
const TUF_PACKAGES: [&PackageName; 11] = [
&PackageName::new_const("clickhouse_keeper"),
&PackageName::new_const("clickhouse"),
&PackageName::new_const("cockroachdb"),
&PackageName::new_const("crucible-pantry-zone"),
&PackageName::new_const("crucible-zone"),
&PackageName::new_const("external-dns"),
&PackageName::new_const("internal-dns"),
&PackageName::new_const("nexus"),
&PackageName::new_const("ntp"),
&PackageName::new_const("oximeter"),
&PackageName::new_const("probe"),
];

const HELIOS_REPO: &str = "https://pkg.oxide.computer/helios/2/dev/";
Expand Down Expand Up @@ -430,7 +430,7 @@ async fn main() -> Result<()> {
"--artifacts",
$target.artifacts_path(&args).as_str(),
"stamp",
package,
package.as_str(),
&version_str,
])
.env_remove("CARGO_MANIFEST_DIR"),
Expand Down Expand Up @@ -655,14 +655,16 @@ impl Target {
}
}

fn proto_packages(self) -> &'static [(&'static str, InstallMethod)] {
fn proto_packages(
self,
) -> &'static [(&'static PackageName, InstallMethod)] {
match self {
Target::Host => &HOST_IMAGE_PACKAGES,
Target::Recovery => &RECOVERY_IMAGE_PACKAGES,
}
}

fn proto_package_names(self) -> impl Iterator<Item = &'static str> {
fn proto_package_names(self) -> impl Iterator<Item = &'static PackageName> {
self.proto_packages().iter().map(|(name, _)| *name)
}

Expand Down Expand Up @@ -694,7 +696,7 @@ impl std::fmt::Display for Target {
async fn build_proto_area(
mut package_dir: Utf8PathBuf,
proto_dir: Utf8PathBuf,
packages: &'static [(&'static str, InstallMethod)],
packages: &'static [(&'static PackageName, InstallMethod)],
manifest: Arc<Config>,
) -> Result<()> {
let opt_oxide = proto_dir.join("root/opt/oxide");
Expand All @@ -709,15 +711,15 @@ async fn build_proto_area(
manifest.packages.get(package_name).expect("checked in preflight");
match method {
InstallMethod::Install => {
let path = opt_oxide.join(&package.service_name);
let path = opt_oxide.join(package.service_name.as_str());
fs::create_dir(&path).await?;

let cloned_path = path.clone();
let cloned_package_dir = package_dir.to_owned();
tokio::task::spawn_blocking(move || -> Result<()> {
let mut archive = tar::Archive::new(std::fs::File::open(
cloned_package_dir
.join(package_name)
.join(package_name.as_str())
.with_extension("tar"),
)?);
archive.unpack(cloned_path).with_context(|| {
Expand All @@ -733,7 +735,7 @@ async fn build_proto_area(
fs::rename(
smf_manifest,
manifest_site
.join(&package.service_name)
.join(package.service_name.as_str())
.with_extension("xml"),
)
.await?;
Expand Down
Loading

0 comments on commit 06f7d73

Please sign in to comment.