Added set Slackware version via config

Signed-off-by: Dimitris Zlatanidis <d.zlatanidis@gmail.com>
This commit is contained in:
Dimitris Zlatanidis 2017-10-07 19:41:47 +02:00
parent 72b8ffe014
commit cbd151ca90
5 changed files with 23 additions and 6 deletions

View file

@ -1,3 +1,7 @@
3.3.1 - 07/10/2017
Added:
- Set Slackware version via configuration file /etc/slpkg/slpkg.conf
3.3.0 - 01/10/2017
Fixed:
- TypeError: stat() argument 1 must be encoded string without null bytes,

View file

@ -26,6 +26,10 @@
# Slackware release "stable" or "current".
RELEASE=stable
# Set Slackware version. It's not necessary only for some reasons.
# Default is "off".
SLACKWARE_VERSION=off
# Build directory for repository "sbo" slackbuilds.org. In this
# directory downloaded sources and scripts for building.
BUILD_PATH=/tmp/slpkg/build/

View file

@ -78,7 +78,7 @@ class MetaData(object):
__all__ = "slpkg"
__author__ = "dslackw"
__version_info__ = (3, 3, 0)
__version_info__ = (3, 3, 1)
__version__ = "{0}.{1}.{2}".format(*__version_info__)
__license__ = "GNU General Public License v3 (GPLv3)"
__email__ = "d.zlatanidis@gmail.com"
@ -97,6 +97,7 @@ class MetaData(object):
# Default configuration values
_conf_slpkg = {
"RELEASE": "stable",
"SLACKWARE_VERSION": "off",
"REPOSITORIES": ["slack", "sbo", "rlw", "alien",
"slacky", "conrad", "slonly",
"ktown{latest}", "multi", "slacke{18}",
@ -148,6 +149,7 @@ class MetaData(object):
# Set values from configuration file
slack_rel = _conf_slpkg["RELEASE"]
slackware_version = _conf_slpkg["SLACKWARE_VERSION"]
build_path = _conf_slpkg["BUILD_PATH"]
sbosrcarch = _conf_slpkg["SBOSRCARCH"]
sbosrcarch_link = _conf_slpkg["SBOSRCARCH_LINK"]

View file

@ -43,6 +43,7 @@ class Config(object):
print("") # new line at start
conf_args = [
"RELEASE",
"SLACKWARE_VERSION",
"BUILD_PATH",
"PACKAGES",
"PATCHES",

View file

@ -25,15 +25,21 @@
import re
from slpkg.utils import Utils
from __metadata__ import MetaData as _meta_
def slack_ver():
"""
Open file and read Slackware version
"""
slackware_version = _meta_.slackware_version
if slackware_version == "off":
sv = Utils().read_file("/etc/slackware-version")
version = re.findall(r"\d+", sv)
if len(sv) > 2:
return (".".join(version[:2]))
else:
return (".".join(version))
else:
return slackware_version