updated for version 1.9.5

This commit is contained in:
Dimitris Zlatanidis 2014-10-04 01:44:18 +03:00
parent 62ebc153ab
commit 615258b989
14 changed files with 195 additions and 195 deletions

View file

@ -1,5 +1,5 @@
Version 1.9.5
03-10.2014
04-10.2014
[Updated] - Added 'aaa_elflibs' in blacklist.
- Fix current version upgrade only installed packages.

View file

@ -122,23 +122,21 @@ Command Line Tool Usage
Utility for easy management packages in Slackware
Optional arguments:
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check if your packages is up to date
-s, <repository> <package> --current download, build & install packages
-f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo
-n, <package> view packages from SBo repository
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents of the packages
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-b, --list, [package...] --add, --remove add, remove packages in blacklist
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check for updated packages
-s, <repository> <package> --current download, build & install
-f, <package> find installed packages
-t, <package> tracking dependencies from SBo
-n, <package> view packages from SBo
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents
Repositories:
SlackBuilds = sbo
Slackware = slack '--current'
@ -446,7 +444,7 @@ Find installed packages:
$ slpkg -f apr
Installed packages with name matching [ apr ]
Installed packages with name begin matching [ apr ]
[ installed ] - apr-1.5.0-x86_64-1_slack14.1
[ installed ] - apr-util-1.5.3-x86_64-1_slack14.1

View file

@ -16,11 +16,12 @@
slpkg - Utility for easy management packages in Slackware
.SH SYNOPSIS
\fBUsage: slpkg [-h] [-v] [-a script [sources...]]
[-b --list, --add, --remove [...]]
[-l all, sbo, slack, noarch]
[-c <repository> --upgrade --current]
[-s <repository> <package> --current]
[-f] [-t] [-n] [-i [...]]
[-u [...]] [-o [...]] [-r [...]] [-d [...]]\fp
[-f] [-t] [-n] [-i [...]] [-u [...]]
[-o [...]] [-r [...]] [-d [...]]\fp
.SH DESCRIPTION
\fBslpkg\fP is a terminal multitool in order to easy use Slackware packages.
@ -30,22 +31,21 @@ It's a quick and easy way to manage your packages in slackware to a command.
\fBUtility for easy management packages in Slackware
Optional arguments:
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check if your packages is up to date
-s, <repository> <package> --current download, build & install packages
-f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo
-n, <package> view packages from SBo repository
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents of the packages
-h, --help show this help message and exit
-v, --version print version and exit
-a, script [source...] auto build packages
-b, --list, [package...] --add, --remove add, remove packages in blacklist
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check for updated packages
-s, <repository> <package> --current download, build & install
-f, <package> find installed packages
-t, <package> tracking dependencies from SBo
-n, <package> view packages from SBo
-i, [package...] install binary packages
-u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages
-r, [package...] remove binary packages
-d, [package...] display the contents
Repositories:
SlackBuilds = sbo
@ -62,6 +62,11 @@ The following commands are available.
\fBslpkg\fP \fB-a\fP <\fIscript\fP> <\fIsources\fP>
.PP
With this argument, build slackware package from source quickly and easy.
.SS -b , --list <packages> -- add --remove
\fBslpkg\fP \fB-b\fP \fB--list\fP <\fIpackages\fP> \fB--add\fP \fB--remove\fP
.PP
Print, add or remove packages from blacklist file. The settings here affect
all repositories.
.SS -l all, sbo, slack, noarch
\fBslpkg\fP \fB-l\fP \fIall\fP \fIsbo\fP \fIslack\fp \fInoarch\fp
.PP
@ -92,16 +97,6 @@ The sequence shown is that you must follow to correctly install package.
.PP
With this method you can find the SBo script that interests you through
the network. (www.slackbuilds.org)
.SS -b , --list blacklisted packages
\fBslpkg\fP \fB-b\fP \fB--list\fP
.PP
Print all blacklist packages. Each package listed here may not be
installed be upgraded be find or deleted.
.SS -b , <packages> -- add --remove
\fBslpkg\fP \fB-b\fP <\fIpackages\fP> \fB--add\fP \fB--remove\fP
.PP
Add or remove packages from blacklist. The settings here affect
all repositories.
.SS -i , install binary package
\fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP>
.PP

View file

@ -77,11 +77,13 @@ python setup.py install --root=$PKG
find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
| cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
mkdir -p $PKG/etc/$PRGNAM
if [ ! -f /etc/$PRGNAM/blacklist ]; then
# check if blacklist file if already exist in /etc/slpkg
if [ ! -f "/etc/$PRGNAM/blacklist" ]; then
mkdir -p $PKG/etc/$PRGNAM
install -D -m0644 conf/blacklist $PKG/etc/$PRGNAM/blacklist
fi
# install man page
mkdir -p $PKG/usr/man/man8
gzip -9 man/$PRGNAM.8
install -D -m0644 man/$PRGNAM.8.gz $PKG/usr/man/man8/$PRGNAM.8.gz

