diff --git a/rpg/__init__.py b/rpg/__init__.py index d024f30..9d3e2bb 100644 --- a/rpg/__init__.py +++ b/rpg/__init__.py @@ -229,10 +229,10 @@ def build_srpm(self, path=None): self.spec_path, self.archive_path, self.base_dir) if path: Command("cp " + path_to_str(self.srpm_path) + " " + - str(path)).execute() + str(path)).execute() print ('SRPM pakcage was created.') - def build_rpm(self, target_distro, target_arch): + def build_rpm(self, target_distro, target_arch, path=None): """ Build rpm from srpm. If srpm does not exists, it will be created. """ try: @@ -241,14 +241,18 @@ def build_rpm(self, target_distro, target_arch): 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): + def build_rpm_recover(self, distro, arch, path=None): """ 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) + self.build_rpm(distro, arch, path) def analyse(): _files_to_pkgs.installed(self.base_dir, self.spec, self.sack) diff --git a/rpg/gui/wizard.py b/rpg/gui/wizard.py index f71736a..3056719 100644 --- a/rpg/gui/wizard.py +++ b/rpg/gui/wizard.py @@ -1059,15 +1059,42 @@ def CancelSRPM(self): def buildRpm(self): self.textBuildRPMLabel.setText('Building RPM...') - self.textBuildSRPMLabel.repaint() + self.textBuildRPMLabel.repaint() self.base.final_path = self.buildLocationEdit.text() + + self.rpm_dialog = QDialog(self) + self.rpm_dialog.resize(600, 400) + self.rpm_dialog.setWindowTitle('Building RPM') + self.rpm_progress = QTextEdit() + self.rpm_progress.setReadOnly(True) + self.rpm_progress.setText('Building RPM...') + self.cancelButton = QPushButton('Cancel') + self.cancelButton.setMinimumHeight(45) + self.cancelButton.setMaximumHeight(45) + self.cancelButton.setMinimumWidth(100) + self.cancelButton.setMaximumWidth(115) + self.cancelButton.clicked.connect(self.CancelRPM) + mainLayout = QVBoxLayout() + mainLayout.addSpacing(50) + mainLayout.addWidget(self.rpm_progress) + mainLayout.addSpacing(50) + grid = QGridLayout() + grid.addWidget(self.cancelButton) + mainLayout.addLayout(grid) + self.rpm_dialog.setLayout(mainLayout) + arch = self.BuildArchEdit.currentText() distro = self.BuildDistroEdit.currentText() - self.base.build_rpm_recover(distro, arch) - packages = self.base.rpm_path - for package in packages: - Command("cp " + str(package) + " " + - self.base.final_path).execute() + self.rpm_dialog.show() + self.rpm_process = ThreadWrapper(self.rpm_progress, + self.base.build_rpm_recover, + distro, arch, + self.base.final_path) + self.rpm_process.run() + + def CancelRPM(self): + self.rpm_dialog.close() + self.rpm_process.kill() self.textBuildRPMLabel.setText( 'Your package was build in ' + self.base.final_path) diff --git a/rpg/package_builder.py b/rpg/package_builder.py index ad39501..168ef09 100644 --- a/rpg/package_builder.py +++ b/rpg/package_builder.py @@ -83,6 +83,7 @@ def check_output(proc): line = proc.stdout.readline().decode("utf-8") if self._regex.search(line): yield line + print(line) self.build_ret_code = proc.returncode _ret = list(