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-12 10:44:00.000000000 +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"^(.*)-([^-]*)-([^-]*?)(?:\.([^-]*))?$")
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.
44 +# PLD: use the architecture the steam-launcher package was built for
47 Get the current architecture
51 - if ( _arch is None ):
52 - _arch = subprocess.check_output(['dpkg', '--print-architecture']).decode("utf-8").strip()
55 + return PLD_ARCH_MAP[ARCH]
58 def getFullPackageName( name ):
60 # N.B. Version checks are not supported on virtual packages
62 def isProvided(pkgname):
64 - process = subprocess.Popen( ['apt-cache', 'showpkg', pkgname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
65 - pattern = re.compile( r'^Reverse Provides\:')
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):
80 + pkgname, arch = pkgname.split(":", 1)
82 + arch = PLD_ARCH_MAP[ARCH]
84 + if pkgname.startswith("@"):
85 + pkgname = pkgname[1:]
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 ):
94 + pkg_arch = match.group(4)
95 + if pkg_arch and PLD_ARCH_MAP[pkg_arch] != arch:
103 return isProvided(self.name)
105 for (op, version) in self.versionConditions:
106 - if ( subprocess.call( ['dpkg', '--compare-versions', self.installed, op, version] ) != 0 ):
108 + rc = subprocess.call(['rpmvercmp', self.installed, version], stdout=open("/dev/null","w") )
109 + if op in ("=", "==") and rc != 0:
111 + if op == ">" and rc != 1:
113 + if ope == ">=" and rc not in (0, 1):
115 + if op == "<" and rc != 2:
117 + if ope == "<=" and rc not in (0, 2):
122 @@ -103,20 +141,12 @@
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 ):
137 + return isProvided(package)
139 def remapPackage( description ):
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 @@
148 if ( "DISPLAY" in os.environ ):
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"] ),
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 ):
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.
167 - packageList = " ".join( [ package.name for package in packages ] )
169 # Create a temporary file to hold the installation completion status
170 (fd, statusFile) = tempfile.mkstemp()
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
179 # Create a script to run, in a secure way
180 (fd, scriptFile) = tempfile.mkstemp()
181 script = """#!/bin/sh
182 @@ -239,21 +275,16 @@
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
191 # Update the package list, showing progress
192 -sudo apt-get update | while read line; do echo -n "."; done
196 # Install the packages!
197 -sudo apt-get install %s
198 +sudo poldek -u --pset=%s
200 echo -n "Press return to continue: "
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") )
206 os.chmod( scriptFile, (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) )
208 except KeyboardInterrupt:
210 os.unlink( scriptFile )
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"] )
219 - # Make sure we can use dpkg on this system.
220 + # Make sure we can use rpm on this system.
222 - subprocess.call( ['dpkg', '--version'], stdout=subprocess.PIPE )
223 + subprocess.call( ['rpm', '--version'], stdout=subprocess.PIPE )
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" )
230 @@ -355,10 +387,20 @@
233 for section in line.split( "|" ):
234 - package = createPackage( section )
235 + pld_pkg = PLD_PACKAGE_MAP.get(section, section)
239 + package = createPackage( pld_pkg )
240 if ( package is None ):
243 + if package.name in packages:
244 + existing = packages[package.name]
245 + if existing.versionConditions == package.versionConditions:
246 + row.append( existing )
249 packages[ package.name ] = package
250 row.append( package )
252 @@ -375,32 +417,39 @@
253 if ( "COLUMNS" in os.environ ):
254 del os.environ[ "COLUMNS" ]
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 )
264 + match = PLD_PKGNAME_RE.match(line)
265 if ( match is None ):
268 name = match.group(1)
269 - if ( name not in packages ):
270 + if name not in packages:
272 + arch = PLD_ARCH_MAP[match.group(4)]
273 + name = "{0}:{1}".format(name, arch)
275 name = getFullPackageName( name )
276 + if name not in packages:
279 packages[ name ].setInstalled( match.group(2) )
281 # See which ones need to be installed
284 for row in dependencies:
285 if ( len(row) == 0 ):
290 if ( dep.isAvailable() ):
293 if ( not satisfied ):
294 - needed.append( row[0] )
295 + needed.add( row[0] )
297 # If we have anything to install, do it!
298 if ( len(needed) > 0 ):