diff options
author | V3n3RiX <venerix@redcorelinux.org> | 2020-08-18 12:26:10 +0100 |
---|---|---|
committer | V3n3RiX <venerix@redcorelinux.org> | 2020-08-18 12:26:10 +0100 |
commit | a71ffe9cd09164182584bb01b3993881f7766dfd (patch) | |
tree | 3131c0ac94300b27d5983249f54769ec95a89689 /src/backend/searchbinary.py | |
parent | f28b67f3d6910f71e20da86367205f3c3660ff72 (diff) |
make sisyphus.check.root more portable, replace it everywhere
Diffstat (limited to 'src/backend/searchbinary.py')
-rw-r--r-- | src/backend/searchbinary.py | 15 |
1 files changed, 9 insertions, 6 deletions
diff --git a/src/backend/searchbinary.py b/src/backend/searchbinary.py index 0305a14..e16c98c 100644 --- a/src/backend/searchbinary.py +++ b/src/backend/searchbinary.py @@ -1,6 +1,5 @@ #!/usr/bin/python3 -import os import sisyphus.filesystem import sisyphus.update import sqlite3 @@ -101,11 +100,7 @@ def searchDB(filter, cat = '', pn = '', desc = ''): def tosql(string): return '%%' if string == '' else string.replace('*', '%').replace('?', '_') -def start(filter, cat, pn, desc, single = False): - if os.getuid() == 0: - sisyphus.update.start() - else: - print('You are not root, cannot fetch updates.\nSearch result may be inaccurate!') +def showSearch(filter, cat, pn, desc, single = False): print(f"Looking for {filter} matching packages ...\n") pkglist = searchDB(filter, tosql(cat), tosql(pn), tosql(desc)) @@ -129,3 +124,11 @@ def start(filter, cat, pn, desc, single = False): print(f"\nFound {len(pkglist)} binary package(s)") print("To search for source packages, use the '--ebuild' option.") + +def start(filter, cat, pn, desc, single = False): + if sisyphus.check.root() == 0: + sisyphus.update.start() + showSearch(filter, cat, pn, desc, single = False) + else: + print('\nYou are not root, cannot fetch updates.\nSearch result may be inaccurate!\n') + showSearch(filter, cat, pn, desc, single = False) |