summaryrefslogtreecommitdiff
path: root/src/backend/metadata.py
diff options
context:
space:
mode:
Diffstat (limited to 'src/backend/metadata.py')
-rw-r--r--src/backend/metadata.py35
1 files changed, 35 insertions, 0 deletions
diff --git a/src/backend/metadata.py b/src/backend/metadata.py
new file mode 100644
index 0000000..fc30b15
--- /dev/null
+++ b/src/backend/metadata.py
@@ -0,0 +1,35 @@
+#!/usr/bin/python3
+
+import animation
+import os
+import shutil
+import subprocess
+
+portageMetadataDir = '/var/cache/edb'
+
+def regenSilent():
+ if os.path.isdir(portageMetadataDir):
+ for files in os.listdir(portageMetadataDir):
+ if os.path.isfile(os.path.join(portageMetadataDir, files)):
+ os.remove(os.path.join(portageMetadataDir, files))
+ else:
+ shutil.rmtree(os.path.join(portageMetadataDir, files))
+
+ portageExecStage1 = subprocess.Popen(['emerge', '--quiet', '--regen'], stdout=subprocess.PIPE)
+ portageExecStage1.wait()
+ portageExecStage2 = subprocess.Popen(['emerge', '--quiet', '--metadata'], stdout=subprocess.PIPE)
+ portageExecStage2.wait()
+
+@animation.wait("refreshing metadata")
+def regenAnimated():
+ if os.path.isdir(portageMetadataDir):
+ for files in os.listdir(portageMetadataDir):
+ if os.path.isfile(os.path.join(portageMetadataDir, files)):
+ os.remove(os.path.join(portageMetadataDir, files))
+ else:
+ shutil.rmtree(os.path.join(portageMetadataDir, files))
+
+ portageExecStage1 = subprocess.Popen(['emerge', '--quiet', '--regen'], stdout=subprocess.PIPE)
+ portageExecStage1.wait()
+ portageExecStage2 = subprocess.Popen(['emerge', '--quiet', '--metadata'], stdout=subprocess.PIPE)
+ portageExecStage2.wait()