updated log_file

This commit is contained in:
Dimitris Zlatanidis 2014-09-07 08:52:40 +03:00
parent c35a87c0fd
commit 6e14a0a3ba
4 changed files with 20 additions and 21 deletions

View file

@ -49,22 +49,21 @@ def build_package(script, sources, path):
shutil.copy2(src, prgnam)
os.chdir(path + prgnam)
subprocess.call("chmod +x {0}.SlackBuild".format(prgnam), shell=True)
p = subprocess.Popen("./{0}.SlackBuild".format(prgnam), shell=True, stdout=subprocess.PIPE)
log = open(log_file, "a")
log.write(template)
log.write("File : " + log_file + "\n")
log.write("Path : " + log_path + "\n")
log.write("Date : " + log_date + "\n\n")
log.write(template)
for build in p.communicate():
if build:
print build,
log.write(str(build,))
log.write(template)
log.write(" " * 38 + "E N D\n\n")
log.write(template)
log.close()
os.chdir(path)
with open(log_file, "w") as log: # write headers to log file
log.write(template)
log.write("File : " + log_file + "\n")
log.write("Path : " + log_path + "\n")
log.write("Date : " + log_date + "\n\n")
log.write(template)
log.close()
with open(log_file, "a") as log: # append END tag to a log file
log.write(template)
log.write(" " * 38 + "E N D\n\n")
log.write(template)
subprocess.Popen("./{0}.SlackBuild 2>&1 | tee -a {1}".format(
prgnam, log_file), shell=True, stdout=sys.stdout).communicate()
log.close()
os.chdir(path)
except (OSError, IOError):
message = "Wrong file"
pkg_not_found("\n", prgnam, message, "\n")

View file

@ -189,7 +189,6 @@ def sbo_check():
subprocess.call("wget -N {0}".format(src), shell=True)
sources.append(get_file(src, "/"))
build_package(script, sources, build_path)
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
'''
Searches the package name and version in /tmp to install.
If find two or more packages e.g. to build tag
@ -204,6 +203,7 @@ def sbo_check():
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
print("{0}[ Upgrading ] --> {1}{2}".format(GREEN, ENDC, name))
pkg_upgrade(binary)
print("Complete!\n")
if len(pkg_for_upg) > 1:

View file

@ -189,8 +189,6 @@ def sbo_build(name):
subprocess.call("wget -N {0}".format(src), shell=True)
sources.append(get_file(src, "/"))
build_package(script, sources, build_path)
print("{0}[ Installing ] --> {1}{2}".format(
colors.GREEN, ENDC, pkg))
'''
Searches the package name and version in /tmp to install.
If find two or more packages e.g. to build tag
@ -205,6 +203,8 @@ def sbo_build(name):
except ValueError:
build_FAILED(sbo_url, prgnam)
sys.exit()
print("{0}[ Installing ] --> {1}{2}".format(
colors.GREEN, ENDC, pkg))
pkg_upgrade(binary)
print("Complete!\n")
installs.append(pkg)

View file

@ -131,7 +131,6 @@ def sbo_network(name):
subprocess.call("wget -N {0}".format(src), shell=True)
sources.append(get_file(src, "/"))
build_package(script, sources, build_path)
print("{0}[ Installing ] --> {1}{2}".format(colors.GREEN, colors.ENDC, name))
'''
Searches the package name and version in /tmp to install.
If find two or more packages e.g. to build tag
@ -144,8 +143,9 @@ def sbo_network(name):
try:
binary = (tmp + max(binary_list)).split()
except ValueError:
build_failed(sbo_url, prgnam)
build_FAILED(sbo_url, prgnam)
sys.exit()
print("{0}[ Installing ] --> {1}{2}".format(colors.GREEN, colors.ENDC, name))
pkg_upgrade(binary)
print("Complete!\n")
break