summary refs log tree commit diff
path: root/pkgs/games/steam/update-runtime.py
diff options
context:
space:
mode:
authornyanloutre <paul@nyanlout.re>2019-04-19 18:19:22 +0200
committernyanloutre <paul@nyanlout.re>2019-04-19 18:23:34 +0200
commit87e35a1439392f66f8234f18bc7f3c0999ddf91d (patch)
tree7060a3f82861cb733456e2366f080a5f03f3be54 /pkgs/games/steam/update-runtime.py
parentf785ba1d74687330d5a641361a79501c0bf829c4 (diff)
downloadnixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.tar
nixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.tar.gz
nixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.tar.bz2
nixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.tar.lz
nixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.tar.xz
nixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.tar.zst
nixpkgs-87e35a1439392f66f8234f18bc7f3c0999ddf91d.zip
steamrt: fix update script
The package.txt file doesn't exist anymore on upstream.
The new method is to install two metapackages and their dependencies.

Reference : https://github.com/ValveSoftware/steam-runtime/commit/8849d366bf9673ab5350d4036171c834acfb8955
Diffstat (limited to 'pkgs/games/steam/update-runtime.py')
-rwxr-xr-xpkgs/games/steam/update-runtime.py36
1 files changed, 19 insertions, 17 deletions
diff --git a/pkgs/games/steam/update-runtime.py b/pkgs/games/steam/update-runtime.py
index aed42cdd566..d33165b309d 100755
--- a/pkgs/games/steam/update-runtime.py
+++ b/pkgs/games/steam/update-runtime.py
@@ -35,12 +35,11 @@ def parse_args():
 	parser.add_argument("--repo", help="source repository", default=REPO)
 	return parser.parse_args()
 
-def download_file(file_base, file_name, file_url):
+def download_file(file_base, file_name, file_url, sha256):
 	file_shortname = file_base + ".deb"
-	sha256 = subprocess.check_output(["nix-prefetch-url", "--type", "sha256", "--name", file_shortname, file_url])
 	out.write("    rec {\n")
 	out.write("      name = \"%s\";\n" % file_name)
-	out.write("      sha256 = \"%s\";\n" % sha256.strip())
+	out.write("      sha256 = \"%s\";\n" % sha256)
 	out.write("      url = \"%s\";\n" % file_url.replace(REPO, "mirror://steamrt", 1))
 	out.write("      source = fetchurl {\n")
 	out.write("        inherit url sha256;\n")
@@ -49,8 +48,20 @@ def download_file(file_base, file_name, file_url):
 	out.write("    }\n")
 
 
+def parse_dependencies (arch, binarylist):
+	packages_url = "%s/dists/%s/%s/binary-%s/Packages" % (REPO, DIST, COMPONENT, arch)
+	for stanza in deb822.Packages.iter_paragraphs(urllib.urlopen(packages_url)):
+		p = stanza['Package']
+		if p in binarylist:
+			for deps in stanza.relations['depends']:
+				for dep in deps:
+					binarylist.add(dep['name'])
+	return binarylist
+
 def install_binaries (arch, binarylist):
-	installset = binarylist.copy()
+	installset = parse_dependencies(arch, binarylist.copy())
+	# Steam doesn't start if we include their libc
+	installset.remove("libc6")
 
 	#
 	# Load the Packages file so we can find the location of each binary package
@@ -66,7 +77,7 @@ def install_binaries (arch, binarylist):
 			# Download the package and install it
 			#
 			file_url="%s/%s" % (REPO,stanza['Filename'])
-			download_file(p, os.path.splitext(os.path.basename(stanza['Filename']))[0], file_url)
+			download_file(p, os.path.splitext(os.path.basename(stanza['Filename']))[0], file_url, stanza["SHA256"])
 			installset.remove(p)
 
 	for p in installset:
@@ -108,22 +119,13 @@ if args.debug:
 	COMPONENT = "debug"
 
 # Process packages.txt to get the list of source and binary packages
-source_pkgs = set()
 binary_pkgs = set()
 
 print ("Creating runtime-generated.nix")
 
-pkgs_list = urllib.urlopen("https://raw.githubusercontent.com/ValveSoftware/steam-runtime/master/packages.txt").readlines()
-for line in pkgs_list:
-	if line[0] != '#':
-		toks = line.split()
-		if len(toks) > 1:
-			source_pkgs.add(toks[0])
-			binary_pkgs.update(toks[1:])
-
-# remove development packages for end-user runtime
-if not args.debug:
-	binary_pkgs -= {x for x in binary_pkgs if re.search('-dbg$|-dev$|-multidev$',x)}
+# https://github.com/ValveSoftware/steam-runtime/blob/173ef028fb6b84e804f4e1b0ef11c12ffd4f3a8e/build-runtime.py#L264
+binary_pkgs.add("steamrt-libs")
+binary_pkgs.add("steamrt-legacy")
 
 for arch in arches:
 	out.write("  %s = [\n" % arch)