Compare commits
9 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e07cb53932 | |||
| 51d7bdc968 | |||
| 79d3d5d4b5 | |||
| 2c05cdce52 | |||
| a55856cb97 | |||
| 967cd9708a | |||
| 566e4603c8 | |||
| 55bb3cc44e | |||
| 502b85b84b |
@@ -1,6 +1,7 @@
|
|||||||
#!/usr/bin/env perl
|
#!/usr/bin/env perl
|
||||||
|
|
||||||
use Getopt::Long;
|
use Getopt::Long;
|
||||||
|
use v5.10;
|
||||||
|
|
||||||
my $profile = $ENV{BUILDER_PROFILE} // 3;
|
my $profile = $ENV{BUILDER_PROFILE} // 3;
|
||||||
my $jobs = $ENV{BUILDER_JOBS} // 1;
|
my $jobs = $ENV{BUILDER_JOBS} // 1;
|
||||||
@@ -42,9 +43,29 @@ sub package_deps {
|
|||||||
my $package = shift;
|
my $package = shift;
|
||||||
my $depth = shift // 1; # defaults to 1 level of depthness of the tree
|
my $depth = shift // 1; # defaults to 1 level of depthness of the tree
|
||||||
my $atom = shift // 0;
|
my $atom = shift // 0;
|
||||||
return
|
|
||||||
map { $_ =~ s/\[.*\]|\s//g; &atom($_) if $atom; $_ }
|
# Since we expect this sub to be called multiple times with the same arguments, cache the results
|
||||||
qx/equery -C -q g --depth=$depth $package/; #depth=0 it's all
|
state %cache;
|
||||||
|
$cache_key = "${package}:${depth}:${atom}";
|
||||||
|
|
||||||
|
if ( ! exists $cache{$cache_key} ) {
|
||||||
|
@dependencies = qx/equery -C -q g --depth=$depth $package/; #depth=0 it's all
|
||||||
|
chomp @dependencies;
|
||||||
|
|
||||||
|
# If an unversioned atom is given, equery returns results for all versions in the portage tree
|
||||||
|
# leading to duplicates. The sanest thing to do is dedup the list. This gives the superset of all
|
||||||
|
# possible dependencies, which isn't perfectly accurate but should be good enough. For completely
|
||||||
|
# accurate results, pass in a versioned atom.
|
||||||
|
@dependencies = uniq(
|
||||||
|
sort
|
||||||
|
grep { $_ }
|
||||||
|
map { $_ =~ s/\[.*\]|\s//g; &atom($_) if $atom; $_ }
|
||||||
|
@dependencies);
|
||||||
|
|
||||||
|
$cache{$cache_key} = \@dependencies;
|
||||||
|
}
|
||||||
|
|
||||||
|
return @{ $cache{$cache_key} };
|
||||||
}
|
}
|
||||||
|
|
||||||
#Input: nothing
|
#Input: nothing
|
||||||
@@ -71,18 +92,17 @@ sub calculate_missing {
|
|||||||
say "[$package] Getting the package dependencies and the installed packages";
|
say "[$package] Getting the package dependencies and the installed packages";
|
||||||
my @dependencies = package_deps( $package, $depth, 1 );
|
my @dependencies = package_deps( $package, $depth, 1 );
|
||||||
|
|
||||||
# XXX: Endless loop as for now.
|
my %install_dependencies = map { $_ => 1 } @dependencies;
|
||||||
# my %install_dependencies = map { $_ => 1 } @dependencies;
|
# Look for any virtuals and remove its immediate dependencies to avoid
|
||||||
# # Look for any virtuals and remove its immediate dependencies to avoid
|
# installing multiple conflicting packages one by one
|
||||||
# # installing multiple conflicting packages one by one
|
my @virtual_deps;
|
||||||
# my @virtual_deps;
|
for my $dep (@dependencies) {
|
||||||
# for my $dep (@dependencies) {
|
push(@virtual_deps, package_deps( $dep, 1, 1 )) if ( $dep =~ /^virtual\// );
|
||||||
# push(@virtual_deps, package_deps( $dep, 1, 1 )) if ( $dep =~ /^virtual\// );
|
}
|
||||||
# }
|
for my $dep (@virtual_deps) {
|
||||||
# for my $dep (@virtual_deps) {
|
$install_dependencies{$dep} = 0 if ( $dep !~ /^virtual\// );
|
||||||
# $install_dependencies{$dep} = 0 if ( $dep !~ /^virtual\// );
|
}
|
||||||
# }
|
@dependencies = grep { $install_dependencies{$_} } @dependencies;
|
||||||
# @dependencies = grep { $install_dependencies{$_} } @dependencies;
|
|
||||||
|
|
||||||
#taking only the 4th column of output as key of the hashmap
|
#taking only the 4th column of output as key of the hashmap
|
||||||
my %installed_packs =
|
my %installed_packs =
|
||||||
@@ -93,7 +113,7 @@ sub calculate_missing {
|
|||||||
my @to_install = grep( defined $available_packs{$_},
|
my @to_install = grep( defined $available_packs{$_},
|
||||||
uniq( grep( !defined $installed_packs{$_}, @dependencies ) ) );
|
uniq( grep( !defined $installed_packs{$_}, @dependencies ) ) );
|
||||||
@to_install=grep { length } @to_install;
|
@to_install=grep { length } @to_install;
|
||||||
# say "[$package] packages that will be installed with equo: @to_install" if @to_install>0;
|
say "[$package] packages that will be installed with equo: @to_install" if @to_install>0;
|
||||||
|
|
||||||
return @to_install;
|
return @to_install;
|
||||||
}
|
}
|
||||||
|
|||||||
+9
-1
@@ -25,6 +25,10 @@ docker_volumes=(
|
|||||||
-v "$entropysrv:/etc/entropy/server.conf"
|
-v "$entropysrv:/etc/entropy/server.conf"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
[ -z "$PUBKEY" ] || docker_volumes+=(-v "$PUBKEY:/etc/entropy/mykeys/key.pub")
|
||||||
|
[ -z "$PRIVATEKEY" ] || docker_volumes+=(-v "$PRIVATEKEY:/etc/entropy/mykeys/private.key")
|
||||||
|
|
||||||
|
|
||||||
if [ $# -eq 0 ]
|
if [ $# -eq 0 ]
|
||||||
then
|
then
|
||||||
docker_volumes+=(-v "$PORTAGE_ARTIFACTS:/usr/portage/packages" )
|
docker_volumes+=(-v "$PORTAGE_ARTIFACTS:/usr/portage/packages" )
|
||||||
@@ -51,7 +55,7 @@ mkdir -p /sabayon/artifacts
|
|||||||
|
|
||||||
if [ -d "/sabayon/artifacts/standard" ]; then
|
if [ -d "/sabayon/artifacts/standard" ]; then
|
||||||
eit unlock \$repo || true
|
eit unlock \$repo || true
|
||||||
eit pull --quick $repo || true
|
eit pull --quick \$repo || true
|
||||||
#eit sync \$repo
|
#eit sync \$repo
|
||||||
else
|
else
|
||||||
echo "Yes" | eit init --quick \$repo
|
echo "Yes" | eit init --quick \$repo
|
||||||
@@ -59,6 +63,10 @@ fi
|
|||||||
|
|
||||||
echo "Yes" | eit inject \${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
|
echo "Yes" | eit inject \${built_pkgs} || { echo "ouch unable to inject" && exit 3; }
|
||||||
echo "Yes Yes Yes" | eit commit --quick
|
echo "Yes Yes Yes" | eit commit --quick
|
||||||
|
|
||||||
|
[ -f "/etc/entropy/mykeys/key.pub" ] && [ -f "/etc/entropy/mykeys/private.key" ] &&\
|
||||||
|
eit key import \$repo /etc/entropy/mykeys/private.key /etc/entropy/mykeys/key.pub && { eit key sign \$repo || true; }
|
||||||
|
|
||||||
eit push --quick --force
|
eit push --quick --force
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ REPOSITORY_DESCRIPTION="${REPOSITORY_DESCRIPTION:-My Sabayon repository}"
|
|||||||
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/eit-amd64}"
|
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/eit-amd64}"
|
||||||
PORTAGE_ARTIFACTS="${PORTAGE_ARTIFACTS:-$SAB_WORKSPACE/portage_artifacts}"
|
PORTAGE_ARTIFACTS="${PORTAGE_ARTIFACTS:-$SAB_WORKSPACE/portage_artifacts}"
|
||||||
OUTPUT_DIR="${OUTPUT_DIR:-$SAB_WORKSPACE/entropy_artifacts}"
|
OUTPUT_DIR="${OUTPUT_DIR:-$SAB_WORKSPACE/entropy_artifacts}"
|
||||||
|
DOCKER_OPTS="${DOCKER_OPTS:--ti --rm}"
|
||||||
|
|
||||||
args=("$@")
|
args=("$@")
|
||||||
EDITOR=cat
|
EDITOR=cat
|
||||||
@@ -88,6 +89,6 @@ function cleanup {
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
|
||||||
echo "docker run --rm --entrypoint /bin/bash ${docker_env[@]} ${docker_volumes[@]} -ti $DOCKER_IMAGE /sabayon/bin/create_repo.sh"
|
echo "docker run $DOCKER_OPTS --entrypoint /bin/bash ${docker_env[@]} ${docker_volumes[@]} $DOCKER_IMAGE /sabayon/bin/create_repo.sh"
|
||||||
|
|
||||||
docker run --rm --entrypoint /bin/bash "${docker_env[@]}" "${docker_volumes[@]}" -ti $DOCKER_IMAGE /sabayon/bin/create_repo.sh || true
|
docker run $DOCKER_OPTS --entrypoint /bin/bash "${docker_env[@]}" "${docker_volumes[@]}" $DOCKER_IMAGE /sabayon/bin/create_repo.sh || true
|
||||||
|
|||||||
@@ -10,6 +10,7 @@ REPOSITORY_DESCRIPTION="${REPOSITORY_DESCRIPTION:-My Sabayon repository}"
|
|||||||
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/eit-amd64}"
|
DOCKER_IMAGE="${DOCKER_IMAGE:-sabayon/eit-amd64}"
|
||||||
PORTAGE_ARTIFACTS="${PORTAGE_ARTIFACTS:-$SAB_WORKSPACE/portage_artifacts}"
|
PORTAGE_ARTIFACTS="${PORTAGE_ARTIFACTS:-$SAB_WORKSPACE/portage_artifacts}"
|
||||||
OUTPUT_DIR="${OUTPUT_DIR:-$SAB_WORKSPACE/entropy_artifacts}"
|
OUTPUT_DIR="${OUTPUT_DIR:-$SAB_WORKSPACE/entropy_artifacts}"
|
||||||
|
DOCKER_OPTS="${DOCKER_OPTS:--ti --rm}"
|
||||||
|
|
||||||
args=("$@")
|
args=("$@")
|
||||||
EDITOR=cat
|
EDITOR=cat
|
||||||
@@ -86,6 +87,6 @@ function cleanup {
|
|||||||
trap cleanup EXIT
|
trap cleanup EXIT
|
||||||
|
|
||||||
|
|
||||||
echo "docker run --rm --entrypoint /bin/bash ${docker_env[@]} ${docker_volumes[@]} -ti $DOCKER_IMAGE /sabayon/bin/create_repo.sh"
|
echo "docker run $DOCKER_OPTS --entrypoint /bin/bash ${docker_env[@]} ${docker_volumes[@]} $DOCKER_IMAGE /sabayon/bin/create_repo.sh"
|
||||||
|
|
||||||
docker run --rm --entrypoint /bin/bash "${docker_env[@]}" "${docker_volumes[@]}" -ti $DOCKER_IMAGE /sabayon/bin/create_repo.sh || true
|
docker run $DOCKER_OPTS --entrypoint /bin/bash "${docker_env[@]}" "${docker_volumes[@]}" $DOCKER_IMAGE /sabayon/bin/create_repo.sh || true
|
||||||
|
|||||||
Reference in New Issue
Block a user