From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1851) id E7581384F034; Wed, 9 Nov 2022 18:37:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org E7581384F034 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1668019054; bh=bb+beJZCUy3tzVxYgYAekyiy9Gp1xKzKx38sycadGf4=; h=From:To:Subject:Date:From; b=cLqzKxxVEmcStdVSECfDjNEfRiROLrxM1jl2Nr1HUDuO/HlepHaZlH2H2SLgousuj k5LI6mCpXUL965xJOo4WZBOsQ+Awy4FpL06qeGErw3WH7UGjlftS6mCjRcuel/uY7+ TIOzoAAeYQRi+New2Hyov3Z3JxivXUO74oUd5bkw= MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="utf-8" From: Martin Liska To: gcc-cvs@gcc.gnu.org Subject: [gcc r13-3861] docs: create sources tarball X-Act-Checkin: gcc X-Git-Author: Martin Liska X-Git-Refname: refs/heads/master X-Git-Oldrev: 4eadbe80060ab6c45193a1a57fac84b035e1c328 X-Git-Newrev: 52eedc1fa3d211f29196eed60e11e6a8738329c2 Message-Id: <20221109183734.E7581384F034@sourceware.org> Date: Wed, 9 Nov 2022 18:37:34 +0000 (GMT) List-Id: https://gcc.gnu.org/g:52eedc1fa3d211f29196eed60e11e6a8738329c2 commit r13-3861-g52eedc1fa3d211f29196eed60e11e6a8738329c2 Author: Martin Liska Date: Wed Nov 9 19:36:39 2022 +0100 docs: create sources tarball maintainer-scripts/ChangeLog: * update_web_docs_git.py: Create sources tarball. Diff: --- maintainer-scripts/update_web_docs_git.py | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/maintainer-scripts/update_web_docs_git.py b/maintainer-scripts/update_web_docs_git.py index 18c8bbb8324..d9cf9b70968 100755 --- a/maintainer-scripts/update_web_docs_git.py +++ b/maintainer-scripts/update_web_docs_git.py @@ -37,6 +37,32 @@ def find_configs(): yield (Path(root).resolve(), docname) +def create_source_tarball(output, configs): + pwd = Path('.').resolve() + subfolders = {'doc'} + explicit_files = {'gcc/BASE-VER', 'gcc/DEV-PHASE', 'gcc/DATESTAMP'} + + for location, _ in configs: + location = location.relative_to(pwd) + while not location.name == 'doc': + location = location.parent + subfolders.add(location) + + sources = Path('sources') + sources.mkdir() + + # Copy all subfolders and files + for subfolder in subfolders: + shutil.copytree(subfolder, sources / subfolder) + + for filename in explicit_files: + shutil.copy(filename, sources / filename) + + shutil.make_archive(Path(output, 'docs-sources'), 'gztar', + sources) + print('sources tarball has been created') + + with tempfile.TemporaryDirectory() as folder: print(f'Using {folder} as temporary directory') os.chdir(folder) @@ -49,6 +75,9 @@ with tempfile.TemporaryDirectory() as folder: if not output.exists(): output.mkdir() + # Create source tarball + create_source_tarball(output, configs) + temp = Path('tmp').resolve() temp.mkdir()