mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-10 20:48:40 +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):
|
def __init__(self):
|
||||||
self.configs = Configs
|
self.configs = Configs
|
||||||
|
|
||||||
def updates(self):
|
def check(self):
|
||||||
|
print('Checking for news in the Changelog.txt file...')
|
||||||
local_date = 0
|
local_date = 0
|
||||||
local_chg_txt = (f'{self.configs.sbo_repo_path}/'
|
local_chg_txt = (f'{self.configs.sbo_repo_path}/'
|
||||||
f'{self.configs.chglog_txt}')
|
f'{self.configs.chglog_txt}')
|
||||||
|
@ -28,7 +29,10 @@ class CheckUpdates:
|
||||||
|
|
||||||
repo_date = int(repo.headers['Content-Length'])
|
repo_date = int(repo.headers['Content-Length'])
|
||||||
|
|
||||||
if repo_date != local_date:
|
return repo_date != local_date
|
||||||
print('\nThere are new updates available.\n')
|
|
||||||
|
def updates(self):
|
||||||
|
if self.check():
|
||||||
|
print('\nThere are new updates available!\n')
|
||||||
else:
|
else:
|
||||||
print('\nNo updated packages since the last check.\n')
|
print('\nNo updated packages since the last check.\n')
|
||||||
|
|
|
@ -8,6 +8,8 @@ from os import path
|
||||||
|
|
||||||
from slpkg.downloader import Wget
|
from slpkg.downloader import Wget
|
||||||
from slpkg.configs import Configs
|
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.create_data import CreateData
|
||||||
from slpkg.models.models import SBoTable
|
from slpkg.models.models import SBoTable
|
||||||
from slpkg.models.models import session as Session
|
from slpkg.models.models import session as Session
|
||||||
|
@ -21,6 +23,16 @@ class UpdateRepository:
|
||||||
self.session = Session
|
self.session = Session
|
||||||
|
|
||||||
def sbo(self):
|
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')
|
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.sbo_txt)
|
||||||
self.delete_file(self.configs.sbo_repo_path, self.configs.chglog_txt)
|
self.delete_file(self.configs.sbo_repo_path, self.configs.chglog_txt)
|
||||||
|
|
Loading…
Add table
Reference in a new issue