aboutsummaryrefslogtreecommitdiff
path: root/scripts
diff options
context:
space:
mode:
authorSergio <sergiotarxz@posteo.net>2026-09-21 12:31:01 +0200
committerSergio <sergiotarxz@posteo.net>2026-09-21 12:31:01 +0200
commit763a6b4fb56e9f29efd2383adfa6c0b2cee15fd5 (patch)
tree1a196cfb84f1af2efdb3ef5cb9e1f012e0a90e27 /scripts
parent82bc235c7be87b94eb0954a225a5dd2e0f87ee9b (diff)
Multiple fixesHEADmain
Diffstat (limited to 'scripts')
-rw-r--r--scripts/build.pl25
-rw-r--r--scripts/complete-build.pl5
-rw-r--r--scripts/export_ebuild_tree.pl120
3 files changed, 138 insertions, 12 deletions
diff --git a/scripts/build.pl b/scripts/build.pl
index 57ac09c..3f7189b 100644
--- a/scripts/build.pl
+++ b/scripts/build.pl
@@ -20,6 +20,8 @@ my $clean_binpkg;
my $tmp_dir;
my $source_stage_suffix;
+$ENV{ACCEPT_LICENSE} = '*';
+
Getopt::Long::Configure( "bundling", "no_ignore_case" );
GetOptions(
'repo|r=s' => \$ebuild_tree,
@@ -156,12 +158,15 @@ sub prepare_root {
{
die "Unable to link profile to $link_profile";
}
+ if (system qw{emerge -1 -v --buildpkg --getbinpkg -uUDN portage}) {
+ die 'Unable to update portage';
+ }
if ( !$binpkg_dir ) {
- if ( system qw{emerge --buildpkg --getbinpkg -uUDN @world @system} )
+ if ( system qw{emerge -v --buildpkg --getbinpkg -uUDN @world @system} )
{
die 'Unable to finish previous profile';
}
- if ( system qw{emerge --buildpkg --getbinpkg @preserved-rebuild} ) {
+ if ( system qw{emerge -v --buildpkg --getbinpkg @preserved-rebuild} ) {
die 'Unable to finish previous profile';
}
}
@@ -181,7 +186,7 @@ sub prepare_root {
if ( $rebuild_all || $is_binpkg ) {
die "Could not build the system"
if system(
- qw{emerge --buildpkg --getbinpkg -e --with-bdeps=y @world @system});
+ qw{emerge -v --buildpkg --getbinpkg -e --with-bdeps=y @world @system});
}
else {
if ( $yaml->{break_circular} ) {
@@ -194,10 +199,10 @@ sub prepare_root {
install_clang_if_needed();
die "Could not build the system"
if system
- qw{emerge --buildpkg --getbinpkg --noreplace --with-bdeps=y @world @system};
+ qw{emerge -v --buildpkg --getbinpkg --noreplace --with-bdeps=y @world @system};
die "Could not build the system"
if system
- qw{emerge --buildpkg --getbinpkg -uUDN --with-bdeps=y @world @system};
+ qw{emerge -v --buildpkg --getbinpkg -uUDN --with-bdeps=y @world @system};
if ( system rm => $tmp_use_file ) {
die 'Failed to delete tmp cycle breaker package.use file';
@@ -206,16 +211,16 @@ sub prepare_root {
install_clang_if_needed();
die "Could not build the system"
if system
- qw{emerge --buildpkg --getbinpkg --noreplace --with-bdeps=y @world @system};
+ qw{emerge -v --buildpkg --getbinpkg --noreplace --with-bdeps=y @world @system};
die "Could not build the system"
if system
- qw{emerge --buildpkg --getbinpkg -uUDN --with-bdeps=y @world @system};
+ qw{emerge -v --buildpkg --getbinpkg -uUDN --with-bdeps=y @world @system};
}
die "Could not set the default editor"
- if system qw{emerge --buildpkg --getbinpkg --noreplace vim};
+ if system qw{emerge -v --buildpkg --getbinpkg --noreplace vim};
die "Could not set the default editor"
if system qw{eselect editor set vim};
- system qw{emerge --depclean --with-bdeps=y};
+ system qw{emerge -v --depclean --with-bdeps=y};
my @commands = @{ $commands // [] };
for my $command (@commands) {
say "Running command $command";
@@ -358,7 +363,7 @@ sub install_clang_if_needed {
}
sub install_clang {
- if ( system qw{emerge --buildpkg --getbinpkg --noreplace llvm-core/clang} )
+ if ( system qw{emerge -1 -v --buildpkg --getbinpkg --noreplace llvm-core/clang} )
{
die "Failed to install clang";
}
diff --git a/scripts/complete-build.pl b/scripts/complete-build.pl
index a81fafd..ffe7842 100644
--- a/scripts/complete-build.pl
+++ b/scripts/complete-build.pl
@@ -28,7 +28,7 @@ GetOptions(
'repo=s' => \$repo,
'jobs|j=s' => \$jobs,
'tag|t=s' => \$tag,
- 'suffix' => \$suffix,
+ 'suffix=s' => \$suffix,
'output-dir|O=s' => \$output_dir,
'binpkg-dir=s' => \$binpkg_dir,
'precursor-dir|P=s' => \$precursor,
@@ -71,9 +71,10 @@ if ( $< != 0 ) {
exit 1;
}
+system "umount -R /var/tmp/algabuild/tmp/algaos-complete-*/tmp/*/*";
for my $dir ( glob '/var/tmp/algabuild/tmp/algaos-complete-*' ) {
if ( !-e "$dir/.pid" ) {
- system qw{rm -rf}, $dir;
+ system qw{rm -rf --one-file-system}, $dir;
next;
}
my $pid = `cat $dir/.pid`;
diff --git a/scripts/export_ebuild_tree.pl b/scripts/export_ebuild_tree.pl
new file mode 100644
index 0000000..3da8247
--- /dev/null
+++ b/scripts/export_ebuild_tree.pl
@@ -0,0 +1,120 @@
+#!/usr/bin/env perl
+
+use strict;
+use warnings;
+
+use Getopt::Long qw(GetOptions);
+use File::Temp qw(tempdir);
+use File::Path qw(make_path);
+use IPC::Open3 qw(open3);
+use Symbol qw(gensym);
+
+my ($repo, $tag, $output_dir, $suffix);
+my $help;
+
+GetOptions(
+ 'repo=s' => \$repo,
+ 'tag=s' => \$tag,
+ 'output-dir=s' => \$output_dir,
+ 'suffix=s' => \$suffix,
+ 'help|h' => \$help,
+) or usage(1);
+
+usage(0) if $help;
+usage(1) unless defined $repo && defined $tag && defined $suffix;
+
+$output_dir //= '.';
+
+sub usage {
+ my ($exit) = @_;
+
+ print <<"EOF";
+Usage: $0 --repo PATH --tag TAG --suffix SUFFIX [--output-dir DIR]
+
+Options:
+ --repo PATH Git repository
+ --tag TAG Git tag
+ --suffix SUFFIX Snapshot filename suffix
+ --output-dir DIR Output directory (default: .)
+ --help, -h Show this help
+
+Output:
+ webrsync-SUFFIX.tar.bz2
+
+EOF
+
+ exit $exit;
+}
+
+sub run {
+ my (@cmd) = @_;
+
+ print '+ ', join(' ', @cmd), "\n";
+
+ system(@cmd);
+
+ die "command failed: $?\n" if $? == -1;
+ die "command failed: signal " . ($? & 127) . "\n" if $? & 127;
+ die "command failed: exit " . ($? >> 8) . "\n" if $? >> 8;
+}
+
+die "Repository does not exist: $repo\n"
+ unless -d $repo;
+
+make_path($output_dir)
+ unless -d $output_dir;
+
+my $tmp = tempdir(
+ 'webrsync-XXXXXX',
+ TMPDIR => 1,
+ CLEANUP => 1,
+);
+
+my $tree = "$tmp/tree";
+my $archive = "$tmp/tree.tar";
+
+make_path($tree);
+
+run(
+ 'git',
+ '-C', $repo,
+ 'archive',
+ '--format=tar',
+ '--output', $archive,
+ $tag,
+);
+
+run(
+ 'tar',
+ '-xf', $archive,
+ '-C', $tree,
+);
+
+my $timestamp = "$tree/metadata/timestamp.x";
+
+make_path("$tree/metadata");
+
+open my $fh, '>', $timestamp
+ or die "$timestamp: $!\n";
+
+print {$fh} time, "\n"
+ or die "$timestamp: $!\n";
+
+close $fh
+ or die "$timestamp: $!\n";
+
+my $output = "$output_dir/webrsync-$suffix.tar.bz2";
+
+if (system qw{rsync -P --delete -a}, 'rsync://rsync.gentoo.org/gentoo-portage/metadata/glsa/', "$tree/metadata/glsa/") {
+ die 'Unable to append security advisories (glsa)';
+}
+
+run(
+ 'tar',
+ '-C', $tree,
+ '--sort=name',
+ '-cjf', $output,
+ '.',
+);
+
+print "Created $output\n";