Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 478126 | Differences between
and this patch

Collapse All | Expand All

(-)a/lib/PortageXS.pm (-8 / +8 lines)
Lines 71-78 sub new { Link Here
71
	$pxs->{'VERSION'}			= $PortageXS::VERSION;
71
	$pxs->{'VERSION'}			= $PortageXS::VERSION;
72
72
73
	$pxs->{'PORTDIR'}			= $pxs->getPortdir();
73
	$pxs->{'PORTDIR'}			= $pxs->getPortdir();
74
	$pxs->{'PKG_DB_DIR'}			= '/var/db/pkg/';
74
	$pxs->{'PKG_DB_DIR'}			= '@GENTOO_PORTAGE_EPREFIX@/var/db/pkg/';
75
	$pxs->{'PATH_TO_WORLDFILE'}		= '/var/lib/portage/world';
75
	$pxs->{'PATH_TO_WORLDFILE'}		= '@GENTOO_PORTAGE_EPREFIX@/var/lib/portage/world';
76
	$pxs->{'IS_INITIALIZED'}		= 1;
76
	$pxs->{'IS_INITIALIZED'}		= 1;
77
77
78
	$pxs->{'EXCLUDE_DIRS'}{'.'}		= 1;
78
	$pxs->{'EXCLUDE_DIRS'}{'.'}		= 1;
Lines 85-101 sub new { Link Here
85
	$pxs->{'EXCLUDE_DIRS'}{'CVS'}		= 1;
85
	$pxs->{'EXCLUDE_DIRS'}{'CVS'}		= 1;
86
	$pxs->{'EXCLUDE_DIRS'}{'.cache'}	= 1;
86
	$pxs->{'EXCLUDE_DIRS'}{'.cache'}	= 1;
87
87
88
	$pxs->{'PORTAGEXS_ETC_DIR'}		= '/etc/pxs/';
88
	$pxs->{'PORTAGEXS_ETC_DIR'}		= '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/';
89
	$pxs->{'ETC_DIR'}			= '/etc/';
89
	$pxs->{'ETC_DIR'}			= '@GENTOO_PORTAGE_EPREFIX@/etc/';
90
90
91
	$pxs->{'MAKE_PROFILE_PATHS'} = [
91
	$pxs->{'MAKE_PROFILE_PATHS'} = [
92
		'/etc/make.profile',
92
		'@GENTOO_PORTAGE_EPREFIX@/etc/make.profile',
93
		'/etc/portage/make.profile'
93
		'@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.profile'
94
	];
94
	];
95
95
96
	$pxs->{'MAKE_CONF_PATHS'} = [
96
	$pxs->{'MAKE_CONF_PATHS'} = [
97
		'/etc/make.conf',
97
		'@GENTOO_PORTAGE_EPREFIX@/etc/make.conf',
98
		'/etc/portage/make.conf'
98
		'@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf'
99
	];
99
	];
100
100
101
	for my $path ( @{ $pxs->{'MAKE_PROFILE_PATHS'} } ) {
101
	for my $path ( @{ $pxs->{'MAKE_PROFILE_PATHS'} } ) {
(-)a/lib/PortageXS/Core.pm (-4 / +4 lines)
Lines 122-128 sub getPortageMakeParam { Link Here
122
	my $self		= shift;
122
	my $self		= shift;
123
	my $param		= shift;
123
	my $param		= shift;
124
	my @files		= ();
124
	my @files		= ();
125
	my @etcfiles		= qw(/usr/share/portage/config/make.globals /etc/make.conf);
125
	my @etcfiles		= qw(@GENTOO_PORTAGE_EPREFIX@/usr/share/portage/config/make.globals @GENTOO_PORTAGE_EPREFIX@/etc/make.conf);
126
	my $v			= '';
126
	my $v			= '';
127
	my $parent		= '';
127
	my $parent		= '';
128
	my $curPath;
128
	my $curPath;
Lines 166-172 sub getPortageMakeParam { Link Here
166
166
167
	# - Defaults >
167
	# - Defaults >
168
	if ($param eq 'PORTDIR' && !$v) {
168
	if ($param eq 'PORTDIR' && !$v) {
169
		$v='/usr/portage';
169
		$v='@GENTOO_PORTAGE_EPREFIX@/usr/portage';
170
	}
170
	}
171
171
172
	return $v;
172
	return $v;
Lines 193-199 sub getPortdir { Link Here
193
		return $self->{'PORTDIR'};
193
		return $self->{'PORTDIR'};
194
	}
194
	}
195
	else {
195
	else {
196
		$self->{'PORTDIR'}=$self->getParamFromFile($self->getFileContents('/usr/share/portage/config/make.globals').$self->getFileContents('/etc/portage/make.conf'),'PORTDIR','lastseen');
196
		$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');
197
		return $self->{'PORTDIR'};
197
		return $self->{'PORTDIR'};
198
	}
198
	}
199
}
199
}
Lines 210-216 sub getPortdirOverlay { Link Here
210
	my $self	= shift;
210
	my $self	= shift;
211
	my $forcereload	= shift;
211
	my $forcereload	= shift;
212
212
213
	return split(/ /,$self->getParamFromFile($self->getFileContents('/usr/share/portage/config/make.globals').$self->getFileContents('/etc/make.conf'),'PORTDIR_OVERLAY','lastseen'));
213
	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'));
214
}
214
}
215
215
216
# Description:
216
# Description:
(-)a/lib/PortageXS/examples/getParamFromFile.pl (-1 / +1 lines)
Lines 8-11 use PortageXS; Link Here
8
8
9
my $pxs=PortageXS->new();
9
my $pxs=PortageXS->new();
10
print "CFLAGS are set to: ";
10
print "CFLAGS are set to: ";
11
print join(' ',$pxs->getParamFromFile($pxs->getFileContents('/etc/make.globals').$pxs->getFileContents('/etc/make.conf'),'CFLAGS','lastseen'))."\n";
11
print join(' ',$pxs->getParamFromFile($pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/make.globals').$pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/make.conf'),'CFLAGS','lastseen'))."\n";
(-)a/t/01_Core.t (-6 / +6 lines)
Lines 14-21 ok(-d $pxs->getPortdir(),'getPortdir: '.$pxs->getPortdir()); Link Here
14
14
15
# - getFileContents >
15
# - getFileContents >
16
{
16
{
17
	my $content = $pxs->getFileContents('/etc/portage/make.conf');
17
	my $content = $pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf');
18
	ok($content ne '','getFileContents of /etc/portage/make.conf');
18
	ok($content ne '','getFileContents of @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf');
19
}
19
}
20
20
21
# - searchInstalledPackage >
21
# - searchInstalledPackage >
Lines 26-33 ok(-d $pxs->getPortdir(),'getPortdir: '.$pxs->getPortdir()); Link Here
26
26
27
# - getParamFromFile >
27
# - getParamFromFile >
28
{
28
{
29
	my $param = $pxs->getParamFromFile($pxs->getFileContents('/etc/portage/make.conf'),'CFLAGS','lastseen');
29
	my $param = $pxs->getParamFromFile($pxs->getFileContents('@GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf'),'CFLAGS','lastseen');
30
	ok($param ne '','getParamFromFile /etc/portage/make.conf - CFLAGS: '.$param);
30
	ok($param ne '','getParamFromFile @GENTOO_PORTAGE_EPREFIX@/etc/portage/make.conf - CFLAGS: '.$param);
31
}
31
}
32
32
33
# - getUseSettingsOfInstalledPackage >
33
# - getUseSettingsOfInstalledPackage >
Lines 65-72 ok(-d $pxs->getPortdir(),'getPortdir: '.$pxs->getPortdir()); Link Here
65
65
66
# - fileBelongsToPackage >
66
# - fileBelongsToPackage >
67
{
67
{
68
	my @packages = $pxs->fileBelongsToPackage('/etc/gentoo-release');
68
	my @packages = $pxs->fileBelongsToPackage('@GENTOO_PORTAGE_EPREFIX@/etc/gentoo-release');
69
	ok($#packages==0,'fileBelongsToPackage - /etc/gentoo-release: '.$packages[0]);
69
	ok($#packages==0,'fileBelongsToPackage - @GENTOO_PORTAGE_EPREFIX@/etc/gentoo-release: '.$packages[0]);
70
}
70
}
71
ok(!$pxs->fileBelongsToPackage('/this/path/most/likely/does/not/exist'),'fileBelongsToPackage bogus test');
71
ok(!$pxs->fileBelongsToPackage('/this/path/most/likely/does/not/exist'),'fileBelongsToPackage bogus test');
72
72
(-)a/usr/bin/portagexs_client (-4 / +4 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl
1
#!@GENTOO_PORTAGE_EPREFIX@/usr/bin/perl
2
2
3
# -----------------------------------------------------------------------------
3
# -----------------------------------------------------------------------------
4
#
4
#
Lines 54-62 if(!($sock = IO::Socket::SSL->new( PeerAddr => $remote_addr, Link Here
54
				SSL_use_cert => 1,
54
				SSL_use_cert => 1,
55
				SSL_verify_mode => 0x01,
55
				SSL_verify_mode => 0x01,
56
				SSL_passwd_cb => sub { return "" },
56
				SSL_passwd_cb => sub { return "" },
57
				SSL_key_file => '/etc/pxs/certs/client-key.pem',
57
				SSL_key_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/client-key.pem',
58
				SSL_cert_file => '/etc/pxs/certs/client-cert.pem',
58
				SSL_cert_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/client-cert.pem',
59
				SSL_ca_file => '/etc/pxs/certs/my-ca.pem'
59
				SSL_ca_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/my-ca.pem'
60
				 ))) {
60
				 ))) {
61
	$pxs->print_err("unable to create socket: ".&IO::Socket::SSL::errstr."\n");
61
	$pxs->print_err("unable to create socket: ".&IO::Socket::SSL::errstr."\n");
62
	$pxs->print_err("Server down?\n");
62
	$pxs->print_err("Server down?\n");
(-)a/usr/sbin/portagexsd (-6 / +6 lines)
Lines 1-4 Link Here
1
#!/usr/bin/perl -t
1
#!@GENTOO_PORTAGE_EPREFIX@/usr/bin/perl -t
2
2
3
# -----------------------------------------------------------------------------
3
# -----------------------------------------------------------------------------
4
#
4
#
Lines 50-56 else { Link Here
50
sub main {
50
sub main {
51
	# - Parse config >
51
	# - Parse config >
52
	my %config	= ();
52
	my %config	= ();
53
	$config{'cfgfiledata'} = $pxs->getFileContents("/etc/pxs/portagexsd.conf");
53
	$config{'cfgfiledata'} = $pxs->getFileContents("@GENTOO_PORTAGE_EPREFIX@/etc/pxs/portagexsd.conf");
54
	$config{'Port'} = $pxs->getParamFromFile($config{'cfgfiledata'},"Port","lastseen");
54
	$config{'Port'} = $pxs->getParamFromFile($config{'cfgfiledata'},"Port","lastseen");
55
	$config{'SSLpasswd'} = $pxs->getParamFromFile($config{'cfgfiledata'},"SSLpasswd","lastseen");
55
	$config{'SSLpasswd'} = $pxs->getParamFromFile($config{'cfgfiledata'},"SSLpasswd","lastseen");
56
	$config{'PidFile'} = $pxs->getParamFromFile($config{'cfgfiledata'},"PidFile","lastseen");
56
	$config{'PidFile'} = $pxs->getParamFromFile($config{'cfgfiledata'},"PidFile","lastseen");
Lines 60-66 sub main { Link Here
60
	$config{'cfgfiledata'} = undef;
60
	$config{'cfgfiledata'} = undef;
61
61
62
	if (!$config{'I_AM_ROOT_AND_I_KNOW_WHAT_I_AM_DOING'}) {
62
	if (!$config{'I_AM_ROOT_AND_I_KNOW_WHAT_I_AM_DOING'}) {
63
		syslog("info", 'Not starting server as it seems that you did not have a look at the configs yet! (/etc/pxs/portagexsd.conf)');
63
		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)');
64
		exit(0);
64
		exit(0);
65
	}
65
	}
66
66
Lines 70-78 sub main { Link Here
70
				Reuse     => 1,
70
				Reuse     => 1,
71
				SSL_verify_mode => 0x01,
71
				SSL_verify_mode => 0x01,
72
				SSL_passwd_cb => sub {return $config{'SSLpasswd'}},
72
				SSL_passwd_cb => sub {return $config{'SSLpasswd'}},
73
				SSL_key_file => '/etc/pxs/certs/server-key.pem',
73
				SSL_key_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/server-key.pem',
74
				SSL_cert_file => '/etc/pxs/certs/server-cert.pem',
74
				SSL_cert_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/server-cert.pem',
75
				SSL_ca_file => '/etc/pxs/certs/my-ca.pem'
75
				SSL_ca_file => '@GENTOO_PORTAGE_EPREFIX@/etc/pxs/certs/my-ca.pem'
76
			)) ) {
76
			)) ) {
77
		syslog("info", "Unable to create socket: ", &IO::Socket::SSL::errstr);
77
		syslog("info", "Unable to create socket: ", &IO::Socket::SSL::errstr);
78
		exit(0);
78
		exit(0);

Return to bug 478126