Bug 1409923

Summary: [RFE] Mockchain does not understand `include` statement
Product: [Fedora] Fedora Reporter: Medic Momcilo <momcilo>
Component: mockAssignee: Miroslav Suchý <msuchy>
Status: CLOSED NEXTRELEASE QA Contact: Fedora Extras Quality Assurance <extras-qa>
Severity: high Docs Contact:
Priority: unspecified    
Version: 30CC: dominik, gary.buhrmaster, hobbes1069, jdisnard, leamas.alec, mebrown, momcilo, msuchy, pingou, praiskup, sochotni, thofmann, williams
Target Milestone: ---   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: Doc Type: If docs needed, set a value
Doc Text:
Story Points: ---
Clone Of: Environment:
Last Closed: 2019-05-17 13:35:00 UTC Type: Bug
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:

Description Medic Momcilo 2017-01-03 21:50:41 UTC
Description of problem:
There is an error shown when fedora-review is ran against obs-studio package from RPMFusion.

Version-Release number of selected component (if applicable):
fedora-review-0.6.1-1.fc24.noarch

How reproducible:
always

Steps to Reproduce:
1. Enable rpmfusion-free and rpmfusion-nonfree repositories
2. dnf download --source obs-studio
3. fedora-review -m fedora-24-x86_64-rpmfusion_nonfree -rn obs-studio*

Actual results:
Error is thrown.

Expected results:
Review completes.

