Skip to content

Commit a16a38a

Browse files
committed
meta: Inital rewrite (not yet usable)
* removed plugin system (nobody used it anyways) * removed unused functions from utils module * removed unreliable threaded builder * use bashvar to parse spec files * more reliable dependency resolver * resolves dependency prior to building * PEP-484 typing conformance * added mypy to enforce PEP-484 conformance * more comments coverage * use de-facto setup.py for packaging
1 parent 9815a3d commit a16a38a

33 files changed

+1158
-1865
lines changed

.gitignore

Lines changed: 139 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,139 @@
1-
**/__pycache__
2-
/docs/build
3-
repo
1+
# Byte-compiled / optimized / DLL files
2+
__pycache__/
3+
*.py[cod]
4+
*$py.class
5+
6+
# C extensions
7+
*.so
8+
9+
# Distribution / packaging
10+
.Python
11+
build/
12+
develop-eggs/
13+
dist/
14+
downloads/
15+
eggs/
16+
.eggs/
17+
lib/
18+
lib64/
19+
parts/
20+
sdist/
21+
var/
22+
wheels/
23+
pip-wheel-metadata/
24+
share/python-wheels/
25+
*.egg-info/
26+
.installed.cfg
27+
*.egg
28+
MANIFEST
29+
30+
# PyInstaller
31+
# Usually these files are written by a python script from a template
32+
# before PyInstaller builds the exe, so as to inject date/other infos into it.
33+
*.manifest
34+
*.spec
35+
36+
# Installer logs
37+
pip-log.txt
38+
pip-delete-this-directory.txt
39+
40+
# Unit test / coverage reports
41+
htmlcov/
42+
.tox/
43+
.nox/
44+
.coverage
45+
.coverage.*
46+
.cache
47+
nosetests.xml
48+
coverage.xml
49+
*.cover
50+
*.py,cover
51+
.hypothesis/
52+
.pytest_cache/
53+
cover/
54+
55+
# Translations
56+
*.mo
57+
*.pot
58+
59+
# Django stuff:
60+
*.log
61+
local_settings.py
62+
db.sqlite3
63+
db.sqlite3-journal
64+
65+
# Flask stuff:
66+
instance/
67+
.webassets-cache
68+
69+
# Scrapy stuff:
70+
.scrapy
71+
72+
# Sphinx documentation
73+
docs/_build/
74+
75+
# PyBuilder
76+
.pybuilder/
77+
target/
78+
79+
# Jupyter Notebook
80+
.ipynb_checkpoints
81+
82+
# IPython
83+
profile_default/
84+
ipython_config.py
85+
86+
# pyenv
87+
# For a library or package, you might want to ignore these files since the code is
88+
# intended to run in multiple environments; otherwise, check them in:
89+
# .python-version
90+
91+
# pipenv
92+
# According to pypa/pipenv#598, it is recommended to include Pipfile.lock in version control.
93+
# However, in case of collaboration, if having platform-specific dependencies or dependencies
94+
# having no cross-platform support, pipenv may install dependencies that don't work, or not
95+
# install all needed dependencies.
96+
#Pipfile.lock
97+
98+
# PEP 582; used by e.g. github.com/David-OConnor/pyflow
99+
__pypackages__/
100+
101+
# Celery stuff
102+
celerybeat-schedule
103+
celerybeat.pid
104+
105+
# SageMath parsed files
106+
*.sage.py
107+
108+
# Environments
109+
.env
110+
.venv
111+
env/
112+
venv/
113+
ENV/
114+
env.bak/
115+
venv.bak/
116+
117+
# Spyder project settings
118+
.spyderproject
119+
.spyproject
120+
121+
# Rope project settings
122+
.ropeproject
123+
124+
# mkdocs documentation
125+
/site
126+
127+
# mypy
128+
.mypy_cache/
129+
.dmypy.json
130+
dmypy.json
131+
132+
# Pyre type checker
133+
.pyre/
134+
135+
# pytype static type analyzer
136+
.pytype/
137+
138+
# Cython debug symbols
139+
cython_debug/

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,17 @@ Dependencies
2424
------------
2525

