Bug 1165716 - mock must *not* automatically update packages in build root
Summary: mock must *not* automatically update packages in build root
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: rawhide
Hardware: Unspecified
OS: Unspecified
unspecified
unspecified
Target Milestone: ---
Assignee: Miroslav Suchý
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2014-11-19 14:29 UTC by Vít Ondruch
Modified: 2015-01-06 02:07 UTC (History)
7 users (show)

Fixed In Version: mock-1.2.3-1.el6
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2014-12-12 04:07:27 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Vít Ondruch 2014-11-19 14:29:32 UTC
Description of problem:
mock must *not* automatically update packages in build root (and it never did). I am forced quite often to do something like:

$ mock -r fedora-rawhide-x86_64 --pm-cmd downgrade https://kojipkgs.fedoraproject.org//packages/crypto-policies/20140905/1.git4649b7d.fc22/noarch/crypto-policies-20140905-1.git4649b7d.fc22.noarch.rpm

$ mock -r fedora-rawhide-x86_64 ruby-2.1.5-24.fc22.src.rpm --no-clean

to test what if that specific version of package is causing issues. But recently, mock updates the package back to the most recent version. This is wrong!


Version-Release number of selected component (if applicable):
$ rpm -q mock
mock-1.2.1-1.fc20.noarch


How reproducible:


Steps to Reproduce:
1. mock -r fedora-rawhide-x86_64 --pm-cmd downgrade https://kojipkgs.fedoraproject.org//packages/crypto-policies/20140905/1.git4649b7d.fc22/noarch/crypto-policies-20140905-1.git4649b7d.fc22.noarch.rpm
2. mock -r fedora-rawhide-x86_64 ruby-2.1.5-24.fc22.src.rpm --no-clean
3.

Actual results:
The second command updates the crypto-policies to the most recent version:
Start: yum update

================================================================================
 Package             Arch       Version                         Repository
                                                                           Size
================================================================================
Updating:
 crypto-policies     noarch     20141119-1.gitbe6fb4f.fc22      local      23 k

Transaction Summary
================================================================================
Upgrade  1 Package

Total size: 23 k

Updated:
  crypto-policies.noarch 0:20141119-1.gitbe6fb4f.fc22                           

Finish: yum update
Finish: chroot init


Expected results:
mock does not touch the packages in the build root, since the build root was already populated and all dependencies are met.

Additional info:

Comment 1 Vít Ondruch 2014-11-19 14:58:24 UTC
This is the offending patch:

ae79fb5bed79946b84871dc204fc0e6c8cb17cea

Comment 2 Vít Ondruch 2014-11-19 14:59:32 UTC
Just FTR, I tried to use  --disablerepo=* to workaround the issues, and of course mock fails with error:

Start: yum update
There are no enabled repos.
 Run "yum repolist all" to see the repos you have.
 You can enable repos with yum-config-manager --enable <repo>
ERROR: Exception(ruby-2.1.5-24.fc22.src.rpm) Config(fedora-rawhide-x86_64) 0 minutes 1 seconds
INFO: Results and/or logs in: /var/lib/mock/fedora-rawhide-x86_64/result
ERROR: Command failed. See logs for output.
 # /usr/bin/yum --installroot /var/lib/mock/fedora-rawhide-x86_64/root/ --releasever 22 --disablerepo * update --setopt=tsflags=nocontexts

This is wrong as well.

Comment 3 Mikolaj Izdebski 2014-11-19 15:01:12 UTC
You can use --offline to prevent packages from being updated.

Comment 4 Miroslav Suchý 2014-11-19 16:08:48 UTC
'yum update' was presented in previous mock as well. And on exactly the same place. So this is no regression.

Additionally this is configurable in site-default.cfg by setting:
  config_opts['update_before_build'] = False
or, as Mikolaj said, by using --offline.

Comment 5 Vít Ondruch 2014-11-20 08:00:15 UTC
(In reply to Miroslav Suchý from comment #4)
> 'yum update' was presented in previous mock as well. And on exactly the same
> place. So this is no regression.

This is not true IMO.

1) The behavior I described never happened before.
2) Checking 1.1.41, the update was run under this condition:

https://git.fedorahosted.org/cgit/mock.git/tree/py/mockbuild/backend.py?id=mock-1.1.41#n453

and if go further, you'll see that the condition was never true for not cleaned chroot.

