v0.43.1
This commit is contained in:
1 parent
5b6d4a7903
commit
4d1087e357
160 files changed
+2407
-1933
No files matched your search
+3
-11
@@ -21,10 +21,9 @@ MANAGED = [
|
||||
]
|
||||
EXCLUDED = {'__pycache__', '.DS_Store', 'node_modules', 'target', 'data', '.git', '.upgrade-backup'}
|
||||
EXECUTABLE_ROOT = {'dev.sh', 'upgrade.sh', 'install.sh', 'install-debian13.sh', 'update.sh', 'make_zip.py'}
|
||||
ZIP_MIN_EPOCH = 315532800 # 1980-01-01T00:00:00Z
|
||||
ZIP_MAX_EPOCH = 4354819198 # 2107-12-31T23:59:58Z
|
||||
DEFAULT_SOURCE_DATE_EPOCH = 946684800 # 2000-01-01T00:00:00Z
|
||||
|
||||
ZIP_MIN_EPOCH = 315532800
|
||||
ZIP_MAX_EPOCH = 4354819198
|
||||
DEFAULT_SOURCE_DATE_EPOCH = 946684800
|
||||
|
||||
def files() -> list[Path]:
|
||||
result: list[Path] = []
|
||||
@@ -39,7 +38,6 @@ def files() -> list[Path]:
|
||||
rel = file.relative_to(ROOT)
|
||||
if any(part in EXCLUDED for part in rel.parts) or file.suffix in ('.pyc', '.pyo', '.zip'):
|
||||
continue
|
||||
# Never ship local .env files; templates such as .env.example are listed explicitly.
|
||||
if rel.name == '.env':
|
||||
continue
|
||||
if rel.as_posix() == 'docker-agent/docker-agent':
|
||||
@@ -50,7 +48,6 @@ def files() -> list[Path]:
|
||||
result.append(file)
|
||||
return sorted(set(result), key=lambda path: path.relative_to(ROOT).as_posix())
|
||||
|
||||
|
||||
def release_datetime() -> tuple[int, int, int, int, int, int]:
|
||||
raw = os.environ.get('SOURCE_DATE_EPOCH')
|
||||
try:
|
||||
@@ -59,11 +56,9 @@ def release_datetime() -> tuple[int, int, int, int, int, int]:
|
||||
raise ValueError('SOURCE_DATE_EPOCH must be an integer Unix timestamp') from error
|
||||
epoch = min(max(epoch, ZIP_MIN_EPOCH), ZIP_MAX_EPOCH)
|
||||
stamp = dt.datetime.fromtimestamp(epoch, tz=dt.timezone.utc).replace(microsecond=0)
|
||||
# The classic ZIP timestamp stores seconds in two-second increments.
|
||||
stamp = stamp.replace(second=stamp.second - stamp.second % 2)
|
||||
return stamp.year, stamp.month, stamp.day, stamp.hour, stamp.minute, stamp.second
|
||||
|
||||
|
||||
def deterministic_mode(rel: Path) -> int:
|
||||
executable = rel.as_posix() in EXECUTABLE_ROOT or (
|
||||
rel.parts and rel.parts[0] in {'scripts', 'tools', 'integrations'} and rel.suffix in {'.py', '.sh'}
|
||||
@@ -74,7 +69,6 @@ def deterministic_mode(rel: Path) -> int:
|
||||
)
|
||||
return 0o755 if executable else 0o644
|
||||
|
||||
|
||||
def add_file(archive: zipfile.ZipFile, rel: Path, data: bytes, timestamp: tuple[int, int, int, int, int, int]) -> None:
|
||||
info = zipfile.ZipInfo(f'RustProxy/{rel.as_posix()}', date_time=timestamp)
|
||||
info.create_system = 3
|
||||
@@ -82,7 +76,6 @@ def add_file(archive: zipfile.ZipFile, rel: Path, data: bytes, timestamp: tuple[
|
||||
info.compress_type = zipfile.ZIP_DEFLATED
|
||||
archive.writestr(info, data, compress_type=zipfile.ZIP_DEFLATED, compresslevel=9)
|
||||
|
||||
|
||||
def main() -> None:
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
parser.add_argument('output', nargs='?', type=Path, default=ROOT.parent / f'RustProxy-{project_version(ROOT)}.zip')
|
||||
@@ -105,6 +98,5 @@ def main() -> None:
|
||||
add_file(archive, Path('SHA256SUMS'), checksum.read_bytes(), timestamp)
|
||||
print(f'Created {output}; {len(paths) + 1} source files; deterministic SHA256SUMS refreshed.')
|
||||
|
||||
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
Reference in new issue
Block a user