update slack release manage

This commit is contained in:
Dimitris Zlatanidis 2015-02-21 17:01:48 +02:00
parent df6916b6be
commit bf2464c64a
3 changed files with 19 additions and 7 deletions

View file

@ -20,8 +20,8 @@
# You should have received a copy of the GNU General Public License # You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>. # along with this program. If not, see <http://www.gnu.org/licenses/>.
# Slackware version 'stable' or 'current'. # Slackware release 'stable' or 'current'.
VERSION=stable RELEASE=stable
# Choose repositories want to work. Read first REPOSITORIES file. # Choose repositories want to work. Read first REPOSITORIES file.
# Available repositories : slack,sbo,alien,rlw,slacky,studio,slackr,slonly, # Available repositories : slack,sbo,alien,rlw,slacky,studio,slackr,slonly,

View file

@ -22,6 +22,7 @@
# 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
import sys
def remove_repositories(repositories, default_repositories): def remove_repositories(repositories, default_repositories):
@ -75,6 +76,18 @@ def slacke_repo(repositories):
return sub 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): class MetaData(object):
__all__ = "slpkg" __all__ = "slpkg"
@ -85,7 +98,7 @@ class MetaData(object):
__email__ = "d.zlatanidis@gmail.com" __email__ = "d.zlatanidis@gmail.com"
# Default configuration values # Default configuration values
slack_rel = "stable" slack_rel = ''
# Configuration path # Configuration path
conf_path = "/etc/{0}/".format(__all__) conf_path = "/etc/{0}/".format(__all__)
@ -133,10 +146,9 @@ class MetaData(object):
f.close() f.close()
for line in conf.splitlines(): for line in conf.splitlines():
line = line.lstrip() line = line.lstrip()
if line.startswith("VERSION"): if line.startswith("RELEASE"):
slack_rel = line[8:].strip() slack_rel = line[8:].strip()
if not slack_rel: select_slack_release(slack_rel)
slack_rel = "stable"
if line.startswith("REPOSITORIES"): if line.startswith("REPOSITORIES"):
repositories = line[13:].strip().split(",") repositories = line[13:].strip().split(",")
if line.startswith("BUILD_PATH"): if line.startswith("BUILD_PATH"):

View file

@ -38,7 +38,7 @@ class Config(object):
''' '''
print("") # new line at start print("") # new line at start
conf_args = [ conf_args = [
'VERSION', 'RELEASE',
'REPOSITORIES', 'REPOSITORIES',
'BUILD_PATH', 'BUILD_PATH',
'SBO_CHECK_MD5', 'SBO_CHECK_MD5',