Skip to content
Snippets Groups Projects
Unverified Commit ec2d06bd authored by boklm's avatar boklm
Browse files

Bug 41088: Remove use of projects/browser/run_scripts

The script run_scripts was used to generate multiple bundles (for the
different locales) in parallel. However now that we only have one bundle
for all locales, using run_scripts is not useful anymore, and we can
simplify the build script by removing the use of run_scripts.
parent 5e9f8f0c
No related branches found
No related tags found
1 merge request!935Bug 41088: Remove use of projects/browser/run_scripts
......@@ -363,9 +363,53 @@ done
TBDIR="$distdir/$PKG_DIR/Browser"
[% END %]
cat > "$scripts_dir/create-$PKG_DIR" << SCRIPT_EOF
#!/bin/bash
set -e
[% IF c("var/updater_enabled") -%]
cp $rootdir/[% c('input_files_by_name/firefox') %]/mar-tools-*.zip "$OUTDIR"/
[% END -%]
[% IF c("var/windows") -%]
archive_ext=zip
[% ELSE -%]
archive_ext=tar.xz
[% END -%]
debug_symbols="$rootdir/[% c('input_files_by_name/firefox') %]/browser-debug-symbols.$archive_ext"
if [[ -f "$debug_symbols" ]]; then
cp "$debug_symbols" "$OUTDIR/[% c('var/project-name') %]-debug-symbols-[% c('var/mar_osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
fi
[% IF c("var/macos_universal") -%]
geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
if [[ -f "$geckodriver" ]]; then
cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
fi
geckodriver="$rootdir/[% c('input_files_by_name/firefox-aarch64') %]/geckodriver.$archive_ext"
if [[ -f "$geckodriver" ]]; then
cp "$geckodriver" "$OUTDIR/geckodriver-macos-aarch64-[% c('var/torbrowser_version') %].$archive_ext"
fi
[% ELSE -%]
geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
if [[ -f "$geckodriver" ]]; then
cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
fi
[% END -%]
[%IF c("var/tor-browser") -%]
tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
# strip off trailing "$buildid.tar.gz"
tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
cp $rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
[% IF c("var/macos_universal") %]
tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle-aarch64') %]"
# strip off trailing "$buildid.tar.gz"
tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
cp $rootdir/[% c('input_files_by_name/tor-expert-bundle-aarch64') %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
[% END -%]
[% END -%]
[% IF c("var/build_infos_json") -%]
cp $rootdir/[% c('input_files_by_name/firefox') %]/build-infos.json "$OUTDIR"/build-infos-[% c("var/mar_osname") %].json
[% END -%]
cp -a ${TB_STAGE_DIR} $distdir/$PKG_DIR
[% IF c("var/updater_enabled") -%]
......@@ -415,55 +459,3 @@ cd $distdir
[% END -%]
popd
[% END %]
rm -rf $distdir/${PKG_DIR}
SCRIPT_EOF
[% IF c("var/updater_enabled") -%]
cp $rootdir/[% c('input_files_by_name/firefox') %]/mar-tools-*.zip "$OUTDIR"/
[% END -%]
[% IF c("var/windows") -%]
archive_ext=zip
[% ELSE -%]
archive_ext=tar.xz
[% END -%]
debug_symbols="$rootdir/[% c('input_files_by_name/firefox') %]/browser-debug-symbols.$archive_ext"
if [[ -f "$debug_symbols" ]]; then
cp "$debug_symbols" "$OUTDIR/[% c('var/project-name') %]-debug-symbols-[% c('var/mar_osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
fi
[% IF c("var/macos_universal") -%]
geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
if [[ -f "$geckodriver" ]]; then
cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
fi
geckodriver="$rootdir/[% c('input_files_by_name/firefox-aarch64') %]/geckodriver.$archive_ext"
if [[ -f "$geckodriver" ]]; then
cp "$geckodriver" "$OUTDIR/geckodriver-macos-aarch64-[% c('var/torbrowser_version') %].$archive_ext"
fi
[% ELSE -%]
geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
if [[ -f "$geckodriver" ]]; then
cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
fi
[% END -%]
[%IF c("var/tor-browser") -%]
tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
# strip off trailing "$buildid.tar.gz"
tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
cp $rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
[% IF c("var/macos_universal") %]
tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle-aarch64') %]"
# strip off trailing "$buildid.tar.gz"
tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
cp $rootdir/[% c('input_files_by_name/tor-expert-bundle-aarch64') %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
[% END -%]
[% END -%]
[% IF c("var/build_infos_json") -%]
cp $rootdir/[% c('input_files_by_name/firefox') %]/build-infos.json "$OUTDIR"/build-infos-[% c("var/mar_osname") %].json
[% END -%]
chmod 775 $rootdir/run_scripts "$scripts_dir"/*
$rootdir/run_scripts [% c("num_procs") %] "$scripts_dir"
......@@ -8,8 +8,6 @@ var:
ddmg: '[% INCLUDE ddmg.sh %]'
deps:
- python3
- libparallel-forkmanager-perl
- libfile-slurp-perl
- bzip2
- jq
mar_osname: '[% c("var/osname") %]'
......@@ -67,8 +65,6 @@ targets:
input_files:
- project: container-image
- filename: run_scripts
enable: '[% ! c("var/android") %]'
- project: firefox
name: firefox
enable: '[% ! c("var/android") %]'
......
......@@ -7,8 +7,8 @@ find [% src %] ! -executable -exec chmod 0644 {} \;
find [% src %] -exec [% c("touch") %] {} \;
dmg_tmpdir=\$(mktemp -d)
hfsfile="\$dmg_tmpdir/tbb-uncompressed.dmg"
dmg_tmpdir=$(mktemp -d)
hfsfile="$dmg_tmpdir/tbb-uncompressed.dmg"
# hfsplus sets all the times to time(NULL)
export LD_PRELOAD=[% c("var/faketime_path") %]
......@@ -16,29 +16,29 @@ export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d
src_dir=[% src %]
# 1 for ceiling and 1 for the inode
fileblocks=\$(find "\$src_dir" -type f -printf '%s\n' | awk '{s += int(\$1 / 4096) + 2} END {print s}')
directories=\$(find "\$src_dir" -type d | wc -l)
fileblocks=$(find "$src_dir" -type f -printf '%s\n' | awk '{s += int($1 / 4096) + 2} END {print s}')
directories=$(find "$src_dir" -type d | wc -l)
# Give some room to breathe
size=\$(echo \$((\$fileblocks + \$directories)) | awk '{print int(\$1 * 1.1)}')
dd if=/dev/zero of="\$hfsfile" bs=4096 count=\$size
newfs_hfs -v "[% c('var/display_name') %]" "\$hfsfile"
size=$(echo $(($fileblocks + $directories)) | awk '{print int($1 * 1.1)}')
dd if=/dev/zero of="$hfsfile" bs=4096 count=$size
newfs_hfs -v "[% c('var/display_name') %]" "$hfsfile"
pushd [% src %]
find -type d -mindepth 1 | sed -e 's/^\.\///' | sort | while read dirname; do
hfsplus "\$hfsfile" mkdir "/\$dirname"
hfsplus "\$hfsfile" chmod 0755 "/\$dirname"
hfsplus "$hfsfile" mkdir "/$dirname"
hfsplus "$hfsfile" chmod 0755 "/$dirname"
done
find -type f | sed -e 's/^\.\///' | sort | while read filename; do
hfsplus "\$hfsfile" add "\$filename" "/\$filename"
hfsplus "\$hfsfile" chmod \$(stat --format '0%a' "\$filename") "/\$filename"
hfsplus "$hfsfile" add "$filename" "/$filename"
hfsplus "$hfsfile" chmod $(stat --format '0%a' "$filename") "/$filename"
done
# hfsplus does not play well with dangling links
hfsplus "\$hfsfile" symlink /Applications /Applications
hfsplus "$hfsfile" symlink /Applications /Applications
# Show the volume icon
hfsplus "\$hfsfile" attr / C
hfsplus "$hfsfile" attr / C
dmg dmg "\$hfsfile" [% c('dmg_out', { error_if_undef => 1 }) %]
dmg dmg "$hfsfile" [% c('dmg_out', { error_if_undef => 1 }) %]
popd
rm -Rf "\$dmg_tmpdir"
rm -Rf "$dmg_tmpdir"
#!/usr/bin/perl -w
use strict;
use Parallel::ForkManager;
use File::Slurp;
sub exit_error {
print STDERR "Error: ", $_[0], "\n";
chdir '/';
exit (exists $_[1] ? $_[1] : 1);
}
exit_error "Wrong number of arguments" unless @ARGV == 2;
my ($nb_threads, $scripts_dir) = @ARGV;
exit_error "Could not enter $scripts_dir" unless chdir $scripts_dir;
my $pm = Parallel::ForkManager->new($nb_threads);
$pm->run_on_finish(
sub {
my ($pid, $exit, $id) = @_;
exit_error "Error running $id" unless $exit == 0;
print "Finished $id\n";
}
);
foreach my $script (sort(read_dir($scripts_dir))) {
$pm->start($script) and next;
print "Running $script\n";
exit_error "Error running $script" unless system("./$script") == 0;
$pm->finish;
}
$pm->wait_all_children;
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment