[PATCH 1/4] If outdir is not checked into git... * When SOURCES/ is not checked into git, centpkg creates that directory to download the sources into
[PATCH 2/4] Customize the srpm method * Customized the srpm() method to build from the CentOS SRPMS/ directory
[PATCH 3/4] Redefine the "target" used for mock and koji builds. * For now we are using the epel-{6,7} mock configs for local builds. We will certainly want to change this in the future
[PATCH 4/4] local mockbuilds now work as defined by upstream rpkg * Unmask mockbuild to allow for local building
DIFFSTAT: src/centpkg/__init__.py | 58 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 51 insertions(+), 7 deletions(-)
This commit also moves a comment that was checked in on the wrong line --- src/centpkg/__init__.py | 14 +++++++++++++- 1 files changed, 13 insertions(+), 1 deletions(-)
diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index eff2a72..7eff083 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -110,8 +110,20 @@ class Commands(pyrpkg.Commands): csum, file = archive.strip().split(None, 1) except ValueError: raise pyrpkg.rpkgError('Malformed sources file.') - # See if we already have a valid copy downloaded + + # If a directory is specified in the metadata file, append it to + # outdir + if os.path.dirname(file): + outdir = os.path.join(self.path, os.path.dirname(file)) + file = os.path.basename(file) + + # Create the output directory if it's not checked into git + if not os.path.exists(outdir): + self.log.info("Creating OUTDIR: {0}".format(outdir)) + os.makedirs(outdir) + outfile = os.path.join(outdir, file) + # See if we already have a valid copy downloaded if os.path.exists(outfile): if self._verify_file(outfile, csum, self.lookasidehash): continue
The vanilla rpkg instance dumps all the sources in the toplevel of the package checkout (everything is flat). CentOS uses the SOURCES,SPECS,SRPMS directory structure. --- src/centpkg/__init__.py | 34 +++++++++++++++++++++++++++++++--- 1 files changed, 31 insertions(+), 3 deletions(-)
diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index 7eff083..e6f4e45 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -142,6 +142,37 @@ class Commands(pyrpkg.Commands):
return
+ def srpm(self, hashtype=None): + """Create an srpm using hashtype from content in the module + + Requires sources already downloaded. + """ + + # This line is what changed for centpkg, in Fedora the directory + # structure is flat, in CentOS we use the proper SRPMS/ directory for + # our source RPMs + self.srpmname = os.path.join(self.path, 'SRPMS', + "{0}-{1}-{2}.src.rpm".format(self.module_name, + self.ver, self.rel)) + # See if we need to build the srpm + if os.path.exists(self.srpmname): + self.log.debug('Srpm found, rewriting it.') + + cmd = ['rpmbuild'] + cmd.extend(self.rpmdefines) + if self.quiet: + cmd.append('--quiet') + # Figure out which hashtype to use, if not provided one + if not hashtype: + # Try to determine the dist + hashtype = self._guess_hashtype() + # This may need to get updated if we ever change our checksum default + if not hashtype == 'sha256': + cmd.extend(["--define '_source_filedigest_algorithm %s'" % hashtype, + "--define '_binary_filedigest_algorithm %s'" % hashtype]) + cmd.extend(['--nodeps', '-bs', os.path.join(self.path, self.spec)]) + self._run_command(cmd, shell=True) + # These are the commands defined in the base pyrpkg.Commands class # and have not been implemented here, yet
@@ -199,9 +230,6 @@ class Commands(pyrpkg.Commands): def prep(self, *args, **kwargs): raise NotImplementedError("This command is not yet implemented in centpkg")
- def srpm(self, *args, **kwargs): - raise NotImplementedError("This command is not yet implemented in centpkg") - def unused_patches(self, *args, **kwargs): raise NotImplementedError("This command is not yet implemented in centpkg")
This redefinition temporarily uses the epel mock configs since they are the only EL configs that are readily distributed. This is where we can make changes later. --- src/centpkg/__init__.py | 7 +++++++ 1 files changed, 7 insertions(+), 0 deletions(-)
diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index e6f4e45..37dbe83 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -72,6 +72,13 @@ class Commands(pyrpkg.Commands):
raise pyrpkg.rpkgError('No spec file found.')
+ def load_target(self): + """ This sets the target attribute (used for mock and koji) """ + # This is a hack, eventually we will want to use non-epel mock configs + # We use the epel configs for now because they are the only distributed + # mock configs that build against EL mock trees + self._target = 'epel-{0}'.format(self.distval) + # These are the commands defined in the base pyrpkg.Commands class # and have been implemented here
--- src/centpkg/__init__.py | 3 --- 1 files changed, 0 insertions(+), 3 deletions(-)
diff --git a/src/centpkg/__init__.py b/src/centpkg/__init__.py index 37dbe83..64289e4 100644 --- a/src/centpkg/__init__.py +++ b/src/centpkg/__init__.py @@ -228,9 +228,6 @@ class Commands(pyrpkg.Commands): def mock_config(self, *args, **kwargs): raise NotImplementedError("This command is not yet implemented in centpkg")
- def mockbuild(self, *args, **kwargs): - raise NotImplementedError("This command is not yet implemented in centpkg") - def upload(self, *args, **kwargs): raise NotImplementedError("This command is not yet implemented in centpkg")
On 07/04/2014 11:48 PM, Brian Stinson wrote:
[PATCH 1/4] If outdir is not checked into git...
- When SOURCES/ is not checked into git, centpkg creates that directory to download the sources into
[PATCH 2/4] Customize the srpm method
- Customized the srpm() method to build from the CentOS SRPMS/ directory
[PATCH 3/4] Redefine the "target" used for mock and koji builds.
- For now we are using the epel-{6,7} mock configs for local builds. We will certainly want to change this in the future
[PATCH 4/4] local mockbuilds now work as defined by upstream rpkg
- Unmask mockbuild to allow for local building
DIFFSTAT: src/centpkg/__init__.py | 58 +++++++++++++++++++++++++++++++++++++++++----- 1 files changed, 51 insertions(+), 7 deletions(-) _______________________________________________ CentOS-devel mailing list CentOS-devel@centos.org http://lists.centos.org/mailman/listinfo/centos-devel
all 4 pushed