my $overlays;
my $default_keywords;
+my $default_distdir;
+
+sub _unquote {
+ my $s = shift;
+ $s =~ s/^["']*//;
+ $s =~ s/["']*$//;
+ return $s;
+}
sub format_available {
for my $prog (qw/emerge ebuild/) {
if ($success) {
for (@{$output || []}) {
if (/^PORTDIR_OVERLAY=(.*)$/m) {
- my $o = $1;
- $o =~ s/^["']*//;
- $o =~ s/["']*$//;
- $overlays = [ map abs_path($_), split ' ', $o ];
+ $overlays = [ map abs_path($_), split ' ', _unquote($1) ];
}
if (/^ACCEPT_KEYWORDS=(.*)$/m) {
- my $k = $1;
- $k =~ s/^["']*//;
- $k =~ s/["']*$//;
- $default_keywords = [ split ' ', $k ];
+ $default_keywords = [ split ' ', _unquote($1) ];
+ }
+ if (/^DISTDIR=(.*)$/m) {
+ $default_distdir = abs_path(_unquote($1));
}
}
} else {
}
$default_keywords = [ 'x86' ] unless defined $default_keywords;
+ $default_distdir = '/usr/portage/distfiles' unless defined $default_distdir;
return 1;
}
$stat->overlay($overlay);
my $distdir = delete $opts{'distdir'};
- $distdir = (defined $distdir) ? abs_path $distdir : '/usr/portage/distfiles';
+ $distdir = (defined $distdir) ? abs_path $distdir : $default_distdir;
$stat->distdir($distdir);
if ($stat->do_manifest && !-w $stat->distdir) {