Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authormrussell2011-05-02 23:50:50 +0000
committermrussell2011-05-02 23:50:50 +0000
commit66b3b8c67411a377875e7a4858488b1e7a145a7b (patch)
treed3357ac67f1bc9c229b6b22e6149516273171612 /org.eclipse.wb.releng/src/releng/util.py
parent42b88af803f1f2b5f80cf048c4c36e7c67b97388 (diff)
downloadorg.eclipse.windowbuilder-66b3b8c67411a377875e7a4858488b1e7a145a7b.tar.gz
org.eclipse.windowbuilder-66b3b8c67411a377875e7a4858488b1e7a145a7b.tar.xz
org.eclipse.windowbuilder-66b3b8c67411a377875e7a4858488b1e7a145a7b.zip
initial load into repo
Diffstat (limited to 'org.eclipse.wb.releng/src/releng/util.py')
-rw-r--r--org.eclipse.wb.releng/src/releng/util.py48
1 files changed, 48 insertions, 0 deletions
diff --git a/org.eclipse.wb.releng/src/releng/util.py b/org.eclipse.wb.releng/src/releng/util.py
new file mode 100644
index 00000000..e0c1d4ca
--- /dev/null
+++ b/org.eclipse.wb.releng/src/releng/util.py
@@ -0,0 +1,48 @@
+'''
+Created on Apr 20, 2011
+
+@author: mrrussell
+'''
+import io
+import logging
+import os
+import subprocess
+
+log = logging.getLogger("releng.util")
+
+def unarchive(archive, dest):
+ log.debug("unarchive(" + archive + ", " + dest + ")")
+ cwd = os.getcwd()
+ os.chdir(dest)
+ if archive.endswith("tar.gz") or archive.endswith("tgz"):
+ subprocess.check_call(['/bin/tar', 'xzvf', archive])
+ elif archive.endswith("tar"):
+ subprocess.check_call(['/bin/tar', 'xvf', archive])
+ elif archive.endswith("zip"):
+ subprocess.check_call(['/usr/bin/unzip', archive])
+
+ os.chdir(cwd)
+
+def updateMd5Hash(dir):
+ log.debug("updateMd5Hash(" + dir + ")")
+ try:
+ files = os.listdir(dir);
+ except OSError as e:
+ log.error("could not read files in " + dir);
+ raise e
+
+ for file in files:
+ if file.endswith('.zip'):
+ fullFile = os.path.join(dir, file);
+ commands = ["/usr/bin/md5sum", "-b", fullFile]
+ if log.info:
+ cl = ""
+ for cmd in commands:
+ cl = cl + cmd + ' '
+ log.info('command line: ' + cl)
+
+ md5File = os.path.join(dir, file + '.MD5')
+ fhMd5File = open(md5File, 'wt')
+ log.info('creating ' + md5File)
+ subprocess.check_call(commands, stdout = fhMd5File)
+ \ No newline at end of file

Back to the top