Skip to content

Commit d6a21fa

Browse files
AhrotahnPF4Public
authored andcommitted
Add script to clone source tree
1 parent 9453af3 commit d6a21fa

File tree

11 files changed

+480
-3535
lines changed

11 files changed

+480
-3535
lines changed

.cirrus.yml

Lines changed: 23 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,9 @@ container:
33

44
code_check_task:
55
pip_cache:
6-
folder: ~/.cache/pip
6+
folder: /usr/local/lib/python3.6/site-packages
77
fingerprint_script: cat .cirrus_requirements.txt
88
populate_script: pip install -r .cirrus_requirements.txt
9-
pip_install_script:
10-
# Needed in order for yapf to be fully installed
11-
- pip install -r .cirrus_requirements.txt
129
utils_script:
1310
- python3 -m yapf --style '.style.yapf' -e '*/third_party/*' -rpd utils
1411
- ./devutils/run_utils_pylint.py --hide-fixme
@@ -22,17 +19,32 @@ validate_config_task:
2219
validate_config_script: ./devutils/validate_config.py
2320

2421
validate_with_source_task:
22+
pip_cache:
23+
folder: /usr/local/lib/python3.6/site-packages
24+
fingerprint_script: cat .cirrus_requirements.txt
25+
populate_script: pip install -r .cirrus_requirements.txt
2526
chromium_download_cache:
2627
folder: chromium_download_cache
2728
fingerprint_script: cat chromium_version.txt
28-
populate_script:
29-
# This directory will not exist when this is called, unless cach retrieval
29+
populate_script: |
30+
# These directories will not exist when this is called, unless cache retrieval
3031
# fails and leaves partially-complete files around.
31-
- rm -rf chromium_download_cache || true
32-
- mkdir chromium_download_cache
33-
- ./utils/downloads.py retrieve -i downloads.ini -c chromium_download_cache
34-
unpack_source_script:
35-
- ./utils/downloads.py unpack -i downloads.ini -c chromium_download_cache chromium_src
32+
rm -rf chromium_src
33+
rm -rf chromium_download_cache
34+
mkdir chromium_download_cache
35+
# Attempt to download tarball
36+
if ! ./utils/downloads.py retrieve -i downloads.ini -c chromium_download_cache ; then
37+
# If tarball is not available, attempt a clone
38+
./utils/clone.py -o chromium_src
39+
rm -rf chromium_src/uc_staging
40+
find chromium_src -type d -name '.git' -exec rm -rf "{}" \; -prune
41+
tar cf chromium_download_cache/chromium-$(cat chromium_version.txt).tar.xz \
42+
--transform s/chromium_src/chromium-$(cat chromium_version.txt)/ chromium_src
43+
fi
44+
unpack_source_script: |
45+
if [ ! -d chromium_src ]; then
46+
./utils/downloads.py unpack -i downloads.ini -c chromium_download_cache chromium_src
47+
fi
3648
validate_patches_script:
3749
- ./devutils/validate_patches.py -l chromium_src
3850
validate_lists_script:

.cirrus_Dockerfile

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
# Dockerfile for Python 3 with xz-utils (for tar.xz unpacking)
22

3-
FROM python:3.6-slim
3+
FROM python:3.6-slim-buster
44

5-
RUN apt update && apt install -y xz-utils patch axel
5+
RUN apt update && apt install -y xz-utils patch axel curl git

.cirrus_requirements.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@ astroid==2.1.0 # via pylint
33
pylint==2.2.2
44
pytest-cov==2.6.0
55
pytest==3.10.1
6+
httplib2==0.11.3
67
requests==2.21.0
78
yapf==0.25.0

devutils/update_lists.py

Lines changed: 19 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
sys.path.insert(0, str(Path(__file__).resolve().parent.parent / 'utils'))
2323
from _common import get_logger
2424
from domain_substitution import DomainRegexList, TREE_ENCODINGS
25+
from prune_binaries import CONTINGENT_PATHS
2526
sys.path.pop(0)
2627

