mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-01-30 20:34:38 +01:00
updated for version 1.4.4
This commit is contained in:
parent
c6140a2244
commit
ff578d5834
5 changed files with 117 additions and 168 deletions
|
@ -1,5 +1,12 @@
|
||||||
03-06-2014
|
03-06-2014
|
||||||
Version
|
Version 1.4.4
|
||||||
|
|
||||||
|
[Feature] - Added support ALL extra sources
|
||||||
|
[Updated] - Fix out of range in SBo version link with filename
|
||||||
|
|
||||||
|
|
||||||
|
03-06-2014
|
||||||
|
Version 1.4.3
|
||||||
|
|
||||||
[Updated] - Fix to avoid build packages with more than four arguments.
|
[Updated] - Fix to avoid build packages with more than four arguments.
|
||||||
|
|
||||||
|
|
2
PKG-INFO
2
PKG-INFO
|
@ -1,6 +1,6 @@
|
||||||
Metadata-Version: 1.1
|
Metadata-Version: 1.1
|
||||||
Name: slpkg
|
Name: slpkg
|
||||||
Version: 1.4.3
|
Version: 1.4.4
|
||||||
Author: dslackw
|
Author: dslackw
|
||||||
Author-email: d zlatanidis at gmail com
|
Author-email: d zlatanidis at gmail com
|
||||||
Maintainer: dslackw
|
Maintainer: dslackw
|
||||||
|
|
|
@ -132,6 +132,12 @@ build and install with all dependencies :
|
||||||
Executing install script for brasero-3.11.3-x86_64-1_SBo.tgz.
|
Executing install script for brasero-3.11.3-x86_64-1_SBo.tgz.
|
||||||
Package brasero-3.11.3-x86_64-1_SBo.tgz installed.
|
Package brasero-3.11.3-x86_64-1_SBo.tgz installed.
|
||||||
|
|
||||||
|
The package `orc` was installed
|
||||||
|
The package `gstreamer1` was installed
|
||||||
|
The package `gst1-plugins-base` was installed
|
||||||
|
The package `gst1-plugins-bad` was installed
|
||||||
|
The package `libunique` was installed
|
||||||
|
The package `brasero` was installed
|
||||||
|
|
||||||
|
|
||||||
Tracking all dependencies of packages:
|
Tracking all dependencies of packages:
|
||||||
|
|
186
bin/slpkg
186
bin/slpkg
|
@ -51,7 +51,7 @@ import subprocess
|
||||||
|
|
||||||
|
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version__ = "1.4.3"
|
__version__ = "1.4.4"
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
|
||||||
|
@ -262,9 +262,12 @@ def SBo_extra_dwn(SBo_url, name):
|
||||||
|
|
||||||
for line in read_info.splitlines():
|
for line in read_info.splitlines():
|
||||||
if line.startswith(' '):
|
if line.startswith(' '):
|
||||||
line = line[10:-1]
|
line = line[:-1]
|
||||||
|
line = line.replace(" ", "")
|
||||||
if line.startswith('http'):
|
if line.startswith('http'):
|
||||||
results.append(line)
|
results.append(line)
|
||||||
|
if line.startswith('ftp'):
|
||||||
|
results.append(line)
|
||||||
|
|
||||||
return results
|
return results
|
||||||
|
|
||||||
|
@ -301,9 +304,7 @@ def SBo_dependencies_pkg(name):
|
||||||
SBo_req = SBo_requires_pkg(SBo_url, name)
|
SBo_req = SBo_requires_pkg(SBo_url, name)
|
||||||
dependencies = SBo_req.split() # convert string to list
|
dependencies = SBo_req.split() # convert string to list
|
||||||
|
|
||||||
if dependencies == []:
|
if dependencies != []:
|
||||||
pass
|
|
||||||
else:
|
|
||||||
dep_results.append(dependencies)
|
dep_results.append(dependencies)
|
||||||
|
|
||||||
for line in dependencies:
|
for line in dependencies:
|
||||||
|
@ -328,7 +329,7 @@ def SBo_dependencies_links_pkg(name):
|
||||||
colors.CYAN, name, colors.RED, colors.ENDC))
|
colors.CYAN, name, colors.RED, colors.ENDC))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
version = SBo_version_pkg(SBo_url, name).split()
|
version = ("@" + SBo_version_pkg(SBo_url, name)).split()
|
||||||
SBo_dwn = SBo_slackbuild_dwn(SBo_url, name).split()
|
SBo_dwn = SBo_slackbuild_dwn(SBo_url, name).split()
|
||||||
source_dwn = SBo_source_dwn(SBo_url, name).split()
|
source_dwn = SBo_source_dwn(SBo_url, name).split()
|
||||||
extra_dwn = SBo_extra_dwn(SBo_url, name)
|
extra_dwn = SBo_extra_dwn(SBo_url, name)
|
||||||
|
@ -344,10 +345,7 @@ def SBo_dependencies_links_pkg(name):
|
||||||
dep_links_results.append(source_dwn)
|
dep_links_results.append(source_dwn)
|
||||||
dep_links_results.append(SBo_dwn)
|
dep_links_results.append(SBo_dwn)
|
||||||
|
|
||||||
if SBo_req == []:
|
if SBo_req != []:
|
||||||
pass
|
|
||||||
|
|
||||||
else:
|
|
||||||
dep_links_results.append(SBo_req)
|
dep_links_results.append(SBo_req)
|
||||||
|
|
||||||
for line in SBo_req:
|
for line in SBo_req:
|
||||||
|
@ -372,6 +370,33 @@ def SBo_version_pkg(SBo_url, name):
|
||||||
return line
|
return line
|
||||||
|
|
||||||
|
|
||||||
|
# build packages with extra source
|
||||||
|
def build_extra_pkg(script, source, extra):
|
||||||
|
slack_script = script
|
||||||
|
source_tar = source
|
||||||
|
extra_source = extra
|
||||||
|
|
||||||
|
# remove file type from slackbuild script and store the name
|
||||||
|
pkg_name = slack_script.replace(".tar.gz", "")
|
||||||
|
|
||||||
|
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
||||||
|
try:
|
||||||
|
tar = tarfile.open(slack_script)
|
||||||
|
tar.extractall()
|
||||||
|
tar.close()
|
||||||
|
shutil.copy2(source_tar, pkg_name)
|
||||||
|
|
||||||
|
for es in extra_source:
|
||||||
|
shutil.copy2(es, pkg_name)
|
||||||
|
|
||||||
|
os.chdir(path + pkg_name)
|
||||||
|
os.system("sh {}{}{}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
||||||
|
except (OSError, IOError):
|
||||||
|
print
|
||||||
|
print ("{}Wrong file name, Please try again...{}\n".format(colors.RED,
|
||||||
|
colors.ENDC))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# auto build package from slackbuild script
|
# auto build package from slackbuild script
|
||||||
def build_package(script, source):
|
def build_package(script, source):
|
||||||
|
@ -397,58 +422,6 @@ def build_package(script, source):
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# build package with extra source
|
|
||||||
def build_extra_pkg(script, source, extra):
|
|
||||||
slack_script = script
|
|
||||||
source_tar = source
|
|
||||||
extra_source = extra
|
|
||||||
|
|
||||||
# remove file type from slackbuild script and store the name
|
|
||||||
pkg_name = slack_script.replace(".tar.gz", "")
|
|
||||||
|
|
||||||
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
|
||||||
try:
|
|
||||||
tar = tarfile.open(slack_script)
|
|
||||||
tar.extractall()
|
|
||||||
tar.close()
|
|
||||||
shutil.copy2(source_tar, pkg_name)
|
|
||||||
shutil.copy2(extra_source, pkg_name)
|
|
||||||
os.chdir(path + pkg_name)
|
|
||||||
os.system("sh {}{}{}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
|
||||||
except (OSError, IOError):
|
|
||||||
print
|
|
||||||
print ("{}Wrong file name, Please try again...{}\n".format(colors.RED,
|
|
||||||
colors.ENDC))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# build package with extra-extra sources
|
|
||||||
def build_extra2_pkg(script, source, extra, extra2):
|
|
||||||
slack_script = script
|
|
||||||
source_tar = source
|
|
||||||
extra_source = extra
|
|
||||||
extra2_source = extra2
|
|
||||||
|
|
||||||
# remove file type from slackbuild script and store the name
|
|
||||||
pkg_name = slack_script.replace(".tar.gz", "")
|
|
||||||
|
|
||||||
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
|
||||||
try:
|
|
||||||
tar = tarfile.open(slack_script)
|
|
||||||
tar.extractall()
|
|
||||||
tar.close()
|
|
||||||
shutil.copy2(source_tar, pkg_name)
|
|
||||||
shutil.copy2(extra_source, pkg_name)
|
|
||||||
shutil.copy2(extra2_source, pkg_name)
|
|
||||||
os.chdir(path + pkg_name)
|
|
||||||
os.system("sh {}{}{}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
|
||||||
except (OSError, IOError):
|
|
||||||
print
|
|
||||||
print ("{}Wrong file name, Please try again...{}\n".format(colors.RED,
|
|
||||||
colors.ENDC))
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# print version
|
# print version
|
||||||
def pkg_version():
|
def pkg_version():
|
||||||
print ("Version: {}".format(__version__))
|
print ("Version: {}".format(__version__))
|
||||||
|
@ -462,17 +435,10 @@ def pkg_slackbuild(name):
|
||||||
s_user(getpass.getuser())
|
s_user(getpass.getuser())
|
||||||
if len(name) == 2:
|
if len(name) == 2:
|
||||||
build_package(name[0], name[1])
|
build_package(name[0], name[1])
|
||||||
elif len(name) == 3:
|
elif len(name) > 2:
|
||||||
build_extra_pkg(name[0],
|
build_extra_pkg(name[0],
|
||||||
name[1], name[2])
|
name[1], name[2:])
|
||||||
elif len(name) == 4:
|
else:
|
||||||
build_extra2_pkg(name[0], name[1],
|
|
||||||
name[2], name[3])
|
|
||||||
elif len(name) > 4:
|
|
||||||
print
|
|
||||||
print ("{}Not supported with more than four arguments{}\n".format(colors.RED,
|
|
||||||
colors.ENDC))
|
|
||||||
elif len(name) == 1:
|
|
||||||
print
|
print
|
||||||
print ("{}Must enter at least two arguments{}\n".format(colors.RED,
|
print ("{}Must enter at least two arguments{}\n".format(colors.RED,
|
||||||
colors.ENDC))
|
colors.ENDC))
|
||||||
|
@ -533,7 +499,7 @@ def SBo_network(name):
|
||||||
SBo_req = SBo_requires_pkg(SBo_url, name)
|
SBo_req = SBo_requires_pkg(SBo_url, name)
|
||||||
SBo_dwn = SBo_slackbuild_dwn(SBo_url, name)
|
SBo_dwn = SBo_slackbuild_dwn(SBo_url, name)
|
||||||
source_dwn = SBo_source_dwn(SBo_url, name)
|
source_dwn = SBo_source_dwn(SBo_url, name)
|
||||||
extra_dwn = "".join(SBo_extra_dwn(SBo_url, name))
|
extra_dwn = " ".join(SBo_extra_dwn(SBo_url, name))
|
||||||
|
|
||||||
# caclulate the length of the link
|
# caclulate the length of the link
|
||||||
SBo_name_len = len(name)
|
SBo_name_len = len(name)
|
||||||
|
@ -601,25 +567,16 @@ def SBo_network(name):
|
||||||
os.system("wget -nc " + SBo_dwn)
|
os.system("wget -nc " + SBo_dwn)
|
||||||
os.system("wget -nc " + source_dwn)
|
os.system("wget -nc " + source_dwn)
|
||||||
|
|
||||||
|
extra = []
|
||||||
if extra_dwn == "":
|
if extra_dwn == "":
|
||||||
pass
|
pass
|
||||||
else:
|
else:
|
||||||
os.system("wget -nc " + extra_dwn)
|
os.system("wget -nc " + extra_dwn)
|
||||||
extra_dwn = extra_dwn.split() # convert str to list
|
extra_dwn = extra_dwn.split() # convert str to list
|
||||||
if len(find_extra_dwn) == 1:
|
for ex in extra_dwn:
|
||||||
extra = get_file(extra_dwn[0], "/")
|
extra.append(get_file(ex, "/"))
|
||||||
build_extra_pkg(script, source, extra)
|
|
||||||
break
|
|
||||||
|
|
||||||
elif len(extra_dwn) == 2:
|
build_extra_pkg(script, source, extra)
|
||||||
extra = get_file(extra_dwn[0], "/")
|
|
||||||
extra2 = get_file(extra_dwn[1], "/")
|
|
||||||
build_extra2_pkg(script, source, extra, extra2)
|
|
||||||
break
|
|
||||||
else:
|
|
||||||
print
|
|
||||||
print ("{}Not supported with more than four arguments{}\n".format(colors.RED,
|
|
||||||
colors.ENDC))
|
|
||||||
break
|
break
|
||||||
|
|
||||||
build_package(script, source)
|
build_package(script, source)
|
||||||
|
@ -693,8 +650,8 @@ def SBo_build(name):
|
||||||
# grep the version
|
# grep the version
|
||||||
version = []
|
version = []
|
||||||
for ver in results:
|
for ver in results:
|
||||||
for i in range(0, 10):
|
if ver.startswith("@"):
|
||||||
if ver.startswith(str(i)):
|
ver = ver.replace("@", "")
|
||||||
version.append(ver)
|
version.append(ver)
|
||||||
|
|
||||||
|
|
||||||
|
@ -726,7 +683,6 @@ def SBo_build(name):
|
||||||
filename_version.append(filename[i] + "-" + version[i])
|
filename_version.append(filename[i] + "-" + version[i])
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# remove packages links if already installed
|
# remove packages links if already installed
|
||||||
i = 0
|
i = 0
|
||||||
for file in filename_version:
|
for file in filename_version:
|
||||||
|
@ -737,6 +693,7 @@ def SBo_build(name):
|
||||||
dwn_link.pop(i)
|
dwn_link.pop(i)
|
||||||
files.pop(i)
|
files.pop(i)
|
||||||
|
|
||||||
|
|
||||||
# create list with packages for install
|
# create list with packages for install
|
||||||
pkg_for_install = []
|
pkg_for_install = []
|
||||||
i = 0
|
i = 0
|
||||||
|
@ -754,16 +711,24 @@ def SBo_build(name):
|
||||||
print ("{}Start --> \n{}".format(colors.GREEN, colors.ENDC))
|
print ("{}Start --> \n{}".format(colors.GREEN, colors.ENDC))
|
||||||
os.system("wget -nc {}".format(link))
|
os.system("wget -nc {}".format(link))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
print ("\n")
|
print ("\n")
|
||||||
# build packages and store slackware files in /tmp directory
|
|
||||||
if results[0] == "extra1": # check for one (1) extra sources
|
# build packages and install slackware packages
|
||||||
|
i = 0
|
||||||
|
if pkg_for_install == []:
|
||||||
|
for pkg in filename_version:
|
||||||
|
print ("{}The package {}`{}`{} is already installed{}".format(colors.GREEN,
|
||||||
|
colors.CYAN, pkg, colors.GREEN, colors.ENDC))
|
||||||
|
|
||||||
|
else:
|
||||||
|
|
||||||
|
if results[0].startswith("extra"): # check for extra sources
|
||||||
|
extra_Num = int(results[0].replace("extra", ""))
|
||||||
for i in range(len(files) / 2):
|
for i in range(len(files) / 2):
|
||||||
if len(files) < 4:
|
if len(files) == extra_Num + 2:
|
||||||
script = files[0]
|
script = files[0]
|
||||||
source = files[1]
|
source = files[1]
|
||||||
extra = files[2]
|
extra = files[2:]
|
||||||
build_extra_pkg(script, source, extra)
|
build_extra_pkg(script, source, extra)
|
||||||
|
|
||||||
install_pkg = tmp + pkg_for_install[i] + SBo_arch + SBo_tag + SBo_filetype
|
install_pkg = tmp + pkg_for_install[i] + SBo_arch + SBo_tag + SBo_filetype
|
||||||
|
@ -783,36 +748,6 @@ def SBo_build(name):
|
||||||
files.pop(0)
|
files.pop(0)
|
||||||
|
|
||||||
|
|
||||||
elif results[0] == "extra2": # check for two (2) extra sources
|
|
||||||
|
|
||||||
for i in range(len(files) / 2):
|
|
||||||
if len(files) < 5:
|
|
||||||
script = files[0]
|
|
||||||
source = files[1]
|
|
||||||
extra = files[2]
|
|
||||||
extra2 = files[3]
|
|
||||||
build_extra2_pkg(script, source, extra, extra2)
|
|
||||||
|
|
||||||
install_pkg = tmp + pkg_for_install[i] + SBo_arch + SBo_tag + SBo_filetype
|
|
||||||
os.system("upgradepkg --install-new {}".format(install_pkg))
|
|
||||||
break
|
|
||||||
|
|
||||||
else:
|
|
||||||
|
|
||||||
script = files[0]
|
|
||||||
source = files[1]
|
|
||||||
build_package(script, source)
|
|
||||||
|
|
||||||
install_pkg = tmp + pkg_for_install[i] + SBo_arch + SBo_tag + SBo_filetype
|
|
||||||
os.system("upgradepkg --install-new {}".format(install_pkg))
|
|
||||||
|
|
||||||
for j in range(0, 2):
|
|
||||||
files.pop(0)
|
|
||||||
elif results[0] > "extra2":
|
|
||||||
print
|
|
||||||
print ("{}Not supported with more than four arguments{}\n".format(colors.RED,
|
|
||||||
colors.ENDC))
|
|
||||||
sys.exit()
|
|
||||||
else:
|
else:
|
||||||
|
|
||||||
for i in range(len(files) / 2):
|
for i in range(len(files) / 2):
|
||||||
|
@ -827,6 +762,7 @@ def SBo_build(name):
|
||||||
files.pop(0)
|
files.pop(0)
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
for pkg in pkg_for_install:
|
for pkg in pkg_for_install:
|
||||||
if find_package(pkg, packages) != []:
|
if find_package(pkg, packages) != []:
|
||||||
print ("{}The package {}`{}`{} was installed{}".format(colors.GREEN,
|
print ("{}The package {}`{}`{} was installed{}".format(colors.GREEN,
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ from distutils.core import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'slpkg',
|
name = 'slpkg',
|
||||||
version = "1.4.3",
|
version = "1.4.4",
|
||||||
description = "Python tool to manage Slackware packages",
|
description = "Python tool to manage Slackware packages",
|
||||||
keywords = ["slackware", "slpkg", "upgrade", "install", "remove",
|
keywords = ["slackware", "slpkg", "upgrade", "install", "remove",
|
||||||
"view", "slackpkg", "tool"],
|
"view", "slackpkg", "tool"],
|
||||||
|
|
Loading…
Add table
Reference in a new issue