mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-05 08:46:20 +01:00
Updated for Feature: only update .txt files if they have been modified #153
This commit is contained in:
parent
a22e7d1d08
commit
507b41a754
2 changed files with 19 additions and 3 deletions
|
@ -14,7 +14,8 @@ class CheckUpdates:
|
|||
def __init__(self):
|
||||
self.configs = Configs
|
||||
|
||||
def updates(self):
|
||||
def check(self):
|
||||
print('Checking for news in the Changelog.txt file...')
|
||||
local_date = 0
|
||||
local_chg_txt = (f'{self.configs.sbo_repo_path}/'
|
||||
f'{self.configs.chglog_txt}')
|
||||
|
@ -28,7 +29,10 @@ class CheckUpdates:
|
|||
|
||||
repo_date = int(repo.headers['Content-Length'])
|
||||
|
||||
if repo_date != local_date:
|
||||
print('\nThere are new updates available.\n')
|
||||
return repo_date != local_date
|
||||
|
||||
def updates(self):
|
||||
if self.check():
|
||||
print('\nThere are new updates available!\n')
|
||||
else:
|
||||
print('\nNo updated packages since the last check.\n')
|
||||
|
|
|
@ -8,6 +8,8 @@ from os import path
|
|||
|
||||
from slpkg.downloader import Wget
|
||||
from slpkg.configs import Configs
|
||||
from slpkg.check_updates import CheckUpdates
|
||||
from slpkg.views.views import ViewMessage
|
||||
from slpkg.create_data import CreateData
|
||||
from slpkg.models.models import SBoTable
|
||||
from slpkg.models.models import session as Session
|
||||
|
@ -21,6 +23,16 @@ class UpdateRepository:
|
|||
self.session = Session
|
||||
|
||||
def sbo(self):
|
||||
view = ViewMessage('')
|
||||
check_updates = CheckUpdates()
|
||||
|
||||
if not check_updates.check():
|
||||
print('\nNo changes in ChangeLog.txt between your last update and now.')
|
||||
else:
|
||||
print('\nThere are new updates available!')
|
||||
|
||||
view.question()
|
||||
|
||||
print('Updating the package list...\n')
|
||||
self.delete_file(self.configs.sbo_repo_path, self.configs.sbo_txt)
|
||||
self.delete_file(self.configs.sbo_repo_path, self.configs.chglog_txt)
|
||||
|
|
Loading…
Add table
Reference in a new issue