updated for version 1.9.9

This commit is contained in:
Dimitris Zlatanidis 2014-10-11 05:56:37 +03:00
parent 90b83214c0
commit a8d3186307
12 changed files with 284 additions and 32 deletions

View file

@ -1,3 +1,8 @@
Version 1.9.9
11-10-2014
[Feature] - Added queue options.
Version 1.9.8
07-10-2014

View file

@ -1,6 +1,6 @@
Metadata-Version: 1.1
Name: slpkg
Version: 1.9.8
Version: 1.9.9
Author: dslackw
Author-email: d zlatanidis at gmail com
Maintainer: dslackw

View file

@ -7,9 +7,9 @@
Latest Release:
- Version: 1.9.8
- Version: 1.9.9
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.9.8.tar.gz>`_
- `Source <https://github.com/dslackw/slpkg/archive/v1.9.9.tar.gz>`_
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
@ -86,7 +86,7 @@ Tutorial
--------
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/screenshot-1.png
:target: https://asciinema.org/a/12667
:target: https://asciinema.org/a/12544
Installation
@ -96,8 +96,8 @@ Untar the archive and run install.sh script:
.. code-block:: bash
$ tar xvf slpkg-1.9.8.tar.gz
$ cd slpkg-1.9.8
$ tar xvf slpkg-1.9.9.tar.gz
$ cd slpkg-1.9.9
$ ./install.sh
Using `pip <https://pip.pypa.io/en/latest/>`_ :
@ -126,6 +126,8 @@ Command Line Tool Usage
-v, --version print version and exit
-a, script [source...] auto build packages
-b, --list, [package...] --add, --remove add, remove packages in blacklist
-q, --list, [package...] --add, --remove add, remove packages in queue
--build, --install, --build-install build or install from queue
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check for updated packages
-s, <repository> <package> --current download, build & install
@ -576,6 +578,41 @@ Remove packages with all dependencies:
+==============================================================================
Build and install packages that have added to the queue:
.. code-block:: bash
$ slpkg -q roxterm SDL2 CEGUI --add
Add packages in queue:
roxterm
SDL2
CEGUI
$ slpkg -q roxterm --remove (or 'slpkg -q all --remove' remove all packages from queue)
Remove packages from queue:
roxterm
$ slpkg -q --list
Packages in queue:
SDL2
CEGUI
$ slpkg -q --build (build only packages from queue)
$ slpkg -q --install (install packages from queue)
$ slpkg -q --build-install (build and install)
Add packages in blacklist file manually from
/etc/slpkg/blacklist or with the following options:

View file

@ -21,7 +21,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.9.8}
VERSION=${VERSION:-1.9.9}
TAG=${TAG:-_dsw}
cd ..

View file

@ -17,6 +17,8 @@ slpkg - Utility for easy management packages in Slackware
.SH SYNOPSIS
\fBUsage: slpkg [-h] [-v] [-a script [sources...]]
[-b --list, --add, --remove [...]]
[-q --list, [...] --add, --remove]
[-q --build, --install, --build-install]
[-l all, sbo, slack, noarch]
[-c <repository> --upgrade --current]
[-s <repository> <package> --current]
@ -35,6 +37,8 @@ Optional arguments:
-v, --version print version and exit
-a, script [source...] auto build packages
-b, --list, [package...] --add, --remove add, remove packages in blacklist
-q, --list, [package...] --add, --remove add, remove packages in queue
--build, --install, --build-install build or install from queue
-l, all, sbo, slack, noarch list of installed packages
-c, <repository> --upgrade --current check for updated packages
-s, <repository> <package> --current download, build & install
@ -65,26 +69,35 @@ 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
List, add or remove packages from blacklist file. The settings here affect
all repositories.
.SS -q , --list <packages> --add, --remove, --build, --install, --build-install
\fBslpkg\fP \fB-q\fP \fB--list\fP <\fIpackages\fP> \fB--add\fP \fB--remove\fP
.PP
List, add, or remove sbo packages from queue. If you want to remove all the packages
from the list 'slpkg -q all --remove'. (these arguments only working for the sbo repository)
.PP
\fBslpkg\fP \fB-q\fP \fB--build\fP \fB--install\fP \fB--build-install\fP
.PP
Build or install or build and install packages are queued.
.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
Four display options list, sbo, slack, noarch and all packages
items that are installed on the system.
.SS -c , <repository> check if your packages is up to date
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\fP \fI--current\fP
\fBslpkg\fP \fB-c\fP <\fIrepository\fP> \fI--upgrade\fP \fB--current\fP
.PP
Check your packages from Slackware official mirrors or from
slackbuilds.org is up to date. Use '--current' to switch in current repository.
.SS -s , <repository> download, build and install package with all dependencies
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP> \fI--current\fP
\fBslpkg\fP \fB-s\fP <\fIrepository\fP> <\fIname of package\fP> \fB--current\fP
.PP
Installs or upgrade packages from the repository slackbuilds.org automatically resolving all
dependencies of the package. Also installs the official distribution Slackware
packages. Use '--current' to install packages from Slackware current repository.
.SS -f find packages
\fBslpkg\fP \fB-f\fP <\fIname of packages\fP>
\fBslpkg\fP \fB-f\fP <\fIname of package\fP>
.PP
Find installed packages with view total file size.
.SS -t , tracking dependencies
@ -97,19 +110,19 @@ 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 -i , install binary package
.SS -i , install binary packages
\fBslpkg\fP \fB-i\fP <\fIpackages.t?z\fP>
.PP
Installs single binary packages designed for use with the
Slackware Linux distribution into your system.
.SS -u , install-upgrade package with new
.SS -u , install-upgrade packages with new
\fBslpkg\fP \fB-u\fP <\fIpackages.t?z\fP>
.PP
Normally upgrade only upgrades packages that are already
installed on the system, and will skip any packages that do not
already have a version installed. 'Requires root privileges'
(like slackware command upgradepkg --install-new)
.SS -o , reinstall binary package
.SS -o , reinstall binary packages
\fBslpkg\fP \fB-o\fP <\fIpackages.t?z\fP>
.PP
Upgradepkg usually skips packages if the exact same package

