mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
Update check changelogs.txt
This commit is contained in:
parent
3a2976258e
commit
d47141bbf5
8 changed files with 131 additions and 34 deletions
18
README.rst
18
README.rst
|
@ -363,7 +363,7 @@ Command Line Tool Usage
|
|||
--installed packages repository, index or print
|
||||
only packages installed on the
|
||||
system.
|
||||
-c, --check, [repository] --upgrade, Check, view and install updated
|
||||
-c, --check, [repository], --upgrade, Check, view and install updated
|
||||
--skip=[...] --resolve--off packages from repositories.
|
||||
-s, --sync, [repository] [package...], Sync packages. Install packages
|
||||
--resolve-off directly from remote repositories
|
||||
|
@ -426,6 +426,12 @@ list. This command must be executed to update the package lists:
|
|||
|
||||
$ slpkg update --only=sbo,msb,slacky
|
||||
|
||||
Also you can check ChangeLog.txt for changes like:
|
||||
|
||||
$ slpkg -c sbo
|
||||
|
||||
News in ChangeLog.txt
|
||||
|
||||
|
||||
Add and remove custom repositories:
|
||||
|
||||
|
@ -651,10 +657,18 @@ and also displays installed packages:
|
|||
+--5 libunique
|
||||
|
||||
|
||||
Check if your packages is up to date:
|
||||
Check if your packages is up to date or changes in ChangeLog.txt:
|
||||
|
||||
.. code-block:: bash
|
||||
|
||||
You can check ChangeLog.txt for changes before with command:
|
||||
|
||||
$ slpkg -c sbo
|
||||
|
||||
News in ChangeLog.txt
|
||||
|
||||
And check if packages need upgrade with:
|
||||
|
||||
$ slpkg -c sbo --upgrade
|
||||
Checking ...................Done
|
||||
Reading package lists ......Done
|
||||
|
|
|
@ -93,6 +93,10 @@ View repository information.
|
|||
.PP
|
||||
You can check for new versions and update slpkg itself.
|
||||
|
||||
.SH OPTIONS
|
||||
.PP
|
||||
The following arguments are available.
|
||||
|
||||
.SS -a, --autobuild, auto build packages
|
||||
\fBslpkg\fP \fB-a\fP <\fIscript.tar.gz\fP> <\fIsources\fP>
|
||||
.PP
|
||||
|
@ -136,6 +140,9 @@ additional option "--resolve-off" switch off automatic resolve dependencies.
|
|||
Slackware patches repository works independently of the others i.e not need before updating
|
||||
the list of packages by choosing "# slpkg update", works directly with the official repository
|
||||
and so always you can have updated your system.
|
||||
Also you can check ChangeLog.txt for changes without option "--upgrade" like:
|
||||
"# slpkg -c [repository]" or check all enabled repositories just replace repository name with
|
||||
"ALL".
|
||||
|
||||
.SS -s, --sync, synchronize packages, download, build and install package with all dependencies
|
||||
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fInames of packages\fP>, \fB--resolve-off\fP
|
||||
|
|
|
@ -88,7 +88,7 @@ class MetaData(object):
|
|||
|
||||
__all__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (2, 5, 0)
|
||||
__version_info__ = (2, 5, 1)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
|
|
@ -79,7 +79,7 @@ Optional arguments:
|
|||
--installed packages repository, index or print
|
||||
only packages installed on the
|
||||
system.
|
||||
-c, --check, [repository] --upgrade, Check, view and install updated
|
||||
-c, --check, [repository], --upgrade, Check, view and install updated
|
||||
--skip=[...] --resolve--off packages from repositories.
|
||||
-s, --sync, [repository] [package...], Sync packages. Install packages
|
||||
--resolve-off directly from remote repositories
|
||||
|
@ -136,7 +136,7 @@ def usage(repo):
|
|||
[-q [build, install, build-install]]
|
||||
[-g [print, edit=[editor]]]
|
||||
[-l [repository], --index, --installed]
|
||||
[-c [repository] --upgrade, --skip=[...] --resolve-off]
|
||||
[-c [repository], --upgrade, --skip=[...] --resolve-off]
|
||||
[-s [repository] [package...], --resolve-off]
|
||||
[-t [repository] [package]]
|
||||
[-p [repository] [package], --color=[]]
|
||||
|
|
|
@ -21,39 +21,67 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from messages import Msg
|
||||
from arguments import usage
|
||||
from sbo.check import sbo_upgrade
|
||||
from slack.patches import Patches
|
||||
from binary.check import pkg_upgrade
|
||||
from init import Initialization
|
||||
from __metadata__ import MetaData as _meta_
|
||||
|
||||
|
||||
class Updates(object):
|
||||
|
||||
"""Checking for news in ChangeLog.txt
|
||||
"""
|
||||
def __init__(self, repo):
|
||||
self.repo = repo
|
||||
self.meta = _meta_
|
||||
self.check = 2
|
||||
self._init = Initialization(True)
|
||||
self.all_repos = {
|
||||
"slack": self._init.slack,
|
||||
"sbo": self._init.sbo,
|
||||
"rlw": self._init.rlw,
|
||||
"alien": self._init.alien,
|
||||
"slacky": self._init.slacky,
|
||||
"studio": self._init.studio,
|
||||
"slackr": self._init.slackr,
|
||||
"slonly": self._init.slonly,
|
||||
"ktown": self._init.ktown,
|
||||
"multi": self._init.multi,
|
||||
"slacke": self._init.slacke,
|
||||
"salix": self._init.salix,
|
||||
"slackl": self._init.slackl,
|
||||
"rested": self._init.rested,
|
||||
"msb": self._init.msb
|
||||
}
|
||||
|
||||
def run(self):
|
||||
if self.repo in self.meta.repositories:
|
||||
if self.repo == "sbo":
|
||||
self.check = len(sbo_upgrade(skip=""))
|
||||
elif self.repo == "slack":
|
||||
if self.meta.only_installed in ["on", "ON"]:
|
||||
self.check = len(pkg_upgrade(self.repo, skip=""))
|
||||
else:
|
||||
self.check = Patches(skip="", flag="").store()
|
||||
Msg().done()
|
||||
else:
|
||||
self.check = len(pkg_upgrade(self.repo, skip=""))
|
||||
self.status()
|
||||
"""Run and check if new in ChangeLog.txt
|
||||
"""
|
||||
if self.repo in self.meta.default_repositories:
|
||||
try:
|
||||
self.check = self.all_repos[self.repo]()
|
||||
except OSError:
|
||||
usage(self.repo)
|
||||
elif self.repo in self.meta.repositories:
|
||||
self.check = self._init.custom(self.repo)
|
||||
else:
|
||||
usage(self.repo)
|
||||
self.status()
|
||||
|
||||
def ALL(self):
|
||||
for repo in self.meta.repositories:
|
||||
print("Repository: {0}".format(repo))
|
||||
if repo in self.meta.default_repositories:
|
||||
try:
|
||||
self.check = self.all_repos[repo]()
|
||||
except OSError:
|
||||
usage(self.repo)
|
||||
elif repo in self.meta.repositories:
|
||||
self.check = self._init.custom(repo)
|
||||
self.status()
|
||||
|
||||
def status(self):
|
||||
if self.check > 1:
|
||||
"""Print messages
|
||||
"""
|
||||
if self.check == 1:
|
||||
print("\nNews in ChangeLog.txt\n")
|
||||
else:
|
||||
elif self.check == 0:
|
||||
print("\nNo changes in ChangeLog.txt\n")
|
||||
|
|
|
@ -37,7 +37,8 @@ from slack.slack_version import slack_ver
|
|||
|
||||
class Initialization(object):
|
||||
|
||||
def __init__(self):
|
||||
def __init__(self, check):
|
||||
self.check = check
|
||||
self.meta = _meta_
|
||||
self.conf_path = self.meta.conf_path
|
||||
self.log_path = self.meta.log_path
|
||||
|
@ -79,6 +80,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}".format(repo, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -110,6 +113,8 @@ class Initialization(object):
|
|||
checksums_md5 = ("{0} {1} {2}".format(pkg_checksums, ext_checksums,
|
||||
pas_checksums))
|
||||
changelog_txt = mirrors(log_file, "")
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -134,6 +139,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = ""
|
||||
changelog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
self.remote(log, log_file, changelog_txt, lib, lib_file, packages_txt,
|
||||
|
@ -157,6 +164,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}/{2}".format(repo, slack_ver(), md5_file)
|
||||
changelog_txt = "{0}{1}/{2}".format(repo, slack_ver(), log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -181,6 +190,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}".format(repo, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -213,6 +224,8 @@ class Initialization(object):
|
|||
|
||||
changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
|
||||
log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -244,6 +257,8 @@ class Initialization(object):
|
|||
md5_file)
|
||||
changelog_txt = "{0}slackware{1}-{2}/{3}".format(repo, ar, slack_ver(),
|
||||
log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -268,6 +283,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}".format(repo, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -296,6 +313,8 @@ class Initialization(object):
|
|||
filelist_txt = "{0}{1}/{2}".format(repo, ar, lst_file)
|
||||
checksums_md5 = "{0}{1}/{2}".format(repo, ar, md5_file)
|
||||
changelog_txt = "{0}{1}/{2}".format(repo, ar, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -320,6 +339,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}".format(repo, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -344,6 +365,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}".format(repo, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -377,6 +400,8 @@ class Initialization(object):
|
|||
repo, self.meta.slacke_sub_repo[1:-1], ar, slack_ver(), md5_file)
|
||||
changelog_txt = "{0}slacke{1}/slackware{2}-{3}/{4}".format(
|
||||
repo, self.meta.slacke_sub_repo[1:-1], ar, slack_ver(), log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -405,6 +430,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), md5_file)
|
||||
changelog_txt = "{0}{1}/{2}/{3}".format(repo, ar, slack_ver(), log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -433,6 +460,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}/current/{2}".format(repo, ar, md5_file)
|
||||
changelog_txt = "{0}{1}/current/{2}".format(repo, ar, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -457,6 +486,8 @@ class Initialization(object):
|
|||
filelist_txt = ""
|
||||
checksums_md5 = "{0}{1}".format(repo, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -487,6 +518,8 @@ class Initialization(object):
|
|||
checksums_md5 = "{0}{1}/{2}/{3}/{4}".format(
|
||||
repo, slack_ver(), self.meta.msb_sub_repo[1:-1], ar, md5_file)
|
||||
changelog_txt = "{0}{1}".format(repo, log_file)
|
||||
if self.check:
|
||||
return self.checks_logs(log, log_file, changelog_txt)
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -538,9 +571,8 @@ class Initialization(object):
|
|||
If the two files differ in size delete and replace all files with new.
|
||||
"""
|
||||
PACKAGES_TXT = ""
|
||||
server = FileSize(args[2]).server()
|
||||
local = FileSize(args[0] + args[1]).local()
|
||||
if server != local:
|
||||
check = self.checks_logs(args[0], args[1], args[2])
|
||||
if check == 1:
|
||||
# remove PACKAGES.txt
|
||||
os.remove("{0}{1}".format(args[3], args[4]))
|
||||
# remove Changelog.txt
|
||||
|
@ -569,6 +601,15 @@ class Initialization(object):
|
|||
FILELIST_TXT = URL(args[9]).reading()
|
||||
self.write_file(args[3], args[8], FILELIST_TXT)
|
||||
|
||||
def checks_logs(self, log_path, log_file, url):
|
||||
"""Checks ChangeLog.txt from changes
|
||||
"""
|
||||
server = FileSize(url).server()
|
||||
local = FileSize(log_path + log_file).local()
|
||||
if server != local:
|
||||
return 1
|
||||
return 0
|
||||
|
||||
def upgrade(self, only):
|
||||
"""Remove all package lists with changelog and checksums files
|
||||
and create lists again"""
|
||||
|
@ -596,7 +637,7 @@ class Initialization(object):
|
|||
class Update(object):
|
||||
|
||||
def __init__(self):
|
||||
self._init = "Initialization()"
|
||||
self._init = "Initialization(False)"
|
||||
self.meta = _meta_
|
||||
self.done = "{0}Done{1}\n".format(self.meta.color["GREY"],
|
||||
self.meta.color["ENDC"])
|
||||
|
@ -619,7 +660,7 @@ class Update(object):
|
|||
exec("{0}.{1}()".format(self._init, repo))
|
||||
sys.stdout.write(self.done)
|
||||
elif repo in self.meta.repositories:
|
||||
Initialization().custom(repo)
|
||||
Initialization(False).custom(repo)
|
||||
sys.stdout.write(self.done)
|
||||
else:
|
||||
sys.stdout.write(self.error)
|
||||
|
|
|
@ -28,6 +28,7 @@ import getpass
|
|||
from messages import Msg
|
||||
from desc import PkgDesc
|
||||
from config import Config
|
||||
from checks import Updates
|
||||
from queue import QueuePkgs
|
||||
from repoinfo import RepoInfo
|
||||
from repolist import RepoList
|
||||
|
@ -131,11 +132,11 @@ class ArgParse(object):
|
|||
"""Recreate repositories package lists
|
||||
"""
|
||||
if len(self.args) == 1 and self.args[0] == "upgrade":
|
||||
Initialization().upgrade(only="")
|
||||
Initialization(False).upgrade(only="")
|
||||
elif (len(self.args) == 2 and self.args[0] == "upgrade" and
|
||||
self.args[1].startswith("--only=")):
|
||||
repos = self.args[1].split("=")[-1].split(",")
|
||||
Initialization().upgrade(repos)
|
||||
Initialization(False).upgrade(repos)
|
||||
else:
|
||||
usage("")
|
||||
|
||||
|
@ -219,6 +220,11 @@ class ArgParse(object):
|
|||
SBoInstall(sbo_upgrade(skip), flag).start(if_upgrade=True)
|
||||
else:
|
||||
usage(self.args[1])
|
||||
elif len(self.args) == 2 and self.args[0] in options:
|
||||
if self.args[1] == "ALL":
|
||||
Updates("").ALL()
|
||||
else:
|
||||
Updates(self.args[1]).run()
|
||||
else:
|
||||
usage("")
|
||||
|
||||
|
|
|
@ -67,7 +67,7 @@ class Patches(object):
|
|||
self.comp_sum = []
|
||||
self.uncomp_sum = []
|
||||
self.utils = Utils()
|
||||
Msg().reading()
|
||||
Msg().checking()
|
||||
if self.version == "stable":
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
|
||||
"patches/")).reading()
|
||||
|
@ -150,6 +150,7 @@ class Patches(object):
|
|||
if not find_package(repo_pkg_name, self.meta.pkg_path):
|
||||
self.count_added += 1
|
||||
self.count_upg -= 1
|
||||
return self.count_upg
|
||||
|
||||
def views(self):
|
||||
"""
|
||||
|
|
Loading…
Reference in a new issue