Bug 466460 - yum-builddep problem with local files
yum-builddep problem with local files
Product: Fedora
Classification: Fedora
Component: yum-utils (Show other bugs)
All Linux
medium Severity medium
: ---
: ---
Assigned To: Seth Vidal
Fedora Extras Quality Assurance
: Reopened
Depends On:
  Show dependency treegraph
Reported: 2008-10-10 07:46 EDT by Adam Huffman
Modified: 2014-01-21 18:06 EST (History)
6 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2009-02-02 15:55:54 EST
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

  None (edit)
Description Adam Huffman 2008-10-10 07:46:20 EDT
Description of problem:

I've just tried using yum-builddep for a .src.rpm I have on the local filesystem. 
Each time I try to run it, I see the following error:

Traceback (most recent call last):
  File "/usr/bin/yum-builddep", line 142, in <module>
    util = YumBuildDep()
  File "/usr/bin/yum-builddep", line 41, in __init__
  File "/usr/bin/yum-builddep", line 66, in main
  File "/usr/bin/yum-builddep", line 109, in get_build_deps
    srpms.append(yum.packages.YumLocalPackage(self.ts, arg))
  File "/usr/lib/python2.5/site-packages/yum/packages.py", line 1461, in __init__
    'Could not open local rpm file: %s' % self.localpath
yum.Errors.MiscError: Could not open local rpm file: 

A few other people seem to be having a similar problem:

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

How reproducible:

Steps to Reproduce:
Actual results:

Expected results:

Additional info:
Comment 1 James Antill 2008-10-10 08:34:59 EDT
there is an update in updates-newkey which I'm pretty sure fixes this.
Comment 2 James Antill 2008-10-10 08:42:51 EDT
 Ok, my bad ... it's still broken as the problem is due to what version of rpm you have.
Comment 3 James Antill 2008-10-10 08:44:28 EDT
Panu, the problem is this gbit of code from rpmUtils/miscutils.py:hdrFromPackage:

        hdr = ts.hdrFromFdno(fdno)
    except rpm.error, e:
        raise rpmUtils.RpmUtilsError, "RPM Error opening Package"

...on Fedora 9s rpm, this throws an exception when fdno is for a .src.rpm package.
Comment 4 seth vidal 2008-10-10 08:48:35 EDT
 I have f9 here running:

and yum-builddep 1.1.16 works fine for me accessing local src rpms.
Comment 5 Adam Huffman 2008-10-10 09:10:25 EDT
The system in question is x86_64, if that makes a difference.
Comment 6 James Antill 2008-10-10 09:15:24 EDT
Yeh, I have x86_64 too ... interesting.

% yum --version
  Installed: rpm- at 2008-07-14 15:57
  Built    : Fedora Project at 2008-04-18 16:52
  Committed: Bill Nottingham <notting@redhat.com> at 2008-04-18 22:00

  Installed: yum-3.2.19-3.fc9.noarch at 2008-09-08 14:10
  Built    : Fedora Project at 2008-09-03 15:04
  Committed: Seth Vidal <skvidal at fedoraproject.org> at 2008-09-03 22:00

  Installed: yum-metadata-parser-1.1.2-8.fc9.x86_64 at 2008-07-14 15:58
  Built    : Fedora Project at 2008-02-14 13:26
  Committed: Seth Vidal <skvidal at fedoraproject.org> at 2008-02-14 22:00

...Panu any info. you want?
Comment 7 Adam Huffman 2008-10-10 09:19:43 EDT
Have just updated to yum-utils 1.1.17-1.fc9 and the error is still there.
Comment 8 James Antill 2008-10-10 09:26:10 EDT
 Ok, this "fix" works for me:

diff --git a/yum-builddep.py b/yum-builddep.py
index 2fafdc5..9dba426 100755
--- a/yum-builddep.py
+++ b/yum-builddep.py
@@ -105,7 +105,9 @@ class YumBuildDep(YumUtilBase):
         srpms = []
         for arg in self.cmds:
             if arg.endswith('.src.rpm'):
-                srpms.append(yum.packages.YumLocalPackage(self.ts, arg))
+                ts = rpmUtils.transaction.initReadOnlyTransaction()
+                srpms.append(yum.packages.YumLocalPackage(ts, arg))
+                del ts
             elif arg.endswith('.src'):

...so rpm seems to be failing only with a R/W ts, on .src.rpm, on x86_64 ... hmmm.
Comment 9 Panu Matilainen 2008-10-10 09:30:49 EDT
Can you point me to the exact package(s) you experience this with? In http://fedoraforum.org/forum/showthread.php?t=200121 case it's apparently a f10 package which could mean something broken how the new rpm creates (source) packages, so the question is does it happen with all src.rpm packages or with just some?
Comment 10 James Antill 2008-10-10 09:34:41 EDT
Ahh, the exception it's failing with is:

"public key not available"

...which I think is due to the gpg key storage in the new rpm ... how aren't you hitting this Seth?

So it might be our problem after all, bah.
Comment 11 James Antill 2008-10-10 09:38:29 EDT
I just picked a random .src.rpm on my machine that would have deps. that needed installing ... but yeh, I see that "yumdownloader --source yum" works fine ... so I think Seth just chose a "better" starting pkg.

 I used: http://dag.wieers.com/rpm/packages/gringotts/gringotts-1.2.8-1.dag.src.rpm
Comment 12 seth vidal 2008-10-10 09:59:18 EDT
okay, I get the error with that package. I don't get it with an unsigned pkg from my SRPMS dir.
Comment 13 Panu Matilainen 2008-10-10 13:53:27 EDT
With F9 rpm the key-handling is still the way it "always" was. Using yum-builddep on a signed package with unknown key is probably just a path that nobody has happened to stumble on (surprising as it may be). IIRC yum's "read-only transaction" disables all signature checking, which would explain why the patch in comment #8 "works". And unsigned packages aren't affected either way.
Comment 14 Curt Fiene 2009-01-30 15:04:33 EST
So is there a work around for this issue?
Comment 15 Panu Matilainen 2009-01-31 04:35:06 EST
Easy workaround is to rpm --import the key of the package, whether you actually want to go importing whatever keys into your system rpmdb is another question.

yum-builddep needs to be taught to deal with signed packages, that's the real fix. The patch from comment #8 disables any signature checking at all, might not be exactly what you want either.

In any case, over to yum-utils.
Comment 16 seth vidal 2009-02-02 11:50:21 EST
okay, seems to me the best fix is:

 - make sure yum-builddep errors out appropriately when it encounters an unsigned src rpm
Comment 17 seth vidal 2009-02-02 15:55:54 EST
okay - I checked in a patch which will more intelligently tell you about signed, but unknown-key pkgs. It still allows unsigned srpms, which, we can change - but somehow that seems 'more correct' oddly.

reopen if anyone is unhappy about this.

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