Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add missing dependency and a test for dependencies #241

Merged
merged 3 commits into from
Sep 23, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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-46-2404-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 @@ -1335,7 +1335,7 @@ parts:
done

debs:
after: [ libgnome-games-support, libadwaita, libgweather, libayatana-appindicator, libsoup3 ]
after: [ libgnome-games-support, libadwaita, libgweather, libayatana-appindicator, libsoup3, librest, at-spi2-core, 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")
Loading