Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 670082 - portageq get_repos, master_repositories, master_repos, and get_repo_path ignore the eroot parameter
Summary: portageq get_repos, master_repositories, master_repos, and get_repo_path igno...
Status: RESOLVED FIXED
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Tools (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks: 671498
  Show dependency tree
 
Reported: 2018-11-01 13:28 UTC by Bruce Schultz
Modified: 2020-12-27 22:30 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
portageq.patch (file_670082.txt,277 bytes, patch)
2018-11-01 13:31 UTC, Bruce Schultz
Details | Diff
portageq-v2.patch (file_670082.txt,3.65 KB, patch)
2018-11-05 11:01 UTC, Bruce Schultz
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Bruce Schultz 2018-11-01 13:28:43 UTC
'portageq get_repo_path /eroot gentoo' returns the path from the host system, and no the passed in eroot

Reproducible: Always

Steps to Reproduce:
1. This script demonstrates the problem
#!/bin/bash
tmpdir=/tmp/portageq
mkdir -p ${tmpdir}/etc/portage
printf "[gentoo]\nlocation = /var/blah/portage\n" > \
     ${tmpdir}/etc/portage/repos.conf
portageq --version
portageq repos_config ${tmpdir} | grep ^location
portageq get_repo_path ${tmpdir} gentoo

Actual Results:  
Portage 2.3.40
location = /var/blah/portage
/usr/portage


Expected Results:  
Should return /var/blah/portage in the last line (not /usr/portage)

https://bugs.gentoo.org/489022 reports a similar problem, but that appears to work now for the portageq match
Comment 1 Bruce Schultz 2018-11-01 13:30:49 UTC
Here's a patch:

--- /usr/lib/python-exec/python3.6/portageq     2018-07-26 23:57:43.000000000 +1000
+++ ./portageq  2018-11-01 23:29:43.285242218 +1000
@@ -882,6 +882,7 @@
 master_repos.__doc__ = docstrings['master_repos']
 
 
+@uses_configroot
 @uses_eroot
 def get_repo_path(argv):
Comment 2 Bruce Schultz 2018-11-01 13:31:49 UTC
Created attachment 553810 [details, diff]
portageq.patch

Attached a patch
Comment 3 Larry the Git Cow gentoo-dev 2018-11-02 19:14:53 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=1cc3352b6580af95965e231b35e80627b8391df4

commit 1cc3352b6580af95965e231b35e80627b8391df4
Author:     Bruce Schultz <brulzki@gmail.com>
AuthorDate: 2018-11-02 19:04:52 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-11-02 19:14:13 +0000

    portageq get_repo_path: fix <eroot> parameter (bug 670082)
    
    Use the @uses_configroot decorator to make portage get_repo_path
    respect the <eroot> parameter, like portage repos_config since
    commit 382f4be415394886026ccd5dcd08ca96ecda31fa.
    
    Bug: https://bugs.gentoo.org/670082
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/portageq | 1 +
 1 file changed, 1 insertion(+)
Comment 4 Zac Medico gentoo-dev 2018-11-02 19:15:49 UTC
Thanks!
Comment 5 Bruce Schultz 2018-11-05 10:57:22 UTC
The same problem exists for the commands get_repos, master_repos and master_repositories. Here's a simple script to demonstrate

#!/bin/bash
mkdir -p mkdir /tmp/portageq/etc/portage
cat > /tmp/portageq/etc/portage/repos.conf <<EOF
[gentoo]
location = /var/blah/gentoo
[overlay]
location = /var/blah/overlay
masters = gentoo
EOF
portageq --version
portageq get_repos /tmp/portageq
portageq master_repos /tmp/portageq overlay
portageq master_repositories /tmp/portageq overlay

Output:
Portage 2.3.49
gentoo

(the master_repos commands both print blank lines, because overlay does not exist on the host system)

Expected output:
overlay gentoo
gentoo
gentoo
Comment 6 Bruce Schultz 2018-11-05 11:01:00 UTC
Created attachment 554124 [details, diff]
portageq-v2.patch

Attaching another patch which fixes the get_repos and master_repos variants also.

(Let me know it you would prefer I open a new bug for those)
Comment 7 Larry the Git Cow gentoo-dev 2018-11-19 07:29:23 UTC
The bug has been referenced in the following commit(s):

https://gitweb.gentoo.org/proj/portage.git/commit/?id=089a6082e7d115b7dc07862121f68b72d9f123f6

commit 089a6082e7d115b7dc07862121f68b72d9f123f6
Author:     Bruce Schultz <brulzki@gmail.com>
AuthorDate: 2018-11-19 07:22:53 +0000
Commit:     Zac Medico <zmedico@gentoo.org>
CommitDate: 2018-11-19 07:22:53 +0000

    portageq get_repos: fix <eroot> parameter (bug 670082)
    
    Use the @uses_configroot decorator to make portage get_repos
    respect the <eroot> parameter, like portage repos_config since
    commit 382f4be415394886026ccd5dcd08ca96ecda31fa. Apply the same
    fix to master_repositories and master_repos.
    
    Bug: https://bugs.gentoo.org/670082
    Signed-off-by: Zac Medico <zmedico@gentoo.org>

 bin/portageq | 3 +++
 1 file changed, 3 insertions(+)
Comment 8 Zac Medico gentoo-dev 2019-04-10 04:33:57 UTC
Fixed in portage-2.3.62.