[packages/steam-launcher] up to 1.0.0.63

atler atler at pld-linux.org
Wed Jun 17 17:55:33 CEST 2020


commit 2837397a543574457bb3d58169e1e9d75ef03d5c
Author: Jan Palus <atler at pld-linux.org>
Date:   Wed Jun 17 17:45:37 2020 +0200

    up to 1.0.0.63
    
    - initial port of steamdeps to python3

 desktop_path.patch  |  12 ++
 steam-launcher.spec |  17 +-
 steamdeps.patch     | 608 +++++++++++++++++++++++++++-------------------------
 3 files changed, 339 insertions(+), 298 deletions(-)
---
diff --git a/steam-launcher.spec b/steam-launcher.spec
index 95dec15..01bd7c6 100644
--- a/steam-launcher.spec
+++ b/steam-launcher.spec
@@ -1,13 +1,14 @@
 Summary:	Launcher for the Steam software distribution service
 Name:		steam-launcher
-Version:	1.0.0.59
+Version:	1.0.0.63
 Release:	1
 License:	distributable
 Group:		Applications
 Source0:	http://repo.steampowered.com/steam/pool/steam/s/steam/steam_%{version}.tar.gz
-# Source0-md5:	994dc0700ed28da3a8e23c53ac4717b8
+# Source0-md5:	ace21a51ae486ebf838fa9a89f70ca46
 Source1:	%{name}.sysconfig
 Patch0:		steamdeps.patch
+Patch1:		desktop_path.patch
 URL:		http://store.steampowered.com/
 BuildRequires:	sed >= 4.0
 Requires:	ca-certificates >= 20180409-3
@@ -40,8 +41,12 @@ synchronized savegame and screenshot functionality, and many social
 features.
 
 %prep
-%setup -qn steam
+%setup -qn steam-launcher
 %patch0 -p1
+%patch1 -p1
+
+%{__sed} -i -e '1s,/usr/bin/env python3,%{__python3},' bin_steamdeps.py
+%{__sed} -i -e '1s,/usr/bin/env bash,%{__bash},' bin_steam.sh
 
 sed -i -e's/^ARCH\s*=.*$/ARCH = "%{_arch}"/' steamdeps
 
@@ -60,6 +65,10 @@ rm $RPM_BUILD_ROOT%{_docdir}/steam/{README,steam_subscriber_agreement.txt}
 
 sed -e's/@SOURCES@/%{poldek_sources}/' %{SOURCE1} > $RPM_BUILD_ROOT/etc/sysconfig/%{name}
 
+%{__rm} $RPM_BUILD_ROOT%{_desktopdir}/steam.desktop
+%{__mv} $RPM_BUILD_ROOT/usr/lib/steam/steam.desktop $RPM_BUILD_ROOT%{_desktopdir}/steam.desktop
+
+
 %clean
 rm -rf $RPM_BUILD_ROOT
 
@@ -80,6 +89,8 @@ rm -rf $RPM_BUILD_ROOT
 %attr(755,root,root) %{_bindir}/steamdeps
 %config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
 %dir /usr/lib/steam
+%attr(755,root,root) /usr/lib/steam/bin_steam.sh
+%attr(755,root,root) /usr/lib/steam/bin_steamdeps.py
 /usr/lib/steam/bootstraplinux*.tar.xz
 %{_desktopdir}/steam.desktop
 %{_iconsdir}/hicolor/*/*/*.png
