mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-18 10:26:29 +01:00
add slpkg.conf file
This commit is contained in:
parent
533e5668b2
commit
c90c2144a7
17 changed files with 95 additions and 121 deletions
28
slpkg/slackware_release.py → conf/slpkg.conf
Executable file → Normal file
28
slpkg/slackware_release.py → conf/slpkg.conf
Executable file → Normal file
|
@ -1,7 +1,8 @@
|
|||
#!/usr/bin/python
|
||||
# -*- coding: utf-8 -*-
|
||||
#
|
||||
# slpkg.conf - Configuration for slpkg
|
||||
#
|
||||
|
||||
# slackware_type.py file is part of slpkg.
|
||||
# slpkg.conf file is part of slpkg.
|
||||
|
||||
# Copyright 2014 Dimitris Zlatanidis <d.zlatanidis@gmail.com>
|
||||
# All rights reserved.
|
||||
|
@ -21,17 +22,16 @@
|
|||
# You should have received a copy of the GNU General Public License
|
||||
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
||||
|
||||
# Slackware version 'stable' or 'current'
|
||||
VERSION=stable
|
||||
|
||||
from __metadata__ import log_path
|
||||
from init import Initialization
|
||||
# Build directory for repository slackbuilds.org. In this directory downloaded sources
|
||||
# and scripts for building.
|
||||
BUILD=/tmp/slpkg/build/
|
||||
|
||||
# Download directory for others repositories that use binaries files for installation.
|
||||
PACKAGES=/tmp/slpkg/packages/
|
||||
|
||||
# Download directory for Slackware patches file.
|
||||
PATCHES=/tmp/slpkg/patches/
|
||||
|
||||
def slack_rel():
|
||||
'''
|
||||
Read and return slackware release 'stable' or 'current'
|
||||
'''
|
||||
Initialization().release()
|
||||
with open(log_path + "slackware-release", "r") as f:
|
||||
release = f.read()
|
||||
f.close()
|
||||
return release.strip()
|
6
setup.py
6
setup.py
|
@ -79,9 +79,15 @@ if "install" in sys.argv:
|
|||
f_in.close()
|
||||
shutil.copy2(gzip_man, man_path)
|
||||
os.chmod(man_path, int("444", 8))
|
||||
|
||||
conf_path = "/etc/slpkg/"
|
||||
if not os.path.exists(conf_path):
|
||||
os.system("mkdir -p {0}".format(conf_path))
|
||||
# slpkg.conf file
|
||||
print("Installing slpkg configuration file")
|
||||
conf_file = "conf/slpkg.conf"
|
||||
shutil.copy2(conf_file, conf_path)
|
||||
# blacklist file
|
||||
print("Installing blacklist configuration file")
|
||||
black_file = "conf/blacklist"
|
||||
shutil.copy2(black_file, conf_path)
|
||||
|
|
|
@ -30,6 +30,43 @@ __version__ = "{0}.{1}.{2}".format(*__version_info__)
|
|||
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||
__email__ = "d.zlatanidis@gmail.com"
|
||||
|
||||
|
||||
f = open("/etc/slpkg/slpkg.conf", "r")
|
||||
conf = f.read()
|
||||
f.close()
|
||||
|
||||
''' temponary path '''
|
||||
tmp = "/tmp/"
|
||||
|
||||
for line in conf.splitlines():
|
||||
line = line.lstrip()
|
||||
if line.startswith("VERSION"):
|
||||
slack_rel = line[8:].strip()
|
||||
if line.startswith("BUILD"):
|
||||
build_path = line[6:].strip()
|
||||
if line.startswith("PACKAGES"):
|
||||
slpkg_tmp_packages = line[9:].strip()
|
||||
if line.startswith("PATCHES"):
|
||||
slpkg_tmp_patches = line[8:].strip()
|
||||
|
||||
if not slack_rel or slack_rel not in ['stable', 'current']:
|
||||
slack_rel = "stable"
|
||||
|
||||
if not build_path:
|
||||
build_path = "/tmp/slpkg/build/"
|
||||
elif not build_path.endswith("/"):
|
||||
build_path = build_path + "/"
|
||||
|
||||
if not slpkg_tmp_packages:
|
||||
slpkg_tmp_packages = tmp + "slpkg/packages/"
|
||||
elif not slpkg_tmp_packages.endswith("/"):
|
||||
slpkg_tmp_packages = slpkg_tmp_packages + "/"
|
||||
|
||||
if not slpkg_tmp_patches:
|
||||
slpkg_tmp_patches = tmp + "slpkg/patches/"
|
||||
elif not slpkg_tmp_patches.endswith("/"):
|
||||
slpkg_tmp_patches = slpkg_tmp_patches + "/"
|
||||
|
||||
''' repositories '''
|
||||
repositories = [
|
||||
"sbo",
|
||||
|
@ -45,19 +82,12 @@ sp = "-"
|
|||
''' current path '''
|
||||
path = os.getcwd() + "/"
|
||||
|
||||
''' build path '''
|
||||
build_path = path + "slpkg_Build/"
|
||||
|
||||
''' library path '''
|
||||
lib_path = "/var/lib/slpkg/"
|
||||
|
||||
''' log path '''
|
||||
log_path = "/var/log/slpkg/"
|
||||
|
||||
''' temponary path '''
|
||||
tmp = "/tmp/"
|
||||
slpkg_tmp = tmp + "slpkg/"
|
||||
|
||||
''' packages log files path '''
|
||||
pkg_path = "/var/log/packages/"
|
||||
|
||||
|
|
|
@ -109,7 +109,7 @@ class BlackList(object):
|
|||
print("{0}{1}{2}".format(GREEN, black, ENDC))
|
||||
self.quit = True
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def add(self, pkgs):
|
||||
'''
|
||||
|
@ -126,7 +126,7 @@ class BlackList(object):
|
|||
self.quit = True
|
||||
black_conf.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def remove(self, pkgs):
|
||||
'''
|
||||
|
@ -142,4 +142,4 @@ class BlackList(object):
|
|||
self.quit = True
|
||||
remove.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
|
|
@ -27,7 +27,8 @@ import sys
|
|||
from url_read import URL
|
||||
from repositories import Repo
|
||||
from file_size import FileSize
|
||||
from __metadata__ import log_path, lib_path
|
||||
from __metadata__ import (log_path, lib_path, slack_rel,
|
||||
build_path, slpkg_tmp_packages, slpkg_tmp_patches)
|
||||
|
||||
from slack.mirrors import mirrors
|
||||
from slack.slack_version import slack_ver
|
||||
|
@ -40,38 +41,12 @@ class Initialization(object):
|
|||
os.mkdir(log_path)
|
||||
if not os.path.exists(lib_path):
|
||||
os.mkdir(lib_path)
|
||||
self.release()
|
||||
self.is_release()
|
||||
|
||||
def release(self):
|
||||
'''
|
||||
Create file with Slackware version 'stable' or 'current'
|
||||
'''
|
||||
if (not os.path.isfile(log_path + "slackware-release") or
|
||||
FileSize(log_path + "slackware-release").local() == 0):
|
||||
with open(log_path + "slackware-release", "w") as f:
|
||||
release = raw_input("Please type Slackware version "
|
||||
"(default=stable) [stable/current]: ")
|
||||
if release in ["stable", "current"]:
|
||||
print("Selected version '{0}'".format(release))
|
||||
f.write(release)
|
||||
else:
|
||||
print("Selected the default version 'stable'")
|
||||
f.write("stable")
|
||||
f.close()
|
||||
|
||||
def is_release(self):
|
||||
'''
|
||||
Check if file 'slackware-release' states correct version
|
||||
'''
|
||||
if os.path.isfile(log_path + "slackware-release"):
|
||||
with open(log_path + "slackware-release", "r") as f:
|
||||
release = f.read()
|
||||
f.close()
|
||||
if release not in ["stable", "current"]:
|
||||
os.remove(log_path + "slackware-release")
|
||||
self.release()
|
||||
return release
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
if not os.path.exists(slpkg_tmp_packages):
|
||||
os.mkdir(slpkg_tmp_packages)
|
||||
if not os.path.exists(slpkg_tmp_patches):
|
||||
os.mkdir(slpkg_tmp_patches)
|
||||
|
||||
def slack(self):
|
||||
'''
|
||||
|
@ -81,7 +56,7 @@ class Initialization(object):
|
|||
lib = lib_path + "slack_repo/"
|
||||
lib_file = "PACKAGES.TXT"
|
||||
log_file = "ChangeLog.txt"
|
||||
version = self.is_release()
|
||||
version = slack_rel
|
||||
if not os.path.exists(log):
|
||||
os.mkdir(log)
|
||||
if not os.path.exists(lib):
|
||||
|
|
|
@ -31,8 +31,7 @@ from tracking import track_dep
|
|||
from blacklist import BlackList
|
||||
from version import prog_version
|
||||
from arguments import options, usage
|
||||
from slackware_release import slack_rel
|
||||
from __metadata__ import path, repositories
|
||||
from __metadata__ import path, repositories, slack_rel
|
||||
|
||||
from pkg.build import BuildPackage
|
||||
from pkg.manager import PackageManager
|
||||
|
@ -51,7 +50,7 @@ class Case(object):
|
|||
|
||||
def __init__(self, package):
|
||||
self.package = package
|
||||
self.release = slack_rel()
|
||||
self.release = slack_rel
|
||||
|
||||
def sbo_install(self):
|
||||
SBoInstall(self.package).start()
|
||||
|
|
|
@ -31,8 +31,8 @@ from blacklist import BlackList
|
|||
from init import Initialization
|
||||
from splitting import split_package
|
||||
from colors import YELLOW, GREY, ENDC
|
||||
from __metadata__ import slpkg_tmp, pkg_path, lib_path
|
||||
|
||||
from __metadata__ import (pkg_path, lib_path,
|
||||
slpkg_tmp_packages)
|
||||
|
||||
from pkg.manager import PackageManager
|
||||
|
||||
|
@ -48,7 +48,7 @@ class OthersUpgrade(object):
|
|||
def __init__(self, repo, version):
|
||||
self.repo = repo
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp + "packages/"
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
self.repo_init()
|
||||
repos = Repo()
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
|
@ -78,10 +78,6 @@ class OthersUpgrade(object):
|
|||
'''
|
||||
Initialization repository if only use
|
||||
'''
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.tmp_path):
|
||||
os.mkdir(self.tmp_path)
|
||||
repository = {
|
||||
'rlw': Initialization().rlw,
|
||||
'alien': Initialization().alien,
|
||||
|
|
|
@ -105,7 +105,7 @@ def alien_filter(name, location, size, unsize, version):
|
|||
|
||||
def repo_requires(name, repo):
|
||||
'''
|
||||
Grap package requirements from alien repository
|
||||
Grap package requirements from repositories
|
||||
'''
|
||||
slacky_deps = []
|
||||
if repo in ["alien", "slacky"]:
|
||||
|
@ -129,10 +129,8 @@ def repo_requires(name, repo):
|
|||
else:
|
||||
return line[18:].strip().split(",")
|
||||
elif repo == "rlw":
|
||||
'''
|
||||
Robby's repository dependencies as shown in the central page
|
||||
http://rlworkman.net/pkgs/
|
||||
'''
|
||||
# Robby's repository dependencies as shown in the central page
|
||||
# http://rlworkman.net/pkgs/
|
||||
dependencies = {
|
||||
"abiword": "wv",
|
||||
"claws-mail": "libetpan bogofilter html2ps",
|
||||
|
|
|
@ -31,7 +31,8 @@ from blacklist import BlackList
|
|||
from splitting import split_package
|
||||
from messages import pkg_not_found, template
|
||||
from colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC
|
||||
from __metadata__ import slpkg_tmp, pkg_path, lib_path, log_path
|
||||
from __metadata__ import (pkg_path, lib_path, log_path,
|
||||
slpkg_tmp_packages)
|
||||
|
||||
|
||||
from pkg.find import find_package
|
||||
|
@ -51,7 +52,7 @@ class OthersInstall(object):
|
|||
self.package = package
|
||||
self.repo = repo
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp + "packages/"
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
self.repo_init()
|
||||
repos = Repo()
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
|
@ -84,10 +85,6 @@ class OthersInstall(object):
|
|||
'''
|
||||
Initialization repository if only use
|
||||
'''
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.tmp_path):
|
||||
os.mkdir(self.tmp_path)
|
||||
repository = {
|
||||
"rlw": Initialization().rlw,
|
||||
"alien": Initialization().alien,
|
||||
|
@ -167,6 +164,7 @@ class OthersInstall(object):
|
|||
# location = data[1]
|
||||
# size = data[2]
|
||||
# unsize = data[3]
|
||||
print deps
|
||||
data = repo_data(self.PACKAGES_TXT, self.step, self.repo, self.version)
|
||||
if len(deps) > 1:
|
||||
for pkg in deps:
|
||||
|
|
|
@ -85,7 +85,7 @@ class QueuePkgs(object):
|
|||
print("{0}{1}{2}".format(GREEN, pkg, ENDC))
|
||||
self.quit = True
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def add(self, pkgs):
|
||||
'''
|
||||
|
@ -106,7 +106,7 @@ class QueuePkgs(object):
|
|||
self.quit = True
|
||||
queue.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def remove(self, pkgs):
|
||||
'''
|
||||
|
@ -124,7 +124,7 @@ class QueuePkgs(object):
|
|||
self.quit = True
|
||||
queue.close()
|
||||
if self.quit:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
|
||||
def build(self):
|
||||
'''
|
||||
|
@ -155,7 +155,7 @@ class QueuePkgs(object):
|
|||
'''
|
||||
packages = self.packages()
|
||||
if packages:
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
for pkg in packages:
|
||||
# check if package exist in /tmp
|
||||
find = find_package(pkg, tmp)
|
||||
|
|
|
@ -84,7 +84,6 @@ class SBoCheck(object):
|
|||
count, msg = view_packages(data[1], data[2], data[3])
|
||||
read = raw_input("Would you like to upgrade [Y/n]? ")
|
||||
if read in ['y', 'Y']:
|
||||
create_build_path()
|
||||
os.chdir(build_path)
|
||||
for name, version in zip(data[0], data[2]):
|
||||
prgnam = ("{0}-{1}".format(name, version))
|
||||
|
@ -281,14 +280,6 @@ def view_packages(package_for_upgrade, upgrade_version, upgrade_arch):
|
|||
return [count_installed, count_upgraded], [msg_ins, msg_upg]
|
||||
|
||||
|
||||
def create_build_path():
|
||||
'''
|
||||
Create build directory if not exists
|
||||
'''
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
|
||||
|
||||
def dwn_sources(sources):
|
||||
'''
|
||||
Download sources and return filenames
|
||||
|
|
|
@ -283,14 +283,6 @@ def arch_support(source, support, package_sum, dependencies):
|
|||
return read
|
||||
|
||||
|
||||
def create_build_path():
|
||||
'''
|
||||
Create build directory if not exists
|
||||
'''
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
|
||||
|
||||
def dwn_sources(sources):
|
||||
'''
|
||||
Download sources and return filenames
|
||||
|
@ -321,7 +313,6 @@ def build_install(dependencies, sbo_versions):
|
|||
tag 2 or 3 will fit most
|
||||
'''
|
||||
installs, upgraded, versions = [], [], []
|
||||
create_build_path()
|
||||
os.chdir(build_path)
|
||||
for pkg, ver in zip(dependencies, sbo_versions):
|
||||
prgnam = ("{0}-{1}".format(pkg, ver))
|
||||
|
|
|
@ -188,8 +188,6 @@ class SBoNetwork(object):
|
|||
if FAULT:
|
||||
print("\n{0}The package {1} {2}\n".format(RED, FAULT, ENDC))
|
||||
sys.exit()
|
||||
if not os.path.exists(build_path):
|
||||
os.mkdir(build_path)
|
||||
sources = []
|
||||
os.chdir(build_path)
|
||||
Download(build_path, self.sbo_dwn).start()
|
||||
|
|
|
@ -28,7 +28,7 @@ from sizes import units
|
|||
from blacklist import BlackList
|
||||
from splitting import split_package
|
||||
from messages import pkg_not_found, template
|
||||
from __metadata__ import slpkg_tmp, pkg_path, lib_path
|
||||
from __metadata__ import pkg_path, lib_path, slpkg_tmp_packages
|
||||
from init import Initialization
|
||||
from colors import RED, GREEN, CYAN, YELLOW, GREY, ENDC
|
||||
|
||||
|
@ -46,17 +46,13 @@ class Slack(object):
|
|||
def __init__(self, slack_pkg, version):
|
||||
self.slack_pkg = slack_pkg
|
||||
self.version = version
|
||||
self.tmp_path = slpkg_tmp + "packages/"
|
||||
self.tmp_path = slpkg_tmp_packages
|
||||
Initialization().slack()
|
||||
print("\nPackages with name matching [ {0}{1}{2} ]\n".format(
|
||||
CYAN, self.slack_pkg, ENDC))
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
Initialization().slack()
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.tmp_path):
|
||||
os.mkdir(self.tmp_path)
|
||||
lib = lib_path + "slack_repo/PACKAGES.TXT"
|
||||
f = open(lib, "r")
|
||||
self.PACKAGES_TXT = f.read()
|
||||
|
|
|
@ -31,7 +31,7 @@ from messages import template
|
|||
from blacklist import BlackList
|
||||
from splitting import split_package
|
||||
from colors import GREY, YELLOW, ENDC
|
||||
from __metadata__ import pkg_path, slpkg_tmp
|
||||
from __metadata__ import pkg_path, slpkg_tmp_patches
|
||||
|
||||
from pkg.manager import PackageManager
|
||||
|
||||
|
@ -46,13 +46,9 @@ class Patches(object):
|
|||
|
||||
def __init__(self, version):
|
||||
self.version = version
|
||||
self.patch_path = slpkg_tmp + "patches/"
|
||||
self.patch_path = slpkg_tmp_patches
|
||||
sys.stdout.write("{0}Reading package lists ...{1}".format(GREY, ENDC))
|
||||
sys.stdout.flush()
|
||||
if not os.path.exists(slpkg_tmp):
|
||||
os.mkdir(slpkg_tmp)
|
||||
if not os.path.exists(self.patch_path):
|
||||
os.mkdir(self.patch_path)
|
||||
if version == "stable":
|
||||
self.PACKAGES_TXT = URL(mirrors("PACKAGES.TXT", "patches/",
|
||||
version)).reading()
|
||||
|
|
|
@ -33,8 +33,8 @@ from pkg.find import find_package
|
|||
from sbo.search import sbo_search_pkg
|
||||
from sbo.dependency import sbo_dependencies_pkg
|
||||
|
||||
from others.dependency import dependencies_pkg
|
||||
from others.search import search_pkg
|
||||
from others.dependency import dependencies_pkg
|
||||
|
||||
|
||||
def track_dep(name, repo):
|
||||
|
@ -51,8 +51,8 @@ def track_dep(name, repo):
|
|||
dependencies_list = sbo_dependencies_pkg(name)
|
||||
find_pkg = sbo_search_pkg(name)
|
||||
else:
|
||||
find_pkg = search_pkg(name, repo)
|
||||
dependencies_list = dependencies_pkg(name, repo)
|
||||
find_pkg = search_pkg(name, repo)
|
||||
sys.stdout.write("{0}Done{1}\n".format(GREY, ENDC))
|
||||
if find_pkg:
|
||||
requires, dependencies = [], []
|
||||
|
@ -67,7 +67,7 @@ def track_dep(name, repo):
|
|||
if dependencies == []:
|
||||
dependencies = ["No dependencies"]
|
||||
pkg_len = len(name) + 24
|
||||
print # new line at start
|
||||
print("") # new line at start
|
||||
template(pkg_len)
|
||||
print("| Package {0}{1}{2} dependencies :".format(CYAN, name, ENDC))
|
||||
template(pkg_len)
|
||||
|
@ -83,6 +83,6 @@ def track_dep(name, repo):
|
|||
else:
|
||||
print(" |")
|
||||
print(" {0}{1}: {2}{3}{4}".format("+--", index, RED, pkg, ENDC))
|
||||
print # new line at end
|
||||
print("") # new line at end
|
||||
else:
|
||||
print("\nNo package was found to match\n")
|
||||
|
|
|
@ -38,8 +38,8 @@ class URL(object):
|
|||
f = urllib2.urlopen(self.link)
|
||||
return f.read()
|
||||
except urllib2.URLError:
|
||||
print ("\nslpkg: error: connection refused\n")
|
||||
print("\nslpkg: error: connection refused\n")
|
||||
sys.exit()
|
||||
except KeyboardInterrupt:
|
||||
print # new line at exit
|
||||
print("") # new line at exit
|
||||
sys.exit()
|
||||
|
|
Loading…
Reference in a new issue