Additional info:
Entire log output:
01-03 21:40 root         DEBUG    fedora-review 0.6.1 f03e4e7 2016-05-02 14:21:43 +0200 started
01-03 21:40 root         DEBUG    Command  line: /usr/bin/fedora-review -v -m fedora-24-x86_64-rpmfusion_nonfree -rn obs-studio-17.0.0-1.fc24.src.rpm
01-03 21:40 root         INFO     Processing local files: obs-studio-17.0.0-1.fc24.src.rpm
01-03 21:40 root         INFO     Getting .spec and .srpm Urls from : Local files in /home/momcilo/rpmbuild/SRPMS
01-03 21:40 root         DEBUG    Active settings after processing options
01-03 21:40 root         DEBUG        resultdir: None
01-03 21:40 root         DEBUG        verbose: True
01-03 21:40 root         DEBUG        no_report: False
01-03 21:40 root         DEBUG        session_log: /home/momcilo/.cache/fedora-review.log
01-03 21:40 root         DEBUG        list_flags: False
01-03 21:40 root         DEBUG        list_checks: False
01-03 21:40 root         DEBUG        single: None
01-03 21:40 root         DEBUG        rpm_spec: True
01-03 21:40 root         DEBUG        plugins: {}
01-03 21:40 root         DEBUG        exclude: None
01-03 21:40 root         DEBUG        configdir: None
01-03 21:40 root         DEBUG        log_level: 10
01-03 21:40 root         DEBUG        init_done: True
01-03 21:40 root         DEBUG        cache: False
01-03 21:40 root         DEBUG        mock_config: fedora-24-x86_64-rpmfusion_nonfree
01-03 21:40 root         DEBUG        version: False
01-03 21:40 root         DEBUG        uniqueext: None
01-03 21:40 root         DEBUG        flags: []
01-03 21:40 root         DEBUG        bz_url: https://bugzilla.redhat.com
01-03 21:40 root         DEBUG        mock_options: --no-cleanup-after --no-clean
01-03 21:40 root         DEBUG        list_plugins: False
01-03 21:40 root         DEBUG        _log_config_done: True
01-03 21:40 root         DEBUG        other_bz: None
01-03 21:40 root         DEBUG        plugins_arg: None
01-03 21:40 root         DEBUG        repo: None
01-03 21:40 root         DEBUG        use_colors: True
01-03 21:40 root         DEBUG        bug: None
01-03 21:40 root         DEBUG        prebuilt: False
01-03 21:40 root         DEBUG        name: obs-studio-17.0.0-1.fc24.src.rpm
01-03 21:40 root         DEBUG        url: None
01-03 21:40 root         DEBUG        checksum: sha256
01-03 21:40 root         DEBUG        nobuild: False
01-03 21:40 root         DEBUG        _con_handler: <logging.StreamHandler object at 0x7f5449d52a50>
01-03 21:40 root         INFO       --> SRPM url: file:///home/momcilo/rpmbuild/SRPMS/obs-studio-17.0.0-1.fc24.src.rpm
01-03 21:40 root         INFO     Using review directory: /home/momcilo/rpmbuild/SRPMS/obs-studio
01-03 21:40 root         DEBUG    find_urls completed: 0.079
01-03 21:40 root         DEBUG    Avoiding init of working mock root
01-03 21:40 root         DEBUG    Url download completed: 1.130
01-03 21:40 root         DEBUG      --> /home/momcilo/rpmbuild/SRPMS/obs-studio/upstream : https://github.com/jp9000/obs-studio/archive/17.0.0.tar.gz#/obs-studio-17.0.0.tar.gz
01-03 21:40 root         INFO     Downloading (Source0): https://github.com/jp9000/obs-studio/archive/17.0.0.tar.gz#/obs-studio-17.0.0.tar.gz
01-03 21:40 root         INFO     Running checks and generating report
01-03 21:40 root         DEBUG    Running check: CheckResultdir
01-03 21:40 root         DEBUG        CheckResultdir completed: 0.001 seconds
01-03 21:40 root         DEBUG    Running check: CheckBuild
01-03 21:40 root         DEBUG    Avoiding init of working mock root
01-03 21:40 root         DEBUG    Mock command: mock, -r, fedora-24-x86_64-rpmfusion_nonfree, --no-cleanup-after, --no-clean, --resultdir=/home/momcilo/rpmbuild/SRPMS/obs-studio/results, --chroot, --, rm -rf $(rpm --eval %_builddir)/*
01-03 21:40 root         DEBUG    Mock output: INFO: mock.py version 1.2.21 starting (python version = 3.5.2)...
Start: init plugins
INFO: selinux enabled
Finish: init plugins
Start: run
Start: chroot init
INFO: calling preinit hooks
INFO: enabled root cache
INFO: enabled dnf cache
Start: cleaning dnf metadata
Finish: cleaning dnf metadata
Mock Version: 1.2.21
INFO: Mock Version: 1.2.21
Finish: chroot init
INFO: Running in chroot: ['rm -rf $(rpm --eval %_builddir)/*']
Start: chroot ['rm -rf $(rpm --eval %_builddir)/*']
Finish: chroot ['rm -rf $(rpm --eval %_builddir)/*']
Finish: run
 None
None
01-03 21:40 root         DEBUG    Build command: "mock" "-r" "fedora-24-x86_64-rpmfusion_nonfree" "--no-cleanup-after" "--no-clean" "--resultdir=/home/momcilo/rpmbuild/SRPMS/obs-studio/results" --rebuild /home/momcilo/rpmbuild/SRPMS/obs-studio-17.0.0-1.fc24.src.rpm 2>&1 | tee build.log
01-03 21:42 root         DEBUG    _topdir: /builddir/build
01-03 21:42 root         DEBUG    Exception down the road...
Traceback (most recent call last):
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 237, in run
    self._do_run(outfile)
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 226, in _do_run
    self._do_report(outfile)
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 99, in _do_report
    self._run_checks(self.bug.spec_file, self.bug.srpm_file, outfile)
  File "/usr/lib/python2.7/site-packages/FedoraReview/review_helper.py", line 118, in _run_checks
    writedown=not Settings.no_report)
  File "/usr/lib/python2.7/site-packages/FedoraReview/checks.py", line 378, in run_checks
    run_check(name)
  File "/usr/lib/python2.7/site-packages/FedoraReview/checks.py", line 352, in run_check
    check.run()
  File "/usr/lib/python2.7/site-packages/FedoraReview/plugins/generic_build.py", line 198, in run
    Mock.build(self.srpm.filename)
  File "/usr/lib/python2.7/site-packages/FedoraReview/mock.py", line 438, in build
    self.builddir_cleanup()
  File "/usr/lib/python2.7/site-packages/FedoraReview/mock.py", line 566, in builddir_cleanup
    paths = glob(os.path.join(self.get_builddir('BUILD'), '*'))
  File "/usr/lib/python2.7/site-packages/FedoraReview/mock.py", line 339, in get_builddir
    p = self._get_dir(os.path.join('root', self._topdir[1:]))
  File "/usr/lib/python2.7/site-packages/FedoraReview/mock.py", line 178, in _get_dir
    self._get_root()
  File "/usr/lib/python2.7/site-packages/FedoraReview/mock.py", line 166, in _get_root
    exec config[0]                           # pylint: disable=W0122
IndexError: list index out of range
01-03 21:42 root         ERROR    Exception down the road...(logs in /home/momcilo/.cache/fedora-review.log)
01-03 21:42 root         DEBUG    Report completed:  142.759 seconds

Comment 1 Richard Shaw 2017-05-18 20:30:34 UTC
Ping... I'm seeing something similar.

Comment 2 Richard Shaw 2017-05-18 20:37:20 UTC
It looks like RPM Fusion mock config files do not directly specific a config_opts['root'] because it does an include of the fedora version which already specifies it. 

mock knows how to to use the "include" to create a complete mock config but fedora-review does not.

I'll poke around and see if it's easy enough to port over.

Comment 3 Richard Shaw 2017-05-18 20:48:25 UTC
My python fu is a little too rusty but in:

/usr/lib/python3.5/site-packages/mockbuild/util.py

there are two functions (starting at line 1088), include and update_config_from_file that look promising.

Comment 4 Richard Shaw 2017-06-02 14:35:55 UTC
Reassigning to the correct component.

Comment 5 Richard Shaw 2017-06-02 14:36:47 UTC
Basically mock understands the include option used by RPM Fusion to pull in the base fedora config file but mockchain does not.

Comment 6 Till Hofmann 2017-06-30 09:35:18 UTC
A simple workaround if you need the mock config before this is fixed:

cat /etc/mock/fedora-25-x86_64.cfg /etc/mock/fedora-25-x86_64-rpmfusion_free.cfg | grep -v '^include' > rpmfusion-custom.cfg

Comment 7 Fedora End Of Life 2017-11-16 19:53:19 UTC
This message is a reminder that Fedora 25 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 25. It is Fedora's policy to close all
bug reports from releases that are no longer maintained. At that time
this bug will be closed as EOL if it remains open with a Fedora  'version'
of '25'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version'
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not
able to fix it before Fedora 25 is end of life. If you would still like
to see this bug fixed and are able to reproduce it against a later version
of Fedora, you are encouraged  change the 'version' to a later Fedora
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's
lifetime, sometimes those efforts are overtaken by events. Often a
more recent Fedora release includes newer upstream software that fixes
bugs or makes them obsolete.

Comment 8 Richard Shaw 2017-11-16 22:04:36 UTC
As far as I know this has not been fixed (I haven't tested lately) so reassigning to rawhide.

Comment 9 Fedora End Of Life 2018-02-20 15:21:21 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 28 development cycle.
Changing version to '28'.

Comment 10 Gary Buhrmaster 2018-06-03 15:37:22 UTC
FWIW, this has been reported upstream: https://github.com/rpm-software-management/mock/issues/65

Comment 11 Ben Cotton 2019-05-02 19:22:11 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Ben Cotton 2019-05-02 20:08:57 UTC
This message is a reminder that Fedora 28 is nearing its end of life.
On 2019-May-28 Fedora will stop maintaining and issuing updates for
Fedora 28. It is Fedora's policy to close all bug reports from releases
that are no longer maintained. At that time this bug will be closed as
EOL if it remains open with a Fedora 'version' of '28'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 28 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 13 Miroslav Suchý 2019-05-17 13:35:00 UTC
I am going to close this one as starting from next release the mockchain will be marked as obsoleted and people will be encouraged to start using:
   mock --chain
and this bug will not appear there.