#2201 rpmbuild: fix make_srpm with new git
Merged 2 years ago by praiskup. Opened 2 years ago by praiskup.
Unknown source make-srpm-and-new-git  into  main

@@ -14,6 +14,12 @@

  

  log = logging.getLogger("__main__")

  

+ MAKE_SRPM_TEPMLATE = (

+     "set -x && "

+     'cd {0} && '

+     'echo -e "[safe]\ndirectory = {0}" > ~/.gitconfig && '

+     'make -f {1} srpm outdir="{2}" spec="{3}"'

+ )

  

  class ScmProvider(Provider):

  
@@ -111,9 +117,8 @@

              .format(self.workdir, mock_workdir, self.resultdir, mock_resultdir)

  

          makefile_path = os.path.join(mock_repodir, '.copr', 'Makefile')

-         make_srpm_cmd_part = \

-             'cd {0}; make -f {1} srpm outdir="{2}" spec="{3}"'\

-             .format(mock_cwd, makefile_path, mock_resultdir, mock_spec_path)

+         make_srpm_cmd_part = MAKE_SRPM_TEPMLATE.format(mock_cwd, makefile_path,

+                 mock_resultdir, mock_spec_path)

  

          return ['mock', '--uniqueext', get_mock_uniqueext(),

                  '-r', '/etc/copr-rpmbuild/mock-source-build.cfg',

file modified
+6 -6
@@ -4,7 +4,7 @@

  import configparser

  import shutil

  

- from copr_rpmbuild.providers.scm import ScmProvider

+ from copr_rpmbuild.providers.scm import ScmProvider, MAKE_SRPM_TEPMLATE

  from copr_rpmbuild.helpers import read_config

  from . import TestCase

  
@@ -143,11 +143,11 @@

          bind_mount_cmd_part = '--plugin-option=bind_mount:dirs=(("{0}", "/mnt/{1}"), ("{2}", "/mnt/{3}"))'\

                                .format(provider.workdir, workdir_base,

                                        resultdir, basename)

-         make_srpm_cmd_part = 'cd /mnt/{wb}/somerepo/subpkg; make -f /mnt/{wb}/somerepo/.copr/Makefile srpm '\

-                              'outdir="/mnt/{rb}" spec="/mnt/{wb}/somerepo/subpkg/pkg.spec"'\

-                              .format(

-             wb=workdir_base,

-             rb=basename,

+         make_srpm_cmd_part = MAKE_SRPM_TEPMLATE.format(

+             "/mnt/{0}/somerepo/subpkg".format(workdir_base),

+             "/mnt/{0}/somerepo/.copr/Makefile".format(workdir_base),

+             "/mnt/{0}".format(basename),

+             "/mnt/{0}/somerepo/subpkg/pkg.spec".format(workdir_base),

          )

          assert_cmd = ['mock', '--uniqueext', '2', '-r', '/etc/copr-rpmbuild/mock-source-build.cfg',

                        bind_mount_cmd_part, '--chroot', make_srpm_cmd_part]

The new GIT doesn't allow us to run 'git archive' (typically done in
make_srpm method) as a privileged root user from a directory owned by
non-privileged user. Till we have #534 fixed, we need to do this hack
for make_srpm method (method is run under the root user in a mock
chroot).

Fixes: #2194

rebased onto 682a1e945adb007e26229f1f4adcd8243ea835a7

2 years ago

Build failed. More information on how to proceed and troubleshoot errors available at https://fedoraproject.org/wiki/Zuul-based-ci

rebased onto 9e98ec4

2 years ago

Build succeeded.

Commit 9e98ec4 fixes this pull-request

Pull-Request has been merged by praiskup

2 years ago

Pull-Request has been merged by praiskup

2 years ago