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 Version 1.9.5
03-10.2014 04-10.2014
[Updated] - Added 'aaa_elflibs' in blacklist. [Updated] - Added 'aaa_elflibs' in blacklist.
- Fix current version upgrade only installed packages. - Fix current version upgrade only installed packages.

View file

@ -125,20 +125,18 @@ Command Line Tool Usage
-h, --help show this help message and exit -h, --help show this help message and exit
-v, --version print version and exit -v, --version print version and exit
-a, script [source...] auto build packages -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 -l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check if your packages is up to date -c, <repository> --upgrade --current check for updated packages
-s, <repository> <package> --current download, build & install packages -s, <repository> <package> --current download, build & install
-f, <package> find installed packages -f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo -t, <package> tracking dependencies from SBo
-n, <package> view packages from SBo repository -n, <package> view packages from SBo
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages -i, [package...] install binary packages
-u, [package...] upgrade binary packages -u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages -o, [package...] reinstall binary packages
-r, [package...] remove binary packages -r, [package...] remove binary packages
-d, [package...] display the contents of the packages -d, [package...] display the contents
Repositories: Repositories:
SlackBuilds = sbo SlackBuilds = sbo
Slackware = slack '--current' Slackware = slack '--current'
@ -446,7 +444,7 @@ Find installed packages:
$ slpkg -f apr $ 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-1.5.0-x86_64-1_slack14.1
[ installed ] - apr-util-1.5.3-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 slpkg - Utility for easy management packages in Slackware
.SH SYNOPSIS .SH SYNOPSIS
\fBUsage: slpkg [-h] [-v] [-a script [sources...]] \fBUsage: slpkg [-h] [-v] [-a script [sources...]]
[-b --list, --add, --remove [...]]
[-l all, sbo, slack, noarch] [-l all, sbo, slack, noarch]
[-c <repository> --upgrade --current] [-c <repository> --upgrade --current]
[-s <repository> <package> --current] [-s <repository> <package> --current]
[-f] [-t] [-n] [-i [...]] [-f] [-t] [-n] [-i [...]] [-u [...]]
[-u [...]] [-o [...]] [-r [...]] [-d [...]]\fp [-o [...]] [-r [...]] [-d [...]]\fp
.SH DESCRIPTION .SH DESCRIPTION
\fBslpkg\fP is a terminal multitool in order to easy use Slackware packages. \fBslpkg\fP is a terminal multitool in order to easy use Slackware packages.
@ -33,19 +34,18 @@ Optional arguments:
-h, --help show this help message and exit -h, --help show this help message and exit
-v, --version print version and exit -v, --version print version and exit
-a, script [source...] auto build packages -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 -l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check if your packages is up to date -c, <repository> --upgrade --current check for updated packages
-s, <repository> <package> --current download, build & install packages -s, <repository> <package> --current download, build & install
-f, <package> find installed packages -f, <package> find installed packages
-t, <package> packages tracking dependencies from SBo -t, <package> tracking dependencies from SBo
-n, <package> view packages from SBo repository -n, <package> view packages from SBo
-b, --list blacklisted packages
-b [package...] --add --remove add, remove packages in blacklist
-i, [package...] install binary packages -i, [package...] install binary packages
-u, [package...] upgrade binary packages -u, [package...] upgrade binary packages
-o, [package...] reinstall binary packages -o, [package...] reinstall binary packages
-r, [package...] remove binary packages -r, [package...] remove binary packages
-d, [package...] display the contents of the packages -d, [package...] display the contents
Repositories: Repositories:
SlackBuilds = sbo SlackBuilds = sbo
@ -62,6 +62,11 @@ The following commands are available.
\fBslpkg\fP \fB-a\fP <\fIscript\fP> <\fIsources\fP> \fBslpkg\fP \fB-a\fP <\fIscript\fP> <\fIsources\fP>
.PP .PP
With this argument, build slackware package from source quickly and easy. 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 .SS -l all, sbo, slack, noarch
\fBslpkg\fP \fB-l\fP \fIall\fP \fIsbo\fP \fIslack\fp \fInoarch\fp \fBslpkg\fP \fB-l\fP \fIall\fP \fIsbo\fP \fIslack\fp \fInoarch\fp
.PP .PP
@ -92,16 +97,6 @@ The sequence shown is that you must follow to correctly install package.
.PP .PP
With this method you can find the SBo script that interests you through With this method you can find the SBo script that interests you through
the network. (www.slackbuilds.org) 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 .SS -i , install binary package
\fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP> \fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP>
.PP .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 \ 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 | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
# check if blacklist file if already exist in /etc/slpkg
if [ ! -f "/etc/$PRGNAM/blacklist" ]; then
mkdir -p $PKG/etc/$PRGNAM mkdir -p $PKG/etc/$PRGNAM
if [ ! -f /etc/$PRGNAM/blacklist ]; then
install -D -m0644 conf/blacklist $PKG/etc/$PRGNAM/blacklist install -D -m0644 conf/blacklist $PKG/etc/$PRGNAM/blacklist
fi fi
# install man page
mkdir -p $PKG/usr/man/man8 mkdir -p $PKG/usr/man/man8
gzip -9 man/$PRGNAM.8 gzip -9 man/$PRGNAM.8
install -D -m0644 man/$PRGNAM.8.gz $PKG/usr/man/man8/$PRGNAM.8.gz install -D -m0644 man/$PRGNAM.8.gz $PKG/usr/man/man8/$PRGNAM.8.gz

