#2123 Pass buildroot to preSCMCheckout and postSCMCheckout where applicable.
Merged 2 years ago by mikem. Opened 2 years ago by asaleh.
asaleh/koji RFE_2122  into  master

file modified
+20 -10
@@ -1677,14 +1677,16 @@ 

          uploadpath = self.getUploadDir()

  

          self.run_callbacks('preSCMCheckout', scminfo=scm.get_info(),

-                            build_tag=build_tag, scratch=opts.get('scratch'))

+                            build_tag=build_tag, scratch=opts.get('scratch'),

+                            buildroot=buildroot)

          # Check out sources from the SCM

          sourcedir = scm.checkout(scmdir, self.session, uploadpath, logfile)

          self.run_callbacks("postSCMCheckout",

                             scminfo=scm.get_info(),

                             build_tag=build_tag,

                             scratch=opts.get('scratch'),

-                            srcdir=sourcedir)

+                            srcdir=sourcedir,

+                            buildroot=buildroot)

  

          # zip up pristine sources for auditing purposes

          self._zip_dir(sourcedir, os.path.join(outputdir, 'scm-sources.zip'))
@@ -1695,7 +1697,8 @@ 

              patch_scm = SCM(self.opts.get('patches'))

              patch_scm.assert_allowed(self.options.allowed_scms)

              self.run_callbacks('preSCMCheckout', scminfo=patch_scm.get_info(),

-                                build_tag=build_tag, scratch=opts.get('scratch'))

+                                build_tag=build_tag, scratch=opts.get('scratch'),

+                                buildroot=buildroot)

              # never try to check out a common/ dir when checking out patches

              patch_scm.use_common = False

              patchcheckoutdir = patch_scm.checkout(patchdir, self.session, uploadpath, patchlog)
@@ -1703,7 +1706,8 @@ 

                                 scminfo=patch_scm.get_info(),

                                 build_tag=build_tag,

                                 scratch=opts.get('scratch'),

-                                srcdir=patchcheckoutdir)

+                                srcdir=patchcheckoutdir,

+                                buildroot=buildroot)

              self._zip_dir(patchcheckoutdir, os.path.join(outputdir, 'patches.zip'))

  

          # Apply patches, if present
@@ -1996,13 +2000,15 @@ 

          scmdir = buildroot.tmpdir() + '/scmroot'

          koji.ensuredir(scmdir)

          self.run_callbacks('preSCMCheckout', scminfo=scm.get_info(),

-                            build_tag=build_tag, scratch=opts.get('scratch'))

+                            build_tag=build_tag, scratch=opts.get('scratch'),

+                            buildroot=buildroot)

          specdir = scm.checkout(scmdir, self.session, self.getUploadDir(), logfile)

          self.run_callbacks("postSCMCheckout",

                             scminfo=scm.get_info(),

                             build_tag=build_tag,

                             scratch=opts.get('scratch'),

-                            srcdir=specdir)

+                            srcdir=specdir,

+                            buildroot=buildroot)

  

          spec_template = None

          for path, dir, files in os.walk(specdir):
@@ -2965,13 +2971,15 @@ 

              scm.assert_allowed(self.options.allowed_scms)

              logfile = os.path.join(self.workdir, 'checkout.log')

              self.run_callbacks('preSCMCheckout', scminfo=scm.get_info(),

-                                build_tag=build_tag, scratch=self.opts.get('scratch'))

+                                build_tag=build_tag, scratch=self.opts.get('scratch'),

+                                buildroot=broot)

              scmsrcdir = scm.checkout(scmdir, self.session, self.getUploadDir(), logfile)

              self.run_callbacks("postSCMCheckout",

                                 scminfo=scm.get_info(),

                                 build_tag=build_tag,

                                 scratch=self.opts.get('scratch'),

-                                srcdir=scmsrcdir)

+                                srcdir=scmsrcdir,

+                                buildroot=broot)

              kspath = os.path.join(scmsrcdir, ksfile)

          else:

              kspath = self.localPath("work/%s" % ksfile)
@@ -4932,14 +4940,16 @@ 

          uploadpath = self.getUploadDir()

  

          self.run_callbacks('preSCMCheckout', scminfo=scm.get_info(),

-                            build_tag=build_tag, scratch=opts.get('scratch'))

+                            build_tag=build_tag, scratch=opts.get('scratch'),

+                            buildroot=broot)

          # Check out spec file, etc. from SCM

          sourcedir = scm.checkout(scmdir, self.session, uploadpath, logfile)

          self.run_callbacks("postSCMCheckout",

                             scminfo=scm.get_info(),

                             build_tag=build_tag,

                             scratch=opts.get('scratch'),

-                            srcdir=sourcedir)

+                            srcdir=sourcedir,

+                            buildroot=broot)

          # chown the sourcedir and everything under it to the mockuser

          # so we can build the srpm as non-root

          uid = pwd.getpwnam(self.options.mockuser)[2]

This includes BuildMavenTask, WrapperRPMTask, ImageTask and BuildSRPMfromRPMTask.

Signed-off-by: Adam Saleh asaleh@redhat.com

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

2 years ago

Metadata Update from @jcupova:
- Pull-request tagged with: testing-done

2 years ago

Commit 44cc51c fixes this pull-request

Pull-Request has been merged by mikem

2 years ago