Replace EDSP with EIPP usage obsoleting proxysolver
EIPP stands for "External Installation Planner Protocol" and is rather similar to EDSP but with the clear advantage that we can extract the information we need more easily as we can tell apt to write the file for us rather than playing solver-in-the-middle and the problem space is much smaller meaning less data for apt to generate and to pass through our hands. The idea here is simply that every package which doesn't have a Status field in EIPP has the uninstalled status and the only reason its is part of the EIPP request is that we want to change this by installing it. That could be verified via the Install header at the start of the request, but this commit doesn't implement that. Note that this means we need "more" than the download-only mode can provide: Either a simulation or "the real deal". Except we modify the later to be a fancy no op.pull/25/head
parent
09f1dd2ee6
commit
ee142d52a5
@ -1,56 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
#
|
||||
# This script is in the public domain
|
||||
#
|
||||
# Author: Johannes Schauer Marin Rodrigues <josch@mister-muffin.de>
|
||||
#
|
||||
# thin layer around /usr/lib/apt/solvers/apt, so that we can capture the solver
|
||||
# result
|
||||
#
|
||||
# we set Debug::EDSP::WriteSolution=yes so that Install stanzas also come with
|
||||
# Package and Version fields. That way, we do not also have to parse the EDSP
|
||||
# request and spend time matching ID numbers
|
||||
|
||||
import subprocess
|
||||
import sys
|
||||
import os
|
||||
import getpass
|
||||
|
||||
if not os.path.exists("/usr/lib/apt/solvers/apt"):
|
||||
print(
|
||||
"""Error: ERR_NO_SOLVER
|
||||
Message: The external apt solver doesn't exist. You must install the apt-utils package.
|
||||
"""
|
||||
)
|
||||
exit()
|
||||
|
||||
fname = os.environ.get("APT_EDSP_DUMP_FILENAME")
|
||||
if fname is None:
|
||||
print(
|
||||
"""Error: ERR_NO_FILENAME
|
||||
Message: You have to set the environment variable APT_EDSP_DUMP_FILENAME
|
||||
to a valid filename to store the dump of EDSP solver input in.
|
||||
For example with: export APT_EDSP_DUMP_FILENAME=/tmp/dump.edsp
|
||||
"""
|
||||
)
|
||||
exit()
|
||||
|
||||
try:
|
||||
with open(fname, "w") as f:
|
||||
with subprocess.Popen(
|
||||
["/usr/lib/apt/solvers/apt", "-oDebug::EDSP::WriteSolution=yes"],
|
||||
stdin=sys.stdin.fileno(),
|
||||
stdout=subprocess.PIPE,
|
||||
bufsize=0, # unbuffered
|
||||
text=True, # open in text mode
|
||||
) as p:
|
||||
for line in p.stdout:
|
||||
print(line, end="")
|
||||
f.write(line)
|
||||
except (FileNotFoundError, PermissionError) as e:
|
||||
print(
|
||||
"""Error: ERR_CREATE_FILE
|
||||
Message: Writing EDSP solver input to file '%s' failed as it couldn't be created!
|
||||
"""
|
||||
% fname
|
||||
)
|
Loading…
Reference in New Issue