Skip to content

Commit f53dd25

Browse files
committed
Updated CI scripts.
1 parent 2c15258 commit f53dd25

File tree

2 files changed

+47
-22
lines changed

2 files changed

+47
-22
lines changed

ci/build-tool

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
#
44
# Unified Build Tool
5-
# Copyright (C) 2021-2024 by Thomas Dreibholz
5+
# Copyright (C) 2021-2025 by Thomas Dreibholz
66
#
77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by

ci/get-dependencies

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
# -*- coding: utf-8 -*-
33
#
44
# GitHub Actions Scripts
5-
# Copyright (C) 2018-2024 by Thomas Dreibholz
5+
# Copyright (C) 2018-2025 by Thomas Dreibholz
66
#
77
# This program is free software: you can redistribute it and/or modify
88
# it under the terms of the GNU General Public License as published by
@@ -27,30 +27,29 @@ import subprocess
2727
import sys
2828

2929

30-
# ###### Extract dependencies ###############################################
31-
depLine = re.compile(r'^(.*:[ \t]*)(.*)$')
32-
depItem = re.compile(r'^([a-zA-Z0-9-+\.]+)[\s]*(|\|.*|\(.*)[\s]*$')
33-
34-
def extractDependencies(line, system):
30+
# ###### Extract Deb file dependencies ######################################
31+
debDepLine = re.compile(r'^(.*:[ \t]*)(.*)$')
32+
debDepItem = re.compile(r'^([a-zA-Z0-9-+\.]+)[\s]*(|\|.*|\(.*)[\s]*$')
33+
def extractDebDependencies(line, system):
3534
dependencies = []
3635
distribution = distro.codename()
3736

3837
# Remove "build-depends:", etc.:
39-
m = depLine.match(line)
38+
m = debDepLine.match(line)
4039
if m != None:
4140
line = m.group(2)
4241
line = line.strip()
4342

4443
# Split into segments
4544
for l in line.split(','):
4645
l = l.strip()
47-
m = depItem.match(l)
46+
m = debDepItem.match(l)
4847
if m != None:
49-
dependency = m.group(1)
48+
dependency = l
5049

5150
# ------ Ugly work-around for cmake --------------------------------
5251
# We need cmake >= 3.0!
53-
if ((dependency == 'cmake') or (dependency == 'cmake3')):
52+
if ((m.group(1) == 'cmake') or (m.group(1) == 'cmake3')):
5453
if ((system == 'debian') or (system == 'ubuntu')):
5554
try:
5655
if distribution in [ 'trusty' ]:
@@ -63,6 +62,22 @@ def extractDependencies(line, system):
6362
return dependencies
6463

6564

65+
# ###### Extract RPM spec dependencies ######################################
66+
rpmDepLine = re.compile(r'^(.*:[ \t]*)(.*)$')
67+
rpmDepItem = re.compile(r'^([a-zA-Z0-9-+\.]+)[\s]*(|or[ \t]*.*|\(.*)[\s]*$')
68+
def extractRPMDependencies(line, system):
69+
dependencies = []
70+
distribution = distro.codename()
71+
72+
# Remove "build-depends:", etc.:
73+
m = rpmDepLine.match(line)
74+
if m != None:
75+
dependency = m.group(2).strip()
76+
dependencies.append(dependency)
77+
78+
return dependencies
79+
80+
6681
# ###### Main program #######################################################
6782

6883
# ====== Check arguments ====================================================
@@ -107,21 +122,28 @@ if ((system == 'debian') or (system == 'ubuntu')):
107122
line_lower = line.lower()
108123
if inside:
109124
if line.startswith((' ', "\t")):
110-
dependencies = dependencies + extractDependencies(line, system)
125+
dependencies = dependencies + extractDebDependencies(line, system)
111126
continue
112127
elif line.startswith('#'):
113128
continue
114129
inside = False
115130
if line_lower.startswith(('build-depends:', 'build-depends-indep:')):
116-
dependencies = dependencies + extractDependencies(line, system)
131+
dependencies = dependencies + extractDebDependencies(line, system)
117132
inside = True
118133

134+
aptCall = [ 'apt-get', 'satisfy', '-qy' ]
135+
i=0
119136
for dependency in sorted(set(dependencies)):
120-
sys.stdout.write(dependency + ' ')
137+
if i > 0:
138+
sys.stdout.write(', ')
139+
sys.stdout.write(dependency)
140+
aptCall.append(dependency)
141+
i = i + 1
121142
sys.stdout.write('\n')
122143

123144
if runInstall == True:
124-
subprocess.call([ 'apt-get', 'install', '-qy' ] + dependencies)
145+
subprocess.call(aptCall,
146+
env = { 'DEBIAN_FRONTEND': 'noninteractive' })
125147

126148
else:
127149
sys.stderr.write('ERROR: Unable to locate Debian control file!\n')
@@ -139,22 +161,25 @@ elif system == 'fedora':
139161
break
140162
line_lower = line.lower()
141163
if inside:
142-
if line.startswith((' ', "\t")):
143-
dependencies = dependencies + extractDependencies(line, system)
144-
continue
145-
elif line.startswith('#'):
164+
if line.startswith('#'):
146165
continue
147166
inside = False
148167
if line_lower.startswith('buildrequires:'):
149-
dependencies = dependencies + extractDependencies(line, system)
168+
dependencies = dependencies + extractRPMDependencies(line, system)
150169
inside = True
151170

171+
dnfCall = [ 'dnf', 'install', '-y' ]
172+
i=0
152173
for dependency in sorted(set(dependencies)):
153-
sys.stdout.write(dependency + ' ')
174+
if i > 0:
175+
sys.stdout.write(', ')
176+
sys.stdout.write(dependency)
177+
dnfCall.append(dependency)
178+
i = i + 1
154179
sys.stdout.write('\n')
155180

156181
if runInstall == True:
157-
subprocess.call([ 'dnf', 'install', '-y' ] + dependencies)
182+
subprocess.call(dnfCall)
158183

159184
else:
160185
sys.stderr.write('ERROR: Unable to locate RPM spec file!\n')

0 commit comments

Comments
 (0)