1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38
|
def generate(self):
"""Create the package.
"""
self._print("Generate the deb ...")
# FIXME for the GPG agent, we assume we are in '/home'
user = pwd.getpwuid(os.getuid())[5]
cmd = ["debuild", "-i"]
if self.key:
sub = subprocess.Popen(["gpg-agent"], universal_newlines=True,
stdout=subprocess.PIPE,
stderr=subprocess.PIPE).communicate()
if not "gpg-agent running and available" in sub[1]:
#print "Not running"
cm = "eval '$(gpg-agent --daemon --write-env-file '{0}/.gpg-agent-info')'".format(user)
os.system(cm)
cmd = ["debuild", "-S", "-sa", "-k" + self.key]
self._print(" ".join(cmd))
else:
cmd = ["debuild", "-i", "-us", "-uc"]
self._print(" ".join(cmd))
old_rep = os.getcwd()
os.chdir(self.main.app_fld)
sub = subprocess.Popen(cmd, universal_newlines=True,
stdout=subprocess.PIPE)
while 1:
text = sub.stdout.readline()[:-1]
if type(text) != str or text == '' and sub.poll() != None:
break
elif type(text) == str and len(text) > 4:
self._print(text)
os.chdir(old_rep) |
Partager