From bd5547053db29b0bf0c49dac3ec93ffbfb0ed52f Mon Sep 17 00:00:00 2001 From: Lubomír Sedlář Date: Nov 15 2018 14:16:41 +0000 Subject: Make update work for containers We don't really have an NVR available, but users can fill it in by themselves. Fixes: https://pagure.io/fedpkg/issue/296 Signed-off-by: Lubomír Sedlář --- diff --git a/fedpkg/cli.py b/fedpkg/cli.py index 1ca93d9..7465443 100644 --- a/fedpkg/cli.py +++ b/fedpkg/cli.py @@ -644,8 +644,13 @@ targets to build the package for a particular stream. return False def _prepare_bodhi_template(self, template_file): + try: + nvr = self.cmd.nvr + except rpkgError: + # This is not an RPM, can't get NVR + nvr = "FILL_IN_NVR_HERE" bodhi_args = { - 'nvr': self.cmd.nvr, + 'nvr': nvr, 'bugs': six.u(''), 'descr': six.u( 'Here is where you give an explanation of your update.'), @@ -662,10 +667,15 @@ targets to build the package for a particular stream. else: bodhi_args['type_'] = '' - self.cmd.clog() - clog_file = os.path.join(self.cmd.path, 'clog') - with io.open(clog_file, encoding='utf-8') as f: - clog = f.read() + try: + self.cmd.clog() + clog_file = os.path.join(self.cmd.path, 'clog') + with io.open(clog_file, encoding='utf-8') as f: + clog = f.read() + os.unlink(clog_file) + except rpkgError: + # Not an RPM, no changelog to work with + clog = "" if self.args.bugs: bodhi_args['bugs'] = self.args.bugs @@ -721,7 +731,6 @@ targets to build the package for a particular stream. 'as bodhi.template.last' % e) finally: os.unlink(bodhi_template_file) - os.unlink('clog') else: self.log.info('Bodhi update aborted!')