Remove newline characters

This commit is contained in:
mycognosist 2020-12-18 09:26:15 +00:00
parent 3ad8d90076
commit 70fddbb6c4
2 changed files with 18 additions and 18 deletions

View File

@ -31,11 +31,11 @@ SERVICES = [
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:
service_name = 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)
debian_package_path = subprocess.run(
[
@ -47,16 +47,16 @@ for service in SERVICES:
stdout=subprocess.PIPE).stdout.decode("utf-8").strip()
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):
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,
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
subprocess.call(["sudo", "freight", "cache", "-g",
GPG_KEY_EMAIL, "-p", GPG_KEY_PASS_FILE])
print("\n[ MICROSERVICE PACKAGE ARCHIVE UPDATED ]")
print("[ MICROSERVICE PACKAGE ARCHIVE UPDATED ]")

View File

@ -48,7 +48,7 @@ args = parser.parse_args()
# update rust installation
if args.update:
print("\n[ UPDATING RUST ]\n")
print("[ UPDATING RUST ]")
rustup_path = os.path.join(USER_PATH, ".cargo/bin/rustup")
if not os.path.exists(rustup_path):
print("rustup installation not found")
@ -58,7 +58,7 @@ if args.update:
else:
# initialize debian package build environment from a blank slate
# (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",
"apt-get",
"install",
@ -69,13 +69,13 @@ else:
"gcc-aarch64-linux-gnu",
])
print("\n[ CREATING DIRECTORIES ]\n")
print("[ CREATING DIRECTORIES ]")
folders = [MICROSERVICES_SRC_DIR, FREIGHT_CACHE, FREIGHT_LIB]
for folder in folders:
if not os.path.exists(folder):
os.makedirs(folder)
print("\n[ INSTALLING RUST ]\n")
print("[ INSTALLING RUST ]")
rustc_path = os.path.join(USER_PATH, ".cargo/bin/rustc")
if not os.path.exists(rustc_path):
first_command = subprocess.Popen(
@ -84,25 +84,25 @@ else:
["sh", "-s", "--", "-y"], stdin=first_command.stdout)
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")
if not os.path.exists(cargo_deb_path):
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")
subprocess.call([rustup_path, "target", "add",
"aarch64-unknown-linux-gnu"])
subprocess.call([rustup_path, "toolchain", "install",
"nightly-aarch64-unknown-linux-gnu"])
print("\n[ INSTALLING FREIGHT ]\n")
print("[ INSTALLING FREIGHT ]")
freight_path = os.path.join(AUTOMATION_DIR, "freight")
if not os.path.exists(freight_path):
subprocess.call(
["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")
render_template(
src="freight.conf",
@ -115,7 +115,7 @@ else:
)
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:
name = service["name"]
repo_url = service["repo_url"]
@ -123,13 +123,13 @@ else:
if not os.path.exists(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)
if not os.path.exists(output_path):
subprocess.call(["gpg", "--armor", "--output",
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")
render_template(
src="nginx_debian.conf",
@ -141,4 +141,4 @@ else:
subprocess.call(["sudo", "cp", nginx_conf_tmp_path,
"/etc/nginx/sites-enabled/apt.peachcloud.org"])
print("\n[ DEBIAN PACKAGE BUILD ENVIRONMENT SETUP COMPLETE ]")
print("[ DEBIAN PACKAGE BUILD ENVIRONMENT SETUP COMPLETE ]")