-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #242 from sergio-costas/add-dependencies-check-too…
…l-gnome-42 Add missing dependency and tool for checking in Gnome-42
- Loading branch information
Showing
3 changed files
with
76 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: test-dependencies | ||
on: | ||
pull_request: | ||
push: | ||
branches: | ||
- gnome-42-2204-sdk | ||
|
||
jobs: | ||
check-deps: | ||
runs-on: ubuntu-latest | ||
container: | ||
image: ubuntu:rolling | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Install dependencies (Ubuntu) | ||
run: | | ||
apt-get update | ||
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends python3 python3-yaml | ||
- name: Verify dependencies | ||
run: | | ||
tools/check_dependencies.py |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
#!/usr/bin/env python3 | ||
|
||
import os | ||
import sys | ||
import yaml | ||
|
||
# Ensure that "deb" part depends on all previous parts | ||
|
||
config_file = "snapcraft.yaml" | ||
if not os.path.exists(config_file): | ||
config_file = os.path.join("snap", "snapcraft.yaml") | ||
|
||
data = yaml.safe_load(open(config_file, "r")) | ||
|
||
exceptions = ['buildenv'] | ||
|
||
def filldeps(part): | ||
""" Fill recursively the dependencies of each part """ | ||
global data | ||
output = [] | ||
if 'after' in data['parts'][part]: | ||
for dep in data['parts'][part]['after']: | ||
# it's not a problem to have duplicated dependencies | ||
output += filldeps(dep) | ||
output.append(dep) | ||
return output | ||
|
||
dependencies = {} | ||
|
||
# get the dependencies for each part | ||
for part in data["parts"]: | ||
dependencies[part] = filldeps(part) | ||
|
||
deb_dependencies = [] | ||
for part in data["parts"]: | ||
if "debs" == part: | ||
continue | ||
if "debs" in dependencies[part]: | ||
# if it depends on debs, it must be after, so don't take it into account | ||
continue | ||
if part in exceptions: | ||
continue | ||
deb_dependencies.append(part) | ||
|
||
failed = False | ||
for dependency in deb_dependencies: | ||
if dependency not in dependencies["debs"]: | ||
print(f"DEBS part must be after {dependency}") | ||
failed = True | ||
|
||
if failed: | ||
sys.exit(1) | ||
print("All dependencies are correct") |