View file

@ -22,10 +22,18 @@
# 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 os import os
from __metadata__ import bls_path from __metadata__ import bls_path
# create blacklist configuration file in /etc/slpkg if not exist. 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 = [ blacklist_conf = [
"# This is the blacklist file. Each package listed here may not be\n", "# This is the blacklist file. Each package listed here may not be\n",
"# installed be upgraded be find or deleted.\n", "# installed be upgraded be find or deleted.\n",
@ -58,23 +66,22 @@ blacklist_conf = [
"# aaa_elflibs can't be updated.\n", "# aaa_elflibs can't be updated.\n",
"aaa_elflibs\n" "aaa_elflibs\n"
] ]
black_conf = bls_path + "blacklist" self.blackfile = bls_path + "blacklist"
if not os.path.exists(bls_path): if not os.path.exists(bls_path):
os.mkdir(bls_path) os.mkdir(bls_path)
if not os.path.isfile(bls_path + "blacklist"): if not os.path.isfile(self.blackfile):
with open(black_conf, "w") as conf: with open(black_conf, "w") as conf:
for line in blacklist_conf: for line in blacklist_conf:
conf.write(line) conf.write(line)
conf.close() conf.close()
def black_packages(): def packages(self):
''' '''
Return blacklist packages from /etc/slpkg/blacklist Return blacklist packages from /etc/slpkg/blacklist
configuration file. configuration file.
''' '''
blacklist = [] blacklist = []
blackfile = bls_path + "blacklist" with open(self.blackfile, "r") as black_conf:
with open(blackfile, "r") as black_conf:
for read in black_conf: for read in black_conf:
read = read.lstrip() read = read.lstrip()
if not read.startswith("#"): if not read.startswith("#"):
@ -82,28 +89,27 @@ def black_packages():
black_conf.close() black_conf.close()
return blacklist return blacklist
def blacklisted(): def listed(self):
''' '''
Print blacklist packages Print blacklist packages
''' '''
exit = 0 exit = 0
print("\nPackages in blacklist:\n") print("\nPackages in blacklist:\n")
for black in black_packages(): for black in self.packages():
if black: if black:
print(black) print(black)
exit = 1 exit = 1
if exit == 1: if exit == 1:
print # new line at exit print # new line at exit
def add_blacklist(pkgs): def add(self, pkgs):
''' '''
Add blacklist packages if not exist Add blacklist packages if not exist
''' '''
exit = 0 exit = 0
blackfile = bls_path + "blacklist" blacklist = self.packages()
blacklist = black_packages()
print("\nAdd packages in blacklist:\n") print("\nAdd packages in blacklist:\n")
with open(blackfile, "a") as black_conf: with open(self.blackfile, "a") as black_conf:
for pkg in pkgs: for pkg in pkgs:
if pkg not in blacklist: if pkg not in blacklist:
print(pkg) print(pkg)
@ -113,23 +119,22 @@ def add_blacklist(pkgs):
if exit == 1: if exit == 1:
print # new line at exit print # new line at exit
def remove_blacklist(pkgs): def remove(self, pkgs):
''' '''
Remove packages from blacklist Remove packages from blacklist
''' '''
exit = 0 exit = 0
blackfile = bls_path + "blacklist"
print("\nRemove packages from blacklist:\n") print("\nRemove packages from blacklist:\n")
with open(blackfile, "r") as read_black_conf: with open(self.blackfile, "r") as read_black_conf:
lines = read_black_conf.read() lines = read_black_conf.read()
read_black_conf.close() read_black_conf.close()
with open(blackfile, "w") as black_conf: with open(self.blackfile, "w") as write_black_conf:
for line in lines.splitlines(): for line in lines.splitlines():
if line not in pkgs: if line not in pkgs:
black_conf.write(line + "\n") write_black_conf.write(line + "\n")
else: else:
print(line) print(line)
exit = 1 exit = 1
black_conf.close() write_black_conf.close()
if exit == 1: if exit == 1:
print # new line at exit print # new line at exit

