Remove newline characters
This commit is contained in:
parent
3ad8d90076
commit
70fddbb6c4
|
@ -31,11 +31,11 @@ SERVICES = [
|
||||||
|
|
||||||
cargo_path = os.path.join(USER_PATH, ".cargo/bin/cargo")
|
cargo_path = os.path.join(USER_PATH, ".cargo/bin/cargo")
|
||||||
|
|
||||||
print("\n[ BUILDING AND UPDATING MICROSERVICE PACKAGES ]\n")
|
print("[ BUILDING AND UPDATING MICROSERVICE PACKAGES ]")
|
||||||
for service in SERVICES:
|
for service in SERVICES:
|
||||||
service_name = service["name"]
|
service_name = service["name"]
|
||||||
service_path = os.path.join(MICROSERVICES_SRC_DIR, service_name)
|
service_path = os.path.join(MICROSERVICES_SRC_DIR, service_name)
|
||||||
print("\n[ BUILIDING SERVICE {} ]\n".format(service_name))
|
print("[ BUILIDING SERVICE {} ]".format(service_name))
|
||||||
subprocess.call(["git", "pull"], cwd=service_path)
|
subprocess.call(["git", "pull"], cwd=service_path)
|
||||||
debian_package_path = subprocess.run(
|
debian_package_path = subprocess.run(
|
||||||
[
|
[
|
||||||
|
@ -47,16 +47,16 @@ for service in SERVICES:
|
||||||
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
|
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
|
||||||
subprocess.call(["cp", debian_package_path, MICROSERVICES_DEB_DIR])
|
subprocess.call(["cp", debian_package_path, MICROSERVICES_DEB_DIR])
|
||||||
|
|
||||||
print("\n[ ADDING PACKAGES TO FREIGHT LIBRARY ]\n")
|
print("[ ADDING PACKAGES TO FREIGHT LIBRARY ]")
|
||||||
for package in os.scandir(MICROSERVICES_DEB_DIR):
|
for package in os.scandir(MICROSERVICES_DEB_DIR):
|
||||||
if package.name.endswith(".deb"):
|
if package.name.endswith(".deb"):
|
||||||
print("\n[ ADDING PACKAGE {} ]\n".format(package.name))
|
print("[ ADDING PACKAGE {} ]".format(package.name))
|
||||||
subprocess.call(["freight", "add", "-c", FREIGHT_CONF,
|
subprocess.call(["freight", "add", "-c", FREIGHT_CONF,
|
||||||
package.path, "apt/buster"])
|
package.path, "apt/buster"])
|
||||||
|
|
||||||
print("\n[ ADDING PACKAGES TO FREIGHT CACHE ]\n")
|
print("[ ADDING PACKAGES TO FREIGHT CACHE ]")
|
||||||
# needs to be run as sudo user
|
# needs to be run as sudo user
|
||||||
subprocess.call(["sudo", "freight", "cache", "-g",
|
subprocess.call(["sudo", "freight", "cache", "-g",
|
||||||
GPG_KEY_EMAIL, "-p", GPG_KEY_PASS_FILE])
|
GPG_KEY_EMAIL, "-p", GPG_KEY_PASS_FILE])
|
||||||
|
|
||||||
print("\n[ MICROSERVICE PACKAGE ARCHIVE UPDATED ]")
|
print("[ MICROSERVICE PACKAGE ARCHIVE UPDATED ]")
|
||||||
|
|
|
@ -48,7 +48,7 @@ args = parser.parse_args()
|
||||||
|
|
||||||
# update rust installation
|
# update rust installation
|
||||||
if args.update:
|
if args.update:
|
||||||
print("\n[ UPDATING RUST ]\n")
|
print("[ UPDATING RUST ]")
|
||||||
rustup_path = os.path.join(USER_PATH, ".cargo/bin/rustup")
|
rustup_path = os.path.join(USER_PATH, ".cargo/bin/rustup")
|
||||||
if not os.path.exists(rustup_path):
|
if not os.path.exists(rustup_path):
|
||||||
print("rustup installation not found")
|
print("rustup installation not found")
|
||||||
|
@ -58,7 +58,7 @@ if args.update:
|
||||||
else:
|
else:
|
||||||
# initialize debian package build environment from a blank slate
|
# initialize debian package build environment from a blank slate
|
||||||
# (but this code is idempotent so it can be re-run if already initialized)
|
# (but this code is idempotent so it can be re-run if already initialized)
|
||||||
print("\n[ INSTALLING SYSTEM REQUIREMENTS ]\n")
|
print("[ INSTALLING SYSTEM REQUIREMENTS ]")
|
||||||
subprocess.call(["sudo",
|
subprocess.call(["sudo",
|
||||||
"apt-get",
|
"apt-get",
|
||||||
"install",
|
"install",
|
||||||
|
@ -69,13 +69,13 @@ else:
|
||||||
"gcc-aarch64-linux-gnu",
|
"gcc-aarch64-linux-gnu",
|
||||||
])
|
])
|
||||||
|
|
||||||
print("\n[ CREATING DIRECTORIES ]\n")
|
print("[ CREATING DIRECTORIES ]")
|
||||||
folders = [MICROSERVICES_SRC_DIR, FREIGHT_CACHE, FREIGHT_LIB]
|
folders = [MICROSERVICES_SRC_DIR, FREIGHT_CACHE, FREIGHT_LIB]
|
||||||
for folder in folders:
|
for folder in folders:
|
||||||
if not os.path.exists(folder):
|
if not os.path.exists(folder):
|
||||||
os.makedirs(folder)
|
os.makedirs(folder)
|
||||||
|
|
||||||
print("\n[ INSTALLING RUST ]\n")
|
print("[ INSTALLING RUST ]")
|
||||||
rustc_path = os.path.join(USER_PATH, ".cargo/bin/rustc")
|
rustc_path = os.path.join(USER_PATH, ".cargo/bin/rustc")
|
||||||
if not os.path.exists(rustc_path):
|
if not os.path.exists(rustc_path):
|
||||||
first_command = subprocess.Popen(
|
first_command = subprocess.Popen(
|
||||||
|
@ -84,25 +84,25 @@ else:
|
||||||
["sh", "-s", "--", "-y"], stdin=first_command.stdout)
|
["sh", "-s", "--", "-y"], stdin=first_command.stdout)
|
||||||
first_command.wait()
|
first_command.wait()
|
||||||
|
|
||||||
print("\n[ INSTALLING CARGO-DEB ]\n")
|
print("[ INSTALLING CARGO-DEB ]")
|
||||||
cargo_deb_path = os.path.join(USER_PATH, ".cargo/bin/cargo-deb")
|
cargo_deb_path = os.path.join(USER_PATH, ".cargo/bin/cargo-deb")
|
||||||
if not os.path.exists(cargo_deb_path):
|
if not os.path.exists(cargo_deb_path):
|
||||||
subprocess.call([cargo_path, "install", "cargo-deb"])
|
subprocess.call([cargo_path, "install", "cargo-deb"])
|
||||||
|
|
||||||
print("\n[ INSTALL TOOLCHAIN FOR CROSS-COMPILATION ]\n")
|
print("[ INSTALL TOOLCHAIN FOR CROSS-COMPILATION ]")
|
||||||
rustup_path = os.path.join(USER_PATH, ".cargo/bin/rustup")
|
rustup_path = os.path.join(USER_PATH, ".cargo/bin/rustup")
|
||||||
subprocess.call([rustup_path, "target", "add",
|
subprocess.call([rustup_path, "target", "add",
|
||||||
"aarch64-unknown-linux-gnu"])
|
"aarch64-unknown-linux-gnu"])
|
||||||
subprocess.call([rustup_path, "toolchain", "install",
|
subprocess.call([rustup_path, "toolchain", "install",
|
||||||
"nightly-aarch64-unknown-linux-gnu"])
|
"nightly-aarch64-unknown-linux-gnu"])
|
||||||
|
|
||||||
print("\n[ INSTALLING FREIGHT ]\n")
|
print("[ INSTALLING FREIGHT ]")
|
||||||
freight_path = os.path.join(AUTOMATION_DIR, "freight")
|
freight_path = os.path.join(AUTOMATION_DIR, "freight")
|
||||||
if not os.path.exists(freight_path):
|
if not os.path.exists(freight_path):
|
||||||
subprocess.call(
|
subprocess.call(
|
||||||
["git", "clone", "https://github.com/freight-team/freight.git", freight_path])
|
["git", "clone", "https://github.com/freight-team/freight.git", freight_path])
|
||||||
|
|
||||||
print("\n[ CONFIGURING FREIGHT ]\n")
|
print("[ CONFIGURING FREIGHT ]")
|
||||||
freight_conf_tmp_path = os.path.join(USER_PATH, "freight.conf")
|
freight_conf_tmp_path = os.path.join(USER_PATH, "freight.conf")
|
||||||
render_template(
|
render_template(
|
||||||
src="freight.conf",
|
src="freight.conf",
|
||||||
|
@ -115,7 +115,7 @@ else:
|
||||||
)
|
)
|
||||||
subprocess.call(["sudo", "cp", freight_conf_tmp_path, FREIGHT_CONF])
|
subprocess.call(["sudo", "cp", freight_conf_tmp_path, FREIGHT_CONF])
|
||||||
|
|
||||||
print("\n[ PULLING MICROSERVICES CODE FROM GITHUB ]\n")
|
print("[ PULLING MICROSERVICES CODE FROM GITHUB ]")
|
||||||
for service in SERVICES:
|
for service in SERVICES:
|
||||||
name = service["name"]
|
name = service["name"]
|
||||||
repo_url = service["repo_url"]
|
repo_url = service["repo_url"]
|
||||||
|
@ -123,13 +123,13 @@ else:
|
||||||
if not os.path.exists(service_path):
|
if not os.path.exists(service_path):
|
||||||
subprocess.call(["git", "clone", repo_url, service_path])
|
subprocess.call(["git", "clone", repo_url, service_path])
|
||||||
|
|
||||||
print("\n[ EXPORTING PUBLIC GPG KEY ]\n")
|
print("[ EXPORTING PUBLIC GPG KEY ]")
|
||||||
output_path = "{}/peach_pub.gpg".format(FREIGHT_CACHE)
|
output_path = "{}/peach_pub.gpg".format(FREIGHT_CACHE)
|
||||||
if not os.path.exists(output_path):
|
if not os.path.exists(output_path):
|
||||||
subprocess.call(["gpg", "--armor", "--output",
|
subprocess.call(["gpg", "--armor", "--output",
|
||||||
output_path, "--export", GPG_KEY_EMAIL])
|
output_path, "--export", GPG_KEY_EMAIL])
|
||||||
|
|
||||||
print("\n[ COPYING NGINX CONFIG ]\n")
|
print("[ COPYING NGINX CONFIG ]")
|
||||||
nginx_conf_tmp_path = os.path.join(USER_PATH, "apt.peachcloud.org")
|
nginx_conf_tmp_path = os.path.join(USER_PATH, "apt.peachcloud.org")
|
||||||
render_template(
|
render_template(
|
||||||
src="nginx_debian.conf",
|
src="nginx_debian.conf",
|
||||||
|
@ -141,4 +141,4 @@ else:
|
||||||
subprocess.call(["sudo", "cp", nginx_conf_tmp_path,
|
subprocess.call(["sudo", "cp", nginx_conf_tmp_path,
|
||||||
"/etc/nginx/sites-enabled/apt.peachcloud.org"])
|
"/etc/nginx/sites-enabled/apt.peachcloud.org"])
|
||||||
|
|
||||||
print("\n[ DEBIAN PACKAGE BUILD ENVIRONMENT SETUP COMPLETE ]")
|
print("[ DEBIAN PACKAGE BUILD ENVIRONMENT SETUP COMPLETE ]")
|
||||||
|
|
Loading…
Reference in New Issue