1 diff -dur steam.orig/steamdeps steam/steamdeps
2 --- steam.orig/steamdeps 2014-02-11 01:25:25.000000000 +0100
3 +++ steam/steamdeps 2014-06-14 12:23:17.512765217 +0200
5 # This is the set of supported dependency formats
6 SUPPORTED_STEAM_DEPENDENCY_VERSION = [ '1' ]
8 +ARCH = "i686" # updated during package build
15 + "libc6:i386": "@libc.so.6(GLIBC_2.15)",
16 + "libc6:amd64": "@libc.so.6(GLIBC_2.15)(64bit)",
18 + # different libGL implementation pull different drivers & dependencies
19 + "libgl1-mesa-dri:i386": "@libGL.so.1",
20 + "libgl1-mesa-glx:i386": "@libGL.so.1",
24 + PLD_PACKAGE_MAP["libgl1-mesa-dri"] = "@libGL.so.1()(64bit)"
25 + PLD_PACKAGE_MAP["libgl1-mesa-glx"] = "@libGL.so.1()(64bit)"
27 + PLD_PACKAGE_MAP["libgl1-mesa-dri"] = "@libGL.so.1"
28 + PLD_PACKAGE_MAP["libgl1-mesa-glx"] = "@libGL.so.1"
37 +PLD_PKGNAME_RE = re.compile(r"^(.*)-([^-]*)-([^-]*?)(?:\.([^-]*))?$")
39 +PLD_CONFIG_FN = "/etc/sysconfig/steam-launcher"
42 +def pld_get_config():
43 + """Load the sysconfig file. Accept shell-like syntax."""
45 + if _config is not None:
49 + with open(PLD_CONFIG_FN) as config_f:
50 + for line in config_f:
52 + if not line or line.startswith("#"):
55 + print >>sys.stderr, "{0}: syntax error: {1!r}".format(PLD_CONFIG_FN, line)
57 + key, value = line.split("=", 1)
59 + value = value.strip()
60 + if value.startswith('"'):
61 + if value.endswith('"'):
64 + print >>sys.stderr, "{0}: syntax error: {1!r}".format(PLD_CONFIG_FN, line)
67 + except IOError as err:
68 + print >>sys.stderr, "{0}: {1}".format(PLD_CONFIG_FN, err)
72 +def pld_config_enabled(variable, default=False):
73 + config = pld_get_config()
74 + value = config.get(variable, default)
75 + if value in (True, False):
77 + return value.lower() in ("yes", "true", "on")
79 +def pld_config_get(variable, default=None):
80 + config = pld_get_config()
81 + return config.get(variable, default)
84 # Get the current package architecture
85 # This may be different than the actual architecture for the case of i386
86 # chroot environments on amd64 hosts.
88 +# PLD: use the architecture the steam-launcher package was built for
91 Get the current architecture
95 - if ( _arch is None ):
96 - _arch = subprocess.check_output(['dpkg', '--print-architecture']).decode("utf-8").strip()
99 + return PLD_ARCH_MAP[ARCH]
102 def getFullPackageName( name ):
104 # N.B. Version checks are not supported on virtual packages
106 def isProvided(pkgname):
108 - process = subprocess.Popen( ['apt-cache', 'showpkg', pkgname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
109 - pattern = re.compile( r'^Reverse Provides\:')
111 - for line in process.stdout:
112 - if re.match(pattern,line):
113 - for provider in process.stdout:
114 - (name, version) = provider.split()
115 - providers[name] = version
116 - for provider in providers.keys():
117 - if hasPackage(provider):
124 + pkgname, arch = pkgname.split(":", 1)
128 + if pkgname.startswith("@"):
129 + pkgname = pkgname[1:]
131 + process = subprocess.Popen(['rpm', '-q', '--what-provides', pkgname],
132 + stdout=subprocess.PIPE, stderr=subprocess.PIPE)
133 + for line in process.stdout:
134 + line = line.decode( "utf-8" ).strip()
135 + match = PLD_PKGNAME_RE.match(line)
136 + if ( match is None ):
138 + pkg_arch = match.group(4)
139 + if arch and pkg_arch and PLD_ARCH_MAP[pkg_arch] != arch:
140 + print "bad arch {0!r}!={1!r}".format(PLD_ARCH_MAP[pkg_arch], arch)
148 return isProvided(self.name)
150 for (op, version) in self.versionConditions:
151 - if ( subprocess.call( ['dpkg', '--compare-versions', self.installed, op, version] ) != 0 ):
153 + rc = subprocess.call(['rpmvercmp', self.installed, version], stdout=open("/dev/null","w") )
154 + if op in ("=", "==") and rc != 0:
156 + if op == ">" and rc != 1:
158 + if op == ">=" and rc not in (0, 1):
160 + if op == "<" and rc != 2:
162 + if op == "<=" and rc not in (0, 2):
167 @@ -103,20 +186,12 @@
170 def hasPackage( package ):
171 - process = subprocess.Popen( ['dpkg', '-l', package], stdout=subprocess.PIPE, stderr=subprocess.PIPE )
172 - installed_pattern = re.compile( r"^\Si\s+([^\s]+)\s+([^\s]+)" )
173 - for line in process.stdout:
174 - line = line.decode( "utf-8" ).strip()
175 - match = re.match( installed_pattern, line )
176 - if ( match is None ):
182 + return isProvided(package)
184 def remapPackage( description ):
188 # Ubuntu 12.04.2, 12.04.3, and 12.04.4 introduce new X stacks which require
189 # different sets of incompatible glx packages depending on which X
190 # is currently installed.
191 @@ -186,12 +261,14 @@
193 if ( "DISPLAY" in os.environ ):
195 - ( "gnome-terminal", ["gnome-terminal", "--disable-factory", "-t", title, "-e"] ),
196 + # PLD: --disable-factory doesn't work any more
197 + #( "gnome-terminal", ["gnome-terminal", "--disable-factory", "-t", title, "-e"] ),
198 ( "konsole", ["konsole", "--nofork", "-p", "tabtitle="+title, "-e"] ),
199 + ( "Terminal", ["Terminal", "--disable-server", "--title="+title, "-x"] ),
200 ( "xterm", ["xterm", "-bg", "#383635", "-fg", "#d1cfcd", "-T", title, "-e"] ),
202 for (program, commandLine) in programs:
203 - if ( subprocess.call( ['which', program], stdout=subprocess.PIPE ) == 0 ):
204 + if ( subprocess.call( ['which', program], stdout=subprocess.PIPE, stderr=open("/dev/null", "w") ) == 0 ):
207 # Fallback if no GUI terminal program is available
208 @@ -205,17 +282,21 @@
209 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.
212 - packageList = " ".join( [ package.name for package in packages ] )
214 # Create a temporary file to hold the installation completion status
215 (fd, statusFile) = tempfile.mkstemp()
218 + # Create a poldek pset file to allow installing virtual deps
219 + psetFile = tempfile.NamedTemporaryFile("w")
220 + for package in packages:
221 + print >> psetFile, package.name
224 # Create a script to run, in a secure way
225 (fd, scriptFile) = tempfile.mkstemp()
226 - script = """#!/bin/sh
227 + script = """#!/bin/sh{sh_flag}
231 # If your host file is misconfigured in certain circumstances this
232 # can cause sudo to block for a while, which causes gksudo to go into
233 # limbo and never return.
234 @@ -231,29 +312,30 @@
242 Steam needs to install these additional packages:
248 -# Check to make sure 64-bit systems can get 32-bit packages
249 -if [ "$(dpkg --print-architecture)" = "amd64" ] && ! dpkg --print-foreign-architectures | grep i386 >/dev/null; then
250 - sudo dpkg --add-architecture i386
252 +[ -n "{sudo}" ] && check_sudo
254 # Update the package list, showing progress
255 -sudo apt-get update | while read line; do echo -n "."; done
256 +{sudo} poldek {poldek_options} --up
259 # Install the packages!
260 -sudo apt-get install %s
262 +{sudo} poldek {poldek_options} -u --pset={pset}
263 +echo $? >{status_file}
264 echo -n "Press return to continue: "
266 -""" % ( ", ".join( [ package.name for package in packages ] ), packageList, statusFile )
268 + pkg_list = ", ".join( [ package.name for package in packages ] ),
269 + pset=psetFile.name,
270 + status_file=statusFile,
271 + sh_flag=" -x" if pld_config_enabled("DEBUG") else "",
272 + sudo="sudo" if pld_config_enabled("USE_SUDO") else "",
273 + poldek_options=pld_config_get("POLDEK_OPTIONS", ""))
274 os.write( fd, script.encode("utf-8") )
276 os.chmod( scriptFile, (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) )
278 except KeyboardInterrupt:
280 os.unlink( scriptFile )
283 # Read the status out of the file, since if we ran the script in a
284 # terminal the process status will be whether the terminal started
287 os.unlink( statusFile )
290 + print "\nWARNING: dependencies install failed!\n"
295 @@ -295,11 +381,11 @@
296 sys.stderr.write( "Unsupported dependency version: %s\n" % config["STEAM_DEPENDENCY_VERSION"] )
299 - # Make sure we can use dpkg on this system.
300 + # Make sure we can use rpm on this system.
302 - subprocess.call( ['dpkg', '--version'], stdout=subprocess.PIPE )
303 + subprocess.call( ['rpm', '--version'], stdout=subprocess.PIPE )
305 - sys.stderr.write( "Couldn't find dpkg, please update steamdeps for your distribution.\n" )
306 + sys.stderr.write( "Couldn't find rpm, please update steamdeps for your distribution.\n" )
310 @@ -355,10 +441,20 @@
313 for section in line.split( "|" ):
314 - package = createPackage( section )
315 + pld_pkg = PLD_PACKAGE_MAP.get(section, section)
319 + package = createPackage( pld_pkg )
320 if ( package is None ):
323 + if package.name in packages:
324 + existing = packages[package.name]
325 + if existing.versionConditions == package.versionConditions:
326 + row.append( existing )
329 packages[ package.name ] = package
330 row.append( package )
332 @@ -375,32 +471,43 @@
333 if ( "COLUMNS" in os.environ ):
334 del os.environ[ "COLUMNS" ]
336 - process = subprocess.Popen( ['dpkg', '-l'] + list( packages.keys() ), stdout=subprocess.PIPE, stderr=subprocess.PIPE )
337 - installed_pattern = re.compile( r"^\Si\s+([^\s]+)\s+([^\s]+)" )
338 + pkg_names = [name.split(":", 1)[0] for name in packages.keys() if not name.startswith("@")]
339 + process = subprocess.Popen( ['rpm', '-q'] + pkg_names, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
340 for line in process.stdout:
341 line = line.decode( "utf-8" ).strip()
342 - match = re.match( installed_pattern, line )
344 + match = PLD_PKGNAME_RE.match(line)
345 if ( match is None ):
348 name = match.group(1)
349 - if ( name not in packages ):
350 + if name not in packages:
352 + arch = PLD_ARCH_MAP[match.group(4)]
353 + name = "{0}:{1}".format(name, arch)
355 name = getFullPackageName( name )
356 + if name not in packages:
359 packages[ name ].setInstalled( match.group(2) )
361 # See which ones need to be installed
363 + consider_installed = pld_config_get("INSTALLED", "").split()
365 for row in dependencies:
366 if ( len(row) == 0 ):
371 if ( dep.isAvailable() ):
374 if ( not satisfied ):
375 - needed.append( row[0] )
376 + if row[0].name not in consider_installed:
377 + needed.add( row[0] )
379 + print("Considering {0} already installed".format(row[0].name))
381 # If we have anything to install, do it!
382 if ( len(needed) > 0 ):
384 print( "Package %s is installed with version '%s' but doesn't match requirements: %s" % (package.name, package.installed, package) )
386 print( "Package %s needs to be installed" % package.name )
388 - return updatePackages( needed )
389 + if pld_config_enabled("INSTALL_PACKAGES", True):
390 + print("Installing packages as configured through {0}...".format(PLD_CONFIG_FN))
391 + return updatePackages( needed )
393 + print("\nWARNING: Dependencies missing, but package install disabled through {0}\n".format(PLD_CONFIG_FN))