View file

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

View file

@ -23,15 +23,17 @@
import os import os
from blacklist import black_packages from blacklist import BlackList
from slack.splitting import split_package
def find_package(find_pkg, directory): def find_package(find_pkg, directory):
''' '''
Find packages Find packages
''' '''
pkgs = [] pkgs = []
blacklist = black_packages() blacklist = BlackList().packages()
for pkg in sorted(os.listdir(directory)): 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) pkgs.append(pkg)
return pkgs return pkgs

View file

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

View file

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

View file

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

View file

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

View file

@ -28,7 +28,7 @@ import time
from colors import * from colors import *
from url_read import url_read from url_read import url_read
from downloader import download from downloader import download
from blacklist import black_packages from blacklist import BlackList
from messages import pkg_not_found, template from messages import pkg_not_found, template
from __metadata__ import slpkg_tmp, pkg_path, slack_archs from __metadata__ import slpkg_tmp, pkg_path, slack_archs
@ -60,7 +60,7 @@ def install(slack_pkg, version):
CYAN, slack_pkg, ENDC)) CYAN, slack_pkg, ENDC))
sys.stdout.write(reading_lists) sys.stdout.write(reading_lists)
sys.stdout.flush() sys.stdout.flush()
blacklist = black_packages() blacklist = BlackList().packages()
PACKAGES = url_read(mirrors("PACKAGES.TXT", "", version)) PACKAGES = url_read(mirrors("PACKAGES.TXT", "", version))
EXTRA = url_read(mirrors("PACKAGES.TXT", "extra/", version)) EXTRA = url_read(mirrors("PACKAGES.TXT", "extra/", version))
PASTURE = url_read(mirrors("PACKAGES.TXT", "pasture/", 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 url_read import url_read
from messages import template from messages import template
from downloader import download from downloader import download
from blacklist import black_packages from blacklist import BlackList
from __metadata__ import pkg_path, slpkg_tmp from __metadata__ import pkg_path, slpkg_tmp
from pkg.manager import pkg_upgrade from pkg.manager import pkg_upgrade
@ -56,7 +56,7 @@ def patches(version):
os.mkdir(patch_path) os.mkdir(patch_path)
sys.stdout.write (reading_lists) sys.stdout.write (reading_lists)
sys.stdout.flush() sys.stdout.flush()
blacklist = black_packages() blacklist = BlackList().packages()
if version == "stable": if version == "stable":
PACKAGE_TXT = url_read(mirrors("PACKAGES.TXT", "patches/", version)) PACKAGE_TXT = url_read(mirrors("PACKAGES.TXT", "patches/", version))
step = 100 step = 100
@ -92,7 +92,7 @@ def patches(version):
installed = [] installed = []
# get all installed packages and store the package name. # get all installed packages and store the package name.
for pkg in os.listdir(pkg_path): 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, \ for loc, name, comp, uncomp in zip(package_location, package_name, \
comp_size, uncomp_size): comp_size, uncomp_size):
# If the package from the current repository is installed # 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): def split_package(package):
''' '''
Split package by name, version Split package in name, version
arch and build tag. arch and build tag.
''' '''
for archs in slack_archs: for archs in slack_archs: