Bug 927496 - repoquery downloads metadata even if --offline is provided in command line
Summary: repoquery downloads metadata even if --offline is provided in command line
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: mock
Version: 20
Hardware: All
OS: Linux
unspecified
high
Target Milestone: ---
Assignee: Clark Williams
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-03-26 04:51 UTC by Ankur Sinha (FranciscoD)
Modified: 2014-02-21 15:40 UTC (History)
3 users (show)

Fixed In Version:
Clone Of:
Environment:
Last Closed: 2014-02-21 15:40:48 UTC
Type: Bug
Embargoed:


Attachments (Terms of Use)

Description Ankur Sinha (FranciscoD) 2013-03-26 04:51:59 UTC
Description of problem:
While running quick successive builds of an srpm, I use the --offline flag to decrease runtime. It appears that the repoquery command does not appreciate this flag and still downloads metadata each time. 


Version-Release number of selected component (if applicable):


How reproducible:
ALWAYS

Steps to Reproduce:
1.Run mock build on an srpm
2.RUn mock build on an srpm again using --offline flag
3.
  
Actual results:
Yum uses -C and gets stuff from cache, but repoquery does not

Expected results:
Even repoquery should make use of -C and only use the cache. It should not download fresh data.


Additional info:

[ankur@dhcppc1  SRPMS]$ mock --offline -v -r fedora-rawhide-x86_64 rebuild pybrain-0.3.1-2.fc18.src.rpm

...
..
DEBUG: Child return code was: 0
DEBUG: ['/usr/bin/yum', '--installroot', '/var/lib/mock/fedora-rawhide-x86_64/root/', '-C', 'update']
DEBUG: Executing command: ['/usr/bin/yum', '--installroot', '/var/lib/mock/fedora-rawhide-x86_64/root/', '-C', 'update', '--setopt=tsflags=nocontexts'] with env {'LANG': 'en_GB.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'CCACHE_DIR': '/tmp/ccache', 'HOSTNAME': 'mock', 'PROMPT_COMMAND': 'echo -n "<mock-chroot>"', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin', 'CCACHE_UMASK': '002'}
DEBUG: Config time: 0.007
DEBUG: Yum Version: 3.4.3
DEBUG: rpmdb time: 0.000
DEBUG: Updating Everything
DEBUG: Building updates object
DEBUG: Setting up Package Sacks
DEBUG: pkgsack time: 0.103
DEBUG: up:Obs Init time: 0.371
DEBUG: up:simple updates time: 0.003
DEBUG: up:obs time: 0.008
DEBUG: up:condense time: 0.000
DEBUG: updates time: 1.885
DEBUG: No Packages marked for Update
DEBUG: Child return code was: 0
Start: Outputting list of available packages
DEBUG: Executing command: /usr/bin/repoquery -c /var/lib/mock/fedora-rawhide-x86_64/root//etc/yum.conf -a --qf '%{nevra} %{buildtime} %{size} %{pkgid} %{repoid}' > /var/lib/mock/fedora-rawhide-x86_64/result/available_pkgs with env {'LANG': 'en_GB.utf8', 'TERM': 'vt100', 'SHELL': '/bin/bash', 'HOSTNAME': 'mock', 'HOME': '/builddir', 'PATH': '/usr/bin:/bin:/usr/sbin:/sbin'}
...
...
..

Comment 1 Ankur Sinha (FranciscoD) 2013-03-26 05:29:51 UTC
[ankur@dhcppc1  temp_repo]$ rpm -q mock
mock-1.1.29-1.fc18.noarch

Comment 2 Ankur Sinha (FranciscoD) 2013-03-26 07:04:58 UTC
Also, is a list of all available packages really needed for normal running? Is it for debugging purposes? Can a switch be provided to turn this on/off?

Thanks,
Ankur

Comment 3 Clark Williams 2013-03-26 18:35:38 UTC
(In reply to comment #2)
> Also, is a list of all available packages really needed for normal running?
> Is it for debugging purposes? Can a switch be provided to turn this on/off?
> 
> Thanks,
> Ankur

It's part of the package_state plugin, which is used to verify the environment in which a package is built. 

You can disable it with --disable-plugin=package_state

Regardless, the plugin shouldn't run repoquery when --offline is specified. Here's something I'm testing now, which should turn off the package_state callbacks when --offline is specified:

diff --git a/py/mockbuild/plugins/package_state.py b/py/mockbuild/plugins/package_state.py
index 59385b1..13fff31 100644
--- a/py/mockbuild/plugins/package_state.py
+++ b/py/mockbuild/plugins/package_state.py
@@ -36,12 +36,13 @@ class PackageState(object):
         self.rootObj = rootObj
         self.avail_done = False
         self.inst_done = False
+        self.online = rootObj.online
         rootObj.addHook("postyum", self._availablePostYumHook)
         rootObj.addHook("prebuild", self._installedPreBuildHook)
         
     decorate(traceLog())
     def _availablePostYumHook(self):
-        if not self.avail_done:
+        if self.online and not self.avail_done:
             self.rootObj.start("Outputting list of available packages")
             out_file = self.rootObj.resultdir + '/available_pkgs'
             cmd = "/usr/bin/repoquery -c %s/etc/yum.conf %s > %s" % (
@@ -52,7 +53,7 @@ class PackageState(object):
 
     decorate(traceLog())
     def _installedPreBuildHook(self):
-        if not self.inst_done:
+        if self.online and not self.inst_done:
             self.rootObj.start("Outputting list of installed packages")
             fd, fn = tempfile.mkstemp()
             fo = os.fdopen(fd, 'w')

I'm testing now and if it doesn't break the world, I'll include it in the next release (1.1.30).

Comment 4 Fedora End Of Life 2013-12-21 15:45:36 UTC
This message is a reminder that Fedora 18 is nearing its end of life.
Approximately 4 (four) weeks from now Fedora will stop maintaining
and issuing updates for Fedora 18. 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 WONTFIX if it remains open with a Fedora 
'version' of '18'.

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 prior to Fedora 18's end of life.

Thank you for reporting this issue and we are sorry that we may not be 
able to fix it before Fedora 18 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 to Fedora 18's end of life.

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 5 Clark Williams 2014-02-21 15:40:48 UTC
Don't know how this got missed but it's been fixed since 1.1.30


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