Loading bin/isimage +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ def build(options): for d in ("", "parser", "setup", "data"): rp = os.path.join(options.path, d) if not os.path.exists(rp): error("Missing directory: %s" % rp) error("Missing directory: %s" % d) if not os.path.isdir(rp): error("Not a directory: %s" % rp) if not os.access(rp, os.R_OK|os.X_OK): Loading bin/isinstall +2 −0 Original line number Diff line number Diff line Loading @@ -73,3 +73,5 @@ try: pkg.run_setup({"args": args}) except Exception as e: error(e) except KeyboardInterrupt: warn("Keyboard Interrupted") installsystems/image.py +5 −4 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ import stat import datetime import time import json import hashlib import StringIO import ConfigParser import subprocess Loading @@ -19,10 +18,10 @@ import json import tarfile import re import installsystems.template import installsystems.tools as istools from installsystems.printer import * from installsystems.tarball import Tarball class Image(object): '''Abstract class of images''' Loading Loading @@ -185,15 +184,17 @@ class SourceImage(Image): def create_data_tarball(self, tar_path, data_path): '''Create a data tarball''' dname = os.path.basename(data_path) # not derefence for directory. Verbatim copy. ddref = False if os.path.isdir(data_path) else True try: # opening file if self.pbzip2_path: tb = open(tar_path, mode="w") p = subprocess.Popen(self.pbzip2_path, shell=False, close_fds=True, stdin=subprocess.PIPE, stdout=tb.fileno()) tarball = Tarball.open(mode="w|", dereference=True, fileobj=p.stdin) tarball = Tarball.open(mode="w|", dereference=ddref, fileobj=p.stdin) else: tarball = Tarball.open(tar_path, "w:bz2", dereference=True) tarball = Tarball.open(tar_path, "w:bz2", dereference=ddref) tarball.add(data_path, arcname=dname, recursive=True) # closing tarball file tarball.close() Loading installsystems/tools.py +3 −3 Original line number Diff line number Diff line Loading @@ -7,15 +7,15 @@ InstallSystems Generic Tools Library ''' import os from installsystems.image import Image import hashlib def md5sum(self, path): def md5sum(path): '''Compute md5 of a file''' m = hashlib.md5() m.update(open(path, "r").read()) return m.hexdigest() def cp(self, source, destination): def cp(source, destination): '''Copy a source to destination. Take care of path type''' stype = path_type(source) dtype = path_type(destination) Loading Loading
bin/isimage +1 −1 Original line number Diff line number Diff line Loading @@ -40,7 +40,7 @@ def build(options): for d in ("", "parser", "setup", "data"): rp = os.path.join(options.path, d) if not os.path.exists(rp): error("Missing directory: %s" % rp) error("Missing directory: %s" % d) if not os.path.isdir(rp): error("Not a directory: %s" % rp) if not os.access(rp, os.R_OK|os.X_OK): Loading
bin/isinstall +2 −0 Original line number Diff line number Diff line Loading @@ -73,3 +73,5 @@ try: pkg.run_setup({"args": args}) except Exception as e: error(e) except KeyboardInterrupt: warn("Keyboard Interrupted")
installsystems/image.py +5 −4 Original line number Diff line number Diff line Loading @@ -11,7 +11,6 @@ import stat import datetime import time import json import hashlib import StringIO import ConfigParser import subprocess Loading @@ -19,10 +18,10 @@ import json import tarfile import re import installsystems.template import installsystems.tools as istools from installsystems.printer import * from installsystems.tarball import Tarball class Image(object): '''Abstract class of images''' Loading Loading @@ -185,15 +184,17 @@ class SourceImage(Image): def create_data_tarball(self, tar_path, data_path): '''Create a data tarball''' dname = os.path.basename(data_path) # not derefence for directory. Verbatim copy. ddref = False if os.path.isdir(data_path) else True try: # opening file if self.pbzip2_path: tb = open(tar_path, mode="w") p = subprocess.Popen(self.pbzip2_path, shell=False, close_fds=True, stdin=subprocess.PIPE, stdout=tb.fileno()) tarball = Tarball.open(mode="w|", dereference=True, fileobj=p.stdin) tarball = Tarball.open(mode="w|", dereference=ddref, fileobj=p.stdin) else: tarball = Tarball.open(tar_path, "w:bz2", dereference=True) tarball = Tarball.open(tar_path, "w:bz2", dereference=ddref) tarball.add(data_path, arcname=dname, recursive=True) # closing tarball file tarball.close() Loading
installsystems/tools.py +3 −3 Original line number Diff line number Diff line Loading @@ -7,15 +7,15 @@ InstallSystems Generic Tools Library ''' import os from installsystems.image import Image import hashlib def md5sum(self, path): def md5sum(path): '''Compute md5 of a file''' m = hashlib.md5() m.update(open(path, "r").read()) return m.hexdigest() def cp(self, source, destination): def cp(source, destination): '''Copy a source to destination. Take care of path type''' stype = path_type(source) dtype = path_type(destination) Loading