mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2024-12-26 09:58:31 +01:00
updated for version 2.1.4
This commit is contained in:
parent
9e4c0a0ac9
commit
1c944e9271
25 changed files with 343 additions and 164 deletions
11
CHANGELOG
11
CHANGELOG
|
@ -1,3 +1,14 @@
|
|||
Version 2.1.4
|
||||
16-12-2014
|
||||
|
||||
[Feature] - Added command 'update' and remove auto update package lists.
|
||||
- Added slpkg update itself.
|
||||
|
||||
[Updated] - Fix 'UnboundLocalError: local variable 'md5' referenced before assignment'
|
||||
after try update alien repository in some packages and for Slackware current
|
||||
users. Thanks to 'Jack Kiersey' for reporting.
|
||||
- Fix checksums after try to update slackware packages.
|
||||
|
||||
Version 2.1.3
|
||||
06-12-2014
|
||||
|
||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
|||
Metadata-Version: 1.1
|
||||
Name: slpkg
|
||||
Version: 2.1.3
|
||||
Version: 2.1.4
|
||||
Author: dslackw
|
||||
Author-email: d zlatanidis at gmail com
|
||||
Maintainer: dslackw
|
||||
|
|
55
README.rst
55
README.rst
|
@ -11,9 +11,9 @@
|
|||
|
||||
Latest Release:
|
||||
|
||||
- Version: 2.1.3
|
||||
- Version: 2.1.4
|
||||
- `Package <https://sourceforge.net/projects/slpkg/files/slpkg/binary/>`_
|
||||
- `Source <https://github.com/dslackw/slpkg/archive/v2.1.3.tar.gz>`_
|
||||
- `Source <https://github.com/dslackw/slpkg/archive/v2.1.4.tar.gz>`_
|
||||
- `CHANGELOG <https://github.com/dslackw/slpkg/blob/master/CHANGELOG>`_
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/logo.png
|
||||
|
@ -50,8 +50,8 @@ Supported Repositories:
|
|||
Arch: {x86, x86_64}
|
||||
Versions: {13.37, 14.0, 14.1}
|
||||
|
||||
* Choose repositories you need to work from file '/etc/slpkg/slpkg.conf' default is all repositories.
|
||||
|
||||
* Choose repositories you need to work from file '/etc/slpkg/slpkg.conf' default is
|
||||
all repositories.
|
||||
|
||||
Slpkg works in accordance with the standards of the organization slackbuilds.org
|
||||
to builds packages. Also uses the Slackware linux instructions for installation,
|
||||
|
@ -64,18 +64,12 @@ display warning messages, etc.
|
|||
The big advantages is resolving dependencies packages from repositories and monitored for
|
||||
upgraded packages.
|
||||
|
||||
Of course you wonder how the slpkg is up to date at all times;
|
||||
It's simple, every time there is a change in ChangeLog.txt before proceeding to any
|
||||
execution program looksat whether there is a change in file size and downloads and updates
|
||||
the PACKAGES.TXT file.
|
||||
|
||||
Also you can install official packages of your favorite distribution directly from the
|
||||
official repositories
|
||||
of Slackware. Even you can check for the official updates and install them.
|
||||
|
||||
And as we say Slackers, Keep it Simple Stupid!
|
||||
|
||||
|
||||
.. image:: https://raw.githubusercontent.com/dslackw/images/master/slpkg/slpkg_package.png
|
||||
:target: https://github.com/dslackw/slpkg
|
||||
|
||||
|
@ -118,8 +112,8 @@ Untar the archive and run install.sh script:
|
|||
|
||||
.. code-block:: bash
|
||||
|
||||
$ tar xvf slpkg-2.1.3.tar.gz
|
||||
$ cd slpkg-2.1.3
|
||||
$ tar xvf slpkg-2.1.4.tar.gz
|
||||
$ cd slpkg-2.1.4
|
||||
$ ./install.sh
|
||||
|
||||
From SourceForge:
|
||||
|
@ -136,12 +130,10 @@ Using pip:
|
|||
Upgrade
|
||||
-------
|
||||
|
||||
From version '2.1.4' you can update slpkg itself with '# slpkg update slpkg'.
|
||||
In each slpkg upgrade should track the configuration files in the file '/etc/slpkg' for
|
||||
new updates.
|
||||
|
||||
*** IMPORTANT :
|
||||
*** Recommended to replace '/etc/slpkg/slpkg.conf' file with '/etc/slpkg/slpkg.conf.new' file.
|
||||
|
||||
|
||||
Configuration files
|
||||
-------------------
|
||||
|
@ -168,6 +160,15 @@ For Slackware 'current' users must change the variable VERSION in '/etc/slpkg.co
|
|||
$ slpkg -g --config=nano
|
||||
|
||||
|
||||
Testing
|
||||
-------
|
||||
|
||||
The majority of trials have been made in an environment Slackware x86_64 and x86 stable version
|
||||
14.1.
|
||||
Is logical tests are always to be latest versions of the distribution.
|
||||
Slpkg are supported version 'current' but it is minimal tests have been done on this release.
|
||||
|
||||
|
||||
Slackware Mirrors
|
||||
-----------------
|
||||
|
||||
|
@ -175,6 +176,24 @@ Slpkg uses the central mirror "http://mirrors.slackware.com/slackware/"
|
|||
to find the nearest one. If however for some reason this troublesome
|
||||
please edit the file in '/etc/slpkg/slackware-mirrors'.
|
||||
|
||||
|
||||
Usage
|
||||
-----
|
||||
|
||||
Need to run '# slpkg update' for the first time to synchronize the list of packages,
|
||||
also every time you add a repository.
|
||||
To add or remove repositories must edit the file '/etc/slpkg/slpkg.conf'.
|
||||
|
||||
Also it is good to update the list of packages by running the command '# slpkg update'
|
||||
before proceeding to any installation or upgrade a new package.
|
||||
|
||||
|
||||
Issues
|
||||
------
|
||||
|
||||
Please report any bugs in "https://github.com/dslackw/slpkg/issues"
|
||||
|
||||
|
||||
Command Line Tool Usage
|
||||
-----------------------
|
||||
|
||||
|
@ -182,6 +201,10 @@ Command Line Tool Usage
|
|||
|
||||
Utility for easy management packages in Slackware
|
||||
|
||||
Commands:
|
||||
update update all package lists
|
||||
update slpkg check and update slpkg
|
||||
|
||||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version print version and exit
|
||||
|
@ -194,7 +217,7 @@ Command Line Tool Usage
|
|||
-c, [repository] --upgrade check for updated packages
|
||||
-s, [repository] [package] download, build & install
|
||||
-t, [repository] [package] tracking dependencies
|
||||
-p, [repository] [package] --color=[] print package description
|
||||
-p, [repository] [package], --color=[] print package description
|
||||
-f, [package] find installed packages
|
||||
-n, [package] view SBo packages through network
|
||||
-i, [package...] install binary packages
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
# List of Slackware Mirrors copy from :
|
||||
# List of Slackware Mirrors copy from :
|
||||
# http://mirrors.slackware.com/mirrorlist/
|
||||
#
|
||||
# slackware-mirrors file is part of slpkg.
|
||||
|
@ -24,14 +24,14 @@
|
|||
# END OF LEGAL NOTICE
|
||||
#
|
||||
#
|
||||
# Slpkg uses the central mirror "http://mirrors.slackware.com/slackware/"
|
||||
# to find the nearest one. If however for some reason this troublesome
|
||||
# please uncomment (remove the '#' character) only one mirror from
|
||||
# the list available below. You can also add a new mirror in the list
|
||||
# Slpkg uses the central mirror "http://mirrors.slackware.com/slackware/"
|
||||
# to find the nearest one. If however for some reason this troublesome
|
||||
# please uncomment (remove the '#' character) only one mirror from
|
||||
# the list available below. You can also add a new mirror in the list
|
||||
# below. Be careful is the template that the rest.
|
||||
#
|
||||
#
|
||||
# Last Updated: Thu Dec 4 02:47:01 UTC 2014
|
||||
# Last Updated: Mon Dec 15 02:47:02 UTC 2014
|
||||
#
|
||||
# Available http mirrors:
|
||||
#
|
||||
|
|
|
@ -21,7 +21,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-2.1.3}
|
||||
VERSION=${VERSION:-2.1.4}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
# Installation script.
|
||||
|
|
19
man/slpkg.8
19
man/slpkg.8
|
@ -24,7 +24,7 @@ Usage: slpkg [-h] [-v] [-a script.tar.gz [sources...]]
|
|||
[-c [repository] --upgrade]
|
||||
[-s [repository] [package][
|
||||
[-t [repository] [package]]
|
||||
[-p [repository] [package] --color=]
|
||||
[-p [repository] [package], --color=[]]
|
||||
[-f] [-n] [-i [...]] [-u [...]]
|
||||
[-o [...]] [-r [...]] [-d [...]]
|
||||
|
||||
|
@ -35,6 +35,10 @@ It's a quick and easy way to manage your packages in slackware to a command.
|
|||
.SH EXAMPLES
|
||||
Utility for easy management packages in Slackware
|
||||
|
||||
Commands:
|
||||
update update all package lists
|
||||
update slpkg check and update slpkg
|
||||
|
||||
Optional arguments:
|
||||
-h, --help show this help message and exit
|
||||
-v, --version print version and exit
|
||||
|
@ -47,7 +51,7 @@ Optional arguments:
|
|||
-c, [repository] --upgrade check for updated packages
|
||||
-s, [repository] [package] download, build & install
|
||||
-t, [repository] [package] tracking dependencies
|
||||
-p, [repository] [package] --color=[] print package description
|
||||
-p, [repository] [package], --color=[] print package description
|
||||
-f, [package] find installed packages
|
||||
-n, [package] view SBo packages through network
|
||||
-i, [package...] install binary packages
|
||||
|
@ -69,6 +73,17 @@ Print the version of program and exit.
|
|||
.PP
|
||||
The following commands are available.
|
||||
|
||||
.SS update
|
||||
\fBslpkg\fP \fBupdate\fP
|
||||
.PP
|
||||
Used to re-synchronize the package lists and create some important files.
|
||||
This command must run every new repository is added or new updates is available.
|
||||
|
||||
.SS update slpkg
|
||||
\fBslpkg\fP \fBupdate\fP \fBslpkg\fP
|
||||
.PP
|
||||
You can check for new versions and update slpkg itself.
|
||||
|
||||
.SS -a, auto build packages
|
||||
\fBslpkg\fP \fB-a\fP <\fIscript\fP> <\fIsources\fP>
|
||||
.PP
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
||||
|
||||
PRGNAM=slpkg
|
||||
VERSION=${VERSION:-2.1.3}
|
||||
VERSION=${VERSION:-2.1.4}
|
||||
BUILD=${BUILD:-1}
|
||||
TAG=${TAG:-_dsw}
|
||||
|
||||
|
|
|
@ -26,7 +26,7 @@ import os
|
|||
|
||||
__all__ = "slpkg"
|
||||
__author__ = "dslackw"
|
||||
__version_info__ = (2, 1, 3)
|
||||
__version_info__ = (2, 1, 4)
|
||||
__version__ = "{0}.{1}.{2}".format(*__version_info__)
|
||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
|
|
@ -31,6 +31,10 @@ def options():
|
|||
arguments = [
|
||||
"\nslpkg - version {0}\n".format(__version__),
|
||||
"Utility for easy management packages in Slackware\n",
|
||||
"Commands:",
|
||||
" update update all package " +
|
||||
"lists",
|
||||
" update slpkg check and update slpkg\n",
|
||||
"Optional arguments:",
|
||||
" -h, --help show this help message " +
|
||||
"and exit",
|
||||
|
@ -50,7 +54,7 @@ def options():
|
|||
"packages",
|
||||
" -s, [repository] [package] download, build & install",
|
||||
" -t, [repository] [package] tracking dependencies",
|
||||
" -p, [repository] [package] --color=[] print package description",
|
||||
" -p, [repository] [package], --color=[] print package description",
|
||||
" -f, [package] find installed packages",
|
||||
" -n, [package] view SBo packages "
|
||||
"through network",
|
||||
|
@ -76,7 +80,7 @@ def usage():
|
|||
" [-c [repository] --upgrade]",
|
||||
" [-s [repository] [package]",
|
||||
" [-t [repository] [package]",
|
||||
" [-p [repository] [package] --color=[]]",
|
||||
" [-p [repository] [package], --color=[]]",
|
||||
" [-f] [-n] [-i [...]] [-u [...]]",
|
||||
" [-o [...]] [-r [...]] [-d [...]]\n",
|
||||
"For more information try 'slpkg --help' or view manpage\n"
|
||||
|
|
|
@ -22,7 +22,6 @@
|
|||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
|
||||
from init import Initialization
|
||||
from messages import pkg_not_found
|
||||
from __metadata__ import (
|
||||
lib_path,
|
||||
|
@ -39,15 +38,6 @@ class PkgDesc(object):
|
|||
self.paint = paint
|
||||
self.COLOR = ""
|
||||
self.lib = ""
|
||||
init_repos = {
|
||||
'sbo': Initialization().sbo,
|
||||
'slack': Initialization().slack,
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky,
|
||||
'studio': Initialization().studioware
|
||||
}
|
||||
init_repos[self.repo]()
|
||||
color_text = {
|
||||
'red': color['RED'],
|
||||
'green': color['GREEN'],
|
||||
|
|
|
@ -21,7 +21,9 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from slack.mirrors import mirrors
|
||||
|
||||
from url_read import URL
|
||||
from __metadata__ import lib_path
|
||||
|
||||
|
||||
|
@ -29,17 +31,21 @@ def pkg_checksum(binary, repo):
|
|||
'''
|
||||
Return checksum from CHECKSUMS.md5 file by repository
|
||||
'''
|
||||
repos = {
|
||||
'slack': 'slack_repo/CHECKSUMS.md5',
|
||||
'rlw': 'rlw_repo/CHECKSUMS.md5',
|
||||
'alien': 'alien_repo/CHECKSUMS.md5',
|
||||
'slacky': 'slacky_repo/CHECKSUMS.md5',
|
||||
'studio': 'studio_repo/CHECKSUMS.md5'
|
||||
}
|
||||
lib = repos[repo]
|
||||
f = open(lib_path + lib, "r")
|
||||
CHECKSUMS_md5 = f.read()
|
||||
f.close()
|
||||
md5 = "None"
|
||||
if repo == "slack_patches":
|
||||
CHECKSUMS_md5 = URL(mirrors("CHECKSUMS.md5", "patches/")).reading()
|
||||
else:
|
||||
repos = {
|
||||
'slack': 'slack_repo/CHECKSUMS.md5',
|
||||
'rlw': 'rlw_repo/CHECKSUMS.md5',
|
||||
'alien': 'alien_repo/CHECKSUMS.md5',
|
||||
'slacky': 'slacky_repo/CHECKSUMS.md5',
|
||||
'studio': 'studio_repo/CHECKSUMS.md5'
|
||||
}
|
||||
lib = repos[repo]
|
||||
f = open(lib_path + lib, "r")
|
||||
CHECKSUMS_md5 = f.read()
|
||||
f.close()
|
||||
for line in CHECKSUMS_md5.splitlines():
|
||||
if line.endswith(binary):
|
||||
md5 = line.split()[0]
|
||||
|
|
117
slpkg/init.py
117
slpkg/init.py
|
@ -25,13 +25,15 @@ import os
|
|||
import sys
|
||||
|
||||
from url_read import URL
|
||||
from toolbar import status
|
||||
from repositories import Repo
|
||||
from file_size import FileSize
|
||||
from __metadata__ import (
|
||||
color,
|
||||
log_path,
|
||||
lib_path,
|
||||
slack_rel,
|
||||
build_path,
|
||||
repositories,
|
||||
slpkg_tmp_packages,
|
||||
slpkg_tmp_patches
|
||||
)
|
||||
|
@ -67,21 +69,21 @@ class Initialization(object):
|
|||
lib_file = "PACKAGES.TXT"
|
||||
md5_file = "CHECKSUMS.md5"
|
||||
log_file = "ChangeLog.txt"
|
||||
version = slack_rel
|
||||
if not os.path.exists(log):
|
||||
os.mkdir(log)
|
||||
if not os.path.exists(lib):
|
||||
os.mkdir(lib)
|
||||
packages = mirrors(lib_file, "", version)
|
||||
pkg_checksums = mirrors(md5_file, "", version)
|
||||
extra = mirrors(lib_file, "extra/", version)
|
||||
ext_checksums = mirrors(md5_file, "extra/", version)
|
||||
pasture = mirrors(lib_file, "pasture/", version)
|
||||
pas_checksums = mirrors(md5_file, "pasture/", version)
|
||||
packages = mirrors(lib_file, "")
|
||||
pkg_checksums = mirrors(md5_file, "")
|
||||
extra = mirrors(lib_file, "extra/")
|
||||
ext_checksums = mirrors(md5_file, "extra/")
|
||||
pasture = mirrors(lib_file, "pasture/")
|
||||
pas_checksums = mirrors(md5_file, "pasture/")
|
||||
packages_txt = ("{0} {1} {2}".format(packages, extra, pasture))
|
||||
|
||||
checksums_md5 = ("{0} {1} {2}".format(pkg_checksums, ext_checksums,
|
||||
pas_checksums))
|
||||
changelog_txt = mirrors(log_file, "", version)
|
||||
changelog_txt = mirrors(log_file, "")
|
||||
self.write(lib, lib_file, packages_txt)
|
||||
self.write(lib, md5_file, checksums_md5)
|
||||
self.write(log, log_file, changelog_txt)
|
||||
|
@ -218,22 +220,22 @@ class Initialization(object):
|
|||
md5_file, checksums_md5)
|
||||
|
||||
@staticmethod
|
||||
def write(path, files, file_url):
|
||||
def write(path, data_file, file_url):
|
||||
'''
|
||||
Write files in /var/lib/slpkg/?_repo directory
|
||||
Write repositories files in /var/lib/slpkg
|
||||
and /var/log/slpkg
|
||||
'''
|
||||
FILE_TXT = ""
|
||||
if not os.path.isfile(path + files):
|
||||
print("\nslpkg ...initialization")
|
||||
sys.stdout.write(files + " read ...")
|
||||
sys.stdout.flush()
|
||||
if not os.path.isfile(path + data_file):
|
||||
for fu in file_url.split():
|
||||
FILE_TXT += URL(fu).reading()
|
||||
sys.stdout.write("Done\n")
|
||||
with open("{0}{1}".format(path, files), "w") as f:
|
||||
f.write(FILE_TXT)
|
||||
with open("{0}{1}".format(path, data_file), "w") as f:
|
||||
toolbar_width, index = 2, 0
|
||||
for line in FILE_TXT.splitlines():
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 700)
|
||||
f.write(line + "\n")
|
||||
f.close()
|
||||
print("File {0} created in {1}".format(files, path))
|
||||
|
||||
@staticmethod
|
||||
def remote(*args):
|
||||
|
@ -241,30 +243,89 @@ class Initialization(object):
|
|||
args[0]=log, args[1]=log_file, arg[2]=changelog_txt
|
||||
args[3]=lib, args[4]=lib_file, arg[5]=packages_txt
|
||||
args[6]=md5_file, args[7]=checksums_md5
|
||||
If the two files differ in size delete and replaced with new.
|
||||
We take the size of ChangeLog.txt from the server and locally
|
||||
|
||||
We take the size of ChangeLog.txt from the server and locally.
|
||||
If the two files differ in size delete and replace all files with new.
|
||||
'''
|
||||
PACKAGES_TXT = ""
|
||||
toolbar_width, index = 2, 0
|
||||
server = FileSize(args[2]).server()
|
||||
local = FileSize(args[0] + args[1]).local()
|
||||
if server != local:
|
||||
# remove PACKAGES.txt
|
||||
os.remove("{0}{1}".format(args[3], args[4]))
|
||||
# remove Changelog.txt
|
||||
os.remove("{0}{1}".format(args[0], args[1]))
|
||||
print("\nNEWS in " + args[1])
|
||||
sys.stdout.write("Files re-created ...")
|
||||
sys.stdout.flush()
|
||||
# remove CHECKSUMS.md5
|
||||
if args[6]:
|
||||
os.remove("{0}{1}".format(args[3], args[6]))
|
||||
for fu in args[5].split():
|
||||
PACKAGES_TXT += URL(fu).reading()
|
||||
CHANGELOG_TXT = URL(args[2]).reading()
|
||||
# create CHECKSUMS.md5 file
|
||||
if args[6]:
|
||||
CHECKSUMS_md5 = URL(args[7]).reading()
|
||||
with open("{0}{1}".format(args[3], args[6]), "w") as f:
|
||||
f.write(CHECKSUMS_md5)
|
||||
for line in CHECKSUMS_md5.splitlines():
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 700)
|
||||
f.write(line + "\n")
|
||||
f.close()
|
||||
# create PACKAGES.txt file
|
||||
with open("{0}{1}".format(args[3], args[4]), "w") as f:
|
||||
f.write(PACKAGES_TXT)
|
||||
for line in PACKAGES_TXT.splitlines():
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 700)
|
||||
f.write(line + "\n")
|
||||
f.close()
|
||||
# create ChangeLog.txt file
|
||||
with open("{0}{1}".format(args[0], args[1]), "w") as f:
|
||||
f.write(CHANGELOG_TXT)
|
||||
for line in CHANGELOG_TXT.splitlines():
|
||||
index += 1
|
||||
toolbar_width = status(index, toolbar_width, 700)
|
||||
f.write(line + "\n")
|
||||
f.close()
|
||||
sys.stdout.write("Done\n")
|
||||
|
||||
|
||||
class Update(object):
|
||||
|
||||
def __init__(self):
|
||||
self.repos = {
|
||||
'sbo': Initialization().sbo,
|
||||
'slack': Initialization().slack,
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky,
|
||||
'studio': Initialization().studioware
|
||||
}
|
||||
|
||||
def repository(self):
|
||||
'''
|
||||
Update all repositories lists
|
||||
'''
|
||||
print("\nCheck and update repositories:\n")
|
||||
for repo in repositories:
|
||||
sys.stdout.write("{0}Update repository {1} ...{2}".format(
|
||||
color['GREY'], repo, color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
self.repos[repo]()
|
||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'],
|
||||
color['ENDC']))
|
||||
print("") # new line at end
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
def check_exists_repositories():
|
||||
'''
|
||||
Checking if repositories exists by ChangeLog.txt file
|
||||
'''
|
||||
update = False
|
||||
for repo in repositories:
|
||||
if not os.path.isfile("{0}{1}{2}".format(log_path, repo,
|
||||
"/ChangeLog.txt")):
|
||||
update = True
|
||||
if update:
|
||||
print("\n Please update packages lists. Run 'slpkg update'.\n" +
|
||||
" This command should be used to synchronize packages\n" +
|
||||
" lists from the repositories are enabled.\n")
|
||||
sys.exit(0)
|
||||
|
|
|
@ -24,6 +24,8 @@
|
|||
import sys
|
||||
import getpass
|
||||
|
||||
from slpkg_update import it_self_update
|
||||
|
||||
from desc import PkgDesc
|
||||
from config import Config
|
||||
from queue import QueuePkgs
|
||||
|
@ -32,6 +34,10 @@ from tracking import track_dep
|
|||
from blacklist import BlackList
|
||||
from version import prog_version
|
||||
from arguments import options, usage
|
||||
from init import (
|
||||
Update,
|
||||
check_exists_repositories
|
||||
)
|
||||
from __metadata__ import (
|
||||
path,
|
||||
repositories,
|
||||
|
@ -61,7 +67,7 @@ class Case(object):
|
|||
SBoInstall(self.package).start()
|
||||
|
||||
def slack_install(self):
|
||||
Slack(self.package, self.release).start()
|
||||
Slack(self.package).start()
|
||||
|
||||
def rlw_install(self):
|
||||
OthersInstall(self.package, "rlw", self.release).start()
|
||||
|
@ -96,12 +102,21 @@ class Case(object):
|
|||
|
||||
def main():
|
||||
|
||||
# repositories = ["sbo", "slack", "rlw", "alien", "slacky"]
|
||||
s_user(getpass.getuser())
|
||||
args = sys.argv
|
||||
args.pop(0)
|
||||
blacklist = BlackList()
|
||||
queue = QueuePkgs()
|
||||
|
||||
if len(args) == 1 and args[0] == "update":
|
||||
Update().repository()
|
||||
|
||||
if len(args) == 2 and args[0] == "update" and args[1] == "slpkg":
|
||||
it_self_update()
|
||||
|
||||
# checking if repositories exists
|
||||
check_exists_repositories()
|
||||
|
||||
if len(args) == 0:
|
||||
usage()
|
||||
elif (len(args) == 1 and args[0] == "-h" or
|
||||
|
|
|
@ -76,3 +76,12 @@ def template(max_len):
|
|||
Print template
|
||||
'''
|
||||
print("+" + "=" * max_len)
|
||||
|
||||
|
||||
def slacky_error():
|
||||
'''
|
||||
Slacky repository error
|
||||
'''
|
||||
print("\nRepository slack working together with the slacky.")
|
||||
print("Please add the repository slack from file " +
|
||||
"'/etc/slpkg/slpkg.conf'\n")
|
||||
|
|
|
@ -30,7 +30,6 @@ from slpkg.repositories import Repo
|
|||
from slpkg.messages import template
|
||||
from slpkg.checksum import check_md5
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.grep_md5 import pkg_checksum
|
||||
from slpkg.splitting import split_package
|
||||
|
@ -55,7 +54,6 @@ class OthersUpgrade(object):
|
|||
self.repo = repo
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
self.repo_init()
|
||||
repos = Repo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||
color['GREY'], color['ENDC']))
|
||||
|
@ -90,18 +88,6 @@ class OthersUpgrade(object):
|
|||
self.PACKAGES_TXT = f.read()
|
||||
f.close()
|
||||
|
||||
def repo_init(self):
|
||||
'''
|
||||
Initialization repository if only use
|
||||
'''
|
||||
repository = {
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky,
|
||||
'studio': Initialization().studioware
|
||||
}
|
||||
repository[self.repo]()
|
||||
|
||||
def start(self):
|
||||
'''
|
||||
Install packages from official Slackware distribution
|
||||
|
@ -141,7 +127,7 @@ class OthersUpgrade(object):
|
|||
if answer in ['y', 'Y']:
|
||||
upgrade_all.reverse()
|
||||
Download(self.tmp_path, dwn_links).start()
|
||||
upgrade(self.tmp_path, upgrade_all, self.repo)
|
||||
upgrade(self.tmp_path, upgrade_all, self.repo, self.version)
|
||||
delete(self.tmp_path, upgrade_all)
|
||||
else:
|
||||
print("No new updates in the repository '{0}'\n".format(
|
||||
|
@ -230,15 +216,18 @@ def msgs(upgrade_all):
|
|||
return msg_pkg
|
||||
|
||||
|
||||
def upgrade(tmp_path, upgrade_all, repo):
|
||||
def upgrade(tmp_path, upgrade_all, repo, version):
|
||||
'''
|
||||
Install or upgrade packages
|
||||
'''
|
||||
for pkg in upgrade_all:
|
||||
package = (tmp_path + pkg).split()
|
||||
if repo == "alien":
|
||||
if repo == "alien" and version == "stable":
|
||||
check_md5(pkg_checksum("/" + slack_ver() + "/" + pkg, repo),
|
||||
tmp_path + pkg)
|
||||
elif repo == "alien" and version == "current":
|
||||
check_md5(pkg_checksum("/" + version + "/" + pkg, repo),
|
||||
tmp_path + pkg)
|
||||
else:
|
||||
check_md5(pkg_checksum(pkg, repo), tmp_path + pkg)
|
||||
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
|
||||
|
|
|
@ -24,7 +24,6 @@
|
|||
import os
|
||||
|
||||
from slpkg.toolbar import status
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.__metadata__ import lib_path
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.slack.slack_version import slack_ver
|
||||
|
@ -110,8 +109,6 @@ class Requires(object):
|
|||
def __init__(self, name, repo):
|
||||
self.name = name
|
||||
self.repo = repo
|
||||
if not os.path.exists(lib_path + "slack_repo/PACKAGES.TXT"):
|
||||
Initialization().slack()
|
||||
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
||||
f = open(lib, "r")
|
||||
self.SLACK_PACKAGES_TXT = f.read()
|
||||
|
|
|
@ -28,12 +28,12 @@ from slpkg.sizes import units
|
|||
from slpkg.remove import delete
|
||||
from slpkg.repositories import Repo
|
||||
from slpkg.checksum import check_md5
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.grep_md5 import pkg_checksum
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.messages import (
|
||||
slacky_error,
|
||||
pkg_not_found,
|
||||
template
|
||||
)
|
||||
|
@ -62,7 +62,10 @@ class OthersInstall(object):
|
|||
self.repo = repo
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
self.repo_init()
|
||||
if (not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT") and
|
||||
repo == "slacky"):
|
||||
slacky_error()
|
||||
sys.exit(0)
|
||||
repos = Repo()
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
color['CYAN'], self.package, color['ENDC']))
|
||||
|
@ -100,22 +103,6 @@ class OthersInstall(object):
|
|||
f.close()
|
||||
sys.stdout.write("{0}Done{1}\n".format(color['GREY'], color['ENDC']))
|
||||
|
||||
def repo_init(self):
|
||||
'''
|
||||
Initialization repository if only use
|
||||
'''
|
||||
# initialization Slackware repository needed to compare
|
||||
# slacky dependencies
|
||||
if not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT"):
|
||||
Initialization().slack()
|
||||
repository = {
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky,
|
||||
'studio': Initialization().studioware
|
||||
}
|
||||
repository[self.repo]()
|
||||
|
||||
def start(self):
|
||||
'''
|
||||
Install packages from official Slackware distribution
|
||||
|
@ -162,7 +149,8 @@ class OthersInstall(object):
|
|||
if answer in ['y', 'Y']:
|
||||
install_all.reverse()
|
||||
Download(self.tmp_path, dwn_links).start()
|
||||
install(self.tmp_path, install_all, self.repo)
|
||||
install(self.tmp_path, install_all, self.repo,
|
||||
self.version)
|
||||
write_deps(dependencies)
|
||||
delete(self.tmp_path, install_all)
|
||||
else:
|
||||
|
@ -273,15 +261,18 @@ def msgs(install_all, uni_sum):
|
|||
return [msg_pkg, msg_2_pkg]
|
||||
|
||||
|
||||
def install(tmp_path, install_all, repo):
|
||||
def install(tmp_path, install_all, repo, version):
|
||||
'''
|
||||
Install or upgrade packages
|
||||
'''
|
||||
for install in install_all:
|
||||
package = (tmp_path + install).split()
|
||||
if repo == "alien":
|
||||
if repo == "alien" and version == "stable":
|
||||
check_md5(pkg_checksum("/" + slack_ver() + "/" + install, repo),
|
||||
tmp_path + install)
|
||||
elif repo == "alien" and version == "current":
|
||||
check_md5(pkg_checksum("/" + version + "/" + install, repo),
|
||||
tmp_path + install)
|
||||
else:
|
||||
check_md5(pkg_checksum(install, repo), tmp_path + install)
|
||||
if os.path.isfile(pkg_path + install[:-4]):
|
||||
|
@ -330,8 +321,6 @@ def write_deps(dependencies):
|
|||
name = dependencies[-1]
|
||||
if find_package(name + "-", pkg_path):
|
||||
dep_path = log_path + "dep/"
|
||||
if not os.path.exists(log_path):
|
||||
os.mkdir(log_path)
|
||||
if not os.path.exists(dep_path):
|
||||
os.mkdir(dep_path)
|
||||
if os.path.isfile(dep_path + name):
|
||||
|
|
|
@ -29,7 +29,6 @@ from slpkg.pkg.build import BuildPackage
|
|||
from slpkg.pkg.manager import PackageManager
|
||||
|
||||
from slpkg.toolbar import status
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.messages import (
|
||||
|
@ -56,7 +55,6 @@ class SBoCheck(object):
|
|||
|
||||
def __init__(self):
|
||||
self.done = "{0}Done{1}\n".format(color['GREY'], color['ENDC'])
|
||||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||
color['GREY'], color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
|
|
|
@ -25,7 +25,6 @@ import os
|
|||
import sys
|
||||
|
||||
from slpkg.toolbar import status
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.splitting import split_package
|
||||
from slpkg.__metadata__ import (
|
||||
|
@ -60,7 +59,6 @@ class SBoInstall(object):
|
|||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||
color['GREY'], color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
|
@ -398,8 +396,6 @@ def write_deps(dependencies):
|
|||
name = dependencies[-1]
|
||||
if find_package(name + sp, pkg_path):
|
||||
dep_path = log_path + "dep/"
|
||||
if not os.path.exists(log_path):
|
||||
os.mkdir(log_path)
|
||||
if not os.path.exists(dep_path):
|
||||
os.mkdir(dep_path)
|
||||
if os.path.isfile(dep_path + name):
|
||||
|
|
|
@ -25,7 +25,6 @@ import os
|
|||
import sys
|
||||
import pydoc
|
||||
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.__metadata__ import (
|
||||
tmp,
|
||||
|
@ -56,7 +55,6 @@ class SBoNetwork(object):
|
|||
|
||||
def __init__(self, name):
|
||||
self.name = name
|
||||
Initialization().sbo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||
color['GREY'], color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
|
|
|
@ -28,7 +28,6 @@ from slpkg.sizes import units
|
|||
from slpkg.remove import delete
|
||||
from slpkg.checksum import check_md5
|
||||
from slpkg.blacklist import BlackList
|
||||
from slpkg.init import Initialization
|
||||
from slpkg.downloader import Download
|
||||
from slpkg.grep_md5 import pkg_checksum
|
||||
from slpkg.splitting import split_package
|
||||
|
@ -53,17 +52,14 @@ from greps import slack_data
|
|||
|
||||
class Slack(object):
|
||||
|
||||
def __init__(self, slack_pkg, version):
|
||||
def __init__(self, slack_pkg):
|
||||
self.slack_pkg = slack_pkg
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
Initialization().slack()
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
color['CYAN'], self.slack_pkg, color['ENDC']))
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||
color['GREY'], color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
Initialization().slack()
|
||||
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
||||
f = open(lib, "r")
|
||||
self.PACKAGES_TXT = f.read()
|
||||
|
@ -126,8 +122,7 @@ class Slack(object):
|
|||
black = BlackList().packages()
|
||||
for name, loc, comp, uncomp in zip(data[0], data[1], data[2], data[3]):
|
||||
if self.slack_pkg in name and self.slack_pkg not in black:
|
||||
dwn.append("{0}{1}/{2}".format(mirrors("", "", self.version),
|
||||
loc, name))
|
||||
dwn.append("{0}{1}/{2}".format(mirrors("", ""), loc, name))
|
||||
install.append(name)
|
||||
comp_sum.append(comp)
|
||||
uncomp_sum.append(uncomp)
|
||||
|
|
|
@ -21,30 +21,33 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
from slpkg.__metadata__ import arch
|
||||
from slpkg.repositories import Repo
|
||||
from slpkg.__metadata__ import (
|
||||
arch,
|
||||
slack_rel
|
||||
)
|
||||
|
||||
from slack_version import slack_ver
|
||||
|
||||
|
||||
def mirrors(name, location, version):
|
||||
def mirrors(name, location):
|
||||
'''
|
||||
Select Slackware official mirror packages
|
||||
based architecture and version.
|
||||
'''
|
||||
repo = Repo().slack()
|
||||
if arch == "x86_64":
|
||||
if version == "stable":
|
||||
if slack_rel == "stable":
|
||||
http = repo + "slackware64-{0}/{1}{2}".format(slack_ver(),
|
||||
location, name)
|
||||
else:
|
||||
http = repo + "slackware64-{0}/{1}{2}".format(version,
|
||||
http = repo + "slackware64-{0}/{1}{2}".format(slack_rel,
|
||||
location, name)
|
||||
else:
|
||||
if version == "stable":
|
||||
if slack_rel == "stable":
|
||||
http = repo + "slackware-{0}/{1}{2}".format(slack_ver(),
|
||||
location, name)
|
||||
else:
|
||||
http = repo + "slackware-{0}/{1}{2}".format(version,
|
||||
http = repo + "slackware-{0}/{1}{2}".format(slack_rel,
|
||||
location, name)
|
||||
return http
|
||||
|
|
|
@ -57,13 +57,12 @@ class Patches(object):
|
|||
sys.stdout.write("{0}Reading package lists ...{1}".format(
|
||||
color['GREY'], color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
if version == "stable":
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
|
||||
version)).reading()
|
||||
if self.version == "stable":
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT",
|
||||
"patches/")).reading()
|
||||
self.step = 100
|
||||
else:
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "",
|
||||
version)).reading()
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "")).reading()
|
||||
self.step = 700
|
||||
|
||||
def start(self):
|
||||
|
@ -127,8 +126,7 @@ class Patches(object):
|
|||
if find_package(split_package(name)[0] + "-", pkg_path):
|
||||
if (not os.path.isfile(pkg_path + name[:-4]) and
|
||||
split_package(name)[0] not in black):
|
||||
dwn.append("{0}{1}/{2}".format(
|
||||
mirrors("", "", self.version), loc, name))
|
||||
dwn.append("{0}{1}/{2}".format(mirrors("", ""), loc, name))
|
||||
comp_sum.append(comp)
|
||||
uncomp_sum.append(uncomp)
|
||||
upgrade.append(name)
|
||||
|
@ -165,7 +163,7 @@ def upgrade(patch_path, upgrade_all):
|
|||
Upgrade packages
|
||||
'''
|
||||
for pkg in upgrade_all:
|
||||
check_md5(pkg_checksum(pkg, "slack"), patch_path + pkg)
|
||||
check_md5(pkg_checksum(pkg, "slack_patches"), patch_path + pkg)
|
||||
print("[ {0}upgrading{1} ] --> {2}".format(color['YELLOW'],
|
||||
color['ENDC'], pkg[:-4]))
|
||||
PackageManager((patch_path + pkg).split()).upgrade()
|
||||
|
|
83
slpkg/slpkg_update.py
Normal file
83
slpkg/slpkg_update.py
Normal file
|
@ -0,0 +1,83 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# slpkg_update.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 re
|
||||
import sys
|
||||
import tarfile
|
||||
import subprocess
|
||||
|
||||
from url_read import URL
|
||||
from downloader import Download
|
||||
from __metadata__ import (
|
||||
__all__,
|
||||
__version__,
|
||||
__author__,
|
||||
default_answer,
|
||||
build_path
|
||||
)
|
||||
|
||||
|
||||
def it_self_update():
|
||||
'''
|
||||
Check from GitHub slpkg repository if new version is available
|
||||
download and update itself
|
||||
'''
|
||||
__new_version__ = ""
|
||||
repository = 'github'
|
||||
branch = 'master'
|
||||
ver_link = ('https://raw.{0}usercontent.com/{1}/{2}/'
|
||||
'{3}/{4}/__metadata__.py'.format(repository, __author__,
|
||||
__all__, branch, __all__))
|
||||
version_data = URL(ver_link).reading()
|
||||
for line in version_data.splitlines():
|
||||
if line.startswith('__version_info__'):
|
||||
__new_version__ = '.'.join(re.findall(r'\d+', line))
|
||||
if __new_version__ > __version__:
|
||||
if default_answer == "y":
|
||||
answer = default_answer
|
||||
else:
|
||||
print("\nNew version '{0}-{1}' is available !\n".format(
|
||||
__all__, __new_version__))
|
||||
answer = raw_input("Would you like to continue [Y/n]? ")
|
||||
if answer in ['y', 'Y']:
|
||||
print("") # new line after answer
|
||||
else:
|
||||
sys.exit(0)
|
||||
dwn_link = ['https://{0}.com/{1}/{2}/archive/'
|
||||
'v{3}.tar.gz'.format(repository, __author__, __all__,
|
||||
__new_version__)]
|
||||
Download(build_path, dwn_link).start()
|
||||
os.chdir(build_path)
|
||||
tar = tarfile.open('v' + __new_version__ + '.tar.gz')
|
||||
tar.extractall()
|
||||
tar.close()
|
||||
file_name = '{0}-{1}'.format(__all__, __new_version__)
|
||||
os.chdir(file_name)
|
||||
subprocess.call('chmod +x {0}'.format(file_name), shell=True)
|
||||
subprocess.call('sh install.sh', shell=True)
|
||||
else:
|
||||
print('\n{0}: There is no new version, already used the last !'
|
||||
'\n'.format(__all__))
|
||||
sys.exit(0)
|
|
@ -21,11 +21,15 @@
|
|||
# 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 messages import template
|
||||
from init import Initialization
|
||||
from messages import (
|
||||
template,
|
||||
slacky_error
|
||||
)
|
||||
from __metadata__ import (
|
||||
lib_path,
|
||||
pkg_path,
|
||||
color,
|
||||
sp
|
||||
|
@ -47,15 +51,10 @@ def track_dep(name, repo):
|
|||
if allready installed and color red
|
||||
if not installed.
|
||||
'''
|
||||
init_repos = {
|
||||
'sbo': Initialization().sbo,
|
||||
'slack': Initialization().slack,
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
'slacky': Initialization().slacky,
|
||||
'studio': Initialization().studioware
|
||||
}
|
||||
init_repos[repo]()
|
||||
if (not os.path.isfile(lib_path + "slack_repo/PACKAGES.TXT") and
|
||||
repo == "slacky"):
|
||||
slacky_error()
|
||||
sys.exit(0)
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(color['GREY'],
|
||||
color['ENDC']))
|
||||
sys.stdout.flush()
|
||||
|
|
Loading…
Reference in a new issue