Skip to content

Commit

Permalink
Gui - copy rpm and sprm in wizard
Browse files Browse the repository at this point in the history
  • Loading branch information
regeciovad committed Nov 27, 2015
1 parent 580aff5 commit b873b0a
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 16 deletions.
15 changes: 4 additions & 11 deletions rpg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def write_spec(self):
with open(str(self.spec_path), 'w') as spec_file:
spec_file.write(str(self.spec))

def build_srpm(self, path=None):
def build_srpm(self):
""" Builds srpm into base directory. """
print('Building SRPM...')
if not self.spec.Source or not self.archive_path.exists():
Expand All @@ -229,11 +229,8 @@ def build_srpm(self, path=None):
print('Spec file created.')
self._package_builder.build_srpm(
self.spec_path, self.archive_path, self.base_dir)
if path:
Command("cp " + path_to_str(self.srpm_path) + " " +
str(path)).execute()

def build_rpm(self, target_distro, target_arch, path=None):
def build_rpm(self, target_distro, target_arch):
""" Build rpm from srpm. If srpm does not exists,
it will be created. """
try:
Expand All @@ -242,18 +239,14 @@ def build_rpm(self, target_distro, target_arch, path=None):
self.build_srpm()
self._package_builder.build_rpm(
str(self.srpm_path), target_distro, target_arch, self.base_dir)
if path:
packages = self.rpm_path
for package in packages:
Command("cp " + str(package) + " " + path).execute()

def build_rpm_recover(self, distro, arch, path=None):
def build_rpm_recover(self, distro, arch):
""" Repeatedly build rpm with mock and finds all build errors.
May raise RuntimeError on failed recover. """

def build():
self.build_srpm()
self.build_rpm(distro, arch, path)
self.build_rpm(distro, arch)

def analyse():
_files_to_pkgs.installed(self.base_dir, self.spec, self.sack)
Expand Down
1 change: 0 additions & 1 deletion rpg/gui/thread.py
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,3 @@ def writer(self):
""" Appends output from function to the GUI widget. """
while self._process.is_alive():
self._widget.appendPlainText(self._queue.get())
self._widget.repaint()
13 changes: 9 additions & 4 deletions rpg/gui/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -1066,13 +1066,15 @@ def buildSrpm(self):

self.srpm_dialog.show()
self.srpm_process = ThreadWrapper(self.srpm_progress,
self.base.build_srpm,
self.base.final_path)
self.base.build_srpm)
self.srpm_process.run()

def CancelSRPM(self):
self.srpm_dialog.close()
self.srpm_process.kill()
if self.base.srpm_path:
Command("cp " + str(self.base.srpm_path) + " " +
str(self.base.final_path)).execute()
self.textBuildSRPMLabel.setText('Your source package was build in '
+ self.base.final_path)

Expand Down Expand Up @@ -1107,13 +1109,16 @@ def buildRpm(self):
self.rpm_dialog.show()
self.rpm_process = ThreadWrapper(self.rpm_progress,
self.base.build_rpm_recover,
distro, arch,
self.base.final_path)
distro, arch)
self.rpm_process.run()

def CancelRPM(self):
self.rpm_dialog.close()
self.rpm_process.kill()
if self.base.rpm_path:
for package in self.base.rpm_path:
Command("cp " + str(package) + " " +
str(self.base.final_path)).execute()
self.textBuildRPMLabel.setText(
'Your package was build in ' + self.base.final_path)

Expand Down

0 comments on commit b873b0a

Please sign in to comment.