diff --git a/rpg/__init__.py b/rpg/__init__.py index 66e697c..0d232a1 100644 --- a/rpg/__init__.py +++ b/rpg/__init__.py @@ -222,9 +222,11 @@ def write_spec(self): def build_srpm(self): """ Builds srpm into base directory. """ + print('Building SRPM...') if not self.spec.Source or not self.archive_path.exists(): self.create_archive() self.write_spec() + print('Spec file created.') self._package_builder.build_srpm( self.spec_path, self.archive_path, self.base_dir) @@ -274,6 +276,23 @@ def build_project(self): self.compiled_dir, self.spec.build) + def copr_create_and_build(self, name, chroots, desc, intro, url): + print("Creating new project...") + try: + self.copr_create_project(name, chroots, desc, intro) + except: + print("Error in creating project! Please check your login.") + return + print("Creating new project - DONE") + print("Build proccess started...") + print("It takes a while, but it may be safely interrupted.") + try: + self.copr_build(name, url) + except: + print("Error in building project! Please check your url.") + return + print("Building new project - DONE") + def copr_set_config(self, username, login, token): """ Logs into copr with username, login and token. This has to be called before copr_create_project and copr_build diff --git a/rpg/gui/thread.py b/rpg/gui/thread.py new file mode 100644 index 0000000..c30b5ad --- /dev/null +++ b/rpg/gui/thread.py @@ -0,0 +1,62 @@ +from multiprocessing import Process, Queue +from threading import Thread +from io import StringIO +from contextlib import redirect_stdout + + +class _StringIO(StringIO): + """ Overwriting of StringIO for real time output caching. """ + + def __init__(self, buff): + super(_StringIO, self).__init__() + self.buff = buff + + def write(self, s): + super(_StringIO, self).write(s) + if s and s != '\n': + self.buff.put(s) + + +class ThreadWrapper(): + """ Unblocking way to connect functions with GUI for redirection + it's output in real time. """ + + def __init__(self, widget, func, *args): + """ Runs function in new process and add output + to GUI widget from thread with queue. """ + self._widget = widget + self._queue = Queue() + self._process = Process(target=self.wrapper, + args=(self._queue, func, args, )) + self._thread = Thread(target=self.writer) + self._running = False + + def run(self): + """ Starts the process and the thread. """ + if not self._running: + self._process.start() + self._thread.start() + self._running = True + + def kill(self): + """ Stops the process and the thread (there are no official + way to stop thread. This will unlocked thread and it will + be stopped with GUI - without error). """ + self._thread._tstate_lock = None + self._thread._stop() + self._thread.join() + self._process.terminate() + + @staticmethod + def wrapper(queue, func, args): + """ Redirects stdout and call function. + Output will be in queue.""" + f = _StringIO(queue) + with redirect_stdout(f): + func(*args) + f.close() + + def writer(self): + """ Appends output from function to the GUI widget. """ + while self._process.is_alive(): + self._widget.appendPlainText(self._queue.get()) diff --git a/rpg/gui/wizard.py b/rpg/gui/wizard.py index 26c8306..5399abc 100644 --- a/rpg/gui/wizard.py +++ b/rpg/gui/wizard.py @@ -2,15 +2,16 @@ from PyQt5 import QtWidgets, QtCore, QtGui from PyQt5.QtWidgets import (QLabel, QVBoxLayout, QLineEdit, QCheckBox, QGroupBox, QPushButton, QGridLayout, - QTextEdit, QFileDialog, - QComboBox, QWizard, QFrame) + QPlainTextEdit, QFileDialog, QDialog, + QComboBox, QWizard, QFrame, QApplication) from rpg.gui.dialogs import DialogImport -from rpg.utils import path_to_str from pathlib import Path from rpg.command import Command import subprocess import platform +import urllib.request from threading import Thread +from rpg.gui.thread import ThreadWrapper class Wizard(QtWidgets.QWizard): @@ -39,7 +40,7 @@ def __init__(self, base, parent=None): QWizard.BackButton, QWizard.NextButton, QWizard.FinishButton]) self.setButtonLayout(btnList) - self.setStyleSheet("QTextEdit { border-style: solid;" + + self.setStyleSheet("QPlainTextEdit { border-style: solid;" + "border-width: 1px;" + "border-color: rgb(178, 182, 178);" + "border-radius: 3px;" + @@ -106,6 +107,7 @@ def __init__(self, Wizard, parent=None): super(ImportPage, self).__init__(parent) self.base = Wizard.base + self.new_thread = None self.redQLineEdit = ("QLineEdit { border-style: solid;" + "border-width: 1px;" + "border-color: #FF3333;" + @@ -201,12 +203,7 @@ def __init__(self, Wizard, parent=None): self.setLayout(mainLayout) def checkPath(self): - ''' Checks, if path to import is correct while typing''' - path = Path(self.importEdit.text()) - if(path.exists()): - self.importEdit.setStyleSheet("") - else: - self.importEdit.setStyleSheet(self.redQLineEdit) + self.importEdit.setStyleSheet("") def importPath(self): ''' Returns path selected file or archive''' @@ -229,21 +226,35 @@ def validatePage(self): ###### Setting up RPG class references ###### ''' # Verifying path + QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) path = Path(self.importEdit.text()) - if(path.exists()): - self.base.target_arch = self.ArchEdit.currentText() - self.base.target_distro = self.DistroEdit.currentText() - self.base.load_project_from_url(self.importEdit.text().strip()) - self.base.run_extracted_source_analysis() - new_thread = Thread( - target=self.base.fetch_repos, args=(self.base.target_distro, - self.base.target_arch)) - new_thread.start() - self.importEdit.setStyleSheet("") - return True - else: - self.importEdit.setStyleSheet(self.redQLineEdit) - return False + if not (path.exists()): + urlpath = self.importEdit.text() + try: + urllib.request.urlopen(urlpath) + except: + self.importEdit.setStyleSheet(self.redQLineEdit) + QApplication.restoreOverrideCursor() + return False + self.base.target_arch = self.ArchEdit.currentText() + self.base.target_distro = self.DistroEdit.currentText() + self.base.load_project_from_url(self.importEdit.text().strip()) + self.base.run_extracted_source_analysis() + self.new_thread = Thread( + target=self.base.fetch_repos, args=(self.base.target_distro, + self.base.target_arch)) + self.new_thread.start() + self.importEdit.setStyleSheet("") + return True + + def cleanupPage(self): + """ Stops the thread (there are no official way to stop thread. + This will unlocked thread and it will be stopped + with GUI - without error). """ + if self.new_thread: + self.new_thread._tstate_lock = None + self.new_thread._stop() + self.new_thread.join() def nextId(self): ''' [int] Function that determines the next page after the current one @@ -261,6 +272,7 @@ def initializePage(self): self.releaseEdit.setText("1") self.licenseEdit.setText(str(self.base.spec.License)) self.URLEdit.setText(str(self.base.spec.URL)) + QApplication.restoreOverrideCursor() def __init__(self, Wizard, parent=None): super(MandatoryPage, self).__init__(parent) @@ -274,7 +286,10 @@ def __init__(self, Wizard, parent=None): "rgb(233,233,233);}") self.setTitle(self.tr(" Mandatory fields")) - self.setSubTitle(self.tr("Basic required information")) + self.setSubTitle(self.tr("Basic required information. " + + "Name, version and release " + + "will be used to create unique " + + "package name.")) self.nameLabel = QLabel("Name*") self.nameEdit = QLineEdit() @@ -428,7 +443,7 @@ def __init__(self, Wizard, parent=None): "American English (required).")) self.descriptionLabel = QLabel("Description") - self.descriptionEdit = QTextEdit() + self.descriptionEdit = QPlainTextEdit() self.descriptionEdit.setMinimumHeight(30) self.descriptionLabel.setBuddy(self.descriptionEdit) self.descriptionLabelText = QLabel( @@ -468,6 +483,7 @@ def validatePage(self): else: self.base.spec.description = self.descriptionEdit.toPlainText() self.base.spec.Summary = self.summaryEdit.text() + QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) self.base.run_patched_source_analysis() return True @@ -481,9 +497,10 @@ def nextId(self): class ScriptsPage(QtWidgets.QWizardPage): def initializePage(self): - self.prepareEdit.setText(str(self.base.spec.prep)) - self.buildEdit.setText(str(self.base.spec.build)) - self.checkEdit.setText(str(self.base.spec.check)) + self.prepareEdit.insertPlainText(str(self.base.spec.prep)) + self.buildEdit.insertPlainText(str(self.base.spec.build)) + self.checkEdit.insertPlainText(str(self.base.spec.check)) + QApplication.restoreOverrideCursor() def __init__(self, Wizard, parent=None): super(ScriptsPage, self).__init__(parent) @@ -502,7 +519,7 @@ def __init__(self, Wizard, parent=None): "

