kentfredric (owner)

Revisions

gist: 181658 Download_button fork
public
Public Clone URL: git://gist.github.com/181658.git
Embed All Files: show embed
generate_fake_profile.pl #
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
#!/usr/bin/perl
use strict;
use warnings;
 
BEGIN {
  eval "require Path::Class; 1" or die "Please emerge dev-perl/Path-Class";
}
 
#==========VARIABLES============
 
my $gentoo_portage_profiles = "/usr/portage/profiles/";
 
my $normal_profile = "default/linux/amd64/2008.0";
 
my $fake_profile_dir = "/etc/paludis/profile-override";
 
my $fake_profile_name = "profile-faker";
 
my $override_name = "profile-override";
 
#+==============================+
 
use Path::Class qw( file dir );
 
my $g = dir($gentoo_portage_profiles);
my $profile = $g->subdir($normal_profile);
 
printf "\nThis is the full path to your currently selected profile:\n\n\t%s\n\n", $profile;
 
my $fakeroot = dir($fake_profile_dir);
my $fakeprof = $fakeroot->subdir($fake_profile_name);
my $overprof = $fakeroot->subdir($override_name);
 
printf "Going to create these dirs:\n\n\t%s\n\n\t%s\n\n", $fakeprof, $overprof;
 
$fakeprof->mkpath(1);
$overprof->mkpath(1);
 
my $mask = $overprof->file('use.mask');
 
if ( not -e "$mask" ) {
 
  printf "Injecting a demo unmask of kdeprefix\n\n";
  {
    my $fh = $overprof->file('use.mask')->open('w');
    print {$fh} "-kdeprefix\n";
    close $fh;
  }
 
}
 
printf "Generating the profile faking\n\n";
printf "Path from fake-profile to real profile is:\n\n\t%s\n\n", $profile->relative($fakeprof);
printf "Path from fake-profile to override profile is:\n\n\t%s\n\n", $overprof->relative($fakeprof);
 
{
  my $fh = $fakeprof->file('parent')->open('w');
  print {$fh} $profile->relative($fakeprof);
  print {$fh} "\n";
  print {$fh} $overprof->relative($fakeprof);
  print {$fh} "\n";
  close $fh;
}
 
print "All done!\n\n stick this in your /etc/paludis/repositories/gentoo.conf \n\n";
printf "\tprofiles = \${ROOT}%s\n\n", $fakeprof->absolute;
 
Sample Output.txt #
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
This is the full path to your currently selected profile:
 
        /usr/portage/profiles/default/linux/amd64/2008.0
 
Going to create these dirs:
 
        /etc/paludis/profile-override/profile-faker
 
        /etc/paludis/profile-override/profile-override
 
Generating the profile faking
 
Path from fake-profile to real profile is:
 
        ../../../../usr/portage/profiles/default/linux/amd64/2008.0
 
Path from fake-profile to override profile is:
 
        ../profile-override
 
All done!
 
 stick this in your /etc/paludis/repositories/gentoo.conf
 
        profiles = ${ROOT}/etc/paludis/profile-override/profile-faker