2626
Mandatory:
27-
- Python 3 (>= 3.3): Running the program itself.
27+
- Python 3 (>= 3.6): Running the program itself.
2828
- GNU File (libmagic): File type detection.
2929
- Util-Linux: File checksum verification.
3030
- LibArchive (bsdtar): Archive handling.
3131
- GNU Wget or Aria2: Source downloading.
3232
- [Autobuild3](https://github.com/AOSC-Dev/autobuild3): Package building.
3333

3434
Optional:
35-
- psutil: Build timing, disk space detection, device health (temperature).
3635
- libmagic: Python module to detect file type.
3736
- libarchive-c: Python module to handle archives.
37+
- pycrypto: Python module to verify file checksums.
3838
- ptyprocess, pexpect: Build logging.
3939

4040
Deployment

acbs-build.py renamed to acbs-build

Lines changed: 11 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -8,11 +8,12 @@
88
import sys
99
import shutil
1010
import argparse
11-
from acbs.mainflow import BuildCore
1211
import acbs
1312

13+
from acbs.main import BuildCore
1414

15-
def main():
15+
16+
def main() -> None:
1617
tmp_loc = '/var/cache/acbs/build/'
1718
parser = argparse.ArgumentParser(description=help_msg(acbs.__version__
1819
), formatter_class=argparse.RawDescriptionHelpFormatter)
@@ -25,47 +26,37 @@ def main():
2526
parser.add_argument('packages', nargs='*', help='Packages to be built')
2627
parser.add_argument('-c', '--clear', help='Clear build directory',
2728
action='store_true', dest='clear_dir')
28-
parser.add_argument('-s', '--system-log', help='Pass logs to system log collector',
29-
action='store_true', dest='syslog')
3029
parser.add_argument('-k', '--skip-deps', help='Skip dependency resolution',
3130
action='store_true', dest='no_deps')
3231
parser.add_argument('-g', '--get',
3332
help='Only download source packages without building', action="store_true")
3433
args = parser.parse_args()
3534
if args.clear_dir:
3635
clear_tmp(tmp_dir=tmp_loc)
36+
del args.clear_dir
3737
if args.packages:
38-
acbs_core_args = {'pkgs_name': args.packages,
39-
'debug_mode': args.debug, 'version': acbs.__version__}
40-
if args.syslog:
41-
acbs_core_args['syslog'] = True
42-
if args.get:
43-
acbs_core_args['download_only'] = True
44-
if args.acbs_tree:
45-
acbs_core_args['tree'] = args.acbs_tree[0]
46-
acbs_instance = BuildCore(**acbs_core_args)
47-
else:
48-
acbs_instance = BuildCore(**acbs_core_args)
38+
# the rest of the arguments are passed to the build process
39+
acbs_instance = BuildCore(args)
4940
acbs_instance.build()
5041
# HACK: Workaround a bug in ArgumentParser
5142
if len(sys.argv) < 2:
5243
parser.print_help()
5344
sys.exit(0)
5445

5546

56-
def clear_tmp(tmp_dir: str):
47+
def clear_tmp(tmp_dir: str) -> None:
5748
from time import sleep
5849

5950
def show_progress():
6051
try:
6152
print(hide_cursor, end='')
6253
while not complete_status:
6354
for bar in ['-', '\\', '|', '/']:
64-
print('\r[%s%%] Clearing cache...%s' %
65-
(int((sub_dirs_deleted / sub_dirs_count) * 100), bar), end='')
55+
print('\r[%s/%s] Clearing cache...%s' %
56+
(sub_dirs_deleted, sub_dirs_count, bar), end='')
6657
sys.stdout.flush()
6758
sleep(0.1)
68-
print('\r[100%%] Clearing cache...done! %s\n' %
59+
print('\r[OK] Clearing cache...done! %s\n' %
6960
(show_cursor), end='')
7061
except Exception as ex:
7162
print(show_cursor, end='')
@@ -90,7 +81,7 @@ def show_progress():
9081
return
9182

9283

93-
def help_msg(acbs_version: str):
84+
def help_msg(acbs_version: str) -> str:
9485
help_msg = '''ACBS - AOSC CI Build System\nVersion: {}\nA small alternative system to port abbs to CI environment to prevent from irregular bash failures'''.format(
9586
acbs_version)
9687
return help_msg

acbs/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
__version__ = '20190807'
1+
__version__ = '20200427'

acbs/base.py

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
from typing import List, Optional, Dict, Tuple, Deque
2+
3+
4+
class ACBSSourceInfo(object):
5+
def __init__(self, type: str, url: str, version: str, revision=None, branch=None, depth=None) -> None:
6+
self.type = type
7+
self.url = url
8+
self.subdir: Optional[str]= None
9+
self.version = version
10+
self.revision: Optional[str] = revision
11+
self.branch: Optional[str] = branch
12+
self.depth: Optional[int] = depth
13+
self.chksum: Tuple[str, str] = ('', '')
14+
self.source_location: Optional[str] = None # where the source file/folder is located (on local filesystem)
15+
16+
def __repr__(self) -> str:
17+
return '<ACBSSourceInfo {type}: {url}:{branch}@{revision} integrity: {checksum}>'.format(type=self.type, url=self.url, branch=self.branch, revision=self.revision, checksum=self.chksum)
18+
19+
20+
class ACBSPackageInfo(object):
21+
def __init__(self, name: str, deps: List[str], location: str, source_uri: ACBSSourceInfo) -> None:
22+
self.name = name
23+
self.deps = deps
24+
self.installables: List[str] = [] # installable dependencies
25+
self.build_location = ''
26+
self.base_slug = '' # group slug (like extra-devel/llvm), if any
27+
self.group_seq = 0 # group sequence number
28+
self.source_uri = source_uri
29+
self.script_location = location # script location (autobuild directory)
30+
31+
def __repr__(self) -> str:
32+
return '<ACBSPackageInfo {name}: - deps: {deps} - uri: {uri}>'.format(name=self.name, deps=self.deps, uri=self.source_uri)

0 commit comments

Comments
 (0)