1. Michał Górny
  2. smart-live-rebuild


Michał Górny  committed f381830

Write the variable output code into the temporary script.

Now the code responsible for outputting variables (in a simpler form) is
written into the temporary file (one with the variable declarations copied
from environment.bz2) instead of being inlined in the bash call.

This is the first step towards (hopefully more efficient) server/client
model for environment parsing.

  • Participants
  • Parent commits ab99bd2
  • Branches master

Comments (0)

Files changed (1)

File SmartLiveRebuild/vcs/__init__.py

View file
 		f.seek(0, 0)
 		shutil.copyfileobj(envf, f)
+		f.write('\nprintf "%%s\\0" %s\n' % ' '.join(['"${%s}"' % x for x in vars]))
-		script = 'source "%s"||exit 1;%s' % (f.name,
-			';echo -ne "\\0";'.join(['echo -n "${%s}"' % x for x in vars]))
-		return dict(zip(vars, self.call(['bash', '-c', script]).split('\0')))
+		return dict(zip(vars, self.call(['bash', f.name]).split('\0')))
 	def __init__(self, cpv, envf, tmpf, opts, settings):
 		self.cpv = [cpv]