1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
use std::process::exit;
use crate::{File, yes_or_no};
use crate::buildsystem::BuildSystem;
pub struct BashBuildSystem;
impl BashBuildSystem {
pub fn new() -> Self { Self {} }
}
impl BuildSystem for BashBuildSystem {
fn install(&mut self) -> Result<(), String> {
info!("Writing install file to `./install.sh`");
File::write("install.sh", "#!/bin/sh
sudo apt-get install python3-dev -y
sudo apt-get install python3-pip -y
sudo apt-get install python3-venv -y
python3 -m venv venv
. venv/bin/activate; python3 -m pip install -U pip; python3 -m pip install 'buildbot[bundle]';
. venv/bin/activate; python3 -m pip install buildbot-worker setuptools-trial
")?;
info!("Successfully wrote install file");
warn!("To install dependencies run `install.sh`");
warn!("Before building from a YAML file, be sure to run `. venv/bin/activate`");
Ok(())
}
fn prebuild(&mut self) -> Result<(), String> {
if yes_or_no("Did you already run the install subcommand? (y/n) ") {
Ok(())
} else {
error!("You must run the install subcommand before the build subcommand!");
exit(0);
}
}
fn install_python(&mut self) -> Result<(), String> {Ok(())}
fn install_buildbot(&mut self) -> Result<(), String> {Ok(())}
}