From bf2464c64a47f293fe9b7a752cbc57dcf2a5adf4 Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Sat, 21 Feb 2015 17:01:48 +0200 Subject: [PATCH] update slack release manage --- conf/slpkg.conf | 4 ++-- slpkg/__metadata__.py | 20 ++++++++++++++++---- slpkg/config.py | 2 +- 3 files changed, 19 insertions(+), 7 deletions(-) diff --git a/conf/slpkg.conf b/conf/slpkg.conf index 43878d07..c2e2719f 100644 --- a/conf/slpkg.conf +++ b/conf/slpkg.conf @@ -20,8 +20,8 @@ # You should have received a copy of the GNU General Public License # along with this program. If not, see . -# Slackware version 'stable' or 'current'. -VERSION=stable +# Slackware release 'stable' or 'current'. +RELEASE=stable # Choose repositories want to work. Read first REPOSITORIES file. # Available repositories : slack,sbo,alien,rlw,slacky,studio,slackr,slonly, diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 5c7c8443..adda9f60 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -22,6 +22,7 @@ # along with this program. If not, see . import os +import sys def remove_repositories(repositories, default_repositories): @@ -75,6 +76,18 @@ def slacke_repo(repositories): return sub +def select_slack_release(slack_rel): + ''' + Warning message if Slackware release not defined or + defined wrong + ''' + if slack_rel not in ['stable', 'current']: + print("\n You have not specified the Slackware release.\n" + " Edit file '/etc/slpkg/slpkg.conf' and change the \n" + " value of the variable RELEASE.\n") + sys.exit(0) + + class MetaData(object): __all__ = "slpkg" @@ -85,7 +98,7 @@ class MetaData(object): __email__ = "d.zlatanidis@gmail.com" # Default configuration values - slack_rel = "stable" + slack_rel = '' # Configuration path conf_path = "/etc/{0}/".format(__all__) @@ -133,10 +146,9 @@ class MetaData(object): f.close() for line in conf.splitlines(): line = line.lstrip() - if line.startswith("VERSION"): + if line.startswith("RELEASE"): slack_rel = line[8:].strip() - if not slack_rel: - slack_rel = "stable" + select_slack_release(slack_rel) if line.startswith("REPOSITORIES"): repositories = line[13:].strip().split(",") if line.startswith("BUILD_PATH"): diff --git a/slpkg/config.py b/slpkg/config.py index e678eda7..7e5ad2ce 100644 --- a/slpkg/config.py +++ b/slpkg/config.py @@ -38,7 +38,7 @@ class Config(object): ''' print("") # new line at start conf_args = [ - 'VERSION', + 'RELEASE', 'REPOSITORIES', 'BUILD_PATH', 'SBO_CHECK_MD5',