Skip to content

Commit

Permalink
Merge pull request #242 from sergio-costas/add-dependencies-check-too…
Browse files Browse the repository at this point in the history
…l-gnome-42

Add missing dependency and tool for checking in Gnome-42
  • Loading branch information
seb128 authored Sep 23, 2024
2 parents 7a06171 + 33c3510 commit f1346ea
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 1 deletion.
22 changes: 22 additions & 0 deletions .github/workflows/check-dependencies.yml
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
2 changes: 1 addition & 1 deletion snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -1522,7 +1522,7 @@ parts:
fi
debs:
after: [ libgnome-games-support, libadwaita, libgweather, poppler, libayatana-appindicator, intel-media-driver ]
after: [ libgnome-games-support, libadwaita, libgweather, poppler, libayatana-appindicator, intel-media-driver, webp-pixbuf-loader ]
plugin: nil
stage-packages:
- appstream
Expand Down
53 changes: 53 additions & 0 deletions tools/check_dependencies.py
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")

0 comments on commit f1346ea

Please sign in to comment.