View file

@ -23,7 +23,7 @@
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
PRGNAM=slpkg
VERSION=${VERSION:-1.9.8}
VERSION=${VERSION:-1.9.9}
BUILD=${BUILD:-1}
TAG=${TAG:-_dsw}

View file

@ -1,7 +1,7 @@
PRGNAM="slpkg"
VERSION="1.9.8"
VERSION="1.9.9"
HOMEPAGE="https://github.com/dslackw/slpkg"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.8.tar.gz"
DOWNLOAD="https://github.com/dslackw/slpkg/archive/v1.9.9.tar.gz"
MD5SUM=""
DOWNLOAD_x86_64=""
MD5SUM_x86_64=""

View file

@ -26,7 +26,7 @@ import subprocess
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (1, 9, 8)
__version_info__ = (1, 9, 9)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"

View file

@ -22,6 +22,8 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
from colors import *
from __metadata__ import bls_path
@ -98,7 +100,7 @@ class BlackList(object):
print("\nPackages in blacklist:\n")
for black in self.packages():
if black:
print(black)
print("{0}{1}{2}".format(GREEN, black, ENDC))
exit = 1
if exit == 1:
print # new line at exit
@ -109,14 +111,15 @@ class BlackList(object):
'''
exit = 0
blacklist = self.packages()
pkgs = set(pkgs)
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)
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
black_conf.write(pkg + "\n")
exit = 1
black_conf.close()
black_conf.close()
if exit == 1:
print # new line at exit
@ -126,16 +129,17 @@ class BlackList(object):
'''
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:
with open(self.blackfile, "r") as black_conf:
lines = black_conf.read()
black_conf.close()
with open(self.blackfile, "w") as black_conf:
for line in lines.splitlines():
if line not in pkgs:
write_black_conf.write(line + "\n")
black_conf.write(line + "\n")
else:
print(line)
print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1
write_black_conf.close()
black_conf.close()
if exit == 1:
print # new line at exit

View file

