Clarify cgmanifest.json update process. (#9664)

This commit is contained in:
Edward Chen 2021-11-04 16:23:52 -07:00 committed by GitHub
parent 90de3c8e7c
commit a355bcbd73
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 21 additions and 12 deletions

View file

@ -1,21 +1,27 @@
# CGManifest Files
This directory contains CGManifest (cgmanifest.json) files.
See here for details: https://docs.opensource.microsoft.com/tools/cg/cgmanifest.html
See [here](https://docs.opensource.microsoft.com/tools/cg/cgmanifest.html) for details.
`cgmanifests/cgmanifest.json` contains entries that don't belong in more specific categories (e.g., git submodules).
## `cgmanifests/generated/cgmanifest.json`
This file contains generated CGManifest entries.
## Git Submodules
`cgmanifests/submodules/cgmanifest.json` contains entries for git submodules.
It can be generated like this:
It covers these dependencies:
- git submodules
- dependencies from the Dockerfile `tools/ci_build/github/linux/docker/Dockerfile.manylinux2014_cuda11`
If any of these dependencies change, this file should be updated.
**When updating, please regenerate instead of editing manually.**
### How to Generate
1. Change to the repository root directory.
2. Ensure the submodules are checked out. For example, with:
2. Ensure the git submodules are checked out and up to date. For example, with:
```
$ git submodule update --init --recursive
```
3. Run the generator script:
```
$ python cgmanifests/submodules/generate_submodule_cgmanifest.py > cgmanifests/submodules/cgmanifest.json
$ python cgmanifests/generate_cgmanifest.py
```
Please update this cgmanifest.json file when any git submodules change.
## `cgmanifests/cgmanifest.json`
This file contains non-generated CGManifest entries. Please edit directly as needed.

View file

@ -2,12 +2,12 @@
import json
import os
import re
import subprocess
import sys
import re
SCRIPT_DIR = os.path.dirname(os.path.realpath(__file__))
REPO_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, "..", ".."))
REPO_DIR = os.path.normpath(os.path.join(SCRIPT_DIR, ".."))
package_name = None
package_filename = None
@ -16,7 +16,7 @@ package_url = None
registrations = []
with open(os.path.join(REPO_DIR, 'tools', 'ci_build', 'github', 'linux', 'docker', 'Dockerfile.manylinux2014_cuda11'),
"r") as f:
mode="r") as f:
for line in f:
if not line.strip():
package_name = None
@ -95,4 +95,5 @@ for submodule_line in submodule_lines:
cgmanifest = {"Version": 1, "Registrations": registrations}
print(json.dumps(cgmanifest, indent=2))
with open(os.path.join(SCRIPT_DIR, "generated", "cgmanifest.json"), mode="w") as generated_cgmanifest_file:
print(json.dumps(cgmanifest, indent=2), file=generated_cgmanifest_file)

View file

@ -0,0 +1,2 @@
`cgmanifests/generated/cgmanifest.json` is a generated file. Please do not edit it directly.
More info [here](../README.md).