├── .gitignore ├── Cargo.lock ├── Cargo.toml ├── README.md └── src └── main.rs /.gitignore: -------------------------------------------------------------------------------- 1 | target 2 | *~ 3 | -------------------------------------------------------------------------------- /Cargo.lock: -------------------------------------------------------------------------------- 1 | [root] 2 | name = "cargo-rumpbake" 3 | version = "0.5.0" 4 | dependencies = [ 5 | "cargo 0.5.0 (registry+https://github.com/rust-lang/crates.io-index)", 6 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 7 | ] 8 | 9 | [[package]] 10 | name = "advapi32-sys" 11 | version = "0.1.2" 12 | source = "registry+https://github.com/rust-lang/crates.io-index" 13 | dependencies = [ 14 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 15 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 16 | ] 17 | 18 | [[package]] 19 | name = "aho-corasick" 20 | version = "0.3.2" 21 | source = "registry+https://github.com/rust-lang/crates.io-index" 22 | dependencies = [ 23 | "memchr 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 24 | ] 25 | 26 | [[package]] 27 | name = "bitflags" 28 | version = "0.1.1" 29 | source = "registry+https://github.com/rust-lang/crates.io-index" 30 | 31 | [[package]] 32 | name = "cargo" 33 | version = "0.5.0" 34 | source = "registry+https://github.com/rust-lang/crates.io-index" 35 | dependencies = [ 36 | "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 37 | "crates-io 0.1.0 (registry+https://github.com/rust-lang/crates.io-index)", 38 | "curl 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 39 | "docopt 0.6.72 (registry+https://github.com/rust-lang/crates.io-index)", 40 | "env_logger 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 41 | "filetime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 42 | "flate2 0.2.9 (registry+https://github.com/rust-lang/crates.io-index)", 43 | "git2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", 44 | "git2-curl 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 45 | "glob 0.2.10 (registry+https://github.com/rust-lang/crates.io-index)", 46 | "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 47 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 48 | "libgit2-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", 49 | "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 50 | "num_cpus 0.2.6 (registry+https://github.com/rust-lang/crates.io-index)", 51 | "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", 52 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 53 | "semver 0.1.20 (registry+https://github.com/rust-lang/crates.io-index)", 54 | "tar 0.3.1 (registry+https://github.com/rust-lang/crates.io-index)", 55 | "term 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 56 | "threadpool 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 57 | "time 0.1.32 (registry+https://github.com/rust-lang/crates.io-index)", 58 | "toml 0.1.22 (registry+https://github.com/rust-lang/crates.io-index)", 59 | "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", 60 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 61 | ] 62 | 63 | [[package]] 64 | name = "cmake" 65 | version = "0.1.4" 66 | source = "registry+https://github.com/rust-lang/crates.io-index" 67 | dependencies = [ 68 | "gcc 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 69 | ] 70 | 71 | [[package]] 72 | name = "crates-io" 73 | version = "0.1.0" 74 | source = "registry+https://github.com/rust-lang/crates.io-index" 75 | dependencies = [ 76 | "curl 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 77 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 78 | ] 79 | 80 | [[package]] 81 | name = "curl" 82 | version = "0.2.11" 83 | source = "registry+https://github.com/rust-lang/crates.io-index" 84 | dependencies = [ 85 | "curl-sys 0.1.25 (registry+https://github.com/rust-lang/crates.io-index)", 86 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 87 | "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 88 | "openssl-sys 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 89 | "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", 90 | ] 91 | 92 | [[package]] 93 | name = "curl-sys" 94 | version = "0.1.25" 95 | source = "registry+https://github.com/rust-lang/crates.io-index" 96 | dependencies = [ 97 | "gcc 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 98 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 99 | "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 100 | "openssl-sys 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 101 | "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 102 | ] 103 | 104 | [[package]] 105 | name = "docopt" 106 | version = "0.6.72" 107 | source = "registry+https://github.com/rust-lang/crates.io-index" 108 | dependencies = [ 109 | "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", 110 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 111 | "strsim 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)", 112 | ] 113 | 114 | [[package]] 115 | name = "env_logger" 116 | version = "0.3.1" 117 | source = "registry+https://github.com/rust-lang/crates.io-index" 118 | dependencies = [ 119 | "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 120 | "regex 0.1.41 (registry+https://github.com/rust-lang/crates.io-index)", 121 | ] 122 | 123 | [[package]] 124 | name = "filetime" 125 | version = "0.1.5" 126 | source = "registry+https://github.com/rust-lang/crates.io-index" 127 | dependencies = [ 128 | "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 129 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 130 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 131 | ] 132 | 133 | [[package]] 134 | name = "flate2" 135 | version = "0.2.9" 136 | source = "registry+https://github.com/rust-lang/crates.io-index" 137 | dependencies = [ 138 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 139 | "miniz-sys 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 140 | ] 141 | 142 | [[package]] 143 | name = "gcc" 144 | version = "0.3.16" 145 | source = "registry+https://github.com/rust-lang/crates.io-index" 146 | dependencies = [ 147 | "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 148 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 149 | ] 150 | 151 | [[package]] 152 | name = "git2" 153 | version = "0.2.14" 154 | source = "registry+https://github.com/rust-lang/crates.io-index" 155 | dependencies = [ 156 | "bitflags 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 157 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 158 | "libgit2-sys 0.2.20 (registry+https://github.com/rust-lang/crates.io-index)", 159 | "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", 160 | ] 161 | 162 | [[package]] 163 | name = "git2-curl" 164 | version = "0.2.4" 165 | source = "registry+https://github.com/rust-lang/crates.io-index" 166 | dependencies = [ 167 | "curl 0.2.11 (registry+https://github.com/rust-lang/crates.io-index)", 168 | "git2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)", 169 | "log 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 170 | "url 0.2.37 (registry+https://github.com/rust-lang/crates.io-index)", 171 | ] 172 | 173 | [[package]] 174 | name = "glob" 175 | version = "0.2.10" 176 | source = "registry+https://github.com/rust-lang/crates.io-index" 177 | 178 | [[package]] 179 | name = "kernel32-sys" 180 | version = "0.1.4" 181 | source = "registry+https://github.com/rust-lang/crates.io-index" 182 | dependencies = [ 183 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 184 | "winapi-build 0.1.1 (registry+https://github.com/rust-lang/crates.io-index)", 185 | ] 186 | 187 | [[package]] 188 | name = "libc" 189 | version = "0.1.10" 190 | source = "registry+https://github.com/rust-lang/crates.io-index" 191 | 192 | [[package]] 193 | name = "libgit2-sys" 194 | version = "0.2.20" 195 | source = "registry+https://github.com/rust-lang/crates.io-index" 196 | dependencies = [ 197 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 198 | "libssh2-sys 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", 199 | "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 200 | "openssl-sys 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 201 | "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 202 | ] 203 | 204 | [[package]] 205 | name = "libressl-pnacl-sys" 206 | version = "2.1.6" 207 | source = "registry+https://github.com/rust-lang/crates.io-index" 208 | dependencies = [ 209 | "pnacl-build-helper 1.4.10 (registry+https://github.com/rust-lang/crates.io-index)", 210 | ] 211 | 212 | [[package]] 213 | name = "libssh2-sys" 214 | version = "0.1.30" 215 | source = "registry+https://github.com/rust-lang/crates.io-index" 216 | dependencies = [ 217 | "cmake 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 218 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 219 | "libz-sys 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", 220 | "openssl-sys 0.6.5 (registry+https://github.com/rust-lang/crates.io-index)", 221 | "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 222 | ] 223 | 224 | [[package]] 225 | name = "libz-sys" 226 | version = "0.1.8" 227 | source = "registry+https://github.com/rust-lang/crates.io-index" 228 | dependencies = [ 229 | "gcc 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 230 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 231 | "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 232 | ] 233 | 234 | [[package]] 235 | name = "log" 236 | version = "0.3.2" 237 | source = "registry+https://github.com/rust-lang/crates.io-index" 238 | dependencies = [ 239 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 240 | ] 241 | 242 | [[package]] 243 | name = "matches" 244 | version = "0.1.2" 245 | source = "registry+https://github.com/rust-lang/crates.io-index" 246 | 247 | [[package]] 248 | name = "memchr" 249 | version = "0.1.6" 250 | source = "registry+https://github.com/rust-lang/crates.io-index" 251 | dependencies = [ 252 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 253 | ] 254 | 255 | [[package]] 256 | name = "miniz-sys" 257 | version = "0.1.6" 258 | source = "registry+https://github.com/rust-lang/crates.io-index" 259 | dependencies = [ 260 | "gcc 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 261 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 262 | ] 263 | 264 | [[package]] 265 | name = "num_cpus" 266 | version = "0.2.6" 267 | source = "registry+https://github.com/rust-lang/crates.io-index" 268 | dependencies = [ 269 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 270 | ] 271 | 272 | [[package]] 273 | name = "openssl-sys" 274 | version = "0.6.5" 275 | source = "registry+https://github.com/rust-lang/crates.io-index" 276 | dependencies = [ 277 | "gcc 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 278 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 279 | "libressl-pnacl-sys 2.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 280 | "pkg-config 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", 281 | ] 282 | 283 | [[package]] 284 | name = "pkg-config" 285 | version = "0.3.5" 286 | source = "registry+https://github.com/rust-lang/crates.io-index" 287 | 288 | [[package]] 289 | name = "pnacl-build-helper" 290 | version = "1.4.10" 291 | source = "registry+https://github.com/rust-lang/crates.io-index" 292 | dependencies = [ 293 | "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", 294 | ] 295 | 296 | [[package]] 297 | name = "rand" 298 | version = "0.3.11" 299 | source = "registry+https://github.com/rust-lang/crates.io-index" 300 | dependencies = [ 301 | "advapi32-sys 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 302 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 303 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 304 | ] 305 | 306 | [[package]] 307 | name = "regex" 308 | version = "0.1.41" 309 | source = "registry+https://github.com/rust-lang/crates.io-index" 310 | dependencies = [ 311 | "aho-corasick 0.3.2 (registry+https://github.com/rust-lang/crates.io-index)", 312 | "memchr 0.1.6 (registry+https://github.com/rust-lang/crates.io-index)", 313 | "regex-syntax 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", 314 | ] 315 | 316 | [[package]] 317 | name = "regex-syntax" 318 | version = "0.2.2" 319 | source = "registry+https://github.com/rust-lang/crates.io-index" 320 | 321 | [[package]] 322 | name = "rustc-serialize" 323 | version = "0.3.16" 324 | source = "registry+https://github.com/rust-lang/crates.io-index" 325 | 326 | [[package]] 327 | name = "semver" 328 | version = "0.1.20" 329 | source = "registry+https://github.com/rust-lang/crates.io-index" 330 | 331 | [[package]] 332 | name = "strsim" 333 | version = "0.3.0" 334 | source = "registry+https://github.com/rust-lang/crates.io-index" 335 | 336 | [[package]] 337 | name = "tar" 338 | version = "0.3.1" 339 | source = "registry+https://github.com/rust-lang/crates.io-index" 340 | dependencies = [ 341 | "filetime 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", 342 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 343 | ] 344 | 345 | [[package]] 346 | name = "tempdir" 347 | version = "0.3.4" 348 | source = "registry+https://github.com/rust-lang/crates.io-index" 349 | dependencies = [ 350 | "rand 0.3.11 (registry+https://github.com/rust-lang/crates.io-index)", 351 | ] 352 | 353 | [[package]] 354 | name = "term" 355 | version = "0.2.11" 356 | source = "registry+https://github.com/rust-lang/crates.io-index" 357 | dependencies = [ 358 | "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 359 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 360 | ] 361 | 362 | [[package]] 363 | name = "threadpool" 364 | version = "0.1.4" 365 | source = "registry+https://github.com/rust-lang/crates.io-index" 366 | 367 | [[package]] 368 | name = "time" 369 | version = "0.1.32" 370 | source = "registry+https://github.com/rust-lang/crates.io-index" 371 | dependencies = [ 372 | "kernel32-sys 0.1.4 (registry+https://github.com/rust-lang/crates.io-index)", 373 | "libc 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)", 374 | "winapi 0.2.4 (registry+https://github.com/rust-lang/crates.io-index)", 375 | ] 376 | 377 | [[package]] 378 | name = "toml" 379 | version = "0.1.22" 380 | source = "registry+https://github.com/rust-lang/crates.io-index" 381 | dependencies = [ 382 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 383 | ] 384 | 385 | [[package]] 386 | name = "url" 387 | version = "0.2.37" 388 | source = "registry+https://github.com/rust-lang/crates.io-index" 389 | dependencies = [ 390 | "matches 0.1.2 (registry+https://github.com/rust-lang/crates.io-index)", 391 | "rustc-serialize 0.3.16 (registry+https://github.com/rust-lang/crates.io-index)", 392 | ] 393 | 394 | [[package]] 395 | name = "winapi" 396 | version = "0.2.4" 397 | source = "registry+https://github.com/rust-lang/crates.io-index" 398 | 399 | [[package]] 400 | name = "winapi-build" 401 | version = "0.1.1" 402 | source = "registry+https://github.com/rust-lang/crates.io-index" 403 | 404 | -------------------------------------------------------------------------------- /Cargo.toml: -------------------------------------------------------------------------------- 1 | [package] 2 | name = "cargo-rumpbake" 3 | version = "0.5.0" 4 | authors = ["Sebastian Wicki "] 5 | 6 | 7 | [dependencies] 8 | cargo = "0.5.0" 9 | rustc-serialize = "0.3" 10 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | # cargo rumpbake 2 | 3 | A small wrapper around `cargo build` and `rumpbake` for generating rumprun 4 | unikernel images from binary crates. 5 | 6 | ## Installation 7 | 8 | The prefered way to use this build and install this subcommand is by 9 | building the `rust` package from 10 | [rumprun-packages](https://github.com/rumpkernel/rumprun-packages). 11 | 12 | ## Use 13 | 14 | Make sure rumprun's `app-tools` is in your `$PATH`. A crate named *"hello"* 15 | with a single binary target can be baked into a rumprun unikernel as follows. 16 | 17 | cargo rumpbake hw_virtio 18 | 19 | Which is roughtly equivalent to the following: 20 | 21 | cargo build --target x86_64-rumprun-netbsd 22 | rumpbake hw_virtio hello.img ./target/x86_64-rumprun-netbsd/debug/hello 23 | 24 | The name of the generated image can be set using the `--output` flag. Use the 25 | `rumprun` command line utility to execute the generated image: 26 | 27 | rumprun qemu -i hello.img 28 | 29 | Refer to the [rumpkernel wiki](http://wiki.rumpkernel.org/Repo:-rumprun) for 30 | more information. 31 | -------------------------------------------------------------------------------- /src/main.rs: -------------------------------------------------------------------------------- 1 | extern crate cargo; 2 | extern crate rustc_serialize; 3 | 4 | use std::error::Error; 5 | 6 | use cargo::ops; 7 | use cargo::core::{Source}; 8 | use cargo::sources::path::PathSource; 9 | use cargo::util::{CliResult, CliError, Config}; 10 | use cargo::util::important_paths::{find_root_manifest_for_cwd}; 11 | 12 | #[derive(RustcDecodable)] 13 | struct Options { 14 | flag_output: Option, 15 | flag_config: Option, 16 | flag_bins: Vec, 17 | flag_examples: Vec, 18 | flag_jobs: Option, 19 | flag_features: Vec, 20 | flag_no_default_features: bool, 21 | flag_target: Option, 22 | flag_manifest_path: Option, 23 | flag_verbose: bool, 24 | flag_quiet: bool, 25 | flag_color: Option, 26 | flag_release: bool, 27 | arg_config: String, 28 | } 29 | 30 | pub const USAGE: &'static str = " 31 | Builds and bakes your binaries into a rumprun image 32 | 33 | Usage: 34 | cargo rumpbake [options] 35 | cargo rumpbake -h | --help 36 | 37 | Rumpbake options: 38 | -c PATH, --config PATH Rumpbake config file 39 | -o NAME, --output NAME Name of the generated image (default .img) 40 | 41 | Cargo options: 42 | -h, --help Print this message 43 | --bin NAME Name of the bin target to build and bake 44 | --example NAME Name of the example target to build and bake 45 | -j N, --jobs N The number of jobs to run in parallel 46 | --release Build artifacts in release mode, with optimizations 47 | --features FEATURES Space-separated list of features to also build 48 | --no-default-features Do not build the `default` feature 49 | --target TRIPLE Build for the target triple 50 | --manifest-path PATH Path to the manifest to execute 51 | -v, --verbose Use verbose output 52 | -q, --quiet No output printed to stdout 53 | --color WHEN Coloring: auto, always, never 54 | 55 | Builds a binary target for rumprun and then bakes it into an rumprun unikernel 56 | image, using the specified rumpbake , for example 'hw_generic'. 57 | "; 58 | 59 | fn main() { 60 | cargo::execute_main_without_stdin(execute, false, USAGE); 61 | } 62 | 63 | fn execute(options: Options, config: &Config) -> CliResult> { 64 | try!(config.shell().set_verbosity(options.flag_verbose, options.flag_quiet)); 65 | try!(config.shell().set_color_config(options.flag_color.as_ref().map(|s| &s[..]))); 66 | 67 | let root = try!(find_root_manifest_for_cwd(options.flag_manifest_path)); 68 | let mut src = try!(PathSource::for_path(&root.parent().unwrap(), config)); 69 | try!(src.update()); 70 | let pkg = try!(src.root_package()); 71 | 72 | // FIXME(gandro): should autodetect target fallback 73 | let target = options.flag_target.as_ref() 74 | .map(|t| &t[..]) 75 | .or(Some("x86_64-rumprun-netbsd")); 76 | 77 | let filter = if options.flag_examples.is_empty() && options.flag_bins.is_empty() { 78 | ops::CompileFilter::Everything 79 | } else { 80 | ops::CompileFilter::Only { 81 | lib: false, tests: &[], benches: &[], 82 | bins: &options.flag_bins, 83 | examples: &options.flag_examples, 84 | } 85 | }; 86 | 87 | let compile_opts = ops::CompileOptions { 88 | config: config, 89 | jobs: options.flag_jobs, 90 | target: target, 91 | features: &options.flag_features, 92 | no_default_features: options.flag_no_default_features, 93 | spec: None, 94 | exec_engine: None, 95 | release: options.flag_release, 96 | mode: ops::CompileMode::Build, 97 | filter: filter, 98 | target_rustc_args: None, 99 | }; 100 | 101 | let compile = try!(ops::compile(&root, &compile_opts)); 102 | 103 | if compile.binaries.is_empty() { 104 | return Err(CliError::new( 105 | "a bin target must be available for `cargo rumpbake`", 1)); 106 | } 107 | 108 | let output = options.flag_output.unwrap_or({ 109 | format!("{}.img", pkg.name()) 110 | }); 111 | 112 | try!(config.shell().status("Baking", &output) 113 | .map_err(|err| CliError::new(err.description(), 1))); 114 | 115 | let mut rumpbake = try!(cargo::util::process("rumpbake")); 116 | options.flag_config.map(|config| rumpbake.arg("-c").arg(config)); 117 | rumpbake 118 | .arg(&options.arg_config) 119 | .arg(&output) 120 | .args(&compile.binaries) 121 | .env("RUMPRUN_WARNING_STFU", "please"); 122 | 123 | try!(config.shell().verbose(|c| c.status("Running", &rumpbake)) 124 | .map_err(|err| CliError::new(err.description(), 1))); 125 | 126 | try!(rumpbake.exec_with_output() 127 | .map_err(|err| CliError::from_error(err, 1))); 128 | 129 | Ok(None) 130 | } 131 | --------------------------------------------------------------------------------