added skip packages when upgrading

This commit is contained in:
Dimitris Zlatanidis 2015-06-01 15:23:15 +03:00
parent 782bcb8e64
commit 8eee95a2f5
8 changed files with 95 additions and 48 deletions

View file

@ -1,24 +1,26 @@
Version 2.4.0 Version 2.4.0
02-06-2015
[Updated] - Updated comments arguments to '--help' option. [Updated] - Updated comments arguments to '--help' option.
[Feature] - Added additional option to skip packages when upgrading.
Version 2.3.6 Version 2.3.6
30-05-2014 30-05-2015
[Updated] - Fixed to avoid input the first package for searching when input multiple [Updated] - Fixed to avoid input the first package for searching when input multiple
packages together with the option '-F'. packages together with the option '-F'.
Version 2.3.5 Version 2.3.5
30-05-2014 30-05-2015
[Updated] - Added version for SBo packages when search with option [Updated] - Added version for SBo packages when search with option
'-F'. '-F'.
Version 2.3.4 Version 2.3.4
28-05-2014 28-05-2015
[Updated] - Fix arguments comments. [Updated] - Fix arguments comments.
- Update compression slackbuild package. - Update compression slackbuild package.

View file

@ -352,13 +352,12 @@ Command Line Tool Usage
-g, config, config=[editor] Configuration file management. -g, config, config=[editor] Configuration file management.
Print the configuration file or Print the configuration file or
edit. edit.
-l, [repository], --index, --installed List of repositories packages. -l, [repository], --index, --installed Print a list of all available
Print a list of all available
packages repository, index or print packages repository, index or print
only packages installed on the only packages installed on the
system. system.
-c, [repository] --upgrade Check and print of available -c, [repository] --upgrade, --skip=[] Check the install upgraded packages
packages for upgrade. from repositories.
-s, [repository] [package...] Sync packages. Install packages -s, [repository] [package...] Sync packages. Install packages
directly from remote repositories directly from remote repositories
with all dependencies. with all dependencies.
@ -752,6 +751,37 @@ why always you can have updated your system:
Would you like to continue [Y/n]? Would you like to continue [Y/n]?
Skip packages when upgrading:
.. code-block:: bash
$ slpkg -c sbo --upgrade --skip=pip,jdk
Checking ...................Done
Reading package lists ......Done
Resolving dependencies ...Done
The following packages will be automatically installed or upgraded
with new version:
+==============================================================================
| Package Version Arch Build Repos Size
+==============================================================================
Upgrading:
cffi 1.1.0 x86_64 SBo
Installing for dependencies:
pysetuptools 17.0 x86_64 SBo
pycparser 2.13 x86_64 SBo
Installing summary
===============================================================================
Total 3 packages.
0 package will be installed, 1 allready installed and 2 packages
will be upgraded.
Would you like to continue [Y/n]?
View complete slackbuilds.org site in your terminal. View complete slackbuilds.org site in your terminal.
Read fies, download, build or install: Read fies, download, build or install:

View file

@ -122,9 +122,9 @@ Print configuration file or edit with editor.
List of packages per repository. Support command 'grep' like '# slpkg -l sbo | grep "python"'. List of packages per repository. Support command 'grep' like '# slpkg -l sbo | grep "python"'.
.SS -c , check if your packages is up to date .SS -c , check if your packages is up to date
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fB--upgrade\fP \fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fB--upgrade\fP \fB--skip=[packages...]\fP
.PP .PP
Check your packages if up to date. Check your packages if up to date. Option '--skip' help to skip packages when upgrading.
Slackware 'patches' repository works independently of the others i.e not need before updating 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 the list of packages by choosing "# slpkg update", works directly with the official repository
and so always you can have updated your system. and so always you can have updated your system.

View file

@ -69,13 +69,12 @@ Optional arguments:
-g, config, config=[editor] Configuration file management. -g, config, config=[editor] Configuration file management.
Print the configuration file or Print the configuration file or
edit. edit.
-l, [repository], --index, --installed List of repositories packages. -l, [repository], --index, --installed Print a list of all available
Print a list of all available
packages repository, index or print packages repository, index or print
only packages installed on the only packages installed on the
system. system.
-c, [repository] --upgrade Check and print of available -c, [repository] --upgrade, --skip=[] Check the install upgraded packages
packages for upgrade. from repositories.
-s, [repository] [package...] Sync packages. Install packages -s, [repository] [package...] Sync packages. Install packages
directly from remote repositories directly from remote repositories
with all dependencies. with all dependencies.

View file