diff --git a/desktop_path.patch b/desktop_path.patch
new file mode 100644
index 0000000..9c039b3
--- /dev/null
+++ b/desktop_path.patch
@@ -0,0 +1,12 @@
+diff -urN steam-launcher.orig/bin_steam.sh steam-launcher/bin_steam.sh
+--- steam-launcher.orig/bin_steam.sh	2020-06-15 17:09:51.024468557 +0200
++++ steam-launcher/bin_steam.sh	2020-06-17 17:51:36.436997528 +0200
+@@ -120,7 +120,7 @@
+ 	if [ -d "$DESKTOP_DIR" ] && [ "x$bootstrapdir" = "x/usr/lib/$STEAMPACKAGE" ]; then
+ 		# There might be a symlink in place already, in such case we do nothing
+ 		if [ ! -L "$DESKTOP_DIR/$STEAMPACKAGE.desktop" ]; then
+-			cp "$bootstrapdir/$STEAMPACKAGE.desktop" "$DESKTOP_DIR"
++			cp "/usr/share/applications/$STEAMPACKAGE.desktop" "$DESKTOP_DIR"
+ 			# Older .desktop implementations used the execute bits as
+ 			# a marker for a .desktop being safe to treat as a shortcut
+ 			chmod a+x "$DESKTOP_DIR/$STEAMPACKAGE.desktop"
diff --git a/steamdeps.patch b/steamdeps.patch
index 71cc5d3..2dacc01 100644
--- a/steamdeps.patch
+++ b/steamdeps.patch
@@ -1,12 +1,12 @@
-diff -dur steam.orig/steamdeps steam/steamdeps
---- steam.orig/steamdeps	2014-02-11 01:25:25.000000000 +0100
-+++ steam/steamdeps	2015-02-08 13:53:00.628717189 +0100
-@@ -20,21 +20,91 @@
+--- steam-launcher/bin_steamdeps.py.orig    2020-06-15 16:29:37.582721048 +0200
++++ steam-launcher/bin_steamdeps.py    2020-06-15 16:58:54.551881214 +0200
+@@ -20,24 +20,92 @@
  # This is the set of supported dependency formats
- SUPPORTED_STEAM_DEPENDENCY_VERSION = [ '1' ]
+ SUPPORTED_STEAM_DEPENDENCY_VERSION = ['1']
  
+-_arch = None
 +ARCH = "i686" # updated during package build
