Compare commits
11 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 12e2ccd510 | |||
| b91870c72d | |||
| b1726fdb4d | |||
| 6d0f26ceb7 | |||
| 49ba945b63 | |||
| f55338b552 | |||
| 0c964e4b64 | |||
| 5f75f6e64b | |||
| 9fd7ce2582 | |||
| a62baaf0ea | |||
| bf78080418 |
@@ -41,6 +41,8 @@ my $qualityassurance_checks = $ENV{QA_CHECKS} // 0;
|
|||||||
my $remote_conf_portdir = $ENV{REMOTE_CONF_PORTDIR};
|
my $remote_conf_portdir = $ENV{REMOTE_CONF_PORTDIR};
|
||||||
my $remote_portdir = $ENV{REMOTE_PORTDIR};
|
my $remote_portdir = $ENV{REMOTE_PORTDIR};
|
||||||
my $pretend = $ENV{PRETEND} // 0;
|
my $pretend = $ENV{PRETEND} // 0;
|
||||||
|
my $obsoleted = $ENV{DETECT_OBSOLETE} // 0;
|
||||||
|
my $target_overlay = $ENV{TARGET_OVERLAY};
|
||||||
|
|
||||||
my $make_conf = $ENV{MAKE_CONF};
|
my $make_conf = $ENV{MAKE_CONF};
|
||||||
|
|
||||||
@@ -236,8 +238,9 @@ sub uniq {
|
|||||||
keys %{ { map { $_ => 1 } @_ } };
|
keys %{ { map { $_ => 1 } @_ } };
|
||||||
}
|
}
|
||||||
|
|
||||||
sub detect_useflags
|
# Detect useflags defined as [-alsa,avahi] in atom,
|
||||||
{ # Detect useflags defined as [-alsa,avahi] in atom, and fill $hash within the $target sub-hash
|
# and fill $hash within the $target sub-hash
|
||||||
|
sub detect_useflags {
|
||||||
my ( $target, $packages ) = @_;
|
my ( $target, $packages ) = @_;
|
||||||
my @packs = @{$packages};
|
my @packs = @{$packages};
|
||||||
for my $i ( 0 .. $#packs ) {
|
for my $i ( 0 .. $#packs ) {
|
||||||
@@ -260,8 +263,8 @@ sub compile_packs {
|
|||||||
my $tmp_rt;
|
my $tmp_rt;
|
||||||
say "\n" x 2, "==== Compiling $pack ====", "\n" x 2;
|
say "\n" x 2, "==== Compiling $pack ====", "\n" x 2;
|
||||||
if ( defined $per_package_useflags->{$target}->[$package_counter]
|
if ( defined $per_package_useflags->{$target}->[$package_counter]
|
||||||
and @{ $per_package_useflags->{$target}->[$package_counter] } > 0
|
and @{ $per_package_useflags->{$target}->[$package_counter] }
|
||||||
and !$pretend )
|
> 0 )
|
||||||
{
|
{
|
||||||
say "USEFLAGS: "
|
say "USEFLAGS: "
|
||||||
. join( " ",
|
. join( " ",
|
||||||
@@ -276,14 +279,11 @@ sub compile_packs {
|
|||||||
. "\" emerge $emerge_defaults_args -j $jobs $extra_arg $pack"
|
. "\" emerge $emerge_defaults_args -j $jobs $extra_arg $pack"
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
elsif ( !$pretend ) {
|
else {
|
||||||
$tmp_rt =
|
$tmp_rt =
|
||||||
system(
|
system(
|
||||||
"emerge $emerge_defaults_args -j $jobs $extra_arg $pack");
|
"emerge $emerge_defaults_args -j $jobs $extra_arg $pack");
|
||||||
}
|
}
|
||||||
else {
|
|
||||||
say "Skipping, PRETEND=1";
|
|
||||||
}
|
|
||||||
$package_counter++;
|
$package_counter++;
|
||||||
|
|
||||||
$return = $tmp_rt
|
$return = $tmp_rt
|
||||||
@@ -319,6 +319,14 @@ say "\t* " . $_ for @ARGV;
|
|||||||
|
|
||||||
say "[*] Syncing configurations files, Layman and Portage";
|
say "[*] Syncing configurations files, Layman and Portage";
|
||||||
|
|
||||||
|
if ($pretend) {
|
||||||
|
say "[*] PRETEND enabled, no real action will be performed.";
|
||||||
|
say " Bear in mind that in such way the list of packages";
|
||||||
|
say " that emerge will try to compile will be bigger";
|
||||||
|
$equo_install_args .= " -p";
|
||||||
|
$emerge_defaults_args .= " -p";
|
||||||
|
}
|
||||||
|
|
||||||
# Syncronizing portage configuration and adding overlays
|
# Syncronizing portage configuration and adding overlays
|
||||||
system("echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen"); #be sure about that.
|
system("echo 'en_US.UTF-8 UTF-8' > /etc/locale.gen"); #be sure about that.
|
||||||
|
|
||||||
@@ -523,26 +531,21 @@ if ($use_equo) {
|
|||||||
@packages_deps = grep { defined() and length() } @packages_deps; #cleaning
|
@packages_deps = grep { defined() and length() } @packages_deps; #cleaning
|
||||||
say "", "[install] Those dependencies will be installed with equo :",
|
say "", "[install] Those dependencies will be installed with equo :",
|
||||||
@packages_deps, "";
|
@packages_deps, "";
|
||||||
if ( $equo_split_install and !$pretend ) {
|
if ($equo_split_install) {
|
||||||
|
|
||||||
safe_call("equo i $equo_install_args --bdeps $_")
|
safe_call("equo i $equo_install_args --bdeps $_")
|
||||||
for ( @packages_deps, @equo_install )
|
for ( @packages_deps, @equo_install )
|
||||||
; ## bail out here, if installs fails. emerge will compile a LOT of stuff
|
; ## bail out here, if installs fails. emerge will compile a LOT of stuff
|
||||||
|
if ( @equo_remove > 0 and !$pretend ) {
|
||||||
if ( @equo_remove > 0 ) {
|
say "Removing with equo: @equo_remove";
|
||||||
system("equo rm --nodeps $_") for (@equo_remove);
|
system("equo rm --nodeps $_") for (@equo_remove);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
elsif ( !$pretend ) {
|
else {
|
||||||
safe_call(
|
safe_call(
|
||||||
"equo i $equo_install_args --bdeps @packages_deps @equo_install")
|
"equo i $equo_install_args --bdeps @packages_deps @equo_install")
|
||||||
if ( @packages_deps > 0 or @equo_install > 0 )
|
if ( @packages_deps > 0 or @equo_install > 0 )
|
||||||
; ## bail out here, if installs fails. emerge will compile a LOT of stuff
|
; ## bail out here, if installs fails. emerge will compile a LOT of stuff
|
||||||
system("equo rm --nodeps @equo_remove") if ( @equo_remove > 0 );
|
system("equo rm --nodeps @equo_remove") if ( @equo_remove > 0 );
|
||||||
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
say "Skipping, PRETEND=1";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -564,6 +567,7 @@ system("emerge --info")
|
|||||||
my $rt;
|
my $rt;
|
||||||
|
|
||||||
if ( $emerge_remove and $emerge_remove ne "" ) {
|
if ( $emerge_remove and $emerge_remove ne "" ) {
|
||||||
|
say "Removing with emerge: $emerge_remove";
|
||||||
system("emerge -C $_") for split( / /, $emerge_remove );
|
system("emerge -C $_") for split( / /, $emerge_remove );
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -571,11 +575,8 @@ if ($emerge_split_install) {
|
|||||||
compile_packs( "targets", @packages );
|
compile_packs( "targets", @packages );
|
||||||
$rt = 0; #consider the build good anyway, like a "keep-going"
|
$rt = 0; #consider the build good anyway, like a "keep-going"
|
||||||
}
|
}
|
||||||
elsif ( !$pretend ) {
|
|
||||||
$rt = system("emerge $emerge_defaults_args -j $jobs @packages");
|
|
||||||
}
|
|
||||||
else {
|
else {
|
||||||
say "Skipping, PRETEND=1";
|
$rt = system("emerge $emerge_defaults_args -j $jobs @packages");
|
||||||
}
|
}
|
||||||
|
|
||||||
my $return = $rt >> 8;
|
my $return = $rt >> 8;
|
||||||
@@ -583,7 +584,7 @@ my $return = $rt >> 8;
|
|||||||
# best effort -B
|
# best effort -B
|
||||||
compile_packs( "injected_targets", @injected_packages );
|
compile_packs( "injected_targets", @injected_packages );
|
||||||
|
|
||||||
if ($preserved_rebuild) {
|
if ( $preserved_rebuild and !$pretend ) {
|
||||||
|
|
||||||
system("emerge -j $jobs --buildpkg \@preserved-rebuild");
|
system("emerge -j $jobs --buildpkg \@preserved-rebuild");
|
||||||
system("revdep-rebuild");
|
system("revdep-rebuild");
|
||||||
@@ -599,9 +600,14 @@ if ( $qualityassurance_checks == 1 ) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if ( $obsoleted and $target_overlay ) {
|
||||||
|
say "*** Detecting obsoletes ***";
|
||||||
|
system("sabayon-detectobsolete --overlay ${target_overlay}");
|
||||||
|
}
|
||||||
|
|
||||||
# Copy files to artifacts folder
|
# Copy files to artifacts folder
|
||||||
system(
|
system(
|
||||||
"mkdir -p $artifacts_folder;cp -rfv /usr/portage/packages $artifacts_folder"
|
"mkdir -p $artifacts_folder;cp -rfv /usr/portage/packages $artifacts_folder"
|
||||||
) if ( $artifacts_folder and !$return );
|
) if ( $artifacts_folder and !$return and !$pretend );
|
||||||
|
|
||||||
exit($return);
|
exit($return);
|
||||||
|
|||||||
Executable
+84
@@ -0,0 +1,84 @@
|
|||||||
|
#!/usr/bin/env perl
|
||||||
|
# This code is licenced GPLv2 or newer.
|
||||||
|
|
||||||
|
use warnings;
|
||||||
|
use strict;
|
||||||
|
use 5.010;
|
||||||
|
|
||||||
|
my $g_thres = shift // 3;
|
||||||
|
|
||||||
|
sub set_atoms {
|
||||||
|
my %atoms = ();
|
||||||
|
my $fh = shift;
|
||||||
|
while (my $line = <$fh>) {
|
||||||
|
chomp $line;
|
||||||
|
my @words = split(' ', $line, 2);
|
||||||
|
next if $words[0] eq "??"; # allow "dangling" files
|
||||||
|
my $what = $words[1];
|
||||||
|
@words = split(m:/:, $what);
|
||||||
|
my $pkg;
|
||||||
|
if (@words >= 2) {
|
||||||
|
$pkg = join("/", @words[0..1]);
|
||||||
|
} else {
|
||||||
|
$pkg = $words[0]
|
||||||
|
}
|
||||||
|
$atoms{$pkg} = 1;
|
||||||
|
}
|
||||||
|
keys %atoms
|
||||||
|
}
|
||||||
|
|
||||||
|
sub num {
|
||||||
|
my $what = shift;
|
||||||
|
my @arr = @_;
|
||||||
|
my $num = 0;
|
||||||
|
for (@arr) {
|
||||||
|
$num++ if index($_, "$what-") == 0
|
||||||
|
}
|
||||||
|
$num
|
||||||
|
}
|
||||||
|
|
||||||
|
sub replace {
|
||||||
|
my $atom = shift;
|
||||||
|
my @arr = @_;
|
||||||
|
my @new_arr;
|
||||||
|
for my $item (@arr) {
|
||||||
|
if( index($item, $atom) == 0 ) {
|
||||||
|
1;
|
||||||
|
} else {
|
||||||
|
push @new_arr, $item;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
push @new_arr, "$atom*";
|
||||||
|
@new_arr;
|
||||||
|
}
|
||||||
|
|
||||||
|
# try to make (a*, b, c*) from (a-1, a, a-2, b, c, c-1),
|
||||||
|
# for example, if numberOf(/^a-?/) >= $thres
|
||||||
|
sub do_reduce {
|
||||||
|
my $thres = shift;
|
||||||
|
my @atoms = @_;
|
||||||
|
my @processed_atoms = @atoms;
|
||||||
|
for my $atom (@atoms) {
|
||||||
|
@processed_atoms = replace($atom, @processed_atoms)
|
||||||
|
if (num($atom, @processed_atoms) >= $thres);
|
||||||
|
}
|
||||||
|
@processed_atoms
|
||||||
|
}
|
||||||
|
|
||||||
|
#my @atoms = set_atoms(*DATA);
|
||||||
|
my @atoms = set_atoms(*STDIN);
|
||||||
|
@atoms = do_reduce($g_thres, @atoms);
|
||||||
|
say join ",", sort @atoms;
|
||||||
|
|
||||||
|
__DATA__
|
||||||
|
M net-p2p/transmission-base/metadata.xml
|
||||||
|
M net-p2p/transmission-cli/metadata.xml
|
||||||
|
M net-p2p/transmission-daemon/metadata.xml
|
||||||
|
M net-p2p/transmission-gtk/metadata.xml
|
||||||
|
M net-p2p/transmission-qt4/metadata.xml
|
||||||
|
M net-p2p/transmission/metadata.xml
|
||||||
|
M cat/pkg-1
|
||||||
|
M cat/pkg-2
|
||||||
|
M cat/pkg
|
||||||
|
M net-p2p/nic
|
||||||
|
?? betr.pl
|
||||||
Executable
+20
@@ -0,0 +1,20 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
# This code is licenced GPLv2 or newer.
|
||||||
|
|
||||||
|
# An example hook script to prepare the commit log message.
|
||||||
|
# Called by "git commit" with the name of the file that has the
|
||||||
|
# commit message, followed by the description of the commit
|
||||||
|
# message's source. The hook's purpose is to edit the commit
|
||||||
|
# message file. If the hook fails with a non-zero status,
|
||||||
|
# the commit is aborted.
|
||||||
|
|
||||||
|
_out=$(git status -s | overlays-commit-msg.pl)
|
||||||
|
_ver=$(git status -s | sed -rn 's/^[AR] *(.* -> )?.*-([^-]+)\.ebuild$/\2/p' | head -n 1)
|
||||||
|
_bump=${_ver:+version bump to $_ver}
|
||||||
|
|
||||||
|
case $2 in
|
||||||
|
#message)
|
||||||
|
# sed -i -e "1s:^:[$_subdir/$_curdir] :" "$1" ;;
|
||||||
|
"")
|
||||||
|
sed -i -e "1i[$_out] $_bump" "$1" ;;
|
||||||
|
esac
|
||||||
@@ -57,6 +57,8 @@ docker_volumes=( -v "$OUTPUT_DIR:/usr/portage/packages" )
|
|||||||
[ -z "$REMOTE_PORTDIR" ] || docker_env+=(-e "REMOTE_PORTDIR=$REMOTE_PORTDIR")
|
[ -z "$REMOTE_PORTDIR" ] || docker_env+=(-e "REMOTE_PORTDIR=$REMOTE_PORTDIR")
|
||||||
[ -z "$ETP_NOCACHE" ] || docker_env+=(-e "ETP_NOCACHE=$ETP_NOCACHE")
|
[ -z "$ETP_NOCACHE" ] || docker_env+=(-e "ETP_NOCACHE=$ETP_NOCACHE")
|
||||||
[ -z "$PRETEND" ] || docker_env+=(-e "PRETEND=$PRETEND")
|
[ -z "$PRETEND" ] || docker_env+=(-e "PRETEND=$PRETEND")
|
||||||
|
[ -z "$DETECT_OBSOLETE" ] || docker_env+=(-e "DETECT_OBSOLETE=$DETECT_OBSOLETE")
|
||||||
|
[ -z "$TARGET_OVERLAY" ] || docker_env+=(-e "TARGET_OVERLAY=$TARGET_OVERLAY")
|
||||||
[ -d "$LOCAL_OVERLAY" ] && docker_volumes+=(-v "$LOCAL_OVERLAY:/usr/local/local_portage")
|
[ -d "$LOCAL_OVERLAY" ] && docker_volumes+=(-v "$LOCAL_OVERLAY:/usr/local/local_portage")
|
||||||
|
|
||||||
if [ -e $MAKE_CONF ]; then
|
if [ -e $MAKE_CONF ]; then
|
||||||
|
|||||||
Executable
+65
@@ -0,0 +1,65 @@
|
|||||||
|
#!/usr/bin/perl
|
||||||
|
# mudler <mudler@sabayon.org>
|
||||||
|
# this tool requires querypkg
|
||||||
|
use Getopt::Long;
|
||||||
|
use strict;
|
||||||
|
use warnings;
|
||||||
|
my $arch;
|
||||||
|
my $verbose;
|
||||||
|
my $overlay;
|
||||||
|
GetOptions(
|
||||||
|
"arch=s" => \$arch,
|
||||||
|
"overlay=s" => \$overlay,
|
||||||
|
"verbose" => \$verbose
|
||||||
|
) or die("Error in command line arguments\n");
|
||||||
|
|
||||||
|
die("You should at least supply an overlay with --overlay") if !$overlay;
|
||||||
|
|
||||||
|
# Input: Overlay absolute path
|
||||||
|
# Output: array with package names (category/name)
|
||||||
|
sub get_packages {
|
||||||
|
keys %{
|
||||||
|
{ map {
|
||||||
|
s/$overlay\/|\.ebuild//g;
|
||||||
|
$_ = join( '/', ( split( /\//, $_ ) )[ 0, 1 ] );
|
||||||
|
$_ => 1
|
||||||
|
} glob( $_[0] . "/*/*/*.ebuild" )
|
||||||
|
}
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
|
# Input: package (category/name)
|
||||||
|
# Output: returns 1 if obsolete and can be removed
|
||||||
|
sub obsolete_package($$) {
|
||||||
|
my $package = $_[0];
|
||||||
|
my $arch = $_[1];
|
||||||
|
my $l_arch = ( defined $arch and $arch ne "" ? "--arch $arch" : "" );
|
||||||
|
print "querypkg -q $l_arch $package --show spm_repo\n" if $verbose;
|
||||||
|
my @out = `querypkg -q $l_arch $package --show spm_repo`;
|
||||||
|
chomp(@out);
|
||||||
|
return 1 if "@out" eq "";
|
||||||
|
foreach my $l (@out) {
|
||||||
|
print " >> $l\n" if $verbose;
|
||||||
|
return 1 if ( $l =~ /$package.*\{spm_repo\:gent.*/ );
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
my @packages = get_packages($overlay);
|
||||||
|
my @obsoletes;
|
||||||
|
|
||||||
|
foreach my $p (@packages) {
|
||||||
|
print "[$p] Checking if there is a version in the repositories.... ";
|
||||||
|
print "\n" if $verbose;
|
||||||
|
if ( obsolete_package( $p, $arch ) ) {
|
||||||
|
print " OBSOLETE! \n";
|
||||||
|
push( @obsoletes, $p );
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
print " ok \n";
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
print "\n";
|
||||||
|
print "Obsoletes found:\n\n";
|
||||||
|
print "$_\n" for @obsoletes;
|
||||||
Reference in New Issue
Block a user