You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
gentoo-overlay/app-portage/ufed/files/ufed-0.40.2-prefix.patch

204 lines
7.3 KiB

From 7d133e58b27253ebc1bcfc16fa45ef91125ccde9 Mon Sep 17 00:00:00 2001
From: Paul Varner <fuzzyray@gentoo.org>
Date: Tue, 20 Nov 2012 11:22:09 -0600
Subject: [PATCH 1/2] Change ufed to use EPREFIX for prefix installs.
---
Portage.pm | 26 ++++++++++++++++++--------
ufed-curses-help.c | 7 +++----
ufed.8 | 29 +++++++++++++++--------------
ufed.pl.in | 6 +++---
4 files changed, 39 insertions(+), 29 deletions(-)
diff --git a/Portage.pm b/Portage.pm
index 0b02cab..c7e236d 100644
--- a/Portage.pm
+++ b/Portage.pm
@@ -15,7 +15,9 @@ our %default_flags;
our %make_conf_flags;
our %archs;
our %all_flags;
+our $eprefix;
+sub get_eprefix();
sub have_package($);
sub merge(\%%);
sub merge_env(\%);
@@ -30,6 +32,7 @@ sub read_profiles();
sub read_sh($);
sub read_use_mask();
+get_eprefix;
read_packages;
read_profiles;
read_use_mask;
@@ -54,6 +57,13 @@ if($lastorder ne 'conf') {
die "Sorry, USE_ORDER without make.conf overriding global USE flags are not currently supported by ufed.\n";
}
+
+sub get_eprefix() {
+ $eprefix = `portageq envvar EPREFIX 2>&1`;
+ die "Couldn't determine EPREFIX from Portage" if $? != 0;
+ chomp($eprefix);
+}
+
sub have_package($) {
my ($cp) = @_;
return $packages{$cp};
@@ -130,8 +140,8 @@ sub read_archs() {
}
sub read_make_conf() {
- my %env = read_sh "/etc/make.conf";
- merge (%env, read_sh('/etc/portage/make.conf'));
+ my %env = read_sh "$eprefix/etc/make.conf";
+ merge (%env, read_sh("$eprefix/etc/portage/make.conf"));
merge %make_conf_flags, %{$env{USE}} if exists $env{USE};
@portagedirs = $environment{PORTDIR};
push @portagedirs, split ' ', $environment{PORTDIR_OVERLAY} if defined $environment{PORTDIR_OVERLAY};
@@ -145,13 +155,13 @@ sub read_make_defaults() {
}
sub read_make_globals() {
- for my $dir(@profiles, '/usr/share/portage/config') {
+ for my $dir(@profiles, "$eprefix/usr/share/portage/config") {
read_sh "$dir/make.globals";
}
}
sub read_packages() {
- die "Couldn't read /var/db/pkg\n" unless opendir my $pkgdir, '/var/db/pkg';
+ die "Couldn't read $eprefix/var/db/pkg\n" unless opendir my $pkgdir, "$eprefix/var/db/pkg";
while(my $cat = readdir $pkgdir) {
next if $cat eq '.' or $cat eq '..';
next unless opendir my $catdir, "/var/db/pkg/$cat";
@@ -199,16 +209,16 @@ sub read_packages() {
}
sub read_profiles() {
- $_ = readlink '/etc/make.profile';
- $_ = readlink '/etc/portage/make.profile' if not defined $_;
- die "/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
+ $_ = readlink "$eprefix/etc/make.profile";
+ $_ = readlink "$eprefix/etc/portage/make.profile" if not defined $_;
+ die "$eprefix/etc\{,/portage\}/make.profile is not a symlink\n" if not defined $_;
@profiles = norm_path '/etc', $_;
for (my $i = -1; $i >= -@profiles; $i--) {
for(noncomments "$profiles[$i]/parent") {
splice @profiles, $i, 0, norm_path $profiles[$i], $_;
}
}
- push @profiles, '/etc/portage/profile';
+ push @profiles, "$eprefix/etc/portage/profile";
}
sub read_sh($) {
diff --git a/ufed-curses-help.c b/ufed-curses-help.c
index 19679bb..79bd35e 100644
--- a/ufed-curses-help.c
+++ b/ufed-curses-help.c
@@ -40,11 +40,10 @@ static void init_lines(void) {
"Each USE flag has a 2 character descriptor that represents the two "
"ways a use flag can be set.",
"",
-"The 1st char is the setting from the /etc/make.profile/make.defaults "
-"file. These are the defaults for Gentoo as a whole. These should not be "
-"changed.",
+"The 1st char is the setting from the make.defaults file. These are "
+"the defaults for Gentoo as a whole. These should not be changed.",
"",
-"The 2nd char is the settings from the /etc/make.conf file. these are "
+"The 2nd char is the settings from the make.conf file. these are "
"the only ones that should be changed by the user and these are the ones "
"that ufed changes.",
"",
diff --git a/ufed.8 b/ufed.8
index 7d7fe50..4c55c29 100644
--- a/ufed.8
+++ b/ufed.8
@@ -12,15 +12,14 @@ UFED attempts to show you where a particular use setting came from. Each USE
flag has a 3 character descriptor that represents the three ways a use flag can
be set.
-The 1st char is the setting from the /etc/make.profile/make.defaults file.
-These are the defaults for Gentoo as a whole. These should not be changed.
+The 1st char is the setting from the make.defaults file. These are the defaults
+for Gentoo as a whole. These should not be changed.
-The 2nd char is the setting from the /etc/make.profile/use.defaults file. These
-will change as packages are added and removes from the system.
+The 2nd char is the setting from the use.defaults file. These will change as
+packages are added and removes from the system.
-The 3rd char is the settings from the /etc/make.conf file. these are the only
-ones that should be changed by the user and these are the ones that UFED
-changes.
+The 3rd char is the settings from the make.conf file. these are the only ones
+that should be changed by the user and these are the ones that UFED changes.
If the character is a + then that USE flag was set in that file, if it is a
space then the flag was not mentioned in that file and if it is a - then that
@@ -64,25 +63,27 @@ Please report bugs via http://bugs.gentoo.org/
.BR make.conf (5)
.SH "FILES"
.TP
-\fB/etc/make.conf\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf\fR
Contains user specified USE flags
.TP
-\fB/etc/make.conf.old \fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.conf.old \fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf.old \fR
This is where ufed places a backup of your make.conf file.
.TP
-\fB/etc/make.profile/make.defaults\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/make.defaults\fR
Contains system default USE flags
.TP
-\fB/etc/make.profile/use.defaults\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.defaults\fR
Provides an automatic ebuild to USE flag mapping ('auto' flags)
.TP
-\fB/etc/make.profile/use.mask\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/etc/make.profile/use.mask\fR
Restricted USE flags
.TP
-\fB/usr/portage/profiles/use.desc\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.desc\fR
Description strings for global USE flags
.TP
-\fB/usr/portage/profiles/use.local.desc\fR
+\fB@GENTOO_PORTAGE_EPREFIX@/usr/portage/profiles/use.local.desc\fR
Description strings for local USE flags
.SH "AUTHORS"
Robin Johnson <robbat2@gentoo.org>
diff --git a/ufed.pl.in b/ufed.pl.in
index 7493147..3435dae 100644
--- a/ufed.pl.in
+++ b/ufed.pl.in
@@ -29,7 +29,7 @@ for(keys %Portage::all_flags) {
@{$use_descriptions{$_}} = "(Unknown)"
if not exists $use_descriptions{$_};
}
-@{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in /etc/make.conf';
+@{$use_descriptions{'-*'}} = 'Never enable any flags other than those specified in make.conf';
for(@Portage::archs) {
delete $Portage::default_flags{$_};
@@ -155,8 +155,8 @@ sub save_flags(@) {
my (@flags) = @_;
my $contents;
- my $makeconf_name = '/etc/portage/make.conf';
- $makeconf_name = '/etc/make.conf' unless(-r $makeconf_name);
+ my $makeconf_name = "$Portage::eprefix/etc/portage/make.conf";
+ $makeconf_name = "$Portage::eprefix/etc/make.conf" unless(-r $makeconf_name);
{
open my $makeconf, '<', $makeconf_name or die "Couldn't open $makeconf_name\n";
open my $makeconfold, '>', $makeconf_name . '.old' or die "Couldn't open $makeconf_name.old\n";
--
1.8.0