]> git.pld-linux.org Git - packages/steam-launcher.git/blame - steamdeps.patch
PLD updates
[packages/steam-launcher.git] / steamdeps.patch
CommitLineData
7b16f921
JK
1diff -dur steam.orig/steamdeps steam/steamdeps
2--- steam.orig/steamdeps 2014-02-11 01:25:25.000000000 +0100
3+++ steam/steamdeps 2014-06-12 10:44:00.000000000 +0200
4@@ -20,21 +20,47 @@
5 # This is the set of supported dependency formats
6 SUPPORTED_STEAM_DEPENDENCY_VERSION = [ '1' ]
7
8+ARCH = "i686" # updated during package build
9+
10+PLD_PACKAGE_MAP = {
11+ "python-apt": None,
12+ "xz-utils": "xz",
13+
14+ "libc6": "glibc",
15+ "libc6:i386": "@libc.so.6(GLIBC_2.15)",
16+ "libc6:amd64": "@libc.so.6(GLIBC_2.15)(64bit)",
17+
18+ # different libGL implementation pull different drivers & dependencies
19+ "libgl1-mesa-dri:i386": "@libGL.so.1",
20+ "libgl1-mesa-glx:i386": "@libGL.so.1",
21+ }
22+
23+if "64" in ARCH:
24+ PLD_PACKAGE_MAP["libgl1-mesa-dri"] = "@libGL.so.1()(64bit)"
25+ PLD_PACKAGE_MAP["libgl1-mesa-glx"] = "@libGL.so.1()(64bit)"
26+else:
27+ PLD_PACKAGE_MAP["libgl1-mesa-dri"] = "@libGL.so.1"
28+ PLD_PACKAGE_MAP["libgl1-mesa-glx"] = "@libGL.so.1"
29+
30+PLD_ARCH_MAP = {
31+ "x86_64": "amd64",
32+ "i486": "i386",
33+ "i586": "i386",
34+ "i686": "i386",
35+ }
36+
37+PLD_PKGNAME_RE = re.compile(r"^(.*)-([^-]*)-([^-]*?)(?:\.([^-]*))?$")
38+
39 ###
40 # Get the current package architecture
41 # This may be different than the actual architecture for the case of i386
42 # chroot environments on amd64 hosts.
43-_arch = None
44+# PLD: use the architecture the steam-launcher package was built for
45 def getArch():
46 """
47 Get the current architecture
48 """
49- global _arch
50-
51- if ( _arch is None ):
52- _arch = subprocess.check_output(['dpkg', '--print-architecture']).decode("utf-8").strip()
53- return _arch
54-
55+ return PLD_ARCH_MAP[ARCH]
56
57 ###
58 def getFullPackageName( name ):
59@@ -51,23 +77,26 @@
60 # N.B. Version checks are not supported on virtual packages
61 #
62 def isProvided(pkgname):
63- try:
64- process = subprocess.Popen( ['apt-cache', 'showpkg', pkgname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
65- pattern = re.compile( r'^Reverse Provides\:')
66- providers = {}
67- for line in process.stdout:
68- if re.match(pattern,line):
69- for provider in process.stdout:
70- (name, version) = provider.split()
71- providers[name] = version
72- for provider in providers.keys():
73- if hasPackage(provider):
74- return True
75- return False
76- except:
77- return False
78- return False
79+ if ":" in pkgname:
80+ pkgname, arch = pkgname.split(":", 1)
81+ else:
82+ arch = PLD_ARCH_MAP[ARCH]
83+
84+ if pkgname.startswith("@"):
85+ pkgname = pkgname[1:]
86
87+ process = subprocess.Popen(['rpm', '-q', '--what-provides', pkgname],
88+ stdout=subprocess.PIPE, stderr=subprocess.PIPE)
89+ for line in process.stdout:
90+ line = line.decode( "utf-8" ).strip()
91+ match = PLD_PKGNAME_RE.match(line)
92+ if ( match is None ):
93+ continue
94+ pkg_arch = match.group(4)
95+ if pkg_arch and PLD_ARCH_MAP[pkg_arch] != arch:
96+ continue
97+ return True
98+ return False
99
100 ###
101 class Package:
102@@ -89,8 +118,17 @@
103 return isProvided(self.name)
104
105 for (op, version) in self.versionConditions:
106- if ( subprocess.call( ['dpkg', '--compare-versions', self.installed, op, version] ) != 0 ):
107- return False
108+ rc = subprocess.call(['rpmvercmp', self.installed, version], stdout=open("/dev/null","w") )
109+ if op in ("=", "==") and rc != 0:
110+ return False
111+ if op == ">" and rc != 1:
112+ return False
113+ if ope == ">=" and rc not in (0, 1):
114+ return False
115+ if op == "<" and rc != 2:
116+ return False
117+ if ope == "<=" and rc not in (0, 2):
118+ return False
119
120 return True
121
122@@ -103,20 +141,12 @@
123
124 ###
125 def hasPackage( package ):
126- process = subprocess.Popen( ['dpkg', '-l', package], stdout=subprocess.PIPE, stderr=subprocess.PIPE )
127- installed_pattern = re.compile( r"^\Si\s+([^\s]+)\s+([^\s]+)" )
128- for line in process.stdout:
129- line = line.decode( "utf-8" ).strip()
130- match = re.match( installed_pattern, line )
131- if ( match is None ):
132- continue
133-
134- return True
135- return False
136-
137+ return isProvided(package)
138
139 def remapPackage( description ):
140
141+ return description
142+
143 # Ubuntu 12.04.2, 12.04.3, and 12.04.4 introduce new X stacks which require
144 # different sets of incompatible glx packages depending on which X
145 # is currently installed.
146@@ -186,12 +216,14 @@
147 """
148 if ( "DISPLAY" in os.environ ):
149 programs = [
150- ( "gnome-terminal", ["gnome-terminal", "--disable-factory", "-t", title, "-e"] ),
151+ # PLD: --disable-factory doesn't work any more
152+ #( "gnome-terminal", ["gnome-terminal", "--disable-factory", "-t", title, "-e"] ),
153 ( "konsole", ["konsole", "--nofork", "-p", "tabtitle="+title, "-e"] ),
154+ ( "Terminal", ["Terminal", "--disable-server", "--title="+title, "-x"] ),
155 ( "xterm", ["xterm", "-bg", "#383635", "-fg", "#d1cfcd", "-T", title, "-e"] ),
156 ]
157 for (program, commandLine) in programs:
158- if ( subprocess.call( ['which', program], stdout=subprocess.PIPE ) == 0 ):
159+ if ( subprocess.call( ['which', program], stdout=subprocess.PIPE, stderr=open("/dev/null", "w") ) == 0 ):
160 return commandLine
161
162 # Fallback if no GUI terminal program is available
163@@ -205,12 +237,16 @@
164 Ideally we would call some sort of system UI that users were familiar with to do this, but nothing that exists yet does what we need.
165 """
166
167- packageList = " ".join( [ package.name for package in packages ] )
168-
169 # Create a temporary file to hold the installation completion status
170 (fd, statusFile) = tempfile.mkstemp()
171 os.close( fd )
172
173+ # Create a poldek pset file to allow installing virtual deps
174+ psetFile = tempfile.NamedTemporaryFile("w")
175+ for package in packages:
176+ print >> psetFile, package.name
177+ psetFile.flush()
178+
179 # Create a script to run, in a secure way
180 (fd, scriptFile) = tempfile.mkstemp()
181 script = """#!/bin/sh
182@@ -239,21 +275,16 @@
183 __EOF__
184 check_sudo
185
186-# Check to make sure 64-bit systems can get 32-bit packages
187-if [ "$(dpkg --print-architecture)" = "amd64" ] && ! dpkg --print-foreign-architectures | grep i386 >/dev/null; then
188- sudo dpkg --add-architecture i386
189-fi
190-
191 # Update the package list, showing progress
192-sudo apt-get update | while read line; do echo -n "."; done
193+sudo poldek --up
194 echo
195
196 # Install the packages!
197-sudo apt-get install %s
198+sudo poldek -u --pset=%s
199 echo $? >%s
200 echo -n "Press return to continue: "
201 read line
202-""" % ( ", ".join( [ package.name for package in packages ] ), packageList, statusFile )
203+""" % ( ", ".join( [ package.name for package in packages ] ), psetFile.name, statusFile )
204 os.write( fd, script.encode("utf-8") )
205 os.close( fd )
206 os.chmod( scriptFile, (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) )
207@@ -263,6 +294,7 @@
208 except KeyboardInterrupt:
209 pass
210 os.unlink( scriptFile )
211+ psetFile.close()
212
213 # Read the status out of the file, since if we ran the script in a
214 # terminal the process status will be whether the terminal started
215@@ -295,11 +327,11 @@
216 sys.stderr.write( "Unsupported dependency version: %s\n" % config["STEAM_DEPENDENCY_VERSION"] )
217 return False
218
219- # Make sure we can use dpkg on this system.
220+ # Make sure we can use rpm on this system.
221 try:
222- subprocess.call( ['dpkg', '--version'], stdout=subprocess.PIPE )
223+ subprocess.call( ['rpm', '--version'], stdout=subprocess.PIPE )
224 except:
225- sys.stderr.write( "Couldn't find dpkg, please update steamdeps for your distribution.\n" )
226+ sys.stderr.write( "Couldn't find rpm, please update steamdeps for your distribution.\n" )
227 return False
228
229 return True
230@@ -355,10 +387,20 @@
231
232 row = []
233 for section in line.split( "|" ):
234- package = createPackage( section )
235+ pld_pkg = PLD_PACKAGE_MAP.get(section, section)
236+ if not pld_pkg:
237+ continue
238+
239+ package = createPackage( pld_pkg )
240 if ( package is None ):
241 continue
242
243+ if package.name in packages:
244+ existing = packages[package.name]
245+ if existing.versionConditions == package.versionConditions:
246+ row.append( existing )
247+ continue
248+
249 packages[ package.name ] = package
250 row.append( package )
251
252@@ -375,32 +417,39 @@
253 if ( "COLUMNS" in os.environ ):
254 del os.environ[ "COLUMNS" ]
255
256- process = subprocess.Popen( ['dpkg', '-l'] + list( packages.keys() ), stdout=subprocess.PIPE, stderr=subprocess.PIPE )
257- installed_pattern = re.compile( r"^\Si\s+([^\s]+)\s+([^\s]+)" )
258+ pkg_names = [name.split(":", 1)[0] for name in packages.keys() if not name.startswith("@")]
259+ process = subprocess.Popen( ['rpm', '-q'] + pkg_names, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
260 for line in process.stdout:
261 line = line.decode( "utf-8" ).strip()
262- match = re.match( installed_pattern, line )
263+
264+ match = PLD_PKGNAME_RE.match(line)
265 if ( match is None ):
266 continue
267
268 name = match.group(1)
269- if ( name not in packages ):
270+ if name not in packages:
271+ if match.group(4):
272+ arch = PLD_ARCH_MAP[match.group(4)]
273+ name = "{0}:{1}".format(name, arch)
274+ else:
275 name = getFullPackageName( name )
276+ if name not in packages:
277+ continue
278+
279 packages[ name ].setInstalled( match.group(2) )
280
281 # See which ones need to be installed
282- needed = []
283+ needed = set()
284 for row in dependencies:
285 if ( len(row) == 0 ):
286 continue
287-
288 satisfied = False
289 for dep in row:
290 if ( dep.isAvailable() ):
291 satisfied = True
292 break
293 if ( not satisfied ):
294- needed.append( row[0] )
295+ needed.add( row[0] )
296
297 # If we have anything to install, do it!
298 if ( len(needed) > 0 ):
This page took 0.075726 seconds and 4 git commands to generate.