") prepareLabel = QLabel("%prepare: ") - self.prepareEdit = QTextEdit() + self.prepareEdit = QPlainTextEdit() prepareLabelText = QLabel( self.base.tip_html_style % ("Script commands to prepare the program (e.g. to " @@ -511,14 +528,14 @@ def __init__(self, Wizard, parent=None): "%autosetup -n NAME if the source file unpacks into NAME.")) buildLabel = QLabel("%build: ") - self.buildEdit = QTextEdit() + self.buildEdit = QPlainTextEdit() buildLabelText = QLabel( self.base.tip_html_style % ("Script commands to build the program (e.g. to compile it)" " and get it ready for installing.")) checkLabel = QLabel("%check: ") - self.checkEdit = QTextEdit() + self.checkEdit = QPlainTextEdit() checkLabelText = QLabel( self.base.tip_html_style % "Script commands to test the program.") @@ -579,6 +596,7 @@ def validatePage(self): self.base.spec.check = Command(self.checkEdit.toPlainText()) if self.buildArchCheckbox.isChecked(): self.base.spec.BuildArch = "noarch" + QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) self.base.build_project() self.base.run_compiled_source_analysis() return True @@ -590,10 +608,11 @@ def nextId(self): class InstallPage(QtWidgets.QWizardPage): def initializePage(self): - self.installEdit.setText(str(self.base.spec.install)) - self.pretransEdit.setText(str(self.base.spec.pretrans)) - self.preEdit.setText(str(self.base.spec.pre)) - self.postEdit.setText(str(self.base.spec.post)) + self.installEdit.insertPlainText(str(self.base.spec.install)) + self.pretransEdit.insertPlainText(str(self.base.spec.pretrans)) + self.preEdit.insertPlainText(str(self.base.spec.pre)) + self.postEdit.insertPlainText(str(self.base.spec.post)) + QApplication.restoreOverrideCursor() def __init__(self, Wizard, parent=None): super(InstallPage, self).__init__(parent) @@ -611,25 +630,25 @@ def __init__(self, Wizard, parent=None): "

") pretransLabel = QLabel("%pretrans: ") - self.pretransEdit = QTextEdit() + self.pretransEdit = QPlainTextEdit() pretransLabelText = QLabel( self.base.tip_html_style % "At the start of transaction.") preLabel = QLabel("%pre: ") - self.preEdit = QTextEdit() + self.preEdit = QPlainTextEdit() preLabelText = QLabel( self.base.tip_html_style % "Before a package is installed.") installLabel = QLabel("%install: ") - self.installEdit = QTextEdit() + self.installEdit = QPlainTextEdit() installLabelText = QLabel( self.base.tip_html_style % "Script commands to install the program.") postLabel = QLabel("%post: ") - self.postEdit = QTextEdit() + self.postEdit = QPlainTextEdit() postLabelText = QLabel( self.base.tip_html_style % "After a package is installed.") @@ -686,6 +705,7 @@ def validatePage(self): self.base.spec.pretrans = Command(self.pretransEdit.toPlainText()) self.base.spec.pre = Command(self.preEdit.toPlainText()) self.base.spec.post = Command(self.postEdit.toPlainText()) + QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) self.base.install_project() self.base.run_installed_source_analysis() return True @@ -697,9 +717,11 @@ def nextId(self): class RequiresPage(QtWidgets.QWizardPage): def initializePage(self): - self.bRequiresEdit.setText('\n'.join(self.base.spec.BuildRequires)) - self.requiresEdit.setText('\n'.join(self.base.spec.Requires)) - self.providesEdit.setText('\n'.join(self.base.spec.Provides)) + self.bRequiresEdit.insertPlainText( + '\n'.join(self.base.spec.BuildRequires)) + self.requiresEdit.insertPlainText('\n'.join(self.base.spec.Requires)) + self.providesEdit.insertPlainText('\n'.join(self.base.spec.Provides)) + QApplication.restoreOverrideCursor() def __init__(self, Wizard, parent=None): super(RequiresPage, self).__init__(parent) @@ -710,7 +732,7 @@ def __init__(self, Wizard, parent=None): self.setSubTitle(self.tr("Write requires and provides")) buildRequiresLabel = QLabel("BuildRequires: ") - self.bRequiresEdit = QTextEdit() + self.bRequiresEdit = QPlainTextEdit() self.bRequiresEdit.setMaximumHeight(220) buildRequiresLabelText = QLabel( self.base.tip_html_style % @@ -724,7 +746,7 @@ def __init__(self, Wizard, parent=None): "

") requiresLabel = QLabel("Requires: ") - self.requiresEdit = QTextEdit() + self.requiresEdit = QPlainTextEdit() self.requiresEdit.setMaximumHeight(220) requiresLabelText = QLabel( self.base.tip_html_style % @@ -732,7 +754,7 @@ def __init__(self, Wizard, parent=None): "when the program is installed.")) providesLabel = QLabel("Provides: ") - self.providesEdit = QTextEdit() + self.providesEdit = QPlainTextEdit() providesLabelText = QLabel( self.base.tip_html_style % "List virtual package names that this package provides.") @@ -790,9 +812,9 @@ def nextId(self): class UninstallPage(QtWidgets.QWizardPage): def initializePage(self): - self.postunEdit.setText(str(self.base.spec.postun)) - self.preunEdit.setText(str(self.base.spec.preun)) - self.posttransEdit.setText(str(self.base.spec.posttrans)) + self.postunEdit.insertPlainText(str(self.base.spec.postun)) + self.preunEdit.insertPlainText(str(self.base.spec.preun)) + self.posttransEdit.insertPlainText(str(self.base.spec.posttrans)) def __init__(self, Wizard, parent=None): super(UninstallPage, self).__init__(parent) @@ -809,19 +831,19 @@ def __init__(self, Wizard, parent=None): "and what to do after uninstallation.

") preunLabel = QLabel("%preun: ") - self.preunEdit = QTextEdit() + self.preunEdit = QPlainTextEdit() preunLabelText = QLabel( self.base.tip_html_style % "Before a package is uninstalled.") postunLabel = QLabel("%postun: ") - self.postunEdit = QTextEdit() + self.postunEdit = QPlainTextEdit() postunLabelText = QLabel( self.base.tip_html_style % "After a package is uninstalled.") posttransLabel = QLabel("%posttrans: ") - self.posttransEdit = QTextEdit() + self.posttransEdit = QPlainTextEdit() posttransLabelText = QLabel( self.base.tip_html_style % "At the end of transaction.") @@ -866,6 +888,7 @@ def validatePage(self): self.base.spec.postun = Command(self.postunEdit.toPlainText()) self.base.spec.preun = Command(self.preunEdit.toPlainText()) self.base.spec.posttrans = Command(self.posttransEdit.toPlainText()) + QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) self.base.write_spec() return True @@ -876,6 +899,7 @@ def nextId(self): class BuildPage(QtWidgets.QWizardPage): def initializePage(self): + QApplication.restoreOverrideCursor() self.buildLocationEdit.setText(expanduser("~")) self.distro = self.base.target_distro self.arch = self.base.target_arch @@ -1022,24 +1046,83 @@ def openBuildPathFileDialog(self): def buildSrpm(self): self.textBuildSRPMLabel.setText('Building SRPM...') self.textBuildSRPMLabel.repaint() - self.base.build_srpm() - Command("cp " + path_to_str(self.base.srpm_path) + " " + - self.buildLocationEdit.text()).execute() self.base.final_path = self.buildLocationEdit.text() + + self.srpm_dialog = QDialog(self) + self.srpm_dialog.resize(600, 400) + self.srpm_dialog.setWindowTitle('Building SRPM') + self.srpm_progress = QPlainTextEdit() + self.srpm_progress.setReadOnly(True) + 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.CancelSRPM) + mainLayout = QVBoxLayout() + mainLayout.addSpacing(40) + mainLayout.addWidget(self.srpm_progress) + mainLayout.addSpacing(40) + grid = QGridLayout() + grid.addWidget(self.cancelButton) + mainLayout.addLayout(grid) + self.srpm_dialog.setLayout(mainLayout) + + self.srpm_dialog.show() + self.srpm_process = ThreadWrapper(self.srpm_progress, + 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) 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 = QPlainTextEdit() + self.rpm_progress.setReadOnly(True) + self.rpm_progress.insertPlainText('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(40) + mainLayout.addWidget(self.rpm_progress) + mainLayout.addSpacing(40) + 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.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) @@ -1195,6 +1278,7 @@ def validatePage(self): self.base.coprpackageUrl = self.packageUrlEdit.text() self.base.coprlogin = self.loginEdit.text() self.base.coprtoken = self.tokenEdit.text() + QApplication.setOverrideCursor(QtCore.Qt.WaitCursor) self.base.copr_set_config(self.base.coprusername, self.base.coprlogin, self.base.coprtoken) return True @@ -1205,6 +1289,9 @@ def nextId(self): class CoprDistroPage(QtWidgets.QWizardPage): + def initializePage(self): + QApplication.restoreOverrideCursor() + def __init__(self, Wizard, parent=None): super(CoprDistroPage, self).__init__(parent) @@ -1286,12 +1373,11 @@ def initializePage(self): self.textBuildLabel.setText( "

" + - "New project " + self.newproject + - " will be created.
" + + "style=\" font-size:20pt;\">" + "You can also add descriptions and instructions" + " for your package.
" + - "Next step will build package with Copr." + + "The build button will create new project " + + self.newproject + " and build package with Copr." + "

") def __init__(self, Wizard, parent=None): @@ -1303,15 +1389,14 @@ def __init__(self, Wizard, parent=None): self.setSubTitle(self.tr("Copr additional information")) self.textBuildLabel = QLabel() - self.packageDescLabel = QLabel("Description ") - self.packageDescEdit = QTextEdit() + self.packageDescEdit = QPlainTextEdit() self.packageDescLabelText = QLabel( self.base.tip_html_style % "Description for your package, optional.") self.packageInstuctionLabel = QLabel("Instructions ") - self.packageInstuctionEdit = QTextEdit() + self.packageInstuctionEdit = QPlainTextEdit() self.packageInstuctionLabelText = QLabel( self.base.tip_html_style % ("How install your project, where users can report bugs " @@ -1336,6 +1421,13 @@ def __init__(self, Wizard, parent=None): gridInstuction.addWidget(self.packageInstuctionEdit, 0, 1, 1, 8) gridInstuction.addWidget(self.packageInstuctionLabelText, 1, 0, 1, 8) + self.coprBuildButton = QPushButton('Build package with Copr') + self.coprBuildButton.setMinimumHeight(45) + self.coprBuildButton.setMaximumHeight(45) + self.coprBuildButton.setMinimumWidth(200) + self.coprBuildButton.setMaximumWidth(205) + self.coprBuildButton.clicked.connect(self.buildCopr) + mainLayout.addSpacing(25) frameDesc.setLayout(gridDesc) frameInstuction.setLayout(gridInstuction) @@ -1344,50 +1436,49 @@ def __init__(self, Wizard, parent=None): mainLayout.addSpacing(15) mainLayout.addWidget(frameInstuction) mainLayout.addSpacing(15) + mainLayout.addWidget(self.coprBuildButton, 0, QtCore.Qt.AlignCenter) self.setLayout(mainLayout) def validatePage(self): - self.textBuildLabel.setText( - "

" + - "Creating new project..." + - "

") - self.textBuildLabel.repaint() + return True + + def buildCopr(self): + self.copr_dialog = QDialog(self) + self.copr_dialog.resize(600, 400) + self.copr_dialog.setWindowTitle('Building Copr') + self.copr_progress = QPlainTextEdit() + self.copr_progress.setReadOnly(True) + 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.CancelCopr) + mainLayout = QVBoxLayout() + mainLayout.addSpacing(40) + mainLayout.addWidget(self.copr_progress) + mainLayout.addSpacing(40) + grid = QGridLayout() + grid.addWidget(self.cancelButton) + mainLayout.addLayout(grid) + self.copr_dialog.setLayout(mainLayout) + + self.copr_dialog.show() self.base.coprdesc = self.packageDescEdit.toPlainText() self.base.coprintro = self.packageInstuctionEdit.toPlainText() - try: - self.base.copr_create_project(self.base.coprpackageName, + + self.copr_process = ThreadWrapper(self.copr_progress, + self.base.copr_create_and_build, + self.base.coprpackageName, self.base.coprversion, self.base.coprdesc, - self.base.coprintro) - except subprocess.CalledProcessError: - self.textBuildLabel.setText( - "

" + - "Error in creating project!" + - "
Please check your log in information" + - "

") - return False - self.textBuildLabel.setText( - "

" + - "Creating new project - DONE
" + - "Build proccess started...
" + - "It takes a while, but it may be safely interrupted." - "

") - self.textBuildLabel.repaint() - try: - self.base.copr_build( - self.base.coprpackageName, self.base.coprpackageUrl) - except subprocess.CalledProcessError: - self.textBuildLabel.setText( - "

" + - "Error in building project!" + - "
Please check your url information" + - "

") - return False - return True + self.base.coprintro, + self.base.coprpackageUrl) + self.copr_process.run() + + def CancelCopr(self): + self.copr_dialog.close() + self.copr_process.kill() def nextId(self): return Wizard.PageCoprFinal @@ -1396,6 +1487,7 @@ def nextId(self): class CoprFinalPage(QtWidgets.QWizardPage): def initializePage(self): + QApplication.restoreOverrideCursor() self.newproject = self.base.coprusername + \ "/" + self.base.coprpackageName self.webpage = "https://copr.fedoraproject.org/api/coprs/" + \ diff --git a/rpg/package_builder.py b/rpg/package_builder.py index ad39501..735f1f3 100644 --- a/rpg/package_builder.py +++ b/rpg/package_builder.py @@ -48,10 +48,12 @@ def __init__(self): def build_srpm(spec_file, tarball, output_dir): """ Builds source rpm from spec and tarball and moves it to the output directory """ + print('Starting build command...') Command("rpmdev-setuptree").execute() - Command("cp " + path_to_str(tarball) + + Command("cp -v " + path_to_str(tarball) + ' $(rpm --eval "%{_topdir}")/SOURCES').execute() - output = Command("rpmbuild -bs " + path_to_str(spec_file)).execute() + output = Command("rpmbuild -bs -v " + path_to_str(spec_file)).execute() + print('SRPM package was created.') Command("mv " + path_to_str(output.split()[-1]) + " " + path_to_str(output_dir)).execute() @@ -83,6 +85,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(