Ticket #999 (closed enhancement: fixed)

Opened 8 years ago

Last modified 8 years ago

cave parse-spec

Reported by: eternaleye Owned by:
Priority: Sometime Milestone: cave Long Term Extras
Component: clients/cave Version:
Keywords: Cc:
Blocked By: Blocking:
Distribution: N/A

Description

Add cave subcommand 'parse-spec', with usage:

cave parse-spec [--format 'foo'] spec1 [spec2...]

It will take the specs given as arguments, parse them, and then format them according to the format string. If given no format, it is the identity function. If the format requires more data than is present in the spec, it should error out. This command will allow elimination of most icky seds used when scripting with cave, like the oneliner used to reinstall Perl modules after upgrading the interpreter. That specific example would change from

"cave resolve -1 `cave print-owners /usr/lib64/perl5/vendor_perl/5.12.0|grep -v dev-lang/perl|sed 's/^/>=/' |sed 's/::installed//'`"

to

"cave print-owners /usr/lib64/perl5/vendor_perl/5.12.0 | xargs cave parse-spec --format '%c/%p:%s\n' | grep -v dev-lang/perl | xargs cave resolve -1"

Possible problems: EAPIs may mean that version parsing rules change. Perhaps have an --eapi flag?

Change History

comment:1 Changed 8 years ago by filko_

In this case wouldn't --format for print-owners be enough?

comment:2 Changed 8 years ago by ciaranm

  • Status changed from new to closed
  • Resolution set to fixed

I've added cave print-spec, which can probably do what you're after.

Note: See TracTickets for help on using tickets.