@ -41,6 +41,7 @@ def initialization():
'''
sbo_log = log_path + "sbo/"
sbo_lib = lib_path + "sbo_repo/"
pkg_que = lib_path + "queue"
if not os.path.exists(log_path):
os.mkdir(log_path)
if not os.path.exists(lib_path):
@ -49,6 +50,8 @@ def initialization():
os.mkdir(sbo_log)
if not os.path.exists(sbo_lib):
os.mkdir(sbo_lib)
if not os.path.exists(pkg_que):
os.mkdir(pkg_que)
sbo_url = ("http://slackbuilds.org/slackbuilds/{0}/".format(slack_ver()))
# Read SLACKBUILDS.TXT from slackbuilds.org and write in /var/lib/slpkg/sbo_repo/
# directory if not exist

View file

@ -25,6 +25,7 @@ import sys
import getpass
from colors import *
from queue import QueuePkgs
from messages import s_user
from blacklist import BlackList
from version import prog_version
@ -53,6 +54,8 @@ def main():
" -v, --version print version and exit",
" -a, script [source...] auto build packages",
" -b, --list, [package...] --add, --remove add, remove packages in blacklist",
" -q, --list, [package...] --add, --remove add, remove packages in queue",
" --build, --install, --build-install build or install from queue",
" -l, all, sbo, slack, noarch list of installed packages",
" -c, <repository> --upgrade --current check for updated packages",
" -s, <repository> <package> --current download, build & install",
@ -72,6 +75,8 @@ def main():
"slpkg - version {0}\n".format(__version__),
"Usage: slpkg [-h] [-v] [-a script [sources...]]",
" [-b --list, [...] --add, --remove]",
" [-q --list, [...] --add, --remove]",
" [-q --build, --install, --build-install]",
" [-l all, sbo, slack, noarch]",
" [-c <repository> --upgrade --current]",
" [-s <repository> <package> --current]",
@ -82,6 +87,8 @@ def main():
args = sys.argv
args.pop(0)
repository = ["sbo", "slack"]
blacklist = BlackList()
queue = QueuePkgs()
if len(args) == 0:
for opt in usage: print(opt)
elif len(args) == 1 and args[0] == "-h" or args[0] == "--help" and args[1:] == []:
@ -127,11 +134,24 @@ 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":
BlackList().listed()
blacklist.listed()
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--add":
BlackList().add(args[1:-1])
blacklist.add(args[1:-1])
elif len(args) > 2 and args[0] == "-b" and args[-1] == "--remove":
BlackList().remove(args[1:-1])
blacklist.remove(args[1:-1])
elif len(args) == 2 and args[0] == "-q" and args[1] == "--list":
queue.listed()
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--add":
queue.add(args[1:-1])
elif len(args) > 2 and args[0] == "-q" and args[-1] == "--remove":
queue.remove(args[1:-1])
elif len(args) == 2 and args[0] =="-q" and args[1] == "--build":
queue.build()
elif len(args) == 2 and args[0] =="-q" and args[1] == "--install":
queue.install()
elif len(args) == 2 and args[0] =="-q" and args[1] == "--build-install":
queue.build()
queue.install()
elif len(args) > 1 and args[0] == "-i":
PackageManager(args[1:]).install()
elif len(args) > 1 and args[0] == "-u":

170
slpkg/queue.py Executable file
View file

@ -0,0 +1,170 @@
#!/usr/bin/python
# -*- coding: utf-8 -*-
# queue.py file is part of slpkg.
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
# All rights reserved.
# Utility for easy management packages in Slackware
# https://github.com/dslackw/slpkg
# Slpkg is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import os
import sys
from colors import *
from downloader import Download
from __metadata__ import lib_path, build_path, tmp
from sbo.greps import SBoGrep
from pkg.find import find_package
from pkg.build import build_package
from sbo.search import sbo_search_pkg
from pkg.manager import PackageManager
from sbo.download import sbo_slackbuild_dwn
class QueuePkgs(object):
'''
Class to list, add or remove packages in queue,
also build or install.
'''
def __init__(self):
queue_file = [
"# In this file you can create a list of\n",
"# packages you want to build or install.\n",
"#\n"
]
self.queue = lib_path + "queue/"
self.queue_list = self.queue + "queue_list"
if not os.path.exists(lib_path):
os.mkdir(lib_path)
if not os.path.exists(self.queue):
os.mkdir(self.queue)
if not os.path.isfile(self.queue_list):
with open(self.queue_list, "w") as queue:
for line in queue_file:
queue.write(line)
queue.close()
def packages(self):
'''
Return queue list from /var/lib/queue/queue_list
file.
'''
queue_list = []
with open(self.queue_list, "r") as queue:
for read in queue:
read = read.lstrip()
if not read.startswith("#"):
queue_list.append(read.replace("\n", ""))
queue.close()
return queue_list
def listed(self):
'''
Print packages from queue
'''
exit = 0
print("\nPackages in queue:\n")
for pkg in self.packages():
if pkg:
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
exit = 1
if exit == 1:
print # new line at exit
def add(self, pkgs):
'''
Add packages in queue if not exist
'''
exit = 0
queue_list = self.packages()
pkgs = set(pkgs)
print("\nAdd packages in queue:\n")
with open(self.queue_list, "a") as queue:
for pkg in pkgs:
find = sbo_search_pkg(pkg)
if pkg not in queue_list and find is not None:
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
queue.write(pkg + "\n")
exit = 1
else:
print("{0}{1}{2}".format(RED, pkg, ENDC))
exit = 1
queue.close()
if exit == 1:
print # new line at exit
def remove(self, pkgs):
'''
Remove packages from queue
'''
exit = 0
print("\nRemove packages from queue:\n")
with open(self.queue_list, "r") as queue:
lines = queue.read()
queue.close()
if pkgs == ["all"]: pkgs = self.packages()
with open(self.queue_list, "w") as queue:
for line in lines.splitlines():
if line not in pkgs:
queue.write(line + "\n")
else:
print("{0}{1}{2}".format(RED, line, ENDC))
exit = 1
queue.close()
if exit == 1:
print # new line at exit
def build(self):
'''
Build packages from queue
'''
packages = self.packages()
if packages:
for pkg in packages:
if not os.path.exists(build_path):
os.mkdir(build_path)
sbo_url = sbo_search_pkg(pkg)
sbo_dwn = sbo_slackbuild_dwn(sbo_url)
source_dwn = SBoGrep(pkg).source().split()
sources = []
os.chdir(build_path)
script = sbo_dwn.split("/")[-1] # get file from script link
Download(build_path, sbo_dwn).start()
for src in source_dwn:
Download(build_path, src).start()
sources.append(src.split("/")[-1]) # get file from source link
build_package(script, sources, build_path)
else:
print("\nPackages not found in the queue for building\n")
def install(self):
packages = self.packages()
if packages:
print # new line at start
for pkg in packages:
# check if package exist in repository
find = find_package(pkg, tmp)
try:
find = max(find)
except ValueError:
print("Package '{0}' not found in /tmp\n".format(pkg))
if pkg in find:
binary = "{0}{1}".format(tmp, find)
PackageManager(binary.split()).install()
else:
print("\nPackages not found in the queue for installation\n")