View file

@ -22,114 +22,119 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from __metadata__ import bls_path
# create blacklist configuration file in /etc/slpkg if not exist.
blacklist_conf = [
"# This is the blacklist file. Each package listed here may not be\n",
"# installed be upgraded be find or deleted.\n",
"# NOTE: The settings here affect all repositories.\n",
"#\n",
"# An example syntax is as follows:\n",
"# add a package from SBo repository:\n",
"# brasero\n",
"#\n",
"# Add package from slackware repository:\n",
"# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n",
"# wicd\n",
"#\n",
"# Sometimes the automatic kernel update creates problems because you\n",
"# may need to file intervention 'lilo'. The slpkg automatically detects\n",
"# if the core has been upgraded and running 'lilo'. If you want to avoid\n",
"# any problems uncomment the lines below.\n",
"#\n",
"# kernel-firmware\n",
"# kernel-generic\n",
"# kernel-generic-smp\n",
"# kernel-headers\n",
"# kernel-huge\n",
"# kernel-huge-smp\n",
"# kernel-modules\n",
"# kernel-modules-smp\n",
"# kernel-source\n"
"#\n",
"#\n",
"# aaa_elflibs can't be updated.\n",
"aaa_elflibs\n"
]
black_conf = bls_path + "blacklist"
if not os.path.exists(bls_path):
os.mkdir(bls_path)
if not os.path.isfile(bls_path + "blacklist"):
with open(black_conf, "w") as conf:
for line in blacklist_conf:
conf.write(line)
conf.close()
class BlackList(object):
'''
Blacklist class to add, remove or listed packages
in blacklist file.
'''
def __init__(self):
'''
Initialization blacklist file if not exist in /etc/slpkg
create it by default.
'''
blacklist_conf = [
"# This is the blacklist file. Each package listed here may not be\n",
"# installed be upgraded be find or deleted.\n",
"# NOTE: The settings here affect all repositories.\n",
"#\n",
"# An example syntax is as follows:\n",
"# add a package from SBo repository:\n",
"# brasero\n",
"#\n",
"# Add package from slackware repository:\n",
"# example add package 'wicd-1.7.2.4-x86_64-4.txz':\n",
"# wicd\n",
"#\n",
"# Sometimes the automatic kernel update creates problems because you\n",
"# may need to file intervention 'lilo'. The slpkg automatically detects\n",
"# if the core has been upgraded and running 'lilo'. If you want to avoid\n",
"# any problems uncomment the lines below.\n",
"#\n",
"# kernel-firmware\n",
"# kernel-generic\n",
"# kernel-generic-smp\n",
"# kernel-headers\n",
"# kernel-huge\n",
"# kernel-huge-smp\n",
"# kernel-modules\n",
"# kernel-modules-smp\n",
"# kernel-source\n"
"#\n",
"#\n",
"# aaa_elflibs can't be updated.\n",
"aaa_elflibs\n"
]
self.blackfile = bls_path + "blacklist"
if not os.path.exists(bls_path):
os.mkdir(bls_path)
if not os.path.isfile(self.blackfile):
with open(black_conf, "w") as conf:
for line in blacklist_conf:
conf.write(line)
conf.close()
def packages(self):
'''
Return blacklist packages from /etc/slpkg/blacklist
configuration file.
'''
blacklist = []
with open(self.blackfile, "r") as black_conf:
for read in black_conf:
read = read.lstrip()
if not read.startswith("#"):
blacklist.append(read.replace("\n", ""))
black_conf.close()
return blacklist
def black_packages():
'''
Return blacklist packages from /etc/slpkg/blacklist
configuration file.
'''
blacklist = []
blackfile = bls_path + "blacklist"
with open(blackfile, "r") as black_conf:
for read in black_conf:
read = read.lstrip()
if not read.startswith("#"):
blacklist.append(read.replace("\n", ""))
black_conf.close()
return blacklist
def blacklisted():
'''
Print blacklist packages
'''
exit = 0
print("\nPackages in blacklist:\n")
for black in black_packages():
if black:
print(black)
exit = 1
if exit == 1:
print # new line at exit
def add_blacklist(pkgs):
'''
Add blacklist packages if not exist
'''
exit = 0
blackfile = bls_path + "blacklist"
blacklist = black_packages()
print("\nAdd packages in blacklist:\n")
with open(blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
print(pkg)
black_conf.write(pkg + "\n")
def listed(self):
'''
Print blacklist packages
'''
exit = 0
print("\nPackages in blacklist:\n")
for black in self.packages():
if black:
print(black)
exit = 1
black_conf.close()
if exit == 1:
print # new line at exit
if exit == 1:
print # new line at exit
def remove_blacklist(pkgs):
'''
Remove packages from blacklist
'''
exit = 0
blackfile = bls_path + "blacklist"
print("\nRemove packages from blacklist:\n")
with open(blackfile, "r") as read_black_conf:
lines = read_black_conf.read()
read_black_conf.close()
with open(blackfile, "w") as black_conf:
for line in lines.splitlines():
if line not in pkgs:
black_conf.write(line + "\n")
else:
print(line)
exit = 1
black_conf.close()
if exit == 1:
print # new line at exit
def add(self, pkgs):
'''
Add blacklist packages if not exist
'''
exit = 0
blacklist = self.packages()
print("\nAdd packages in blacklist:\n")
with open(self.blackfile, "a") as black_conf:
for pkg in pkgs:
if pkg not in blacklist:
print(pkg)
black_conf.write(pkg + "\n")
exit = 1
black_conf.close()
if exit == 1:
print # new line at exit
def remove(self, pkgs):
'''
Remove packages from blacklist
'''
exit = 0
print("\nRemove packages from blacklist:\n")
with open(self.blackfile, "r") as read_black_conf:
lines = read_black_conf.read()
read_black_conf.close()
with open(self.blackfile, "w") as write_black_conf:
for line in lines.splitlines():
if line not in pkgs:
write_black_conf.write(line + "\n")
else:
print(line)
exit = 1
write_black_conf.close()
if exit == 1:
print # new line at exit

View file

@ -27,7 +27,7 @@ from colors import *
from messages import s_user
from version import prog_version
from __metadata__ import path, __version__
from blacklist import blacklisted, add_blacklist, remove_blacklist
from blacklist import BlackList
from pkg.manager import *
from pkg.build import build_package
@ -48,22 +48,21 @@ def main():
"slpkg - version {0}\n".format(__version__),
"Utility for easy management packages in Slackware\n",
"Optional arguments:",
" -h, --help show this help message and exit",
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -l, all, sbo, slack, noarch list of installed packages",
" -c, <repository> --upgrade --current check if your packages is up to date",
" -s, <repository> <package> --current download, build & install packages",
" -f, <package> find installed packages",
" -t, <package> packages tracking dependencies from SBo",
" -n, <package> view packages from SBo repository",
" -b, --list blacklisted packages",
" -b [package...] --add --remove add, remove packages in blacklist",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
" -r, [package...] remove binary packages",
" -d, [package...] display the contents of the packages\n",
" -h, --help show this help message and exit",
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -b, --list, [package...] --add, --remove add, remove packages in blacklist",
" -l, all, sbo, slack, noarch list of installed packages",
" -c, <repository> --upgrade --current check for updated packages",
" -s, <repository> <package> --current download, build & install",
" -f, <package> find installed packages",
" -t, <package> tracking dependencies from SBo",
" -n, <package> view packages from SBo",
" -i, [package...] install binary packages",
" -u, [package...] upgrade binary packages",
" -o, [package...] reinstall binary packages",
" -r, [package...] remove binary packages",
" -d, [package...] display the contents\n",
"Repositories:",
" SlackBuilds = sbo",
" Slackware = slack '--current'\n",
@ -71,12 +70,12 @@ def main():
usage = [
"slpkg - version {0}\n".format(__version__),
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
" [-b --list, [...] --add, --remove]",
" [-l all, sbo, slack, noarch]",
" [-c <repository> --upgrade --current]",
" [-s <repository> <package> --current]",
" [-f] [-t] [-n] [-b --list]",
" [-b [...] --add --remove] [-i [...]]",
" [-u [...]] [-o [...]] [-r [...]] [-d [...]]\n",
" [-f] [-t] [-n] [-i [...]] [-u [...]]",
" [-o [...]] [-r [...]] [-d [...]]\n",
"For more information try 'slpkg --help'\n"
]
args = sys.argv
@ -127,11 +126,11 @@ def main():
elif len(args) == 2 and args[0] == "-n":
sbo_network(args[1])
elif len(args) == 2 and args[0] == "-b" and args[1] == "--list":
blacklisted()
BlackList().listed()
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--add":
add_blacklist(args[1:-1])
BlackList().add(args[1:-1])
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
remove_blacklist(args[1:-1])
BlackList().remove(args[1:-1])
elif len(args) > 1 and args[0] == "-i":
pkg_install(args[1:])
elif len(args) > 1 and args[0] == "-u":

View file

@ -23,15 +23,17 @@
import os
from blacklist import black_packages
from blacklist import BlackList
from slack.splitting import split_package
def find_package(find_pkg, directory):
'''
Find packages
'''
pkgs = []
blacklist = black_packages()
blacklist = BlackList().packages()
for pkg in sorted(os.listdir(directory)):
if pkg.startswith(find_pkg) and find_pkg[:-1] not in blacklist:
if pkg.startswith(find_pkg) and split_package(pkg + ".???")[0] not in blacklist:
pkgs.append(pkg)
return pkgs

View file

@ -26,7 +26,7 @@ import sys
import subprocess
from colors import *
from blacklist import black_packages
from blacklist import BlackList
from messages import pkg_not_found, template
from __metadata__ import pkg_path, sp, log_path
@ -172,7 +172,7 @@ def pkg_find(binary):
'''
binary = "".join(binary)
matching = size = int()
print("\nInstalled packages with name matching [ {0}{1}{2} ]\n".format(
print("\nInstalled packages with name begin matching [ {0}{1}{2} ]\n".format(
CYAN, binary, ENDC))
for match in find_package(binary, pkg_path):
if binary in match:
@ -230,7 +230,7 @@ def pkg_list(pattern):
elif "all" in pattern:
search = ""
index, page = 0, 50
for pkg in sorted(os.listdir(pkg_path)):
for pkg in find_package("", pkg_path):
if search in pkg:
index += 1
print("{0}{1}:{2} {3}".format(GREY, index, ENDC, pkg))

View file

@ -25,7 +25,7 @@ import sys
from colors import *
from init import initialization
from blacklist import black_packages
from blacklist import BlackList
from __metadata__ import pkg_path, sp
from messages import pkg_not_found, template
@ -42,7 +42,7 @@ def sbo_dependencies_pkg(name):
'''
try:
dependencies = []
blacklist = black_packages()
blacklist = BlackList().packages()
sbo_url = sbo_search_pkg(name)
if sbo_url:
requires = sbo_requires_pkg(name)

View file

@ -26,7 +26,7 @@ import re
import sys
from __metadata__ import lib_path
from blacklist import black_packages
from blacklist import BlackList
from slack.slack_version import slack_ver
@ -35,7 +35,7 @@ def sbo_search_pkg(name):
Search for package path from SLACKBUILDS.TXT file
'''
try:
blacklist = black_packages()
blacklist = BlackList().packages()
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
with open(lib_path + "sbo_repo/SLACKBUILDS.TXT", "r") as SLACKBUILDS_TXT:
for line in SLACKBUILDS_TXT:

View file

@ -29,7 +29,6 @@ from init import initialization
from downloader import download
from __metadata__ import (tmp, pkg_path, build_path,
log_path, lib_path, sp)
from messages import (pkg_not_found, pkg_found, template,
build_FAILED, sbo_packages_view)

View file

@ -28,7 +28,7 @@ import time
from colors import *
from url_read import url_read
from downloader import download
from blacklist import black_packages
from blacklist import BlackList
from messages import pkg_not_found, template
from __metadata__ import slpkg_tmp, pkg_path, slack_archs
@ -60,7 +60,7 @@ def install(slack_pkg, version):
CYAN, slack_pkg, ENDC))
sys.stdout.write(reading_lists)
sys.stdout.flush()
blacklist = black_packages()
blacklist = BlackList().packages()
PACKAGES = url_read(mirrors("PACKAGES.TXT", "", version))
EXTRA = url_read(mirrors("PACKAGES.TXT", "extra/", version))
PASTURE = url_read(mirrors("PACKAGES.TXT", "pasture/", version))

View file

@ -30,7 +30,7 @@ from colors import *
from url_read import url_read
from messages import template
from downloader import download
from blacklist import black_packages
from blacklist import BlackList
from __metadata__ import pkg_path, slpkg_tmp
from pkg.manager import pkg_upgrade
@ -56,7 +56,7 @@ def patches(version):
os.mkdir(patch_path)
sys.stdout.write (reading_lists)
sys.stdout.flush()
blacklist = black_packages()
blacklist = BlackList().packages()
if version == "stable":
PACKAGE_TXT = url_read(mirrors("PACKAGES.TXT", "patches/", version))
step = 100
@ -92,7 +92,7 @@ def patches(version):
installed = []
# get all installed packages and store the package name.
for pkg in os.listdir(pkg_path):
installed.append(split_package(pkg + ".txz")[0])
installed.append(split_package(pkg + ".???")[0])
for loc, name, comp, uncomp in zip(package_location, package_name, \
comp_size, uncomp_size):
# If the package from the current repository is installed

View file

@ -27,7 +27,7 @@ from slack_version import slack_ver
def split_package(package):
'''
Split package by name, version
Split package in name, version
arch and build tag.
'''
for archs in slack_archs: