From 79ac99c09b7ace9dcd0db1df7505db3e5b59b09d Mon Sep 17 00:00:00 2001 From: Samuel Attard Date: Sat, 22 Jun 2019 22:29:22 -0700 Subject: [PATCH] build: remove scripts in the tools dir that are unused (#18944) --- .dockerignore | 1 - tools/atom_source_root.js | 3 - tools/dump-version-info.js | 80 -------------------------- tools/get-endianness.js | 6 -- tools/linux/pkg-config-wrapper | 54 ------------------ tools/linux/rewrite_dirs.py | 72 ------------------------ tools/linux/sysroot_ld_path.sh | 100 --------------------------------- tools/make_locale_paks.py | 35 ------------ tools/run-electron.sh | 4 -- 9 files changed, 355 deletions(-) delete mode 100644 tools/atom_source_root.js delete mode 100644 tools/dump-version-info.js delete mode 100644 tools/get-endianness.js delete mode 100755 tools/linux/pkg-config-wrapper delete mode 100755 tools/linux/rewrite_dirs.py delete mode 100755 tools/linux/sysroot_ld_path.sh delete mode 100755 tools/make_locale_paks.py delete mode 100644 tools/run-electron.sh diff --git a/.dockerignore b/.dockerignore index abd84a3a662a..fa43feee9940 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,4 +1,3 @@ * !tools/xvfb-init.sh -!tools/run-electron.sh !build/install-build-deps.sh diff --git a/tools/atom_source_root.js b/tools/atom_source_root.js deleted file mode 100644 index 457b4f1a0310..000000000000 --- a/tools/atom_source_root.js +++ /dev/null @@ -1,3 +0,0 @@ -var path = require('path') - -console.log(path.resolve(path.dirname(__dirname))) diff --git a/tools/dump-version-info.js b/tools/dump-version-info.js deleted file mode 100644 index 73f0532bd1f3..000000000000 --- a/tools/dump-version-info.js +++ /dev/null @@ -1,80 +0,0 @@ -var app = require('electron').app -var fs = require('fs') -var request = require('request') - -var TARGET_URL = 'https://electronjs.org/headers/index.json' - -function getDate () { - var today = new Date() - var year = today.getFullYear() - var month = today.getMonth() + 1 - if (month <= 9) month = '0' + month - var day = today.getDate() - if (day <= 9) day = '0' + day - return year + '-' + month + '-' + day -} - -function getInfoForCurrentVersion () { - var json = {} - json.version = process.versions.electron - json.date = getDate() - - var names = ['node', 'v8', 'uv', 'zlib', 'openssl', 'modules', 'chrome'] - for (var i in names) { - var name = names[i] - json[name] = process.versions[name] - } - - json.files = [ - 'darwin-x64', - 'darwin-x64-symbols', - 'linux-ia32', - 'linux-ia32-symbols', - 'linux-x64', - 'linux-x64-symbols', - 'win32-ia32', - 'win32-ia32-symbols', - 'win32-x64', - 'win32-x64-symbols' - ] - - return json -} - -function getIndexJsInServer (callback) { - request(TARGET_URL, function (e, res, body) { - if (e) { - callback(e) - } else if (res.statusCode !== 200) { - callback(new Error('Server returned ' + res.statusCode)) - } else { - callback(null, JSON.parse(body)) - } - }) -} - -function findObjectByVersion (all, version) { - for (var i in all) { - if (all[i].version === version) return i - } - return -1 -} - -app.on('ready', function () { - getIndexJsInServer(function (e, all) { - if (e) { - console.error(e) - process.exit(1) - } - - var current = getInfoForCurrentVersion() - var found = findObjectByVersion(all, current.version) - if (found === -1) { - all.unshift(current) - } else { - all[found] = current - } - fs.writeFileSync(process.argv[2], JSON.stringify(all)) - process.exit(0) - }) -}) diff --git a/tools/get-endianness.js b/tools/get-endianness.js deleted file mode 100644 index fffd04aca40d..000000000000 --- a/tools/get-endianness.js +++ /dev/null @@ -1,6 +0,0 @@ -var os = require('os') -if (os.endianness) { - console.log(require('os').endianness() === 'BE' ? 'big' : 'little') -} else { // Your Node is rather old, but I don't care. - console.log('little') -} diff --git a/tools/linux/pkg-config-wrapper b/tools/linux/pkg-config-wrapper deleted file mode 100755 index 84b57a8fe58e..000000000000 --- a/tools/linux/pkg-config-wrapper +++ /dev/null @@ -1,54 +0,0 @@ -#!/bin/bash -# Copyright (c) 2012 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# This program wraps around pkg-config to generate the correct include and -# library paths when cross-compiling using a sysroot. -# The assumption is that the sysroot contains the .pc files in usr/lib/pkgconfig -# and usr/share/pkgconfig (relative to the sysroot) and that they output paths -# relative to some parent path of the sysroot. -# This assumption is valid for a range of sysroots, in particular: a -# LSB-compliant root filesystem mounted at the sysroot, and a board build -# directory of a Chromium OS chroot. -# Additional directories containing .pc files may be specified by setting -# the PKG_CONFIG_PATH environment variable- these will be prepended to the -# generated paths. - -set -o nounset -set -o errexit - -root="$1" -shift -target_arch="$1" -shift -libpath="$1" -shift - -if [ -z "$root" -o -z "$target_arch" ] -then - echo "usage: $0 /path/to/sysroot target_arch libdir [pkg-config-arguments] package" >&2 - exit 1 -fi - -python2=$(which python2) -if [ ! -x "$python2" ] ; then - python2=python -fi - -rewrite=`dirname $0`/rewrite_dirs.py -package=${!#} - -libdir=$root/usr/$libpath/pkgconfig:$root/usr/share/pkgconfig - -set -e -# Some sysroots, like the Chromium OS ones, may generate paths that are not -# relative to the sysroot. For example, -# /path/to/chroot/build/x86-generic/usr/lib/pkgconfig/pkg.pc may have all paths -# relative to /path/to/chroot (i.e. prefix=/build/x86-generic/usr) instead of -# relative to /path/to/chroot/build/x86-generic (i.e prefix=/usr). -# To support this correctly, it's necessary to extract the prefix to strip from -# pkg-config's |prefix| variable. -prefix=`PKG_CONFIG_LIBDIR=$libdir pkg-config --variable=prefix "$package" | sed -e 's|/usr$||'` -result=`PKG_CONFIG_LIBDIR=$libdir pkg-config "$@"` -echo "$result"| $python2 $rewrite --sysroot "$root" --strip-prefix "$prefix" diff --git a/tools/linux/rewrite_dirs.py b/tools/linux/rewrite_dirs.py deleted file mode 100755 index f6e4ecd32950..000000000000 --- a/tools/linux/rewrite_dirs.py +++ /dev/null @@ -1,72 +0,0 @@ -#!/usr/bin/env python -# Copyright (c) 2011 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -"""Rewrites paths in -I, -L and other option to be relative to a sysroot.""" -from __future__ import print_function - -import sys -import os -import optparse - -REWRITE_PREFIX = ['-I', - '-idirafter', - '-imacros', - '-imultilib', - '-include', - '-iprefix', - '-iquote', - '-isystem', - '-L'] - -def RewritePath(path, opts): - """Rewrites a path by stripping the prefix and prepending the sysroot.""" - sysroot = opts.sysroot - prefix = opts.strip_prefix - if os.path.isabs(path) and not path.startswith(sysroot): - if path.startswith(prefix): - path = path[len(prefix):] - path = path.lstrip('/') - return os.path.join(sysroot, path) - else: - return path - - -def RewriteLine(line, opts): - """Rewrites all the paths in recognized options.""" - args = line.split() - count = len(args) - i = 0 - while i < count: - for prefix in REWRITE_PREFIX: - # The option can be either in the form "-I /path/to/dir" or - # "-I/path/to/dir" so handle both. - if args[i] == prefix: - i += 1 - try: - args[i] = RewritePath(args[i], opts) - except IndexError: - sys.stderr.write('Missing argument following %s\n' % prefix) - break - elif args[i].startswith(prefix): - args[i] = prefix + RewritePath(args[i][len(prefix):], opts) - i += 1 - - return ' '.join(args) - - -def main(argv): - parser = optparse.OptionParser() - parser.add_option('-s', '--sysroot', default='/', help='sysroot to prepend') - parser.add_option('-p', '--strip-prefix', default='', help='prefix to strip') - opts, args = parser.parse_args(argv[1:]) - - for line in sys.stdin.readlines(): - line = RewriteLine(line.strip(), opts) - print(line) - return 0 - - -if __name__ == '__main__': - sys.exit(main(sys.argv)) diff --git a/tools/linux/sysroot_ld_path.sh b/tools/linux/sysroot_ld_path.sh deleted file mode 100755 index 4b8bf7305e2f..000000000000 --- a/tools/linux/sysroot_ld_path.sh +++ /dev/null @@ -1,100 +0,0 @@ -#!/bin/sh -# Copyright (c) 2013 The Chromium Authors. All rights reserved. -# Use of this source code is governed by a BSD-style license that can be -# found in the LICENSE file. - -# Reads etc/ld.so.conf and/or etc/ld.so.conf.d/*.conf and returns the -# appropriate linker flags. -# -# sysroot_ld_path.sh /abspath/to/sysroot -# - -log_error_and_exit() { - echo $0: $@ - exit 1 -} - -process_entry() { - if [ -z "$1" ] || [ -z "$2" ]; then - log_error_and_exit "bad arguments to process_entry()" - fi - local root="$1" - local localpath="$2" - - echo $localpath | grep -qs '^/' - if [ $? -ne 0 ]; then - log_error_and_exit $localpath does not start with / - fi - local entry="$root$localpath" - echo -L$entry - echo -Wl,-rpath-link=$entry -} - -process_ld_so_conf() { - if [ -z "$1" ] || [ -z "$2" ]; then - log_error_and_exit "bad arguments to process_ld_so_conf()" - fi - local root="$1" - local ld_so_conf="$2" - - # ld.so.conf may include relative include paths. pushd is a bashism. - local saved_pwd=$(pwd) - cd $(dirname "$ld_so_conf") - - cat "$ld_so_conf" | \ - while read ENTRY; do - echo "$ENTRY" | grep -qs ^include - if [ $? -eq 0 ]; then - local included_files=$(echo "$ENTRY" | sed 's/^include //') - echo "$included_files" | grep -qs ^/ - if [ $? -eq 0 ]; then - if ls $root$included_files >/dev/null 2>&1 ; then - for inc_file in $root$included_files; do - process_ld_so_conf "$root" "$inc_file" - done - fi - else - if ls $(pwd)/$included_files >/dev/null 2>&1 ; then - for inc_file in $(pwd)/$included_files; do - process_ld_so_conf "$root" "$inc_file" - done - fi - fi - continue - fi - - echo "$ENTRY" | grep -qs ^/ - if [ $? -eq 0 ]; then - process_entry "$root" "$ENTRY" - fi - done - - # popd is a bashism - cd "$saved_pwd" -} - -# Main - -if [ $# -ne 1 ]; then - echo Usage $0 /abspath/to/sysroot - exit 1 -fi - -echo $1 | grep -qs ' ' -if [ $? -eq 0 ]; then - log_error_and_exit $1 contains whitespace. -fi - -LD_SO_CONF="$1/etc/ld.so.conf" -LD_SO_CONF_D="$1/etc/ld.so.conf.d" - -if [ -e "$LD_SO_CONF" ]; then - process_ld_so_conf "$1" "$LD_SO_CONF" | xargs echo -elif [ -e "$LD_SO_CONF_D" ]; then - find "$LD_SO_CONF_D" -maxdepth 1 -name '*.conf' -print -quit > /dev/null - if [ $? -eq 0 ]; then - for entry in $LD_SO_CONF_D/*.conf; do - process_ld_so_conf "$1" "$entry" - done | xargs echo - fi -fi diff --git a/tools/make_locale_paks.py b/tools/make_locale_paks.py deleted file mode 100755 index 70597f54ab40..000000000000 --- a/tools/make_locale_paks.py +++ /dev/null @@ -1,35 +0,0 @@ -#!/usr/bin/env python - -# usage: make_locale_paks build_dir [...] -# -# This script creates the .pak files under locales directory, it is used to fool -# the ResourcesBundle that the locale is available. - -import errno -import sys -import os - - -def main(): - target_dir = sys.argv[1] - locale_dir = os.path.join(target_dir, 'locales') - safe_mkdir(locale_dir) - for pak in sys.argv[2:]: - touch(os.path.join(locale_dir, pak + '.pak')) - - -def touch(filename): - with open(filename, 'w+'): - pass - - -def safe_mkdir(path): - try: - os.makedirs(path) - except OSError as e: - if e.errno != errno.EEXIST: - raise - - -if __name__ == '__main__': - sys.exit(main()) diff --git a/tools/run-electron.sh b/tools/run-electron.sh deleted file mode 100644 index 47b191d04f6e..000000000000 --- a/tools/run-electron.sh +++ /dev/null @@ -1,4 +0,0 @@ -export DISPLAY=":99.0" -sh -e /etc/init.d/xvfb start -cd /tmp/workspace/project/ -out/D/electron --version