-+
+ 
 +PLD_PACKAGE_MAP = {
 +        "python-apt": None,
 +        "xz-utils": "xz",
@@ -40,116 +40,125 @@ diff -dur steam.orig/steamdeps steam/steamdeps
 +
 +_config = None
 +def pld_get_config():
-+	"""Load the sysconfig file. Accept shell-like syntax."""
-+	global _config
-+	if _config is not None:
-+		return _config
-+	config = {}
-+	try:
-+		with open(PLD_CONFIG_FN) as config_f:
-+			for line in config_f:
-+				line = line.strip()
-+				if not line or line.startswith("#"):
-+					continue
-+				if "=" not in line:
-+					print >>sys.stderr, "{0}: syntax error: {1!r}".format(PLD_CONFIG_FN, line)
-+					continue
-+				key, value = line.split("=", 1)
-+				key = key.strip()
-+				value = value.strip()
-+				if value.startswith('"'):
-+					if value.endswith('"'):
-+						value = value[1:-1]
-+					else:
-+						print >>sys.stderr, "{0}: syntax error: {1!r}".format(PLD_CONFIG_FN, line)
-+						continue
-+				config[key] = value
-+	except IOError as err:
-+		print >>sys.stderr, "{0}: {1}".format(PLD_CONFIG_FN, err)
-+	_config = config
-+	return config
++    """Load the sysconfig file. Accept shell-like syntax."""
++    global _config
++    if _config is not None:
++        return _config
++    config = {}
++    try:
++        with open(PLD_CONFIG_FN) as config_f:
++            for line in config_f:
++                line = line.strip()
++                if not line or line.startswith("#"):
++                    continue
++                if "=" not in line:
++                    print >>sys.stderr, "{0}: syntax error: {1!r}".format(PLD_CONFIG_FN, line)
++                    continue
++                key, value = line.split("=", 1)
++                key = key.strip()
++                value = value.strip()
++                if value.startswith('"'):
++                    if value.endswith('"'):
++                        value = value[1:-1]
++                    else:
++                        print >>sys.stderr, "{0}: syntax error: {1!r}".format(PLD_CONFIG_FN, line)
++                        continue
++                config[key] = value
++    except IOError as err:
++        print >>sys.stderr, "{0}: {1}".format(PLD_CONFIG_FN, err)
++    _config = config
++    return config
 +
 +def pld_config_enabled(variable, default=False):
-+	config = pld_get_config()
-+	value = config.get(variable, default)
-+	if value in (True, False):
-+		return value
-+	return value.lower() in ("yes", "true", "on")
++    config = pld_get_config()
++    value = config.get(variable, default)
++    if value in (True, False):
++        return value
++    return value.lower() in ("yes", "true", "on")
 +
 +def pld_config_get(variable, default=None):
-+	config = pld_get_config()
-+	return config.get(variable, default)
-+
- ###
++    config = pld_get_config()
++    return config.get(variable, default)
+ 
+ #
  # Get the current package architecture
  # This may be different than the actual architecture for the case of i386
  # chroot environments on amd64 hosts.
--_arch = None
+ #
 +# PLD: use the architecture the steam-launcher package was built for
- def getArch():
- 	"""
- 	Get the current architecture
- 	"""
--	global _arch
+ def get_arch():
+     """
+     Get the current architecture
+     """
+-    global _arch
 -
--	if ( _arch is None ):
--		_arch = subprocess.check_output(['dpkg', '--print-architecture']).decode("utf-8").strip()
--	return _arch
--
-+        return PLD_ARCH_MAP[ARCH]
+-    if _arch is None:
+-        _arch = subprocess.check_output(
+-            ['dpkg', '--print-architecture']).decode("utf-8").strip()
+-    return _arch
++    return PLD_ARCH_MAP[ARCH]
+ 
  
  ###
- def getFullPackageName( name ):
-@@ -51,23 +121,27 @@
+@@ -50,31 +118,32 @@
+     else:
+         return name
+ 
+-
+ #
+ # Check to see if another package Provides this package
  # N.B. Version checks are not supported on virtual packages
  #
- def isProvided(pkgname):
--	try:
--		process = subprocess.Popen( ['apt-cache', 'showpkg', pkgname], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
--		pattern = re.compile( r'^Reverse Provides\:')
--		providers = {}
--		for line in process.stdout:
--			if re.match(pattern,line):
--				for provider in process.stdout:
--					(name, version) = provider.split()
--					providers[name] = version
--				for provider in providers.keys():
--					if hasPackage(provider):
--						return True
--				return False
--	except:
--		return False
--	return False
-+        if ":" in pkgname:
-+            pkgname, arch = pkgname.split(":", 1)
-+        else:
-+	    arch = None
- 
-+        if pkgname.startswith("@"):
-+            pkgname = pkgname[1:]
+ def is_provided(pkgname):
+-    try:
+-        process = subprocess.Popen(['apt-cache', 'showpkg', pkgname],
+-                                   stdout=subprocess.PIPE,
+-                                   stderr=subprocess.PIPE)
+-        pattern = re.compile(r'^Reverse Provides:')
+-        providers = {}
+-        for line in process.stdout:
+-            if re.match(pattern, str(line, 'utf-8')):
+-                for provider in process.stdout:
+-                    (name, version) = provider.split()
+-                    providers[name] = version
+-                for provider in providers.keys():
+-                    if has_package(provider):
+-                        return True
+-                return False
+-    except (OSError, FileNotFoundError):
+-        return False
+-    return False
++    if ":" in pkgname:
++        pkgname, arch = pkgname.split(":", 1)
++    else:
++        arch = None
 +
-+	process = subprocess.Popen(['rpm', '-q', '--what-provides', pkgname],
-+                                stdout=subprocess.PIPE, stderr=subprocess.PIPE)
-+	for line in process.stdout:
-+		line = line.decode( "utf-8" ).strip()
-+		match = PLD_PKGNAME_RE.match(line)
-+		if ( match is None ):
-+			continue
-+                pkg_arch = match.group(4)
-+                if arch and pkg_arch and PLD_ARCH_MAP[pkg_arch] != arch:
-+	            print "bad arch {0!r}!={1!r}".format(PLD_ARCH_MAP[pkg_arch], arch)
-+                    continue
-+		return True
-+	return False
++    if pkgname.startswith("@"):
++        pkgname = pkgname[1:]
+ 
++    process = subprocess.Popen(['rpm', '-q', '--what-provides', pkgname],
++                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
++    for line in process.stdout:
++        line = line.decode( "utf-8" ).strip()
++        match = PLD_PKGNAME_RE.match(line)
++        if ( match is None ):
++            continue
++        pkg_arch = match.group(4)
++        if arch and pkg_arch and PLD_ARCH_MAP[pkg_arch] != arch:
++            print("bad arch {0!r}!={1!r}".format(PLD_ARCH_MAP[pkg_arch], arch))
++            continue
++        return True
++    return False
  
  ###
  class Package:
-@@ -89,8 +163,17 @@
- 			return isProvided(self.name)
+@@ -96,9 +165,17 @@
+             return is_provided(self.name)
  
- 		for (op, version) in self.versionConditions:
--			if ( subprocess.call( ['dpkg', '--compare-versions', self.installed, op, version] ) != 0 ):
--				return False
+         for (op, version) in self.version_conditions:
+-            if subprocess.call(['dpkg', '--compare-versions', self.installed,
+-                                op, version]) != 0:
+-                return False
 +                    rc = subprocess.call(['rpmvercmp', self.installed, version], stdout=open("/dev/null","w") )
 +                    if op in ("=", "==") and rc != 0:
 +                        return False
@@ -162,76 +171,88 @@ diff -dur steam.orig/steamdeps steam/steamdeps
 +                    if op == "<=" and rc not in (0, 2):
 +                        return False
  
- 		return True
+         return True
  
-@@ -103,20 +186,12 @@
+@@ -111,18 +188,7 @@
  
  ###
- def hasPackage( package ):
--	process = subprocess.Popen( ['dpkg', '-l', package], stdout=subprocess.PIPE, stderr=subprocess.PIPE )
--	installed_pattern = re.compile( r"^\Si\s+([^\s]+)\s+([^\s]+)" )
--	for line in process.stdout:
--		line = line.decode( "utf-8" ).strip()
--		match = re.match( installed_pattern, line )
--		if ( match is None ):
--			continue
+ def has_package(package):
+-    process = subprocess.Popen(['dpkg', '-l', package], stdout=subprocess.PIPE,
+-                               stderr=subprocess.PIPE)
+-    installed_pattern = re.compile(r"^\Si\s+([^\s]+)\s+([^\s]+)")
+-    for line in process.stdout:
+-        line = line.decode("utf-8").strip()
+-        match = re.match(installed_pattern, line)
+-        if match is None:
+-            continue
 -
--		return True
--	return False
+-        return True
+-    return False
 -
-+    return isProvided(package)
++    return is_provided(package)
  
- def remapPackage( description ):
+ def is_glvnd():
+     try:
+@@ -139,6 +205,7 @@
  
-+        return description
-+
- 	# Ubuntu 12.04.2, 12.04.3, and 12.04.4 introduce new X stacks which require 
- 	# different sets of incompatible glx packages depending on which X 
- 	# is currently installed.
-@@ -186,12 +261,14 @@
- 	"""
- 	if ( "DISPLAY" in os.environ ):
- 		programs = [
--			( "gnome-terminal", ["gnome-terminal", "--disable-factory", "-t", title, "-e"] ),
-+                        # PLD: --disable-factory doesn't work any more
-+			#( "gnome-terminal", ["gnome-terminal", "--disable-factory", "-t", title, "-e"] ),
- 			( "konsole", ["konsole", "--nofork", "-p", "tabtitle="+title, "-e"] ),
-+			( "Terminal", ["Terminal", "--disable-server", "--title="+title, "-x"] ),
- 			( "xterm", ["xterm", "-bg", "#383635", "-fg", "#d1cfcd", "-T", title, "-e"] ),
- 		]
- 		for (program, commandLine) in programs:
--			if ( subprocess.call( ['which', program], stdout=subprocess.PIPE ) == 0 ):
-+			if ( subprocess.call( ['which', program], stdout=subprocess.PIPE, stderr=open("/dev/null", "w") ) == 0 ):
- 				return commandLine
- 
- 	# Fallback if no GUI terminal program is available
-@@ -205,17 +282,21 @@
- 	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.
- 	"""
- 
--	packageList = " ".join( [ package.name for package in packages ] )
+ 
+ def remap_package(name):
++    return name
+     if name in (
+             'python-apt',
+     ):
+@@ -218,10 +285,13 @@
+     """
+     if "DISPLAY" in os.environ:
+         programs = [
+-            ("gnome-terminal",
+-             ["gnome-terminal", "--disable-factory", "-t", title, "-e"]),
++            # PLD: --disable-factory doesn't work any more
++            #("gnome-terminal",
++            # ["gnome-terminal", "--disable-factory", "-t", title, "-e"]),
+             ("konsole",
+              ["konsole", "--nofork", "-p", "tabtitle=" + title, "-e"]),
++            ("Terminal",
++             ["Terminal", "--disable-server", "--title"+title, "-x"]),
+             ("xterm",
+              ["xterm", "-bg", "#383635", "-fg", "#d1cfcd", "-T", title, "-e"]),
+             (
+@@ -230,7 +300,7 @@
+         ]
+         for (program, commandLine) in programs:
+             if subprocess.call(['which', program],
+-                               stdout=subprocess.PIPE) == 0:
++                               stdout=subprocess.PIPE, stderr=open("/dev/null", "w")) == 0:
+                 return commandLine
+ 
+     # Fallback if no GUI terminal program is available
+@@ -245,17 +315,21 @@
+     to do this, but nothing that exists yet does what we need.
+     """
+ 
+-    package_list = " ".join([package.name for package in packages])
 -
- 	# Create a temporary file to hold the installation completion status
- 	(fd, statusFile) = tempfile.mkstemp()
- 	os.close( fd )
- 
-+        # Create a poldek pset file to allow installing virtual deps
-+	psetFile = tempfile.NamedTemporaryFile("w")
-+        for package in packages:
-+            print >> psetFile, package.name
-+        psetFile.flush()
+     # Create a temporary file to hold the installation completion status
+     (fd, status_file) = tempfile.mkstemp()
+     os.close(fd)
+ 
++    # Create a poldek pset file to allow installing virtual deps
++    psetFile = tempfile.NamedTemporaryFile("w")
++    for package in packages:
++        print >> psetFile, package.name
++    psetFile.flush()
 +
- 	# Create a script to run, in a secure way
- 	(fd, scriptFile) = tempfile.mkstemp()
--	script = """#!/bin/sh
-+	script = """#!/bin/sh{sh_flag}
+     # Create a script to run, in a secure way
+     (fd, script_file) = tempfile.mkstemp()
+-    script = """#!/bin/sh
++    script = """#!/bin/sh{sh_flag}
  check_sudo()
 -{
 +{{
      # If your host file is misconfigured in certain circumstances this
      # can cause sudo to block for a while, which causes gksudo to go into
      # limbo and never return.
-@@ -231,29 +312,30 @@
+@@ -272,31 +346,30 @@
      else
          return 0
      fi
@@ -239,14 +260,15 @@ diff -dur steam.orig/steamdeps steam/steamdeps
 +}}
  
  cat <<__EOF__
- Steam needs to install these additional packages: 
--	%s
-+	{pkg_list}
+ Steam needs to install these additional packages:
+-    %s
++    {pkg_list}
  __EOF__
 -check_sudo
 -
 -# Check to make sure 64-bit systems can get 32-bit packages
--if [ "$(dpkg --print-architecture)" = "amd64" ] && ! dpkg --print-foreign-architectures | grep i386 >/dev/null; then
+-if [ "$(dpkg --print-architecture)" = "amd64" ] && \
+-   ! dpkg --print-foreign-architectures | grep i386 >/dev/null; then
 -    sudo dpkg --add-architecture i386
 -fi
 +[ -n "{sudo}" ] && check_sudo
@@ -263,148 +285,144 @@ diff -dur steam.orig/steamdeps steam/steamdeps
 +echo $? >{status_file}
  echo -n "Press return to continue: "
  read line
--""" % ( ", ".join( [ package.name for package in packages ] ), packageList, statusFile )
+-""" % (", ".join([package.name for package in packages]), package_list,
+-       status_file)
 +""".format(
-+		pkg_list = ", ".join( [ package.name for package in packages ] ),
-+		pset=psetFile.name,
-+		status_file=statusFile,
-+		sh_flag=" -x" if pld_config_enabled("DEBUG") else "",
-+		sudo="sudo" if pld_config_enabled("USE_SUDO") else "",
-+		poldek_options=pld_config_get("POLDEK_OPTIONS", ""))
- 	os.write( fd, script.encode("utf-8") )
- 	os.close( fd )
- 	os.chmod( scriptFile, (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR) )
-@@ -263,6 +345,7 @@
- 	except KeyboardInterrupt:
- 		pass
- 	os.unlink( scriptFile )
-+        psetFile.close()
- 
- 	# Read the status out of the file, since if we ran the script in a
- 	# terminal the process status will be whether the terminal started
-@@ -274,6 +357,9 @@
- 
- 	os.unlink( statusFile )
- 
-+	if status:
-+		print "\nWARNING: dependencies install failed!\n"
++        pkg_list = ", ".join( [ package.name for package in packages ] ),
++        pset=psetFile.name,
++        status_file=statusFile,
++        sh_flag=" -x" if pld_config_enabled("DEBUG") else "",
++        sudo="sudo" if pld_config_enabled("USE_SUDO") else "",
++        poldek_options=pld_config_get("POLDEK_OPTIONS", ""))
+     os.write(fd, script.encode("utf-8"))
+     os.close(fd)
+     os.chmod(script_file, (stat.S_IRUSR | stat.S_IWUSR | stat.S_IXUSR))
+@@ -307,6 +380,7 @@
+     except KeyboardInterrupt:
+         pass
+     os.unlink(script_file)
++    psetFile.close()
+ 
+     # Read the status out of the file, since if we ran the script in a
+     # terminal the process status will be whether the terminal started
+@@ -318,6 +392,9 @@
+ 
+     os.unlink(status_file)
+ 
++    if status:
++        print("\nWARNING: dependencies install failed!\n")
 +
- 	return status
- 
- 
-@@ -295,11 +381,11 @@
- 		sys.stderr.write( "Unsupported dependency version: %s\n" % config["STEAM_DEPENDENCY_VERSION"] )
- 		return False
- 
--	# Make sure we can use dpkg on this system.
-+	# Make sure we can use rpm on this system.
- 	try:
--		subprocess.call( ['dpkg', '--version'], stdout=subprocess.PIPE )
-+		subprocess.call( ['rpm', '--version'], stdout=subprocess.PIPE )
- 	except:
--		sys.stderr.write( "Couldn't find dpkg, please update steamdeps for your distribution.\n" )
-+		sys.stderr.write( "Couldn't find rpm, please update steamdeps for your distribution.\n" )
- 		return False
- 
- 	return True
-@@ -314,7 +400,11 @@
- 		sys.stderr.write( "Usage: %s dependencies.txt\n" % sys.argv[0] )
- 		return 1
- 
--	# Make sure we can open the file
-+	# disable steam runtime, so their libs won't conflict our binaries
-+	os.unsetenv("LD_LIBRARY_PATH")
-+	os.unsetenv("LD_PRELOAD")
+     return status
+ 
+ 
+@@ -345,11 +422,11 @@
+             "STEAM_DEPENDENCY_VERSION"])
+         return False
+ 
+-    # Make sure we can use dpkg on this system.
++    # Make sure we can use rpm on this system.
+     try:
+-        subprocess.call(['dpkg', '--version'], stdout=subprocess.PIPE)
++        subprocess.call(['rpm', '--version'], stdout=subprocess.PIPE)
+     except FileNotFoundError:
+-        sys.stderr.write("Couldn't find dpkg, please update steamdeps for "
++        sys.stderr.write("Couldn't find rpm, please update steamdeps for "
+                          "your distribution.\n")
+         return False
+ 
+@@ -365,7 +442,11 @@
+         sys.stderr.write("Usage: %s dependencies.txt\n" % sys.argv[0])
+         return 1
+ 
+-    # Make sure we can open the file
++    # disable steam runtime, so their libs won't conflict our binaries
++    os.unsetenv("LD_LIBRARY_PATH")
++    os.unsetenv("LD_PRELOAD")
 +
 +        # Make sure we can open the file
- 	try:
- 		fp = open(sys.argv[1])
- 	except Exception as e:
-@@ -355,10 +445,20 @@
- 	
- 		row = []
- 		for section in line.split( "|" ):
--			package = createPackage( section )
-+                        pld_pkg = PLD_PACKAGE_MAP.get(section, section)
-+                        if not pld_pkg:
-+                            continue
-+
-+			package = createPackage( pld_pkg )
- 			if ( package is None ):
- 				continue
- 
-+                        if package.name in packages:
-+                            existing = packages[package.name]
-+                            if existing.versionConditions == package.versionConditions:
-+                                row.append( existing )
-+                                continue
-+
- 			packages[ package.name ] = package
- 			row.append( package )
- 
-@@ -375,32 +475,43 @@
- 	if ( "COLUMNS" in os.environ ):
- 		del os.environ[ "COLUMNS" ]
- 
--	process = subprocess.Popen( ['dpkg', '-l'] + list( packages.keys() ), stdout=subprocess.PIPE, stderr=subprocess.PIPE )
--	installed_pattern = re.compile( r"^\Si\s+([^\s]+)\s+([^\s]+)" )
-+        pkg_names = [name.split(":", 1)[0] for name in packages.keys() if not name.startswith("@")]
-+	process = subprocess.Popen( ['rpm', '-q'] + pkg_names, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
- 	for line in process.stdout:
- 		line = line.decode( "utf-8" ).strip()
--		match = re.match( installed_pattern, line )
+     try:
+         fp = open(sys.argv[1])
+     except Exception as e:
+@@ -404,10 +485,20 @@
+ 
+         row = []
+         for section in line.split("|"):
+-            package = create_package(section)
++            pld_pkg = PLD_PACKAGE_MAP.get(section, section)
++            if not pld_pkg:
++                continue
 +
-+                match = PLD_PKGNAME_RE.match(line)
- 		if ( match is None ):
- 			continue
- 
- 		name = match.group(1)
--		if ( name not in packages ):
-+		if name not in packages:
-+                    if match.group(4):
-+                        arch = PLD_ARCH_MAP[match.group(4)]
-+                        name = "{0}:{1}".format(name, arch)
-+                    else:
- 			name = getFullPackageName( name )
-+                    if name not in packages:
-+                        continue
++            package = create_package( pld_pkg )
+             if package is None:
+                 continue
+ 
++            if package.name in packages:
++                existing = packages[package.name]
++                if existing.version_conditions == package.version_conditions:
++                    row.append( existing )
++                    continue
 +
- 		packages[ name ].setInstalled( match.group(2) )
- 
- 	# See which ones need to be installed
--	needed = []
-+	consider_installed = pld_config_get("INSTALLED", "").split()
-+	needed = set()
- 	for row in dependencies:
- 		if ( len(row) == 0 ):
- 			continue
--
- 		satisfied = False
- 		for dep in row:
- 			if ( dep.isAvailable() ):
- 				satisfied = True
- 				break
- 		if ( not satisfied ):
--			needed.append( row[0] )
-+			if row[0].name not in consider_installed:
-+				needed.add( row[0] )
-+			else:
-+				print("Considering {0} already installed".format(row[0].name))
- 
- 	# If we have anything to install, do it!
- 	if ( len(needed) > 0 ):
-@@ -409,8 +520,12 @@
- 				print( "Package %s is installed with version '%s' but doesn't match requirements: %s" % (package.name, package.installed, package) )
- 			else:
- 				print( "Package %s needs to be installed" % package.name )
--
--		return updatePackages( needed )
-+		if pld_config_enabled("INSTALL_PACKAGES", True):
-+			print("Installing packages as configured through {0}...".format(PLD_CONFIG_FN))
-+			return updatePackages( needed )
-+		else:
-+			print("\nWARNING: Dependencies missing, but package install disabled through {0}\n".format(PLD_CONFIG_FN))
-+			return 1
- 	else:
- 		return 0
+             packages[package.name] = package
+             row.append(package)
+ 
+@@ -435,22 +526,28 @@
+     if "COLUMNS" in os.environ:
+         del os.environ["COLUMNS"]
+ 
+-    process = subprocess.Popen(['dpkg', '-l'] + list(packages.keys()),
+-                               stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+-    installed_pattern = re.compile(r"^\Si\s+([^\s]+)\s+([^\s]+)")
++    pkg_names = [name.split(":", 1)[0] for name in packages.keys() if not name.startswith("@")]
++    process = subprocess.Popen( ['rpm', '-q'] + pkg_names, stdout=subprocess.PIPE, stderr=subprocess.PIPE )
+     for line in process.stdout:
+         line = line.decode("utf-8").strip()
+-        match = re.match(installed_pattern, line)
++        match = PLD_PKGNAME_RE.match(line)
+         if match is None:
+             continue
+ 
+         name = match.group(1)
+         if name not in packages:
+-            name = get_full_package_name(name)
++            if match.group(4):
++                arch = PLD_ARCH_MAP[match.group(4)]
++                name = "{0}:{1}".format(name, arch)
++            else:
++                name = getFullPackageName( name )
++            if name not in packages:
++                continue
+         packages[name].set_installed(match.group(2))
+ 
+     # See which ones need to be installed
+-    needed = []
++    consider_installed = pld_config_get("INSTALLED", "").split()
++    needed = set()
+     for row in dependencies:
+         if len(row) == 0:
+             continue
+@@ -461,7 +558,10 @@
+                 satisfied = True
+                 break
+         if not satisfied:
+-            needed.append(row[0])
++            if row[0].name not in consider_installed:
++                needed.add( row[0] )
++            else:
++                print("Considering {0} already installed".format(row[0].name))
+ 
+     # If we have anything to install, do it!
+     if len(needed) > 0:
+@@ -475,7 +575,12 @@
+                 print("Package %s needs to be installed" % package.name,
+                       file=sys.stderr)
+ 
+-        return update_packages(needed)
++        if pld_config_enabled("INSTALL_PACKAGES", True):
++            print("Installing packages as configured through {0}...".format(PLD_CONFIG_FN))
++            return updatePackages( needed )
++        else:
++            print("\nWARNING: Dependencies missing, but package install disabled through {0}\n".format(PLD_CONFIG_FN))
++            return 1
+     else:
+         return 0
  
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/steam-launcher.git/commitdiff/2837397a543574457bb3d58169e1e9d75ef03d5c



More information about the pld-cvs-commit mailing list