summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/util.py2
-rw-r--r--src/verbs/install.py23
-rw-r--r--xipkg.conf2
3 files changed, 16 insertions, 11 deletions
diff --git a/src/util.py b/src/util.py
index d911ce8..5ca3310 100644
--- a/src/util.py
+++ b/src/util.py
@@ -11,7 +11,7 @@ DEFAULT_BAR_COLOR_RESET = colors.BG_BLACK + colors.CYAN
def add_path(*argv):
a = argv[0]
for b in argv[1:]:
- a = a + (b if a[-1] == "/" else f"/{b}")
+ a = a + ("" if a[-1] == "/" else "/") + (b[1:] if b[0] == "/" else b)
return a
def loading_bar(completed, total, text,
diff --git a/src/verbs/install.py b/src/verbs/install.py
index 34974a0..6871f2e 100644
--- a/src/verbs/install.py
+++ b/src/verbs/install.py
@@ -72,7 +72,6 @@ def retrieve_package_info(sources, checksum, package_name, config,
cache_dir=config["dir"]["cache"]
# TODO we may potentially do this a few times while resolving deps, might want to cache things here
- # TODO actually use the ping times we made earlier to decide which source to pick
for source in get_best_source(sources_list=sources_list):
url = sources[source]
@@ -98,10 +97,7 @@ def retrieve_package(sources, package_info, package_name, config,
sources_list=config["dir"]["sources"]
cache_dir=config["dir"]["cache"]
keychain_dir=config["dir"]["keychain"]
-
- # TODO actually use the ping times we made earlier to decide which source to pick
- # TODO actually save tar file, and add loading bar
-
+
checksum = package_info["CHECKSUM"]
for source in get_best_source(sources_list=sources_list):
@@ -189,7 +185,7 @@ def find_all_dependencies(package_names, options, config):
deps = resolve_dependencies(info)
for dep in deps:
if not dep in all_deps:
- if is_installed(dep, config):
+ if is_installed(dep, config, options["r"]):
print(colors.YELLOW + f"Package {query} has already been installed")
else:
to_check.append(dep)
@@ -208,11 +204,20 @@ def find_all_dependencies(package_names, options, config):
all_deps.reverse()
return all_deps
-def is_installed(package_name, config):
- # TODO only check that the requested checksum is installed.. if not then its a new update or something
- # TODO actually find out if its installed
+def is_installed(package_name, config, root="/"):
+ installed_dir = util.add_path(root, config["dir"]["installed"])
+ if os.path.exists(installed_dir):
+ files = os.listdir(installed_dir)
+ return package_name in files
return False
+def install_package(package_path, package_info, config, root="/"):
+ # untar and move into root
+ # then add entry in the config["dir"]["installed"]
+
+ pass
+
+
def install(args, options, config):
sources = config["sources"]
repos = config["repos"]
diff --git a/xipkg.conf b/xipkg.conf
index 964a60a..ce7360a 100644
--- a/xipkg.conf
+++ b/xipkg.conf
@@ -3,7 +3,7 @@
include /etc/xipkg.d/default.conf
sources {
- #localhost http://localhost:8089/repo/
+ localhost http://localhost:8089/repo/
davidovski https://xi.davidovski.xyz/repo/
codeberg https://xi.codeberg.page/repo/
ftp https://xilinux.ftp.sh/repo/