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
02-06-2015
[Updated] - Updated comments arguments to '--help' option.
[Feature] - Added additional option to skip packages when upgrading.
Version 2.3.6
30-05-2014
30-05-2015
[Updated] - Fixed to avoid input the first package for searching when input multiple
packages together with the option '-F'.
Version 2.3.5
30-05-2014
30-05-2015
[Updated] - Added version for SBo packages when search with option
'-F'.
Version 2.3.4
28-05-2014
28-05-2015
[Updated] - Fix arguments comments.
- Update compression slackbuild package.

View file

@ -352,13 +352,12 @@ Command Line Tool Usage
-g, config, config=[editor] Configuration file management.
Print the configuration file or
edit.
-l, [repository], --index, --installed List of repositories packages.
Print a list of all available
-l, [repository], --index, --installed Print a list of all available
packages repository, index or print
only packages installed on the
system.
-c, [repository] --upgrade Check and print of available
packages for upgrade.
-c, [repository] --upgrade, --skip=[] Check the install upgraded packages
from repositories.
-s, [repository] [package...] Sync packages. Install packages
directly from remote repositories
with all dependencies.
@ -752,6 +751,37 @@ why always you can have updated your system:
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.
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"'.
.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
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
the list of packages by choosing "# slpkg update", works directly with the official repository
and so always you can have updated your system.

View file

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

View file

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

View file

@ -180,16 +180,22 @@ class ArgParse(object):
def pkg_upgrade(self):
""" 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
self.args[2] == '--upgrade'):
if (self.args[1] in _m.repositories and
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)
elif self.args[1] == 'slack':
Patches().start()
Patches(skip).start()
elif self.args[1] == 'sbo':
SBoInstall(sbo_upgrade()).start(True)
SBoInstall(sbo_upgrade(skip)).start(True)
else:
usage(self.args[1])
else:

View file

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

View file

@ -50,7 +50,8 @@ from slack_version import slack_ver
class Patches(object):
def __init__(self):
def __init__(self, skip):
self.skip = skip
self.version = _m.slack_rel
self.patch_path = _m.slpkg_tmp_patches
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]):
repo_pkg_name = split_package(name)[0]
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("", ""),
loc, name))
self.comp_sum.append(comp)