summaryrefslogtreecommitdiff
path: root/src/verbs/update.py
blob: 5b7a49f04f8da4e1e8e7c7b1fc8fb70cb00576b5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
import os
import util
import colors
import time

from verbs.install import find_package, install
from verbs.sync import sync

VERSION_COMPARED = "CHECKSUM"

def get_installed_list(config, root="/"):
    installed_dir = util.add_path(root, config["dir"]["installed"])
    if os.path.exists(installed_dir):
        files = os.listdir(installed_dir)
        return files
    return []


def update(args, options, config):
    if not options["l"]:
        sync(args, options, config)

    packages = [package for package in get_installed_list(config, options["r"]) if len(args) == 0 or package in args]
    options["l"] = True
    install(packages, options, config)