[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

[tor-commits] [Git][tpo/applications/tor-browser-build][main] 2 commits: Bug 41088: Remove use of projects/browser/run_scripts



Title: GitLab

boklm pushed to branch main at The Tor Project / Applications / tor-browser-build

Commits:

  • ec2d06bd
    by Nicolas Vigier at 2024-03-11T15:52:12+01:00
    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.
    
  • fbc5b080
    by Nicolas Vigier at 2024-03-11T15:52:14+01:00
    Bug 41088: Simplify a little projects/browser/build
    

4 changed files:

Changes:

  • projects/browser/build
    ... ... @@ -14,7 +14,8 @@ mkdir -p $OUTDIR
    14 14
     # When we build with MULTI_LINGUAL=1, the browser will be packaged inside a
    
    15 15
     # directory named tor-browser (instead of tor-browser_en-US). Therefore we
    
    16 16
     # stage everything under tor-browser-stage to avoid a conflict.
    
    17
    -TB_STAGE_DIR=$distdir/tor-browser-stage
    
    17
    +PKG_DIR='[% c("var/project-name") %]'
    
    18
    +TB_STAGE_DIR="$distdir/$PKG_DIR[% IF c('var/windows') %]/[% c('var/Project_Name') %][% END %]"
    
    18 19
     GENERATEDPREFSPATH=$rootdir/Bundle-Data/generated-prefs.js
    
    19 20
     # Create initially empty prefs file where we can dump our conditionally included/genetered prefs
    
    20 21
     touch "$GENERATEDPREFSPATH"
    
    ... ... @@ -37,7 +38,7 @@ touch "$GENERATEDPREFSPATH"
    37 38
       tar -C /var/tmp/dist -xf $rootdir/[% c('input_files_by_name/libdmg') %]
    
    38 39
       export PATH=/var/tmp/dist/hfsplus-tools:/var/tmp/dist/libdmg-hfsplus:$PATH
    
    39 40
     [% ELSE %]
    
    40
    -  TBDIR=$TB_STAGE_DIR/Browser
    
    41
    +  TBDIR="$TB_STAGE_DIR/Browser"
    
    41 42
       TBDIRS=("$TBDIR")
    
    42 43
     
    
    43 44
       DOCSPATH=[% c('var/ProjectName') %]/Docs
    
    ... ... @@ -124,7 +125,6 @@ mv [% c('input_files_by_name/noscript') %] "$TBDIR/$EXTSPATH/{73a6fe31-595d-460b
    124 125
     
    
    125 126
       # on linux, libstdc++ lives in it's own directory
    
    126 127
       [% IF c("var/linux") %]
    
    127
    -    find $TBDIR/$TORBINPATH
    
    128 128
         mkdir -p "$TBDIR/$TORBINPATH/libstdc++"
    
    129 129
         mv "$TBDIR/$TORBINPATH"/libstdc++.so.* "$TBDIR/$TORBINPATH/libstdc++"
    
    130 130
       [% END %]
    
    ... ... @@ -145,32 +145,32 @@ do
    145 145
     done
    
    146 146
     
    
    147 147
     [% IF c("var/linux") %]
    
    148
    -  cat > ${TB_STAGE_DIR}/start-[% c("var/project-name") %].desktop << 'RBM_TB_EOF'
    
    148
    +  cat > "${TB_STAGE_DIR}/start-[% c('var/project-name') %].desktop" << 'RBM_TB_EOF'
    
    149 149
     [% INCLUDE 'RelativeLink/start-browser.desktop' -%]
    
    150 150
     RBM_TB_EOF
    
    151
    -  cat > ${TB_STAGE_DIR}/Browser/start-[% c("var/project-name") %] << 'RBM_TB_EOF'
    
    151
    +  cat > "${TB_STAGE_DIR}/Browser/start-[% c('var/project-name') %]" << 'RBM_TB_EOF'
    
    152 152
     [% INCLUDE 'RelativeLink/start-browser' -%]
    
    153 153
     RBM_TB_EOF
    
    154
    -  cat > ${TB_STAGE_DIR}/Browser/execdesktop << 'RBM_TB_EOF'
    
    154
    +  cat > "${TB_STAGE_DIR}/Browser/execdesktop" << 'RBM_TB_EOF'
    
    155 155
     [% INCLUDE 'RelativeLink/execdesktop' -%]
    
    156 156
     RBM_TB_EOF
    
    157
    -  chmod +x ${TB_STAGE_DIR}/start-[% c("var/project-name") %].desktop \
    
    158
    -           ${TB_STAGE_DIR}/Browser/start-[% c("var/project-name") %] \
    
    159
    -           ${TB_STAGE_DIR}/Browser/execdesktop
    
    160
    -  cp ${TB_STAGE_DIR}/start-[% c("var/project-name") %].desktop \
    
    161
    -     ${TB_STAGE_DIR}/Browser
    
    157
    +  chmod +x "${TB_STAGE_DIR}/start-[% c('var/project-name') %].desktop" \
    
    158
    +           "${TB_STAGE_DIR}/Browser/start-[% c('var/project-name') %]" \
    
    159
    +           "${TB_STAGE_DIR}/Browser/execdesktop"
    
    160
    +  cp "${TB_STAGE_DIR}/start-[% c('var/project-name') %].desktop" \
    
    161
    +     "${TB_STAGE_DIR}/Browser"
    
    162 162
       [% IF c("var/namecoin") %]
    
    163
    -    pushd ${TB_STAGE_DIR}/Browser/
    
    163
    +    pushd "${TB_STAGE_DIR}/Browser/"
    
    164 164
         patch -p1 < $rootdir/namecoin.patch
    
    165 165
         popd
    
    166 166
       [% END %]
    
    167 167
       # Make sure we get the desired scrollbar behavior with Gtk3, see bug 27546.
    
    168
    -  GTK_SETTINGS_DIR=${TB_STAGE_DIR}/Browser/.config/gtk-3.0
    
    168
    +  GTK_SETTINGS_DIR="${TB_STAGE_DIR}/Browser/.config/gtk-3.0"
    
    169 169
       mkdir -p $GTK_SETTINGS_DIR
    
    170 170
       cp $rootdir/gtk3-settings.ini $GTK_SETTINGS_DIR/settings.ini
    
    171 171
     [% END %]
    
    172 172
     
    
    173
    -tar -C ${TB_STAGE_DIR} -xf [% c('input_files_by_name/firefox') %]/browser.tar.[% c("compress_tar") %]
    
    173
    +tar -C "${TB_STAGE_DIR}" -xf [% c('input_files_by_name/firefox') %]/browser.tar.[% c("compress_tar") %]
    
    174 174
     
    
    175 175
     [% IF c("var/macos_universal") -%]
    
    176 176
       # Use symlink in tmp dir to extract "Tor Browser.app" to "Tor Browser-aarch64.app"
    
    ... ... @@ -215,8 +215,8 @@ tar -C ${TB_STAGE_DIR} -xf [% c('input_files_by_name/firefox') %]/browser.tar.[%
    215 215
        END; %]
    
    216 216
     
    
    217 217
     [% IF c("var/macos") %]
    
    218
    -  tar -C "Bundle-Data/[% c('var/ProjectName') %].dmg" -c . | tar -C $TB_STAGE_DIR -x
    
    219
    -  pushd $TB_STAGE_DIR
    
    218
    +  tar -C "Bundle-Data/[% c('var/ProjectName') %].dmg" -c . | tar -C "$TB_STAGE_DIR" -x
    
    219
    +  pushd "$TB_STAGE_DIR"
    
    220 220
       cp [% c('var/channel') %].DS_Store .DS_Store
    
    221 221
       rm *.DS_Store
    
    222 222
       popd
    
    ... ... @@ -264,17 +264,10 @@ done
    264 264
     [% END -%]
    
    265 265
     
    
    266 266
     [% IF c("var/linux") && c("var/tor-browser") %]
    
    267
    -  chmod 700 ${TB_STAGE_DIR}/Browser/[% c('var/ProjectName') %]/Data/Browser
    
    268
    -  chmod 700 ${TB_STAGE_DIR}/Browser/TorBrowser/Data/Tor
    
    267
    +  chmod 700 "${TB_STAGE_DIR}/Browser/[% c('var/ProjectName') %]/Data/Browser"
    
    268
    +  chmod 700 "${TB_STAGE_DIR}/Browser/TorBrowser/Data/Tor"
    
    269 269
     [% END %]
    
    270 270
     
    
    271
    -# With multi-lingual builds, we use "ALL" in the package name as the locale for
    
    272
    -# update purposes. But we do not include "ALL" in the name of the directory that
    
    273
    -# is inside the package (in other words, users will not see tor-browser_ALL
    
    274
    -# after they install Tor Browser).
    
    275
    -PKG_LOCALE="ALL"
    
    276
    -PKG_DIR='[% c("var/project-name") %]'
    
    277
    -
    
    278 271
     for tbdir in "${TBDIRS[@]}"
    
    279 272
     do
    
    280 273
       tbdir="$tbdir[% IF c('var/macos') %]/Contents/Resources[% END %]/"
    
    ... ... @@ -325,12 +318,13 @@ done
    325 318
         # we write the uninstaller from the installer.
    
    326 319
         # Instead, we need to write an updated postupdate.exe also when updating.
    
    327 320
         makensis postupdate.nsi
    
    328
    -    mv postupdate.exe ${TB_STAGE_DIR}/Browser/
    
    321
    +    mv postupdate.exe "${TB_STAGE_DIR}/Browser/"
    
    329 322
         popd
    
    330 323
       [% END -%]
    
    331 324
     
    
    332
    -  mv ${TB_STAGE_DIR} $distdir/windows-installer/"[% c('var/Project_Name') %]"
    
    333
    -  mv $distdir/windows-installer ${TB_STAGE_DIR}
    
    325
    +  mv "${TB_STAGE_DIR}" "$distdir/windows-installer/[% c('var/Project_Name') %]"
    
    326
    +  rmdir "$distdir/$PKG_DIR"
    
    327
    +  mv $distdir/windows-installer "$distdir/$PKG_DIR"
    
    334 328
     [% END %]
    
    335 329
     
    
    336 330
     [% IF c("var/macos_universal") -%]
    
    ... ... @@ -355,18 +349,47 @@ done
    355 349
       rm -Rf "$TBDIR_AARCH64"
    
    356 350
     [% END -%]
    
    357 351
     
    
    358
    -[% IF c("var/windows") %]
    
    359
    -  TBDIR="$distdir/$PKG_DIR/[% c("var/Project_Name") %]/Browser"
    
    360
    -[% ELSIF c("var/macos") %]
    
    361
    -  TBDIR="$distdir/$PKG_DIR/[% c('var/display_name') %].app"
    
    362
    -[% ELSE %]
    
    363
    -  TBDIR="$distdir/$PKG_DIR/Browser"
    
    364
    -[% END %]
    
    352
    +[% IF c("var/updater_enabled") -%]
    
    353
    +  cp $rootdir/[% c('input_files_by_name/firefox') %]/mar-tools-*.zip "$OUTDIR"/
    
    354
    +[% END -%]
    
    365 355
     
    
    366
    -cat > "$scripts_dir/create-$PKG_DIR" << SCRIPT_EOF
    
    367
    -#!/bin/bash
    
    368
    -set -e
    
    369
    -cp -a ${TB_STAGE_DIR} $distdir/$PKG_DIR
    
    356
    +[% IF c("var/windows") -%]
    
    357
    +  archive_ext=zip
    
    358
    +[% ELSE -%]
    
    359
    +  archive_ext=tar.xz
    
    360
    +[% END -%]
    
    361
    +
    
    362
    +debug_symbols="$rootdir/[% c('input_files_by_name/firefox') %]/browser-debug-symbols.$archive_ext"
    
    363
    +if [[ -f "$debug_symbols" ]]; then
    
    364
    +  cp "$debug_symbols"  "$OUTDIR/[% c('var/project-name') %]-debug-symbols-[% c('var/mar_osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
    
    365
    +fi
    
    366
    +
    
    367
    +geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
    
    368
    +if [[ -f "$geckodriver" ]]; then
    
    369
    +  cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
    
    370
    +fi
    
    371
    +[% IF c("var/macos_universal") -%]
    
    372
    +  geckodriver="$rootdir/[% c('input_files_by_name/firefox-aarch64') %]/geckodriver.$archive_ext"
    
    373
    +  if [[ -f "$geckodriver" ]]; then
    
    374
    +    cp "$geckodriver" "$OUTDIR/geckodriver-macos-aarch64-[% c('var/torbrowser_version') %].$archive_ext"
    
    375
    +  fi
    
    376
    +[% END -%]
    
    377
    +
    
    378
    +[%IF c("var/tor-browser") -%]
    
    379
    +  tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
    
    380
    +  # strip off trailing "$buildid.tar.gz"
    
    381
    +  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
    
    382
    +  cp $rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
    
    383
    +  [% IF c("var/macos_universal") %]
    
    384
    +    tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle-aarch64') %]"
    
    385
    +    # strip off trailing "$buildid.tar.gz"
    
    386
    +    tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
    
    387
    +    cp $rootdir/[% c('input_files_by_name/tor-expert-bundle-aarch64') %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
    
    388
    +  [% END -%]
    
    389
    +[% END -%]
    
    390
    +[% IF c("var/build_infos_json") -%]
    
    391
    +  cp $rootdir/[% c('input_files_by_name/firefox') %]/build-infos.json "$OUTDIR"/build-infos-[% c("var/mar_osname") %].json
    
    392
    +[% END -%]
    
    370 393
     
    
    371 394
     [% IF c("var/updater_enabled") -%]
    
    372 395
       pushd "$TBDIR[% IF c("var/macos") %]/Contents/Resources/[% END %]"
    
    ... ... @@ -378,7 +401,7 @@ cd $distdir
    378 401
     
    
    379 402
     [% IF c("var/build_mar") && c("var/updater_enabled") -%]
    
    380 403
       # Create full MAR file and compressed package.
    
    381
    -  [% SET mar_file = c("var/project-name") _ '-' _ c("var/mar_osname") _ '-' _ c("var/torbrowser_version") _ '_${PKG_LOCALE}.mar' %]
    
    404
    +  [% SET mar_file = c("var/project-name") _ '-' _ c("var/mar_osname") _ '-' _ c("var/torbrowser_version") _ '_ALL.mar' %]
    
    382 405
       MAR=$MARTOOLS/mar \
    
    383 406
       MOZ_PRODUCT_VERSION=[% c("var/torbrowser_version") %] \
    
    384 407
       MAR_CHANNEL_ID=[% c("var/mar_channel_id") %] \
    
    ... ... @@ -415,55 +438,3 @@ cd $distdir
    415 438
       [% END -%]
    
    416 439
       popd
    
    417 440
     [% END %]
    418
    -rm -rf $distdir/${PKG_DIR}
    
    419
    -SCRIPT_EOF
    
    420
    -
    
    421
    -[% IF c("var/updater_enabled") -%]
    
    422
    -  cp $rootdir/[% c('input_files_by_name/firefox') %]/mar-tools-*.zip "$OUTDIR"/
    
    423
    -[% END -%]
    
    424
    -
    
    425
    -[% IF c("var/windows") -%]
    
    426
    -  archive_ext=zip
    
    427
    -[% ELSE -%]
    
    428
    -  archive_ext=tar.xz
    
    429
    -[% END -%]
    
    430
    -
    
    431
    -debug_symbols="$rootdir/[% c('input_files_by_name/firefox') %]/browser-debug-symbols.$archive_ext"
    
    432
    -if [[ -f "$debug_symbols" ]]; then
    
    433
    -  cp "$debug_symbols"  "$OUTDIR/[% c('var/project-name') %]-debug-symbols-[% c('var/mar_osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
    
    434
    -fi
    
    435
    -
    
    436
    -[% IF c("var/macos_universal") -%]
    
    437
    -  geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
    
    438
    -  if [[ -f "$geckodriver" ]]; then
    
    439
    -    cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
    
    440
    -  fi
    
    441
    -  geckodriver="$rootdir/[% c('input_files_by_name/firefox-aarch64') %]/geckodriver.$archive_ext"
    
    442
    -  if [[ -f "$geckodriver" ]]; then
    
    443
    -    cp "$geckodriver" "$OUTDIR/geckodriver-macos-aarch64-[% c('var/torbrowser_version') %].$archive_ext"
    
    444
    -  fi
    
    445
    -[% ELSE -%]
    
    446
    -  geckodriver="$rootdir/[% c('input_files_by_name/firefox') %]/geckodriver.$archive_ext"
    
    447
    -  if [[ -f "$geckodriver" ]]; then
    
    448
    -    cp "$geckodriver" "$OUTDIR/geckodriver-[% c('var/osname') %]-[% c('var/torbrowser_version') %].$archive_ext"
    
    449
    -  fi
    
    450
    -[% END -%]
    
    451
    -
    
    452
    -[%IF c("var/tor-browser") -%]
    
    453
    -  tor_expert_bundle_src="[% c("input_files_by_name/tor-expert-bundle") %]"
    
    454
    -  # strip off trailing "$buildid.tar.gz"
    
    455
    -  tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
    
    456
    -  cp $rootdir/[% c("input_files_by_name/tor-expert-bundle") %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
    
    457
    -  [% IF c("var/macos_universal") %]
    
    458
    -    tor_expert_bundle_src="[% c('input_files_by_name/tor-expert-bundle-aarch64') %]"
    
    459
    -    # strip off trailing "$buildid.tar.gz"
    
    460
    -    tor_expert_bundle_dest=${tor_expert_bundle_src:0:-7}.tar.gz
    
    461
    -    cp $rootdir/[% c('input_files_by_name/tor-expert-bundle-aarch64') %]/tor-expert-bundle.tar.gz "$OUTDIR"/$tor_expert_bundle_dest
    
    462
    -  [% END -%]
    
    463
    -[% END -%]
    
    464
    -[% IF c("var/build_infos_json") -%]
    
    465
    -  cp $rootdir/[% c('input_files_by_name/firefox') %]/build-infos.json "$OUTDIR"/build-infos-[% c("var/mar_osname") %].json
    
    466
    -[% END -%]
    
    467
    -
    
    468
    -chmod 775 $rootdir/run_scripts "$scripts_dir"/*
    
    469
    -$rootdir/run_scripts [% c("num_procs") %] "$scripts_dir"

  • projects/browser/config
    ... ... @@ -8,8 +8,6 @@ var:
    8 8
       ddmg: '[% INCLUDE ddmg.sh %]'
    
    9 9
       deps:
    
    10 10
         - python3
    
    11
    -    - libparallel-forkmanager-perl
    
    12
    -    - libfile-slurp-perl
    
    13 11
         - bzip2
    
    14 12
         - jq
    
    15 13
       mar_osname: '[% c("var/osname") %]'
    
    ... ... @@ -67,8 +65,6 @@ targets:
    67 65
     
    
    68 66
     input_files:
    
    69 67
       - project: container-image
    
    70
    -  - filename: run_scripts
    
    71
    -    enable: '[% ! c("var/android") %]'
    
    72 68
       - project: firefox
    
    73 69
         name: firefox
    
    74 70
         enable: '[% ! c("var/android") %]'
    

  • projects/browser/ddmg.sh
    ... ... @@ -7,8 +7,8 @@ find [% src %] ! -executable -exec chmod 0644 {} \;
    7 7
     
    
    8 8
     find [% src %] -exec [% c("touch") %] {} \;
    
    9 9
     
    
    10
    -dmg_tmpdir=\$(mktemp -d)
    
    11
    -hfsfile="\$dmg_tmpdir/tbb-uncompressed.dmg"
    
    10
    +dmg_tmpdir=$(mktemp -d)
    
    11
    +hfsfile="$dmg_tmpdir/tbb-uncompressed.dmg"
    
    12 12
     
    
    13 13
     # hfsplus sets all the times to time(NULL)
    
    14 14
     export LD_PRELOAD=[% c("var/faketime_path") %]
    
    ... ... @@ -16,29 +16,29 @@ export FAKETIME="[% USE date; GET date.format(c('timestamp'), format = '%Y-%m-%d
    16 16
     
    
    17 17
     src_dir=[% src %]
    
    18 18
     # 1 for ceiling and 1 for the inode
    
    19
    -fileblocks=\$(find "\$src_dir" -type f -printf '%s\n' | awk '{s += int(\$1 / 4096) + 2} END {print s}')
    
    20
    -directories=\$(find "\$src_dir" -type d | wc -l)
    
    19
    +fileblocks=$(find "$src_dir" -type f -printf '%s\n' | awk '{s += int($1 / 4096) + 2} END {print s}')
    
    20
    +directories=$(find "$src_dir" -type d | wc -l)
    
    21 21
     # Give some room to breathe
    
    22
    -size=\$(echo \$((\$fileblocks + \$directories)) | awk '{print int(\$1 * 1.1)}')
    
    23
    -dd if=/dev/zero of="\$hfsfile" bs=4096 count=\$size
    
    24
    -newfs_hfs -v "[% c('var/display_name') %]" "\$hfsfile"
    
    22
    +size=$(echo $(($fileblocks + $directories)) | awk '{print int($1 * 1.1)}')
    
    23
    +dd if=/dev/zero of="$hfsfile" bs=4096 count=$size
    
    24
    +newfs_hfs -v "[% c('var/display_name') %]" "$hfsfile"
    
    25 25
     
    
    26 26
     pushd [% src %]
    
    27 27
     
    
    28 28
     find -type d -mindepth 1 | sed -e 's/^\.\///' | sort | while read dirname; do
    
    29
    -  hfsplus "\$hfsfile" mkdir "/\$dirname"
    
    30
    -  hfsplus "\$hfsfile" chmod 0755 "/\$dirname"
    
    29
    +  hfsplus "$hfsfile" mkdir "/$dirname"
    
    30
    +  hfsplus "$hfsfile" chmod 0755 "/$dirname"
    
    31 31
     done
    
    32 32
     find -type f | sed -e 's/^\.\///' | sort | while read filename; do
    
    33
    -  hfsplus "\$hfsfile" add "\$filename" "/\$filename"
    
    34
    -  hfsplus "\$hfsfile" chmod \$(stat --format '0%a' "\$filename") "/\$filename"
    
    33
    +  hfsplus "$hfsfile" add "$filename" "/$filename"
    
    34
    +  hfsplus "$hfsfile" chmod $(stat --format '0%a' "$filename") "/$filename"
    
    35 35
     done
    
    36 36
     # hfsplus does not play well with dangling links
    
    37
    -hfsplus "\$hfsfile" symlink /Applications /Applications
    
    37
    +hfsplus "$hfsfile" symlink /Applications /Applications
    
    38 38
     # Show the volume icon
    
    39
    -hfsplus "\$hfsfile" attr / C
    
    39
    +hfsplus "$hfsfile" attr / C
    
    40 40
     
    
    41
    -dmg dmg "\$hfsfile" [% c('dmg_out', { error_if_undef => 1 }) %]
    
    41
    +dmg dmg "$hfsfile" [% c('dmg_out', { error_if_undef => 1 }) %]
    
    42 42
     popd
    
    43 43
     
    
    44
    -rm -Rf "\$dmg_tmpdir"
    44
    +rm -Rf "$dmg_tmpdir"

  • projects/browser/run_scripts deleted
    1
    -#!/usr/bin/perl -w
    
    2
    -use strict;
    
    3
    -
    
    4
    -use Parallel::ForkManager;
    
    5
    -use File::Slurp;
    
    6
    -
    
    7
    -sub exit_error {
    
    8
    -    print STDERR "Error: ", $_[0], "\n";
    
    9
    -    chdir '/';
    
    10
    -    exit (exists $_[1] ? $_[1] : 1);
    
    11
    -}
    
    12
    -
    
    13
    -exit_error "Wrong number of arguments" unless @ARGV == 2;
    
    14
    -my ($nb_threads, $scripts_dir) = @ARGV;
    
    15
    -exit_error "Could not enter $scripts_dir" unless chdir $scripts_dir;
    
    16
    -my $pm = Parallel::ForkManager->new($nb_threads);
    
    17
    -$pm->run_on_finish(
    
    18
    -    sub {
    
    19
    -        my ($pid, $exit, $id) = @_;
    
    20
    -        exit_error "Error running $id" unless $exit == 0;
    
    21
    -        print "Finished $id\n";
    
    22
    -    }
    
    23
    -);
    
    24
    -foreach my $script (sort(read_dir($scripts_dir))) {
    
    25
    -    $pm->start($script) and next;
    
    26
    -    print "Running $script\n";
    
    27
    -    exit_error "Error running $script" unless system("./$script") == 0;
    
    28
    -    $pm->finish;
    
    29
    -}
    
    30
    -$pm->wait_all_children;

  • _______________________________________________
    tor-commits mailing list
    tor-commits@xxxxxxxxxxxxxxxxxxxx
    https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits