From d3d5666baf59f607118fb80b8853616b1d25f6aa Mon Sep 17 00:00:00 2001 From: regeciovad Date: Fri, 27 Nov 2015 13:18:57 +0100 Subject: [PATCH] Gui - copy rpm and sprm in wizard --- rpg/__init__.py | 15 ++++----------- rpg/gui/thread.py | 1 - rpg/gui/wizard.py | 13 +++++++++---- 3 files changed, 13 insertions(+), 16 deletions(-) diff --git a/rpg/__init__.py b/rpg/__init__.py index c6fe7c9..0d232a1 100644 --- a/rpg/__init__.py +++ b/rpg/__init__.py @@ -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(): @@ -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: @@ -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) diff --git a/rpg/gui/thread.py b/rpg/gui/thread.py index 5f09fce..c30b5ad 100644 --- a/rpg/gui/thread.py +++ b/rpg/gui/thread.py @@ -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() diff --git a/rpg/gui/wizard.py b/rpg/gui/wizard.py index 18d3412..28fc35d 100644 --- a/rpg/gui/wizard.py +++ b/rpg/gui/wizard.py @@ -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) @@ -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)