{"action":"created","issue":{"url":"https://api.github.com/repos/rh-lab-q/rpg/issues/128","labels_url":"https://api.github.com/repos/rh-lab-q/rpg/issues/128/labels{/name}","comments_url":"https://api.github.com/repos/rh-lab-q/rpg/issues/128/comments","events_url":"https://api.github.com/repos/rh-lab-q/rpg/issues/128/events","html_url":"https://github.com/rh-lab-q/rpg/issues/128","id":70337328,"number":128,"title":"implement files_to_pkgs plugin","user":{"login":"jsilhan","id":5243763,"avatar_url":"https://avatars.githubusercontent.com/u/5243763?v=3","gravatar_id":"","url":"https://api.github.com/users/jsilhan","html_url":"https://github.com/jsilhan","followers_url":"https://api.github.com/users/jsilhan/followers","following_url":"https://api.github.com/users/jsilhan/following{/other_user}","gists_url":"https://api.github.com/users/jsilhan/gists{/gist_id}","starred_url":"https://api.github.com/users/jsilhan/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/jsilhan/subscriptions","organizations_url":"https://api.github.com/users/jsilhan/orgs","repos_url":"https://api.github.com/users/jsilhan/repos","events_url":"https://api.github.com/users/jsilhan/events{/privacy}","received_events_url":"https://api.github.com/users/jsilhan/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/rh-lab-q/rpg/labels/high_priority","name":"high_priority","color":"006b75"},{"url":"https://api.github.com/repos/rh-lab-q/rpg/labels/plugin","name":"plugin","color":"84b6eb"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":2,"created_at":"2015-04-23T07:39:25Z","updated_at":"2015-06-21T09:47:40Z","closed_at":null,"body":"It should use dnf sack and convert all (Build)Requires files to packages.\r\nin phase `installed` it should transfer all `File` objects from spec.Requires and spec.Builrequires to packages using hawkey.Selector(file=<file>) passed into hawkey.Goal.install(<selector>)"},"comment":{"url":"https://api.github.com/repos/rh-lab-q/rpg/issues/comments/113880641","html_url":"https://github.com/rh-lab-q/rpg/issues/128#issuecomment-113880641","issue_url":"https://api.github.com/repos/rh-lab-q/rpg/issues/128","id":113880641,"user":{"login":"cibo94","id":8911091,"avatar_url":"https://avatars.githubusercontent.com/u/8911091?v=3","gravatar_id":"","url":"https://api.github.com/users/cibo94","html_url":"https://github.com/cibo94","followers_url":"https://api.github.com/users/cibo94/followers","following_url":"https://api.github.com/users/cibo94/following{/other_user}","gists_url":"https://api.github.com/users/cibo94/gists{/gist_id}","starred_url":"https://api.github.com/users/cibo94/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/cibo94/subscriptions","organizations_url":"https://api.github.com/users/cibo94/orgs","repos_url":"https://api.github.com/users/cibo94/repos","events_url":"https://api.github.com/users/cibo94/events{/privacy}","received_events_url":"https://api.github.com/users/cibo94/received_events","type":"User","site_admin":false},"created_at":"2015-06-21T09:47:40Z","updated_at":"2015-06-21T09:47:40Z","body":"```python\r\n_goal = hawkey.Goal(self.sack)\r\nfor _file in self.spec.Requires:\r\n    sltr = hawkey.Selector(self.sack).set(file=_file)\r\n    _goal.install(select=sltr)\r\n_goal.run()\r\nprint(_goal.list_installs())\r\n```\r\nThis is failing on _goal.install and when i have tried this:\r\n```python\r\nfor _file in self.spec.Requires:\r\n    _goal = hawkey.Goal(self.sack)\r\n    sltr = hawkey.Selector(self.sack).set(file=_file)\r\n    _goal.install(select=sltr)\r\n    _goal.run()\r\n    print(_goal.list_installs())\r\n```\r\nIt prints empty lists and fails after few loops (~40 seconds).\r\n\r\nI have working solution, but it takes 80 seconds to resolve hawkey require dependencies. It looks like this:\r\n```python\r\ndef _resolve(files, query):\r\n    for _file in files:\r\n        yield [str(pckg) for pckg in query.filter(file=_file)]\r\n\r\ndef _uniq(_list):\r\n    return list(set(_list))\r\n\r\nimport itertools\r\n_query = hawkey.Query(self.sack)\r\nself.spec.Requires = _uniq(\r\n    itertools.chain(*list(_resolve(self.spec.Requires, _query))))\r\nself.spec.BuildRequires = _uniq(\r\n    itertools.chain(*list(_resolve(self.spec.BuildRequires, _query))))\r\n```"}}