Skip to content

Commit

Permalink
Gui - rpm build process is shown
Browse files Browse the repository at this point in the history
  • Loading branch information
regeciovad committed Oct 26, 2015
1 parent 9268e11 commit acc1335
Show file tree
Hide file tree
Showing 3 changed files with 42 additions and 10 deletions.
12 changes: 8 additions & 4 deletions rpg/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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)
Expand Down
39 changes: 33 additions & 6 deletions rpg/gui/wizard.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
1 change: 1 addition & 0 deletions rpg/package_builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -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(
Expand Down

0 comments on commit acc1335

Please sign in to comment.