summaryrefslogtreecommitdiff
path: root/src/backend
diff options
context:
space:
mode:
authorV3n3RiX <venerix@koprulu.sector>2023-04-07 18:26:10 +0100
committerV3n3RiX <venerix@koprulu.sector>2023-04-07 18:26:10 +0100
commitb4d6245c84fdbabed108434b800a53cd91fc5b46 (patch)
treed374b7ea1395d224423cf66cd25a0f4313630f17 /src/backend
parentcf87b3a5d27636caf7e9085d12ded34039d21356 (diff)
backend : rewrite the dependency solver in a more efficient way
Diffstat (limited to 'src/backend')
-rw-r--r--src/backend/install.py6
-rw-r--r--src/backend/solvedeps.py74
-rw-r--r--src/backend/upgrade.py6
3 files changed, 26 insertions, 60 deletions
diff --git a/src/backend/install.py b/src/backend/install.py
index 1316c22..5f89b01 100644
--- a/src/backend/install.py
+++ b/src/backend/install.py
@@ -19,7 +19,7 @@ import sisyphus.update
def start(pkgname):
if sisyphus.checkenv.root():
sisyphus.update.start()
- sisyphus.solvedeps.pkg(pkgname)
+ sisyphus.solvedeps.start(pkgname)
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb"))
@@ -73,7 +73,7 @@ def start(pkgname):
def estart(pkgname):
if sisyphus.checkenv.root():
sisyphus.update.start()
- sisyphus.solvedeps.pkg(pkgname)
+ sisyphus.solvedeps.start(pkgname)
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb"))
@@ -165,7 +165,7 @@ def estart(pkgname):
def xstart(pkgname):
- sisyphus.solvedeps.pkg.__wrapped__(pkgname) # undecorate
+ sisyphus.solvedeps.start.__wrapped__(pkgname) # undecorate
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "rb"))
diff --git a/src/backend/solvedeps.py b/src/backend/solvedeps.py
index 407f4f4..d388196 100644
--- a/src/backend/solvedeps.py
+++ b/src/backend/solvedeps.py
@@ -8,66 +8,28 @@ import sisyphus.getfs
@animation.wait('resolving dependencies')
-def pkg(pkgname):
+def start(pkgname=None):
bin_list = []
src_list = []
need_cfg = int()
- p_exe = subprocess.Popen(['emerge', '--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--with-bdeps=y',
- '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname), stdout=subprocess.PIPE, stderr=subprocess.PIPE)
- stdout, stderr = p_exe.communicate()
-
- for p_out in stderr.decode('utf-8').splitlines():
- if "The following keyword changes are necessary to proceed:" in p_out:
- need_cfg = int(1)
-
- if "The following mask changes are necessary to proceed:" in p_out:
- need_cfg = int(1)
-
- if "The following USE changes are necessary to proceed:" in p_out:
- need_cfg = int(1)
-
- if "The following REQUIRED_USE flag constraints are unsatisfied:" in p_out:
- need_cfg = int(1)
-
- if "One of the following masked packages is required to complete your request:" in p_out:
- need_cfg = int(1)
-
- for p_out in stdout.decode('utf-8').splitlines():
- if "[binary" in p_out:
- is_bin = p_out.split("]")[1].split("[")[0].strip(" ")
- bin_list.append(is_bin)
-
- if "[ebuild" in p_out:
- is_src = p_out.split("]")[1].split("[")[0].strip(" ")
- src_list.append(is_src)
-
- pickle.dump([bin_list, src_list, need_cfg], open(os.path.join(
- sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "wb"))
+ if pkgname:
+ args = ['--quiet', '--pretend', '--getbinpkg', '--rebuilt-binaries',
+ '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n'] + list(pkgname)
+ else:
+ args = ['--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries',
+ '--backtrack=100', '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world']
-@animation.wait('resolving dependencies')
-def world():
- bin_list = []
- src_list = []
- need_cfg = int()
- p_exe = subprocess.Popen(['emerge', '--quiet', '--update', '--deep', '--newuse', '--pretend', '--getbinpkg', '--rebuilt-binaries', '--backtrack=100',
- '--with-bdeps=y', '--misspell-suggestion=n', '--fuzzy-search=n', '@world'], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
+ p_exe = subprocess.Popen(
+ ['emerge'] + args, stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p_exe.communicate()
for p_out in stderr.decode('utf-8').splitlines():
- if "The following keyword changes are necessary to proceed:" in p_out:
- need_cfg = int(1)
-
- if "The following mask changes are necessary to proceed:" in p_out:
- need_cfg = int(1)
-
- if "The following USE changes are necessary to proceed:" in p_out:
- need_cfg = int(1)
-
- if "The following REQUIRED_USE flag constraints are unsatisfied:" in p_out:
- need_cfg = int(1)
-
- if "One of the following masked packages is required to complete your request:" in p_out:
+ if any(key in p_out for key in ["The following keyword changes are necessary to proceed:",
+ "The following mask changes are necessary to proceed:",
+ "The following USE changes are necessary to proceed:",
+ "The following REQUIRED_USE flag constraints are unsatisfied:",
+ "One of the following masked packages is required to complete your request:"]):
need_cfg = int(1)
for p_out in stdout.decode('utf-8').splitlines():
@@ -79,5 +41,9 @@ def world():
is_src = p_out.split("]")[1].split("[")[0].strip(" ")
src_list.append(is_src)
- pickle.dump([bin_list, src_list, need_cfg], open(os.path.join(
- sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "wb"))
+ if pkgname:
+ pickle.dump([bin_list, src_list, need_cfg], open(os.path.join(
+ sisyphus.getfs.p_mtd_dir, "sisyphus_pkgdeps.pickle"), "wb"))
+ else:
+ pickle.dump([bin_list, src_list, need_cfg], open(os.path.join(
+ sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "wb"))
diff --git a/src/backend/upgrade.py b/src/backend/upgrade.py
index a897078..d1d21b5 100644
--- a/src/backend/upgrade.py
+++ b/src/backend/upgrade.py
@@ -19,7 +19,7 @@ import sisyphus.update
def start():
if sisyphus.checkenv.root():
sisyphus.update.start()
- sisyphus.solvedeps.world()
+ sisyphus.solvedeps.start()
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb"))
@@ -73,7 +73,7 @@ def start():
def estart():
if sisyphus.checkenv.root():
sisyphus.update.start()
- sisyphus.solvedeps.world()
+ sisyphus.solvedeps.start()
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb"))
@@ -165,7 +165,7 @@ def estart():
def xstart():
- sisyphus.solvedeps.world.__wrapped__() # undecorate
+ sisyphus.solvedeps.start.__wrapped__() # undecorate
bin_list, src_list, need_cfg = pickle.load(
open(os.path.join(sisyphus.getfs.p_mtd_dir, "sisyphus_worlddeps.pickle"), "rb"))