diff options
author | Alyssa Ross <hi@alyssa.is> | 2020-05-30 17:40:25 +0000 |
---|---|---|
committer | Alyssa Ross <hi@alyssa.is> | 2020-06-02 03:24:37 +0000 |
commit | e72c23ff066a947473ef18973bed07ce192ec3b2 (patch) | |
tree | 11bd5b47b89d32f61424ab3b57a0e183a850f329 /pkgs/os-specific/linux/chromium-os/update.py | |
parent | cfa1e27fdfb68503311f5b509b47bc6722d63601 (diff) | |
download | nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.tar nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.tar.gz nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.tar.bz2 nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.tar.lz nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.tar.xz nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.tar.zst nixpkgs-e72c23ff066a947473ef18973bed07ce192ec3b2.zip |
chromiumOSPackages: improve update.py repo compat
These changes make chromiumOSPackages.updateScript better understand the Repo manifest format[1]. It now properly distinguishes between paths in the Chromium OS source tree and paths on the git servers, which are usually not the same. For example, chromiumos-overlay is located in the source tree at src/third_party/chromiumos-overlay, but on chromium.googlesource.com it's located at chromiumos/overlays/chromiumos-overlays. Components are now keyed by their location in the Chromium OS source tree (and packages have all been updated for this change.) Additionally, it now understands Repo remotes. This means that it is now possible to use a Chromium OS component like Minijail, which is hosted on android.googlesource.com rather than chromiumos.googlesource.com. This was not previously possible. [1]: https://gerrit.googlesource.com/git-repo/+/HEAD/docs/manifest-format.md Message-Id: <20200530190028.6388-1-hi@alyssa.is> Reviewed-by: Cole Helbling <cole.e.helbling@outlook.com>
Diffstat (limited to 'pkgs/os-specific/linux/chromium-os/update.py')
-rwxr-xr-x | pkgs/os-specific/linux/chromium-os/update.py | 56 |
1 files changed, 35 insertions, 21 deletions
diff --git a/pkgs/os-specific/linux/chromium-os/update.py b/pkgs/os-specific/linux/chromium-os/update.py index 1405c534d8b..58a15dbb8e8 100755 --- a/pkgs/os-specific/linux/chromium-os/update.py +++ b/pkgs/os-specific/linux/chromium-os/update.py @@ -13,16 +13,16 @@ from re import MULTILINE, fullmatch, match, search from urllib.request import urlopen # ChromiumOS components used in Nixpkgs -components = [ - 'aosp/platform/external/modp_b64', - 'chromiumos/overlays/chromiumos-overlay', - 'chromiumos/platform/crosvm', - 'chromiumos/platform/minigbm', - 'chromiumos/platform2', - 'chromiumos/third_party/adhd', - 'chromiumos/third_party/kernel', - 'chromiumos/third_party/libqmi', - 'chromiumos/third_party/modemmanager-next', +component_paths = [ + 'src/platform/crosvm', + 'src/platform/minigbm', + 'src/platform2', + 'src/third_party/adhd', + 'src/third_party/chromiumos-overlay', + 'src/third_party/kernel/v5.4', + 'src/third_party/libqmi', + 'src/third_party/modemmanager-next', + 'src/third_party/modp_b64', ] git_root = 'https://chromium.googlesource.com/' @@ -65,14 +65,28 @@ with urlopen(f'{buildspecs_url}{chrome_major_version}/?format=TEXT') as resp: buildspecs.sort(reverse=True) buildspec = splitext(buildspecs[0])[0] -revisions = {} +components = {} # Read the buildspec, and extract the git revisions for each component. with urlopen(f'{buildspecs_url}{chrome_major_version}/{buildspec}.xml?format=TEXT') as resp: xml = base64.decodebytes(resp.read()) root = etree.fromstring(xml) + + default_remote = root.find('default').get('remote') + remotes = {} + for remote in root.findall('remote'): + remotes[remote.get('name')] = remote.get('fetch') + for project in root.findall('project'): - revisions[project.get('name')] = project.get('revision') + name = project.get('name') + path = project.get('path') + remote_name = project.get('remote') or default_remote + remote = remotes[remote_name] + + components[path] = { + 'revision': project.get('revision'), + 'url': f'{remote}/{name}', + } # Initialize the data that will be output from this script. Leave the # rc number in buildspec so nobody else is subject to the same level @@ -84,15 +98,15 @@ paths = {} # Fill in the 'components' dictionary with the output from # nix-prefetch-git, which can be passed straight to fetchGit when # imported by Nix. -for component in components: - name = component.split('/')[-1] - url = f'{git_root}{component}' - rev = revisions[component] +for path in component_paths: + name = path.split('/')[-1] + url = components[path]['url'] + rev = components[path]['revision'] tarball = f'{url}/+archive/{rev}.tar.gz' output = subprocess.check_output(['nix-prefetch-url', '--print-path', '--unpack', '--name', name, tarball]) - (sha256, path) = output.decode('utf-8').splitlines() - paths[component] = path - data['components'][component] = { + (sha256, store_path) = output.decode('utf-8').splitlines() + paths[path] = store_path + data['components'][path] = { 'name': name, 'url': url, 'rev': rev, @@ -100,14 +114,14 @@ for component in components: } # Get the version number of the kernel. -kernel = paths['chromiumos/third_party/kernel'] +kernel = paths['src/third_party/kernel/v5.4'] makefile = open(f'{kernel}/Makefile').read() version = search(r'^VERSION = (.+)$', makefile, MULTILINE)[1] patchlevel = search(r'^PATCHLEVEL = (.*?)$', makefile, MULTILINE)[1] sublevel = search(r'^SUBLEVEL = (.*?)$', makefile, MULTILINE)[1] extra = search(r'^EXTRAVERSION =[ \t]*(.*?)$', makefile, MULTILINE)[1] full_ver = '.'.join(filter(None, [version, patchlevel, sublevel])) + extra -data['components']['chromiumos/third_party/kernel']['version'] = full_ver +data['components']['src/third_party/kernel/v5.4']['version'] = full_ver # Finally, write the output. with open(dirname(__file__) + '/upstream-info.json', 'w') as out: |