2728
# Encoding for output files
@@ -74,6 +75,7 @@
7475
'*.woff',
7576
'*.woff2',
7677
'*makefile',
78+
'*.profdata',
7779
'*.xcf',
7880
'*.cur',
7981
'*.pdf',
@@ -253,22 +255,23 @@ def compute_lists_proc(path, source_tree, search_regex):
253255
symlink_set = set()
254256
if path.is_file():
255257
relative_path = path.relative_to(source_tree)
256-
if path.is_symlink():
257-
try:
258-
resolved_relative_posix = path.resolve().relative_to(source_tree).as_posix()
259-
symlink_set.add((resolved_relative_posix, relative_path.as_posix()))
260-
except ValueError:
261-
# Symlink leads out of the source tree
262-
pass
263-
else:
264-
try:
265-
if should_prune(path, relative_path, used_pep_set, used_pip_set):
266-
pruning_set.add(relative_path.as_posix())
267-
elif should_domain_substitute(path, relative_path, search_regex, used_dep_set,
268-
used_dip_set):
269-
domain_substitution_set.add(relative_path.as_posix())
270-
except: #pylint: disable=bare-except
271-
get_logger().exception('Unhandled exception while processing %s', relative_path)
258+
if not any(cpath in str(relative_path.as_posix()) for cpath in CONTINGENT_PATHS):
259+
if path.is_symlink():
260+
try:
261+
resolved_relative_posix = path.resolve().relative_to(source_tree).as_posix()
262+
symlink_set.add((resolved_relative_posix, relative_path.as_posix()))
263+
except ValueError:
264+
# Symlink leads out of the source tree
265+
pass
266+
elif not any(skip in ('.git', '__pycache__', 'uc_staging') for skip in path.parts):
267+
try:
268+
if should_prune(path, relative_path, used_pep_set, used_pip_set):
269+
pruning_set.add(relative_path.as_posix())
270+
elif should_domain_substitute(path, relative_path, search_regex, used_dep_set,
271+
used_dip_set):
272+
domain_substitution_set.add(relative_path.as_posix())
273+
except: #pylint: disable=bare-except
274+
get_logger().exception('Unhandled exception while processing %s', relative_path)
272275
return (used_pep_set, used_pip_set, used_dep_set, used_dip_set, pruning_set,
273276
domain_substitution_set, symlink_set)
274277

docs/developing.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,15 +34,22 @@ To gain a deeper understanding of this updating process, have a read through [do
3434
* This is available in most (if not all) Linux distributions, and also Homebrew on macOS.
3535
* This utility facilitates most of the updating process, so it is important to learn how to use this. The manpage for quilt (as of early 2017) lacks an example of a workflow. There are multiple guides online, but [this guide from Debian](https://wiki.debian.org/UsingQuilt) and [the referenced guide on that page](https://raphaelhertzog.com/2012/08/08/how-to-use-quilt-to-manage-patches-in-debian-packages/) are the ones referenced in developing the current workflow.
3636
* Python 3.6 or newer
37+
* `httplib2` and `six` are also required if you wish to utilize a source clone instead of the source tarball.
3738

3839
### Downloading the source code
3940

41+
#### Source tarball download (recommended):
4042
```sh
4143
mkdir -p build/download_cache
4244
./utils/downloads.py retrieve -i downloads.ini -c build/download_cache
4345
./utils/downloads.py unpack -i downloads.ini -c build/download_cache build/src
4446
```
4547

48+
#### Source clone:
49+
```sh
50+
./utils/clone.py -o build/src
51+
```
52+
4653
### Updating lists
4754

4855
The utility `devutils/update_lists.py` automates this process. By default, it will update the files in the local repo. Pass in `-h` or `--help` for available options.

0 commit comments

Comments
 (0)