summaryrefslogtreecommitdiffstats
path: root/build_tools
diff options
context:
space:
mode:
authorMichael Hanson <hansonorders@verizon.net>2011-01-14 00:03:43 (GMT)
committerMichael Hanson <hansonorders@verizon.net>2011-01-14 00:03:43 (GMT)
commite3a78e06d45835371b2f78358c98a399d8fa8d21 (patch)
treeb2d77a7b2d1154b5d7f229b805ef7bb3f098ce2a /build_tools
parent63a7d9308df828cba8e050f753079db4bb8c9cf6 (diff)
downloadlinhes_dev-e3a78e06d45835371b2f78358c98a399d8fa8d21.zip
mp.py: Fix handling of the -o option. Add logging of building/packaging.
Diffstat (limited to 'build_tools')
-rwxr-xr-xbuild_tools/bin/mp.py34
1 files changed, 28 insertions, 6 deletions
diff --git a/build_tools/bin/mp.py b/build_tools/bin/mp.py
index 5dab22e..46e1974 100755
--- a/build_tools/bin/mp.py
+++ b/build_tools/bin/mp.py
@@ -1,4 +1,5 @@
#!/usr/bin/env python2
+# Version 0.5
import os
import sys
@@ -96,7 +97,7 @@ def commandline():
clparser.add_option("--skipinteg", action="store_true", default=False, help="Do not perform any integrity checks, just print a warning instead.")
clparser.add_option("--holdver", action="store_true", default=False, help="Prevents makepkg from automatically bumping the pkgver to the latest revision number in the package's development tree.")
clparser.add_option("-i", "--install", action="store_true", default=False, help="Install or upgrade the package after a successful build.")
- clparser.add_option("-L", "--log", action="store_true", default=False, help="Enable makepkg build logging.")
+ clparser.add_option("-L", "--log", action="store_true", default=True, help="Enable makepkg build logging.")
clparser.add_option("-m", "--nocolor", action="store_true", default=False, help="Disable color in output messages.")
clparser.add_option("-o", "--nobuild", action="store_true", default=False, help="Download and extract files only, but do not build them.")
clparser.add_option("-p", action="store", help="Read the package script buildscript instead of the PKGBUILD default.", metavar='/path/to/buildscript')
@@ -234,8 +235,12 @@ def update_repo():
print "DELPKG:",DELPKG
os.remove(DELPKG)
# Remove any symlinks to old packages
- if os.path.islink(mydir + "/" + DELPKG):
- os.remove(mydir + "/" + DELPKG)
+ # We make it conditional on "--force" because force will overwrite
+ # an existing package and we want the symlink to stay, pointing to
+ # the newly built package with the same pkgrel.
+ if "--force" not in makepkg_cmd:
+ if os.path.islink(mydir + "/" + DELPKG):
+ os.remove(mydir + "/" + DELPKG)
# Copy in new package
print "############################################"
print "Updating " + DOCROOT + "/" + CARCH + "/" + REPO + " with " + TOTALPKG
@@ -374,6 +379,8 @@ def config_file():
print "Architecture is:",arch
def make_package():
+ global arch
+ global CARCH
# Make the package!
retcode = subprocess.call(makepkg_cmd)
if retcode != 0:
@@ -383,9 +390,10 @@ def make_package():
shutil.move(pkgfile + '.old', pkgfile)
print "Reverted pkgrel bump."
sys.exit(2)
+ elif "--nobuild" in makepkg_cmd:
+ sys.exit(0)
else:
print "=============FINSHED CREATING PKG=================="
-
if arch == 'any':
CARCH = 'any'
@@ -405,11 +413,9 @@ updateMD5()
make_package()
print "------------updating database-------------"
-
update_repo()
print "----------creating source package---------"
-
os.chdir(mydir)
retcode = subprocess.call(["makepkg", "--force", "--holdver", "--asroot", "--source"])
if retcode != 0:
@@ -423,3 +429,19 @@ os.chdir(mydir)
if os.path.isfile(pkgfile + '.old'):
os.remove(pkgfile + '.old')
print "Removed temporary backup file",pkgfile + '.old'
+
+# Remove any old -build and -package log files
+os.chdir(mydir)
+build_log = pkgname + "-" + pkgver + "-" + pkgrel + "-" + CARCH + "-build.log"
+pkg_log = pkgname + "-" + pkgver + "-" + pkgrel + "-" + CARCH + "-package.log"
+all_logs = glob.glob("*.log*")
+#print "All Logs:",all_logs
+saved_logs = []
+if os.path.isfile(build_log):
+ saved_logs.append(build_log)
+if os.path.isfile(pkg_log):
+ saved_logs.append(pkg_log)
+#print "Saved Logs:",saved_logs
+for log in all_logs:
+ if log not in saved_logs:
+ os.remove(log)