Lines 4-13
Link Here
|
4 |
# Distributed under the terms of the GNU General Public License v2 |
4 |
# Distributed under the terms of the GNU General Public License v2 |
5 |
# $Header: /var/cvsroot/gentoo-src/ufed/Portage.pm,v 1.3 2005/11/13 00:28:17 truedfx Exp $ |
5 |
# $Header: /var/cvsroot/gentoo-src/ufed/Portage.pm,v 1.3 2005/11/13 00:28:17 truedfx Exp $ |
6 |
|
6 |
|
|
|
7 |
use strict; |
8 |
use warnings; |
9 |
use File::Spec; ## provided by virtual/perl-File-Spec |
10 |
|
7 |
my %environment; |
11 |
my %environment; |
8 |
$environment{$_}={} for qw(USE); # INCREMENTALS, except we only need USE |
12 |
$environment{$_}={} for qw(USE); # INCREMENTALS, except we only need USE |
9 |
|
13 |
|
10 |
our %packages; |
14 |
our %packages; |
|
|
15 |
our @portagedirs; |
11 |
our @profiles; |
16 |
our @profiles; |
12 |
our %use_masked_flags; |
17 |
our %use_masked_flags; |
13 |
our %use_defaults_flags; |
18 |
our %use_defaults_flags; |
Lines 16-21
Link Here
|
16 |
our %make_conf_flags; |
21 |
our %make_conf_flags; |
17 |
our %archs; |
22 |
our %archs; |
18 |
our %all_flags; |
23 |
our %all_flags; |
|
|
24 |
our $make_conf_path; |
19 |
|
25 |
|
20 |
sub have_package($); |
26 |
sub have_package($); |
21 |
sub merge(\%%); |
27 |
sub merge(\%%); |
Lines 42-47
Link Here
|
42 |
read_archs; |
48 |
read_archs; |
43 |
|
49 |
|
44 |
my $lastorder; |
50 |
my $lastorder; |
|
|
51 |
|
45 |
for(reverse split /:/, $environment{USE_ORDER} || "env:pkg:conf:auto:defaults") { |
52 |
for(reverse split /:/, $environment{USE_ORDER} || "env:pkg:conf:auto:defaults") { |
46 |
if($_ eq 'defaults') { |
53 |
if($_ eq 'defaults') { |
47 |
merge %default_flags, %make_defaults_flags; |
54 |
merge %default_flags, %make_defaults_flags; |
Lines 136-144
Link Here
|
136 |
} |
143 |
} |
137 |
|
144 |
|
138 |
sub read_make_conf() { |
145 |
sub read_make_conf() { |
139 |
my %env = read_sh "/etc/make.conf"; |
146 |
my $mcFile = "/etc/make.conf"; |
140 |
merge %make_conf_flags, %{$env{USE}} if exists $env{USE}; |
147 |
my $mcPath = ( -l $mcFile ) ? File::Spec->rel2abs( readlink($mcFile) ) : $mcFile; |
141 |
@portagedirs = $environment{PORTDIR}; |
148 |
my %env = (); |
|
|
149 |
|
150 |
# 1. There is no known valid path, yet |
151 |
$make_conf_path = ""; |
152 |
|
153 |
# 2. Read the old path if it is not a symlink to the new path |
154 |
if ( ( -e $mcPath ) && ("/etc/portage/make.conf" ne $mcPath) ) { |
155 |
%env = read_sh $mcPath; |
156 |
merge %make_conf_flags, %{$env{USE}} if exists $env{USE}; |
157 |
%env = (); |
158 |
## Store this path as being valid for now |
159 |
$make_conf_path = $mcPath; |
160 |
} |
161 |
|
162 |
# 3. Now switch to the new location - it must not be a symlink to the old either |
163 |
$mcFile = "/etc/portage/make.conf"; |
164 |
$mcPath = ( -l $mcFile ) ? File::Spec->rel2abs( readlink($mcFile) ) : $mcFile; |
165 |
if ( (-e $mcPath ) && ("/etc/make.conf" ne $mcPath) ) { |
166 |
%env = read_sh $mcPath; |
167 |
merge %make_conf_flags, %{$env{USE}} if exists $env{USE}; |
168 |
|
169 |
# Overwrite the old path, as the new location is the overriding one. |
170 |
$make_conf_path = $mcPath; |
171 |
} |
172 |
|
173 |
@portagedirs = $environment{PORTDIR} || ( "/usr/portage" ); ## PORTDIR is not necassarily set by make.conf |
142 |
push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY}; |
174 |
push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY}; |
143 |
} |
175 |
} |
144 |
|
176 |
|