Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!

Bug 482464

Summary: sys-apps/portage-2.2.1 egencache gives confusing error when using "--repositories-configuration"
Product: Portage Development Reporter: Kent Fredric (IRC: kent\n) (RETIRED) <kentnl>
Component: UnclassifiedAssignee: Portage team <dev-portage>
Status: CONFIRMED ---    
Severity: normal CC: esigra
Priority: Normal    
Version: unspecified   
Hardware: All   
OS: Linux   
Whiteboard:
Package list:
Runtime testing required: ---
Bug Depends on:    
Bug Blocks: 240187    

Description Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2013-08-25 22:11:38 UTC
I've been using egencache to perform an automated cache-enabled version of a repository for a while, and I noticed after upgrading portage it tells me the "--portdir-overlay" parameter is deprecated.

So  I threw together a repos.conf file as below, to match the target I'm generating:

--------------------

[DEFAULT]
main-repo = gentoo

[gentoo]
location = /usr/portage
sync-type = rsync
sync-uri = rsync://rsync.gentoo.org/gentoo-portage

[perl-experimental-snapshots]
location = /graft/repositories/perl-experimental-snapshot/

---------------------

However, egencache just bails in confusion 

egencache --update --update-use-local-desc 
   --repo=perl-experimental-snapshots 
   --repositories-configuration=/graft/repositories/perl-experimental-snapshot-scripts/repos.conf 
   --jobs=2 --load-average=3

!!! Error while reading repo config file: File contains no section headers.
file: <io.StringIO>, line: 1
'/graft/repositories/perl-experimental-snapshot-scripts/repos.conf'
!!! main-repo not set in DEFAULT and PORTDIR is empty.
usage: egencache [options] <action> ... [atom] ...
egencache: error: Unable to locate repository named 'perl-experimental-snapshots'


which gives me the impression its trying to parse the file *name* like its file *contents*

egencache --update --update-use-local-desc --repo=perl-experimental-snapshots --repositories-configuration="$(cat /graft/repositories/perl-experimental-snapshot-scripts/repos.conf )" --jobs=2 --load-average=3

^ this however, doesn't give any errors. 

I can't confirm it works, but strace does seem to report that this hack makes it return to normal behaviour.
Comment 1 Zac Medico gentoo-dev 2013-08-26 00:02:04 UTC
You've done it correctly. You can use "$(< /path/to/repos.conf)" without cat.
Comment 2 Kent Fredric (IRC: kent\n) (RETIRED) gentoo-dev 2013-08-26 11:26:23 UTC
Hrm, I guess reading the docs it does kinda make sense looking backwards, it just wasn't obvious it would work that way looking forwards. ( That, and expecting an inline form of an INI-format-like file just struck me as weird ).

It seems plausible you could add an edge case for when the contents was a filename ( or even have an argument that provided a filename instead of this one ).

And thanks for the $(< ) trick, didn't realise that  =)
Comment 3 Zac Medico gentoo-dev 2013-08-26 18:14:56 UTC
We can definitely clarify the documentation. The reason that it uses the INI format directly is that this option is a convenience for people who don't want to bother with a separate config file (if they wanted to use config files then they could use --config-root instead).