Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Find files wil now replace system paths with rpm macros (fix #351) #352

Open
wants to merge 12 commits into
base: master
Choose a base branch
from

Conversation

onionka
Copy link
Member

@onionka onionka commented Nov 5, 2015

No description provided.

@onionka
Copy link
Member Author

onionka commented Nov 5, 2015

Could you restart Travis? This error shown up:

11.08s$ docker exec -i test_fedora bash -c "dnf builddep -y hawkey"
enabling fedora-source repository
enabling updates-source repository
Last metadata expiration check performed 0:00:01 ago on Thu Nov  5 20:06:32 2015.
Traceback (most recent call last):
  File "/usr/bin/dnf", line 36, in <module>
    main.user_main(sys.argv[1:], exit_code=True)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 198, in user_main
    errcode = main(args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 84, in main
    return _main(base, args)
  File "/usr/lib/python2.7/site-packages/dnf/cli/main.py", line 136, in _main
    cli.run()
  File "/usr/lib/python2.7/site-packages/dnf/cli/cli.py", line 1091, in run
    return self.command.run(self.base.extcmds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/builddep.py", line 76, in inner
    return func(*args, **kwds)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/builddep.py", line 142, in run
    self._remote_deps(pkgspec)
  File "/usr/lib/python2.7/site-packages/dnf-plugins/builddep.py", line 213, in _remote_deps
    package).get_best_query(self.base.sack)})
  File "/usr/lib/python2.7/site-packages/dnf-plugins/builddep.py", line 212, in <setcomp>
    for pkg in dnf.subject.Subject(
  File "/usr/lib/python2.7/site-packages/dnfpluginscore/lib.py", line 170, in package_source_name
    srcname = package.sourcerpm.rstrip(".src.rpm")
AttributeError: 'NoneType' object has no attribute 'rstrip'

@jsilhan
Copy link
Member

jsilhan commented Nov 6, 2015

The travis will be when new dnf-plugins-core package is in the repositories. (the bug is fixed in the upstream but no new version has been released)



class FindFilePlugin(Plugin):

PREFIXES = [
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this should be tuples (prefixes, macros)

@onionka onionka force-pushed the FindFile branch 2 times, most recently from 63452c5 to f91873a Compare November 6, 2015 18:59
("/usr/share", "%{_datadir}"),
("/var/lib", "%{_sharedstatedir}"),
("/var", "%{_localstatedir}"),
("/etc", "%{_sysconfdir}"),
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lkardos, can you answer, please, if these tuples are accessible from rpm?

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can use rpm.expandMacro() but there is no easy way how to get names of all defined macros. Probably you have to hardcode them. So you can use something like this:

MACROS = { rpm.expandMacro(x): x for x in ["%{_javadocdir}", "%{_javadocdir}", "%{_javadir}", ... ] }

One way how to avoid harcoded names of macros is to parse them from string returned by rpm.expandMacro("%dump") but I don't recommend that.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I have done it with %dump ... there is a problem only with duplicities like this:

-  ('%{_kde4_libdir}/libl.so', None, None),
?      -----

+  ('%{_libdir}/libl.so', None, None),

where %{_kde4_libdir} == '/usr/lib64'
and %{_libdir} == '/usr/lib64'

should I just ignore it?

@onionka
Copy link
Member Author

onionka commented Feb 7, 2016

Now this should be all OK and non-hardcoded

@onionka onionka force-pushed the FindFile branch 4 times, most recently from 9bf95dd to cc573ef Compare February 7, 2016 16:38
@onionka
Copy link
Member Author

onionka commented Feb 7, 2016

this error is issued #373 but everything else is OK. please restart travis

@onionka
Copy link
Member Author

onionka commented Feb 24, 2016

depends on #358 heavily but all done - I hope tests will pass now

@onionka
Copy link
Member Author

onionka commented Feb 24, 2016

It is failing because of missing macro definition

see #374

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants