From 5e3ffdef46cd52bdbc03aa2ef89c5373b2f5be6f Mon Sep 17 00:00:00 2001 From: Ondrej Nosek Date: Feb 25 2019 14:09:59 +0000 Subject: Simplify srpm method Making its structure more clear. Some arguments are not needed for srpm call, but it allows us to keep the structure of 'rpmbuild' related methods similar. Signed-off-by: Ondrej Nosek --- diff --git a/pyrpkg/cli.py b/pyrpkg/cli.py index cef1ebd..e287512 100644 --- a/pyrpkg/cli.py +++ b/pyrpkg/cli.py @@ -2314,36 +2314,16 @@ see API KEY section of copr-cli(1) man page. def srpm(self): self.sources() - if hasattr(self.args, 'define'): - defines = self.args.define - else: - # koji does not allow defines argparse won't set them - # for koji style builds - defines = None - - if hasattr(self.args, 'builddir'): - builddir = self.args.builddir - else: - # koji does not allow custom builddir argparse won't set them - # for koji style builds - builddir = None - - if hasattr(self.args, 'buildroot'): - buildrootdir = self.args.buildroot - else: - # koji does not allow custom buildroot argparse won't set them - # for koji style builds - buildrootdir = None - - if hasattr(self.args, 'arch'): - arch = self.args.arch - else: - # normal koji builds are for all arches and not set via argparse - arch = None - - self.cmd.srpm(builddir=builddir, define=defines, - buildrootdir=buildrootdir, - arch=arch, hashtype=self.args.hash) + # Koji does not allow defines, custom builddir and custom buildroot. + # Argparse won't set them for koji style builds. Normal koji builds + # are for all arches and not set via argparse. + self.cmd.srpm( + builddir=getattr(self.args, 'builddir', None), + define=getattr(self.args, 'define', None), + buildrootdir=getattr(self.args, 'buildroot', None), + arch=getattr(self.args, 'arch', None), + hashtype=self.args.hash + ) def switch_branch(self): if self.args.branch: