summaryrefslogtreecommitdiff
blob: df1881118c9afd64ae582bb291c39da3f07d9c10 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
 lib/PortageXS.pm                           | 16 ++++++++--------
 lib/PortageXS/Core.pm                      |  8 ++++----
 lib/PortageXS/examples/getParamFromFile.pl |  2 +-
 t/01_Core.t                                | 12 ++++++------
 usr/bin/portagexs_client                   |  8 ++++----
 usr/sbin/portagexsd                        | 12 ++++++------
 6 files changed, 29 insertions(+), 29 deletions(-)

diff --git a/lib/PortageXS.pm b/lib/PortageXS.pm
index db57a25..6cec46e 100644
--- a/lib/PortageXS.pm
+++ b/lib/PortageXS.pm
@@ -71,8 +71,8 @@ sub new {
 	$pxs->{'VERSION'}			= $PortageXS::VERSION;
 
 	$pxs->{'PORTDIR'}			= $pxs->getPortdir();
-	$pxs->{'PKG_DB_DIR'}			= '/var/db/pkg/';
-	$pxs->{'PATH_TO_WORLDFILE'}		= '/var/lib/portage/world';
+	$pxs->{'PKG_DB_DIR'}			= '@GENTOO_PORTAGE_EPREFIX@/var/db/pkg/';
+	$pxs->{'PATH_TO_WORLDFILE'}		= '@GENTOO_PORTAGE_EPREFIX@/var/lib/portage/world';
 	$pxs->{'IS_INITIALIZED'}		= 1;
 
 	$pxs->{'EXCLUDE_DIRS'}{'.'}		= 1;
@@ -85,17 +85,17 @@ sub new {
 	$pxs->{'EXCLUDE_DIRS'}{'CVS'}		= 1;
 	$pxs->{'EXCLUDE_DIRS'}{'.cache'}	= 1;
 
-	$pxs->{'PORTAGEXS_ETC_DIR'}		= '/etc/pxs/';
-	$pxs->{'ETC_DIR'}			= '/etc/';
+	$pxs->{'PORTAGEXS_ETC_DIR'}		= '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/';
+	$pxs->{'ETC_DIR'}			= '@GENTOO_PORTAGE_EPREFIX@/etc/';
 
 	$pxs->{'MAKE_PROFILE_PATHS'} = [
-		'/etc/make.profile',
-		'/etc/portage/make.profile'
+		'@GENTOO_PORTAGE_EPREFIX@/etc/make.profile',
+		'@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.profile'
 	];
 
 	$pxs->{'MAKE_CONF_PATHS'} = [
-		'/etc/make.conf',
-		'/etc/portage/make.conf'
+		'@GENTOO_PORTAGE_EPREFIX@/etc/make.conf',
+		'@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf'
 	];
 
 	for my $path ( @{ $pxs->{'MAKE_PROFILE_PATHS'} } ) {
diff --git a/lib/PortageXS/Core.pm b/lib/PortageXS/Core.pm
index 5d51023..3dd0b84 100644
--- a/lib/PortageXS/Core.pm
+++ b/lib/PortageXS/Core.pm
@@ -122,7 +122,7 @@ sub getPortageMakeParam {
 	my $self		= shift;
 	my $param		= shift;
 	my @files		= ();
-	my @etcfiles		= qw(/usr/share/portage/config/make.globals /etc/make.conf);
+	my @etcfiles		= qw(@GENTOO_PORTAGE_EPREFIX@/usr/share/portage/config/make.globals @GENTOO_PORTAGE_EPREFIX@/etc/make.conf);
 	my $v			= '';
 	my $parent		= '';
 	my $curPath;
@@ -166,7 +166,7 @@ sub getPortageMakeParam {
 
 	# - Defaults >
 	if ($param eq 'PORTDIR' && !$v) {
-		$v='/usr/portage';
+		$v='@GENTOO_PORTAGE_EPREFIX@/usr/portage';
 	}
 
 	return $v;
@@ -193,7 +193,7 @@ sub getPortdir {
 		return $self->{'PORTDIR'};
 	}
 	else {
-		$self->{'PORTDIR'}=$self->getParamFromFile($self->getFileContents('/usr/share/portage/config/make.globals').$self->getFileContents('/etc/portage/make.conf'),'PORTDIR','lastseen');
+		$self->{'PORTDIR'}=$self->getParamFromFile($self->getFileContents('@GENTOO_PORTAGE_EPREFIX@/usr/share/portage/config/make.globals').$self->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf'),'PORTDIR','lastseen');
 		return $self->{'PORTDIR'};
 	}
 }
@@ -210,7 +210,7 @@ sub getPortdirOverlay {
 	my $self	= shift;
 	my $forcereload	= shift;
 
-	return split(/ /,$self->getParamFromFile($self->getFileContents('/usr/share/portage/config/make.globals').$self->getFileContents('/etc/make.conf'),'PORTDIR_OVERLAY','lastseen'));
+	return split(/ /,$self->getParamFromFile($self->getFileContents('@GENTOO_PORTAGE_EPREFIX@/usr/share/portage/config/make.globals').$self->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/make.conf'),'PORTDIR_OVERLAY','lastseen'));
 }
 
 # Description:
diff --git a/lib/PortageXS/examples/getParamFromFile.pl b/lib/PortageXS/examples/getParamFromFile.pl
index 416b1be..9ea88bb 100755
--- a/lib/PortageXS/examples/getParamFromFile.pl
+++ b/lib/PortageXS/examples/getParamFromFile.pl
@@ -8,4 +8,4 @@ use PortageXS;
 
 my $pxs=PortageXS->new();
 print "CFLAGS are set to: ";
-print join(' ',$pxs->getParamFromFile($pxs->getFileContents('/etc/make.globals').$pxs->getFileContents('/etc/make.conf'),'CFLAGS','lastseen'))."\n";
+print join(' ',$pxs->getParamFromFile($pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/make.globals').$pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/make.conf'),'CFLAGS','lastseen'))."\n";
diff --git a/t/01_Core.t b/t/01_Core.t
index d01dc31..6daba99 100644
--- a/t/01_Core.t
+++ b/t/01_Core.t
@@ -14,8 +14,8 @@ ok(-d $pxs->getPortdir(),'getPortdir: '.$pxs->getPortdir());
 
 # - getFileContents >
 {
-	my $content = $pxs->getFileContents('/etc/portage/make.conf');
-	ok($content ne '','getFileContents of /etc/portage/make.conf');
+	my $content = $pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf');
+	ok($content ne '','getFileContents of @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf');
 }
 
 # - searchInstalledPackage >
@@ -26,8 +26,8 @@ ok(-d $pxs->getPortdir(),'getPortdir: '.$pxs->getPortdir());
 
 # - getParamFromFile >
 {
-	my $param = $pxs->getParamFromFile($pxs->getFileContents('/etc/portage/make.conf'),'CFLAGS','lastseen');
-	ok($param ne '','getParamFromFile /etc/portage/make.conf - CFLAGS: '.$param);
+	my $param = $pxs->getParamFromFile($pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf'),'CFLAGS','lastseen');
+	ok($param ne '','getParamFromFile @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf - CFLAGS: '.$param);
 }
 
 # - getUseSettingsOfInstalledPackage >
@@ -65,8 +65,8 @@ ok(-d $pxs->getPortdir(),'getPortdir: '.$pxs->getPortdir());
 
 # - fileBelongsToPackage >
 {
-	my @packages = $pxs->fileBelongsToPackage('/etc/gentoo-release');
-	ok($#packages==0,'fileBelongsToPackage - /etc/gentoo-release: '.$packages[0]);
+	my @packages = $pxs->fileBelongsToPackage('@GENTOO_PORTAGE_EPREFIX@/etc/gentoo-release');
+	ok($#packages==0,'fileBelongsToPackage - @GENTOO_PORTAGE_EPREFIX@/etc/gentoo-release: '.$packages[0]);
 }
 ok(!$pxs->fileBelongsToPackage('/this/path/most/likely/does/not/exist'),'fileBelongsToPackage bogus test');
 
diff --git a/usr/bin/portagexs_client b/usr/bin/portagexs_client
index 598d05a..688cb97 100755
--- a/usr/bin/portagexs_client
+++ b/usr/bin/portagexs_client
@@ -1,4 +1,4 @@
-#!/usr/bin/perl
+#!@GENTOO_PORTAGE_EPREFIX@/usr/bin/perl
 
 # -----------------------------------------------------------------------------
 #
@@ -54,9 +54,9 @@ if(!($sock = IO::Socket::SSL->new( PeerAddr => $remote_addr,
 				SSL_use_cert => 1,
 				SSL_verify_mode => 0x01,
 				SSL_passwd_cb => sub { return "" },
-				SSL_key_file => '/etc/pxs/certs/client-key.pem',
-				SSL_cert_file => '/etc/pxs/certs/client-cert.pem',
-				SSL_ca_file => '/etc/pxs/certs/my-ca.pem'
+				SSL_key_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/client-key.pem',
+				SSL_cert_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/client-cert.pem',
+				SSL_ca_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/my-ca.pem'
 				 ))) {
 	$pxs->print_err("unable to create socket: ".&IO::Socket::SSL::errstr."\n");
 	$pxs->print_err("Server down?\n");
diff --git a/usr/sbin/portagexsd b/usr/sbin/portagexsd
index 638f662..e93bdfa 100755
--- a/usr/sbin/portagexsd
+++ b/usr/sbin/portagexsd
@@ -1,4 +1,4 @@
-#!/usr/bin/perl -t
+#!@GENTOO_PORTAGE_EPREFIX@/usr/bin/perl -t
 
 # -----------------------------------------------------------------------------
 #
@@ -50,7 +50,7 @@ else {
 sub main {
 	# - Parse config >
 	my %config	= ();
-	$config{'cfgfiledata'} = $pxs->getFileContents("/etc/pxs/portagexsd.conf");
+	$config{'cfgfiledata'} = $pxs->getFileContents("@GENTOO_PORTAGE_EPREFIX@/etc/pxs/portagexsd.conf");
 	$config{'Port'} = $pxs->getParamFromFile($config{'cfgfiledata'},"Port","lastseen");
 	$config{'SSLpasswd'} = $pxs->getParamFromFile($config{'cfgfiledata'},"SSLpasswd","lastseen");
 	$config{'PidFile'} = $pxs->getParamFromFile($config{'cfgfiledata'},"PidFile","lastseen");
@@ -60,7 +60,7 @@ sub main {
 	$config{'cfgfiledata'} = undef;
 
 	if (!$config{'I_AM_ROOT_AND_I_KNOW_WHAT_I_AM_DOING'}) {
-		syslog("info", 'Not starting server as it seems that you did not have a look at the configs yet! (/etc/pxs/portagexsd.conf)');
+		syslog("info", 'Not starting server as it seems that you did not have a look at the configs yet! (@GENTOO_PORTAGE_EPREFIX@/etc/pxs/portagexsd.conf)');
 		exit(0);
 	}
 
@@ -70,9 +70,9 @@ sub main {
 				Reuse     => 1,
 				SSL_verify_mode => 0x01,
 				SSL_passwd_cb => sub {return $config{'SSLpasswd'}},
-				SSL_key_file => '/etc/pxs/certs/server-key.pem',
-				SSL_cert_file => '/etc/pxs/certs/server-cert.pem',
-				SSL_ca_file => '/etc/pxs/certs/my-ca.pem'
+				SSL_key_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/server-key.pem',
+				SSL_cert_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/server-cert.pem',
+				SSL_ca_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/my-ca.pem'
 			)) ) {
 		syslog("info", "Unable to create socket: ", &IO::Socket::SSL::errstr);
 		exit(0);