mirror of
https://gitlab.com/dslackw/slpkg.git
synced 2025-02-11 20:48:11 +01:00
updated for version 1.4.9
This commit is contained in:
parent
8c7b2919c6
commit
4531c82590
4 changed files with 69 additions and 79 deletions
|
@ -1,3 +1,9 @@
|
||||||
|
06.06.2014
|
||||||
|
Version 1.4.9
|
||||||
|
|
||||||
|
[Updated] - Fix exit from loop after build in option 'network'
|
||||||
|
[Updated] - Source code
|
||||||
|
|
||||||
06-06-2014
|
06-06-2014
|
||||||
Version 1.4.8
|
Version 1.4.8
|
||||||
|
|
||||||
|
@ -26,20 +32,17 @@ Version 1.4.4
|
||||||
[Feature] - Added support ALL extra sources
|
[Feature] - Added support ALL extra sources
|
||||||
[Updated] - Fix out of range in SBo version link with filename
|
[Updated] - Fix out of range in SBo version link with filename
|
||||||
|
|
||||||
|
|
||||||
03-06-2014
|
03-06-2014
|
||||||
Version 1.4.3
|
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.
|
||||||
|
|
||||||
|
|
||||||
03-06-2014
|
03-06-2014
|
||||||
Version 1.4.2
|
Version 1.4.2
|
||||||
|
|
||||||
[Updated] - Fix to avoid build package if already installed
|
[Updated] - Fix to avoid build package if already installed
|
||||||
[Updated] - Fix not download if file already installed
|
[Updated] - Fix not download if file already installed
|
||||||
|
|
||||||
|
|
||||||
31-05-2014
|
31-05-2014
|
||||||
Version 1.4.1
|
Version 1.4.1
|
||||||
|
|
||||||
|
|
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.8
|
Version: 1.4.9
|
||||||
Author: dslackw
|
Author: dslackw
|
||||||
Author-email: d zlatanidis at gmail com
|
Author-email: d zlatanidis at gmail com
|
||||||
Maintainer: dslackw
|
Maintainer: dslackw
|
||||||
|
|
133
bin/slpkg
133
bin/slpkg
|
@ -51,7 +51,7 @@ import subprocess
|
||||||
|
|
||||||
|
|
||||||
__author__ = "dslackw"
|
__author__ = "dslackw"
|
||||||
__version__ = "1.4.8"
|
__version__ = "1.4.9"
|
||||||
__license__ = "GNU General Public License v3 (GPLv3)"
|
__license__ = "GNU General Public License v3 (GPLv3)"
|
||||||
__email__ = "d.zlatanidis@gmail.com"
|
__email__ = "d.zlatanidis@gmail.com"
|
||||||
|
|
||||||
|
@ -86,11 +86,28 @@ SBo_url = "http://slackbuilds.org/repository/14.1/"
|
||||||
|
|
||||||
|
|
||||||
# create repository list
|
# create repository list
|
||||||
repository = ("academic", "business", "games", "ham",
|
repository = [
|
||||||
"misc", "office", "ruby", "accessibility",
|
'academic',
|
||||||
"desktop", "gis", "haskell", "multimedia",
|
'business',
|
||||||
"perl", "system", "audio", "development",
|
'games',
|
||||||
"graphics", "libraries", "network", "python")
|
'ham',
|
||||||
|
'misc',
|
||||||
|
'office',
|
||||||
|
'ruby',
|
||||||
|
'accessibility',
|
||||||
|
'desktop',
|
||||||
|
'gis',
|
||||||
|
'haskell',
|
||||||
|
'multimedia',
|
||||||
|
'perl',
|
||||||
|
'system',
|
||||||
|
'audio',
|
||||||
|
'development',
|
||||||
|
'graphics',
|
||||||
|
'libraries',
|
||||||
|
'network',
|
||||||
|
'python'
|
||||||
|
]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,8 +134,8 @@ def s_user(user):
|
||||||
# remove unused chars
|
# remove unused chars
|
||||||
def rmv_unused(name):
|
def rmv_unused(name):
|
||||||
rmv = "><"
|
rmv = "><"
|
||||||
for i in rmv:
|
for ch in rmv:
|
||||||
name = name.replace(i, "")
|
name = name.replace(ch, "")
|
||||||
|
|
||||||
return name
|
return name
|
||||||
|
|
||||||
|
@ -128,7 +145,7 @@ def rmv_unused(name):
|
||||||
def get_file(link, char):
|
def get_file(link, char):
|
||||||
j = 0
|
j = 0
|
||||||
results = []
|
results = []
|
||||||
for i in link:
|
for urls in link:
|
||||||
j += 1
|
j += 1
|
||||||
results.append(link[-j:])
|
results.append(link[-j:])
|
||||||
|
|
||||||
|
@ -137,10 +154,7 @@ def get_file(link, char):
|
||||||
file = file
|
file = file
|
||||||
break
|
break
|
||||||
|
|
||||||
file = file.replace(char, "")
|
return file.replace(char, "").strip(' ')
|
||||||
file = file.strip(" ")
|
|
||||||
|
|
||||||
return file
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -159,17 +173,13 @@ def find_package(find_pkg, directory):
|
||||||
# open url and read page
|
# open url and read page
|
||||||
def url_read(name):
|
def url_read(name):
|
||||||
f = urllib2.urlopen(name)
|
f = urllib2.urlopen(name)
|
||||||
read_page = f.read()
|
return f.read()
|
||||||
|
|
||||||
return read_page
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# read SBo README
|
# read SBo README
|
||||||
def read_readme(SBo_url, name, site):
|
def read_readme(SBo_url, name, site):
|
||||||
SBo_url = SBo_url + site
|
readme = url_read((SBo_url + site).replace("repository", "slackbuilds"))
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
readme = url_read(SBo_url)
|
|
||||||
|
|
||||||
file = open("/tmp/slpkg/readme/" + name + "." + site, "w")
|
file = open("/tmp/slpkg/readme/" + name + "." + site, "w")
|
||||||
file.write(readme)
|
file.write(readme)
|
||||||
|
@ -179,9 +189,7 @@ def read_readme(SBo_url, name, site):
|
||||||
|
|
||||||
# read SBo .info
|
# read SBo .info
|
||||||
def read_info_slackbuild(SBo_url, name, site):
|
def read_info_slackbuild(SBo_url, name, site):
|
||||||
SBo_url = SBo_url + name + site
|
info = url_read((SBo_url + name + site).replace("repository", "slackbuilds"))
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
info = url_read(SBo_url)
|
|
||||||
|
|
||||||
file = open("/tmp/slpkg/readme/" + name + site, "w")
|
file = open("/tmp/slpkg/readme/" + name + site, "w")
|
||||||
file.write(info)
|
file.write(info)
|
||||||
|
@ -211,57 +219,49 @@ def SBo_search_pkg(name):
|
||||||
find_SBo = rmv_unused(find_SBo)
|
find_SBo = rmv_unused(find_SBo)
|
||||||
|
|
||||||
if name in find_SBo:
|
if name in find_SBo:
|
||||||
name = SBo_url_sub + name + "/"
|
return SBo_url_sub + name + "/"
|
||||||
|
|
||||||
return name
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# find slackbuild download
|
# find slackbuild download
|
||||||
def SBo_slackbuild_dwn(SBo_url, name):
|
def SBo_slackbuild_dwn(SBo_url, name):
|
||||||
SBo_url = SBo_url.replace(name + "/", name + ".tar.gz")
|
SBo_url = SBo_url.replace(name + "/", name + ".tar.gz")
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
|
|
||||||
return SBo_url
|
return SBo_url.replace("repository", "slackbuilds")
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# find source downloads
|
# find source downloads
|
||||||
def SBo_source_dwn(SBo_url, name):
|
def SBo_source_dwn(SBo_url, name):
|
||||||
SBo_url = SBo_url + name + ".info"
|
read_info = url_read((SBo_url + name + ".info").replace("repository", "slackbuilds"))
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
read_info = url_read(SBo_url)
|
|
||||||
|
|
||||||
if arch == "x86_64":
|
if arch == "x86_64":
|
||||||
for line in read_info.splitlines():
|
for line in read_info.splitlines():
|
||||||
if line.startswith('DOWNLOAD_x86_64='):
|
if line.startswith('DOWNLOAD_x86_64='):
|
||||||
arch_x86_64_len = len(line)
|
if len(line) > 18:
|
||||||
if arch_x86_64_len > 18:
|
|
||||||
line = line[17:-1]
|
return line[17:-1]
|
||||||
|
|
||||||
return line
|
|
||||||
else:
|
else:
|
||||||
for line in read_info.splitlines():
|
for line in read_info.splitlines():
|
||||||
if line.startswith('DOWNLOAD='):
|
if line.startswith('DOWNLOAD='):
|
||||||
line = line[10:-1]
|
|
||||||
|
|
||||||
return line
|
return line[10:-1]
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# find extra source downloads
|
# find extra source downloads
|
||||||
def SBo_extra_dwn(SBo_url, name):
|
def SBo_extra_dwn(SBo_url, name):
|
||||||
SBo_url = SBo_url + name + ".info"
|
read_info = url_read((SBo_url + name + ".info").replace("repository", "slackbuilds"))
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
read_info = url_read(SBo_url)
|
|
||||||
results = []
|
results = []
|
||||||
|
|
||||||
for line in read_info.splitlines():
|
for line in read_info.splitlines():
|
||||||
if line.startswith(' '):
|
if line.startswith(' '):
|
||||||
line = line[:-1]
|
line = line[:-1].replace(" ", "")
|
||||||
line = line.replace(" ", "")
|
|
||||||
if line.startswith('http'):
|
if line.startswith('http'):
|
||||||
results.append(line)
|
results.append(line)
|
||||||
|
|
||||||
if line.startswith('ftp'):
|
if line.startswith('ftp'):
|
||||||
results.append(line)
|
results.append(line)
|
||||||
|
|
||||||
|
@ -271,17 +271,12 @@ def SBo_extra_dwn(SBo_url, name):
|
||||||
|
|
||||||
# search for package requirements
|
# search for package requirements
|
||||||
def SBo_requires_pkg(SBo_url, name):
|
def SBo_requires_pkg(SBo_url, name):
|
||||||
SBo_url = SBo_url + name + ".info"
|
read_info = url_read((SBo_url + name + ".info").replace("repository", "slackbuilds"))
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
|
|
||||||
read_info = url_read(SBo_url)
|
|
||||||
|
|
||||||
for line in read_info.splitlines():
|
for line in read_info.splitlines():
|
||||||
if line.startswith('REQUIRES="'):
|
if line.startswith('REQUIRES="'):
|
||||||
line = line[10:-1]
|
|
||||||
|
|
||||||
|
return line[10:-1]
|
||||||
return line
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -316,7 +311,7 @@ def SBo_dependencies_links_pkg(name):
|
||||||
|
|
||||||
if SBo_url == None:
|
if SBo_url == None:
|
||||||
print ("\n")
|
print ("\n")
|
||||||
print ("{}The {}'{}'{} not found{}\n".format(colors.RED,
|
print ("{}The {}`{}`{} not found{}\n".format(colors.RED,
|
||||||
colors.CYAN, name, colors.RED, colors.ENDC))
|
colors.CYAN, name, colors.RED, colors.ENDC))
|
||||||
|
|
||||||
else:
|
else:
|
||||||
|
@ -349,33 +344,26 @@ def SBo_dependencies_links_pkg(name):
|
||||||
|
|
||||||
# find from www.slackbuilds.org the version of the package
|
# find from www.slackbuilds.org the version of the package
|
||||||
def SBo_version_pkg(SBo_url, name):
|
def SBo_version_pkg(SBo_url, name):
|
||||||
SBo_url = SBo_url + name + ".info"
|
read_info = url_read((SBo_url + name + ".info").replace("repository", "slackbuilds"))
|
||||||
SBo_url = SBo_url.replace("repository", "slackbuilds")
|
|
||||||
read_info = url_read(SBo_url)
|
|
||||||
|
|
||||||
for line in read_info.splitlines():
|
for line in read_info.splitlines():
|
||||||
if line.startswith('VERSION="'):
|
if line.startswith('VERSION="'):
|
||||||
line = line[9:-1]
|
return line[9:-1]
|
||||||
|
|
||||||
return line
|
|
||||||
|
|
||||||
|
|
||||||
# build packages with extra source
|
# build packages with extra source
|
||||||
def build_extra_pkg(script, source, extra):
|
def build_extra_pkg(script, source, extra):
|
||||||
slack_script = script
|
pkg_name = script.replace(".tar.gz", "")
|
||||||
source_tar = source
|
|
||||||
extra_source = extra
|
|
||||||
|
|
||||||
pkg_name = slack_script.replace(".tar.gz", "")
|
|
||||||
|
|
||||||
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
||||||
try:
|
try:
|
||||||
tar = tarfile.open(slack_script)
|
tar = tarfile.open(script)
|
||||||
tar.extractall()
|
tar.extractall()
|
||||||
tar.close()
|
tar.close()
|
||||||
shutil.copy2(source_tar, pkg_name)
|
shutil.copy2(source, pkg_name)
|
||||||
|
|
||||||
for es in extra_source:
|
for es in extra:
|
||||||
shutil.copy2(es, pkg_name)
|
shutil.copy2(es, pkg_name)
|
||||||
|
|
||||||
os.chdir(path + pkg_name)
|
os.chdir(path + pkg_name)
|
||||||
|
@ -389,17 +377,14 @@ def build_extra_pkg(script, source, extra):
|
||||||
|
|
||||||
# auto build package from slackbuild script
|
# auto build package from slackbuild script
|
||||||
def build_package(script, source):
|
def build_package(script, source):
|
||||||
slack_script = script
|
pkg_name = script.replace(".tar.gz", "")
|
||||||
source_tar = source
|
|
||||||
|
|
||||||
pkg_name = slack_script.replace(".tar.gz", "")
|
|
||||||
|
|
||||||
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
path = subprocess.check_output(["pwd"], shell=True).replace("\n", "/")
|
||||||
try:
|
try:
|
||||||
tar = tarfile.open(slack_script)
|
tar = tarfile.open(script)
|
||||||
tar.extractall()
|
tar.extractall()
|
||||||
tar.close()
|
tar.close()
|
||||||
shutil.copy2(source_tar, pkg_name)
|
shutil.copy2(source, pkg_name)
|
||||||
os.chdir(path + pkg_name)
|
os.chdir(path + pkg_name)
|
||||||
os.system("sh {}{}{}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
os.system("sh {}{}{}".format(path, pkg_name + "/", pkg_name + ".SlackBuild"))
|
||||||
os.chdir(path)
|
os.chdir(path)
|
||||||
|
@ -460,7 +445,7 @@ def pkg_tracking(name):
|
||||||
print ("\n")
|
print ("\n")
|
||||||
pkg_len = len(name) + 18
|
pkg_len = len(name) + 18
|
||||||
print ("+" + "=" * pkg_len)
|
print ("+" + "=" * pkg_len)
|
||||||
print ("| {}`{}' {}dependencies :{}".format(colors.CYAN, name,
|
print ("| {}`{}` {}dependencies :{}".format(colors.CYAN, name,
|
||||||
colors.YELLOW, colors.ENDC))
|
colors.YELLOW, colors.ENDC))
|
||||||
print ("+" + "=" * pkg_len)
|
print ("+" + "=" * pkg_len)
|
||||||
dependencies.reverse()
|
dependencies.reverse()
|
||||||
|
@ -480,7 +465,7 @@ def SBo_network(name):
|
||||||
SBo_url = SBo_search_pkg(name)
|
SBo_url = SBo_search_pkg(name)
|
||||||
if SBo_url == None:
|
if SBo_url == None:
|
||||||
print ("\n")
|
print ("\n")
|
||||||
print ("{}The {}'{}'{} not found{}\n".format(colors.RED,
|
print ("{}The {}`{}`{} not found{}\n".format(colors.RED,
|
||||||
colors.CYAN, name, colors.RED, colors.ENDC))
|
colors.CYAN, name, colors.RED, colors.ENDC))
|
||||||
else:
|
else:
|
||||||
|
|
||||||
|
@ -566,6 +551,7 @@ def SBo_network(name):
|
||||||
break
|
break
|
||||||
|
|
||||||
build_package(script, source)
|
build_package(script, source)
|
||||||
|
break
|
||||||
|
|
||||||
elif read == "I" or read == "i":
|
elif read == "I" or read == "i":
|
||||||
s_user(getpass.getuser())
|
s_user(getpass.getuser())
|
||||||
|
@ -664,6 +650,7 @@ def SBo_check(name):
|
||||||
extra.append(get_file(ex, "/"))
|
extra.append(get_file(ex, "/"))
|
||||||
|
|
||||||
build_extra_pkg(script, source, extra)
|
build_extra_pkg(script, source, extra)
|
||||||
|
|
||||||
install_pkg = tmp + pkg_for_install + SBo_arch + SBo_tag + SBo_filetype
|
install_pkg = tmp + pkg_for_install + SBo_arch + SBo_tag + SBo_filetype
|
||||||
os.system("upgradepkg --install-new {}".format(install_pkg))
|
os.system("upgradepkg --install-new {}".format(install_pkg))
|
||||||
sys.exit()
|
sys.exit()
|
||||||
|
@ -845,7 +832,7 @@ def pkg_install(name):
|
||||||
for i in range(len(name)):
|
for i in range(len(name)):
|
||||||
try:
|
try:
|
||||||
print
|
print
|
||||||
print subprocess.check_output('installpkg ' + name[i], shell=True)
|
print subprocess.check_output('installpkg %s' % name[i], shell=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print ("{}Cannot install {}`{}`{} file not found\n{}".format(colors.RED, colors.CYAN,
|
print ("{}Cannot install {}`{}`{} file not found\n{}".format(colors.RED, colors.CYAN,
|
||||||
name[i], colors.RED, colors.ENDC))
|
name[i], colors.RED, colors.ENDC))
|
||||||
|
@ -857,7 +844,7 @@ def pkg_upgrade(name):
|
||||||
s_user(getpass.getuser())
|
s_user(getpass.getuser())
|
||||||
for i in range(len(name)):
|
for i in range(len(name)):
|
||||||
try:
|
try:
|
||||||
print subprocess.check_output('upgradepkg --install-new ' + name[i], shell=True)
|
print subprocess.check_output('upgradepkg --install-new %s' % name[i], shell=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print
|
print
|
||||||
print ("{}Cannot install {}`{}`{} file not found\n{}".format(colors.RED, colors.CYAN,
|
print ("{}Cannot install {}`{}`{} file not found\n{}".format(colors.RED, colors.CYAN,
|
||||||
|
@ -870,7 +857,7 @@ def pkg_reinstall(name):
|
||||||
s_user(getpass.getuser())
|
s_user(getpass.getuser())
|
||||||
for i in range(len(name)):
|
for i in range(len(name)):
|
||||||
try:
|
try:
|
||||||
print subprocess.check_output('upgradepkg --reinstall ' + name[i], shell=True)
|
print subprocess.check_output('upgradepkg --reinstall %s' % name[i], shell=True)
|
||||||
except subprocess.CalledProcessError:
|
except subprocess.CalledProcessError:
|
||||||
print
|
print
|
||||||
print ("{}Cannot install {}`{}`{} file not found\n{}".format(colors.RED, colors.CYAN,
|
print ("{}Cannot install {}`{}`{} file not found\n{}".format(colors.RED, colors.CYAN,
|
||||||
|
|
2
setup.py
2
setup.py
|
@ -7,7 +7,7 @@ from distutils.core import setup
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name = 'slpkg',
|
name = 'slpkg',
|
||||||
version = "1.4.8",
|
version = "1.4.9",
|
||||||
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