Skip to content

Commit

Permalink
Fixing minor implementation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
JustinTimperio committed Sep 11, 2020
1 parent a3cc625 commit c123bc2
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions core/create.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,8 +55,8 @@ def main(config, info):
paf.mk_dir(info['path'], sudo=False)
paf.mk_dir(info['pkgcache'], sudo=False)
# This Is Much Faster Than A For Loop
cmds = {'ln ' + pkg + ' ' + info['pkgcache'] + '/' + paf.basename(pkg) for pkg in found_pkgs}
cmds = {paf.escape_bash_input(x) for x in cmds}
cmds = {'ln ' + paf.escape_bash_input(pkg) + ' ' + info['pkgcache']
+ '/' + paf.basename(pkg) for pkg in found_pkgs}
os.system(' & '.join(cmds))
paf.write_to_log(fname, 'HardLinked ' + str(len(found_pkgs)) + ' Packages', config['log'])

Expand Down
2 changes: 1 addition & 1 deletion core/session.py
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ def load_config():
mandatory = ['hook_cooldown', 'max_ss', 'reboot']
optional = ['old_rp', 'keep_versions', 'reboot_offset', 'log_length', 'basepath', 'rp_paths', 'ss_paths']
default = {
'version': '2.0.0',
'version': '2.0.1',
'paf': '4f25050',
'log': '/var/log/pacback.log',
'slock': '/tmp/pacback_session.lck',
Expand Down
16 changes: 13 additions & 3 deletions core/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -180,7 +180,7 @@ def scan_caches(config):

if len(inode_filter) != len(unique_pkgs):
# THIS SHOULD BASICALLY NEVER RUN
paf.write_to_log(fname, 'File System None-Inoded Duplicated Files!', config['log'])
paf.write_to_log(fname, 'File System Contains None-Hardlinked Duplicate Packages!', config['log'])
paf.write_to_log(fname, 'Attempting to Filter Packages With Regex...', config['log'])
thread_cap = 4

Expand Down Expand Up @@ -326,9 +326,19 @@ def cache_size(config):

caches = find_cache_paths(config)
pacman_cache = find_pkgs_in_dir(caches[0])
user_cache = find_pkgs_in_dir(caches[1:])
user_cache = find_pkgs_in_dir(caches[1:-1])
pacback_cache = find_pkgs_in_dir(caches[-1:])
pacback_filter = pacback_cache.difference({*pacman_cache, *user_cache})

inodes = set()
pacback_filter = set()
for x in {*pacman_cache, *user_cache, *pacback_cache}:
i = os.lstat(x)[stat.ST_INO]
if i in inodes:
pass
else:
pacback_filter.add(x)
inodes.add(i)

all_cache = {*pacman_cache, *user_cache, *pacback_cache}
pkg_total = len(pacman_cache) + len(user_cache) + len(pacback_filter)

Expand Down

0 comments on commit c123bc2

Please sign in to comment.