@ -22,6 +22,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
import sys
from slpkg.messages import Msg from slpkg.messages import Msg
from slpkg.toolbar import status from slpkg.toolbar import status
from slpkg.blacklist import BlackList from slpkg.blacklist import BlackList
@ -34,10 +36,11 @@ from repo_init import RepoInit
from greps import repo_data from greps import repo_data
def pkg_upgrade(repo): def pkg_upgrade(repo, skip):
''' '''
Checking packages for upgrade Checking packages for upgrade
''' '''
try:
Msg().checking() Msg().checking()
PACKAGES_TXT = RepoInit(repo).fetch()[0] PACKAGES_TXT = RepoInit(repo).fetch()[0]
pkgs_for_upgrade = [] pkgs_for_upgrade = []
@ -54,16 +57,21 @@ def pkg_upgrade(repo):
for name in data[0]: for name in data[0]:
if name: # this tips because some pkg_name is empty if name: # this tips because some pkg_name is empty
repo_pkg = split_package(name[:-4]) repo_pkg = split_package(name[:-4])
if (((repo_pkg[0] == inst_pkg[0] and repo_pkg[1] > inst_pkg[1] and if (((repo_pkg[0] == inst_pkg[0] and
repo_pkg[1] > inst_pkg[1] and
repo_pkg[3] == inst_pkg[3]) or repo_pkg[3] == inst_pkg[3]) or
(repo_pkg[0] == inst_pkg[0] and (repo_pkg[0] == inst_pkg[0] and
repo_pkg[1] == inst_pkg[1] and repo_pkg[1] == inst_pkg[1] and
repo_pkg[3] > inst_pkg[3])) and repo_pkg[3] > inst_pkg[3])) and
inst_pkg[0] not in BlackList().packages()): inst_pkg[0] not in BlackList().packages() and
inst_pkg[0] not in skip):
pkgs_for_upgrade.append('{0}-{1}'.format(repo_pkg[0], pkgs_for_upgrade.append('{0}-{1}'.format(repo_pkg[0],
repo_pkg[1])) repo_pkg[1]))
Msg().done() Msg().done()
return pkgs_for_upgrade return pkgs_for_upgrade
except KeyboardInterrupt:
print("") # new line at exit
sys.exit(0)
def installed(): def installed():

View file

@ -180,16 +180,22 @@ class ArgParse(object):
def pkg_upgrade(self): def pkg_upgrade(self):
""" check and upgrade packages by repository """ """ check and upgrade packages by repository """
skip = ''
if (len(self.args) == 4 and self.args[0] == '-c' and
self.args[2] == '--upgrade' and
self.args[3].startswith('--skip=')):
skip = ''.join(self.args[3].split("=")[1:]).split(',')
self.args.pop(3)
if (len(self.args) == 3 and self.args[0] == '-c' and if (len(self.args) == 3 and self.args[0] == '-c' and
self.args[2] == '--upgrade'): self.args[2] == '--upgrade'):
if (self.args[1] in _m.repositories and if (self.args[1] in _m.repositories and
self.args[1] not in ['slack', 'sbo']): self.args[1] not in ['slack', 'sbo']):
BinaryInstall(pkg_upgrade(self.args[1]), BinaryInstall(pkg_upgrade(self.args[1], skip),
self.args[1]).start(True) self.args[1]).start(True)
elif self.args[1] == 'slack': elif self.args[1] == 'slack':
Patches().start() Patches(skip).start()
elif self.args[1] == 'sbo': elif self.args[1] == 'sbo':
SBoInstall(sbo_upgrade()).start(True) SBoInstall(sbo_upgrade(skip)).start(True)
else: else:
usage(self.args[1]) usage(self.args[1])
else: else:

View file

@ -34,7 +34,7 @@ from greps import SBoGrep
from search import sbo_search_pkg from search import sbo_search_pkg
def sbo_upgrade(): def sbo_upgrade(skip):
''' '''
Return packages for upgrade Return packages for upgrade
''' '''
@ -47,7 +47,7 @@ def sbo_upgrade():
toolbar_width = status(index, toolbar_width, 4) toolbar_width = status(index, toolbar_width, 4)
name = split_package(pkg)[0] name = split_package(pkg)[0]
ver = split_package(pkg)[1] ver = split_package(pkg)[1]
if sbo_search_pkg(name): if sbo_search_pkg(name) and name not in skip:
sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version())) sbo_package = ("{0}-{1}".format(name, SBoGrep(name).version()))
package = ("{0}-{1}".format(name, ver)) package = ("{0}-{1}".format(name, ver))
if sbo_package > package: if sbo_package > package:

View file

@ -50,7 +50,8 @@ from slack_version import slack_ver
class Patches(object): class Patches(object):
def __init__(self): def __init__(self, skip):
self.skip = skip
self.version = _m.slack_rel self.version = _m.slack_rel
self.patch_path = _m.slpkg_tmp_patches self.patch_path = _m.slpkg_tmp_patches
self.pkg_for_upgrade = [] self.pkg_for_upgrade = []
@ -135,7 +136,8 @@ class Patches(object):
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]): for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
repo_pkg_name = split_package(name)[0] repo_pkg_name = split_package(name)[0]
if (not os.path.isfile(_m.pkg_path + name[:-4]) and if (not os.path.isfile(_m.pkg_path + name[:-4]) and
repo_pkg_name not in black): repo_pkg_name not in black and
repo_pkg_name not in self.skip):
self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""), self.dwn_links.append("{0}{1}/{2}".format(mirrors("", ""),
loc, name)) loc, name))
self.comp_sum.append(comp) self.comp_sum.append(comp)