Skip to content

Commit

Permalink
Add missing dependency and tool for checking
Browse files Browse the repository at this point in the history
There is a missing dependency in DEBS part: webp-pixbuf-loader.
This patch adds it and also adds a check to ensure that any
push fulfills the dependencies, ensuring that DEBS is ran after
all the previous parts.
  • Loading branch information
sergio-costas committed Sep 19, 2024
1 parent 7a06171 commit 7f2789a
Show file tree
Hide file tree
Showing 3 changed files with 69 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
46 changes: 46 additions & 0 deletions tools/check_dependencies.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
#!/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"))

parts = {}
exceptions = ['buildenv']

for part in data['parts']:
if part == "debs":
break
if part in exceptions:
continue
parts[part] = False

def filldeps(part):
global data
global parts
if 'after' not in data['parts'][part]:
return

deps = data['parts'][part]['after']
for dep in deps:
parts[dep] = True
filldeps(dep)

filldeps("debs")
failed = False
for part in parts:
if parts[part]:
continue
print(f"DEBS must depend on {part}")
failed = True

if failed:
sys.exit(1)
print("All dependencies are correct")

0 comments on commit 7f2789a

Please sign in to comment.