https://git.fedorahosted.org/cgit/mock.git/tree/py/mockbuild/plugins/root_cache.py?id=mock-1.1.41#n105

Other reason why this happens might be enabled LVM plugin, not sure ...

> Additionally this is configurable in site-default.cfg by setting:
>   config_opts['update_before_build'] = False

Luckily it is and it should be disabled by default. It should never update. I can't imagine building package several times with --no-clean option and suddenly it starts failing due to some update which lands in the mean time. Moreover, it just delays the build.

> or, as Mikolaj said, by using --offline.

Thanks for the tip, I'll try it ...

Comment 6 Mikolaj Izdebski 2014-11-20 08:07:55 UTC
(In reply to Vít Ondruch from comment #5)
> (In reply to Miroslav Suchý from comment #4)
> > 'yum update' was presented in previous mock as well. And on exactly the same
> > place. So this is no regression.
> 
> This is not true IMO.
> 
> 1) The behavior I described never happened before.

It definitely happened with mock 1.1.x. I am sure because I used to use private build of mock with this "feature" removed: https://github.com/mizdebsk/mock/commit/7ab92f6538b5e441d74f7fa3b56fc37e4d7ce711

> > or, as Mikolaj said, by using --offline.
> 
> Thanks for the tip, I'll try it ...

I might be wrong, but as I understand, in mock 1.1.x or 1.2.x with --offline will prevent mock from downloading any new dependencies. However if you configure mock to use dnf, --offline prevents running "dnf update" and refreshing metadata, but it doesn't prevent mock from downloading and installing new dependencies. This is exactly what I personally need and expect.

Comment 7 Michael Simacek 2014-11-20 12:00:35 UTC
Vit is right, it didn't happen before when --no-clean was specified. Mikolaj is probably talking about updating without --no-clean which stayed the same. The code is similar, but previous versions of mock didn't execute it at all with --no-clean. Now initialize function is executed for all buildroot modifying actions in order to minimize code duplication and enable things like automatic initialization, LVM, mock shell accessible during build, etc. So this is a regression. Sent a patch upstream.

In the meantime, you can use
config_opts['update_before_build'] = False
as a workaround for this (it will disable yum update for builds regardless of clean/no-clean)

Comment 8 Miroslav Suchý 2014-11-20 12:27:38 UTC
Commited as 9085831

Comment 9 Fedora Update System 2014-12-04 12:06:34 UTC
mock-1.2.3-1.fc21 has been submitted as an update for Fedora 21.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc21

Comment 10 Fedora Update System 2014-12-04 12:10:05 UTC
mock-1.2.3-1.fc20 has been submitted as an update for Fedora 20.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.fc20

Comment 11 Fedora Update System 2014-12-04 12:11:01 UTC
mock-1.2.3-1.el7 has been submitted as an update for Fedora EPEL 7.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.el7

Comment 12 Fedora Update System 2014-12-04 12:12:30 UTC
mock-1.2.3-1.el6 has been submitted as an update for Fedora EPEL 6.
https://admin.fedoraproject.org/updates/mock-1.2.3-1.el6

Comment 13 Fedora Update System 2014-12-05 00:46:45 UTC
Package mock-1.2.3-1.fc21:
* should fix your issue,
* was pushed to the Fedora 21 testing repository,
* should be available at your local mirror within two days.
Update it with:
# su -c 'yum update --enablerepo=updates-testing mock-1.2.3-1.fc21'
as soon as you are able to.
Please go to the following url:
https://admin.fedoraproject.org/updates/FEDORA-2014-16285/mock-1.2.3-1.fc21
then log in and leave karma (feedback).

Comment 14 Fedora Update System 2014-12-12 04:07:27 UTC
mock-1.2.3-1.fc21 has been pushed to the Fedora 21 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 15 Fedora Update System 2014-12-17 04:42:32 UTC
mock-1.2.3-1.fc20 has been pushed to the Fedora 20 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 16 Fedora Update System 2015-01-06 02:06:15 UTC
mock-1.2.3-1.el7 has been pushed to the Fedora EPEL 7 stable repository.  If problems still persist, please make note of it in this bug report.

Comment 17 Fedora Update System 2015-01-06 02:07:40 UTC
mock-1.2.3-1.el6 has been pushed to the Fedora EPEL 6 stable repository.  If problems still persist, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.