Kaydet (Commit) a8c85747 authored tarafından Suleyman Poyraz's avatar Suleyman Poyraz

Last twilight fixes

üst d0d311be
......@@ -100,7 +100,7 @@
Provides
)*>
<!ELEMENT Provides (COMAR)+>
<!ELEMENT Provides (SCOM)+>
<!ELEMENT SCOM (#PCDATA)>
<!ATTLIST SCOM script CDATA #IMPLIED>
<!ATTLIST SCOM name CDATA #IMPLIED>
......
......@@ -160,6 +160,7 @@ def makeJOBS():
procs = 4
try:
procs = multiprocessing.cpu_count()
env.jobs = procs
except Exception as e:
ctx.ui.warning("Unable to retrieve CPU count: %s" % e)
return env.jobs
......
import inary.actionsapi
import inary.util as util
import inary.context as ctx
from inary.actionsapi import get
from inary.actionsapi.shelltools import can_access_file
from inary.actionsapi.shelltools import system
import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
class MesonError(inary.actionsapi.Error):
def __init__(self, value=''):
inary.actionsapi.Error.__init__(self, value)
......@@ -48,5 +53,5 @@ def ninja_install(parameters=""):
def ninja_check():
if system('ninja test {} -C inaryPackageBuild'.format(get.makeJobs())):
if system('ninja test {} -C inaryPackageBuild'.format(get.makeJOBS())):
raise MesonError(_("[Ninja]: Test failed"))
......@@ -87,7 +87,7 @@ def install(parameters=''):
# Handle config files
if handleConfigFiles():
raise Installing(_('Handle config files failed'))
raise InstallError(_('Handle config files failed'))
def createSymlinksFormat2Engines():
......
......@@ -68,5 +68,5 @@ class Dependency(relation.Relation, metaclass=autoxml.autoxml):
return self.satisfies_relation(pkg.version, pkg.release)
# Added for AnyDependency, single Dependency always returns False
def satisfied_by_any_installed_other_than():
def satisfied_by_any_installed_other_than(self):
pass
......@@ -10,7 +10,6 @@
# Please read the COPYING file.
#
import sys
import glob
import os
import sys
......
......@@ -121,7 +121,6 @@ class TarFile(tarfile.TarFile):
name=None,
mode="r",
fileobj=None,
compressformat = None,
compresslevel = None,
**kwargs):
"""Open lzma/xz compressed tar archive name for reading or writing.
......@@ -158,7 +157,7 @@ class TarFile(tarfile.TarFile):
try:
t = cls.taropen(name, mode, fileobj, **kwargs)
except IOError:
raise ReadError(_(" {} is not a lzma file").format(name))
raise tarfile.ReadError(_(" {} is not a lzma file").format(name))
t._extfileobj = False
return t
......@@ -453,7 +452,6 @@ class ArchiveTar(ArchiveBase):
# Try to extract again.
self.tar.extract(tarinfo)
except IOError as e:
# Handle the case where new path is file, but old path is directory
# due to not possible touch file c in /a/b if directory /a/b/c exists.
if not e.errno == errno.EISDIR:
......
......@@ -252,7 +252,6 @@ class Install(AtomicOperation):
pkg = self.pkginfo
if self.installdb.has_package(pkg.name): # is this a reinstallation?
ipkg = self.installdb.get_package(pkg.name)
(iversion_s, irelease_s, ibuild) = self.installdb.get_version(pkg.name)
# determine if same version
......@@ -551,10 +550,10 @@ class Install(AtomicOperation):
actions = self.pkginfo.get_update_actions("1")
for package_name in actions.get("serviceRestart", []):
inary.db.installdb.InstallDB().mark_needs_restart(package)
inary.db.installdb.InstallDB().mark_needs_restart(package_name)
for package_name in actions.get("systemRestart", []):
inary.db.installdb.InstallDB().mark_needs_reboot(package)
inary.db.installdb.InstallDB().mark_needs_reboot(package_name)
# filesdb
ctx.ui.info(_('-> Adding \'{}\' to db...').format(self.metadata.package.name), color='purple')
......
......@@ -168,7 +168,7 @@ class Command(object):
else:
ui = inary.cli.CLI()
if (write and not os.access(inary.context.config.packages_dir(), os.W_OK) or \
if (write and not os.access(inary.context.config.packages_dir(), os.W_OK) or
('sf' == self.get_name() or 'cp' == self.get_name() and not os.access(
os.path.join(ctx.config.info_dir(), ctx.const.files_db), os.W_OK))):
raise inary.cli.Error(_("You have to be root for this operation."))
......
......@@ -50,14 +50,13 @@ repositories.
self.init(database=True, write=False)
l = self.componentdb.list_components(ctx.get_option('repository'))
if l:
maxlen = max([len(_p) for _p in l])
l.sort()
for p in l:
component = self.componentdb.get_component(p)
if self.options.long:
ctx.ui.info(str(component))
else:
lenp = len(p)
# if p in installed_list:
# p = util.colorize(p, 'cyan')
# p = p + ' ' * max(0, 15 - lenp)
component.name += ' ' * max(0, maxlen - len(p))
ctx.ui.info('{0} - {1} '.format(component.name, str(component.summary)))
......@@ -13,6 +13,7 @@
#
import optparse
import sys
import gettext
__trans = gettext.translation('inary', fallback=True)
......@@ -57,7 +58,7 @@ Lists the packages that will be upgraded.
upgradable_pkgs = list(filter(is_upgradable, installdb.list_installed()))
# replaced packages can not pass is_upgradable test, so we add them manually
upgradable_pkgs.extend(list_replaces())
#upgradable_pkgs.extend(list_replaces())
# consider also blacklist filtering
upgradable_pkgs = inary.blacklist.exclude_from(upgradable_pkgs, ctx.const.blacklist)
......
......@@ -43,7 +43,6 @@ class Repo(metaclass=autoxml.autoxml):
def __str__(self):
# "update", "remove", "add"
operation = ""
if self.operation == "update":
return _("{0} repository is updated.").format(self.name)
elif self.operation == "add":
......@@ -62,7 +61,6 @@ class Package(metaclass=autoxml.autoxml):
def __str__(self):
# "upgrade", "remove", "install", "reinstall", "downgrade"
operation = ""
if self.operation == "upgrade":
if self.type == "delta":
return _("{0} is upgraded from {1} to {2} with delta.").format(self.name, self.before, self.after)
......
......@@ -68,7 +68,7 @@ class Index(xmlfile.XmlFile, metaclass=autoxml.autoxml):
urlfile.write(uri) # uri
urlfile.close()
doc = self.read_uri(uri, tmpdir, force)
doc = self.read_uri(uri, tmpdir, force) # Fixme: Fuck
if not repo:
repo = self.distribution.name()
......@@ -215,7 +215,7 @@ def add_package(params):
if md.errors():
ctx.ui.info("")
ctx.ui.error(_('Package {}: metadata corrupt, skipping...').format(md.package.name))
ctx.ui.error(str(Error(*errs)))
ctx.ui.error(str(*errs))
else:
# No need to carry these with index (#3965)
md.package.files = None
......
......@@ -226,12 +226,12 @@ class InstallDB(lazydb.LazyDB):
found = []
for name in self.list_installed():
xml = open(os.path.join(self.package_path(name), ctx.const.metadata_xml)).read()
if terms == [term for term in terms if (fields['name'] and \
if terms == [term for term in terms if (fields['name'] and
re.compile(term, re.I).search(name)) or \
(fields['summary'] and \
(fields['summary'] and
re.compile(resum.format(lang, term), 0 if cs else re.I).search(
xml)) or \
(fields['desc'] and \
(fields['desc'] and
re.compile(redesc.format(lang, term), 0 if cs else re.I).search(
xml))]:
found.append(name)
......
......@@ -137,12 +137,12 @@ class PackageDB(lazydb.LazyDB):
fields = {'name': True, 'summary': True, 'desc': True}
found = []
for name, xml in self.pdb.get_items_iter(repo):
if terms == [term for term in terms if (fields['name'] and \
if terms == [term for term in terms if (fields['name'] and
re.compile(term, re.I).search(name)) or \
(fields['summary'] and \
(fields['summary'] and
re.compile(resum.format(lang, term), 0 if cs else re.I).search(
xml)) or \
(fields['desc'] and \
(fields['desc'] and
re.compile(redesc.format(lang, term), 0 if cs else re.I).search(
xml))]:
found.append(name)
......
......@@ -35,9 +35,9 @@ xmlext içine tag için remove eklenene kadar böyle
"""
try:
import iksemel
import ciksemel
parser = "iksemel"
parser = "ciksemel"
except:
import xml.dom.minidom as minidom
......@@ -83,7 +83,7 @@ class RepoOrder:
def set_status(self, repo_name, status):
repo_doc = self._get_doc()
if parser == "iksemel":
if parser == "ciksemel":
for r in repo_doc.tags("Repo"):
if r.getTagData("Name") == repo_name:
status_node = r.getTag("Status")
......@@ -123,7 +123,7 @@ class RepoOrder:
def remove(self, repo_name):
repo_doc = self._get_doc()
if parser == "iksemel":
if parser == "ciksemel":
for r in repo_doc.tags("Repo"):
if r.getTagData("Name") == repo_name:
r.hide()
......@@ -222,6 +222,7 @@ class RepoDB(lazydb.LazyDB):
return uri.rstrip()
def add_repo(self, name, repo_info, at=None):
#Fixme: Fucking at
repo_path = util.join_path(ctx.config.index_dir(), name)
###########
try:
......
......@@ -12,7 +12,6 @@
# Please read the COPYING file.
#
import re
import gzip
import re
......@@ -113,12 +112,12 @@ class SourceDB(lazydb.LazyDB):
lang = autoxml.LocalText.get_lang()
found = []
for name, xml in self.sdb.get_items_iter(repo):
if terms == [term for term in terms if (fields['name'] and \
if terms == [term for term in terms if (fields['name'] and
re.compile(term, re.I).search(name)) or \
(fields['summary'] and \
(fields['summary'] and
re.compile(resum.format(lang, term), 0 if cs else re.I).search(
xml)) or \
(fields['desc'] and \
(fields['desc'] and
re.compile(redesc.format(lang, term), 0 if cs else re.I).search(
xml))]:
found.append(name)
......
......@@ -223,7 +223,7 @@ class Fetcher:
def _get_ftp_headers(self):
headers = []
if self.url.auth_info() and self.url.scheme() == "ftp":
enc = encodesbytes('{0}:{0}'.format(self.url.auth_info()).encode('utf-8'))
enc = encodebytes('{0}:{0}'.format(self.url.auth_info()).encode('utf-8'))
headers.append(('Authorization', 'Basic {}'.format(enc)))
return headers
......@@ -283,7 +283,7 @@ def fetch(packages=None, path=os.path.curdir):
ctx.ui.warning(_("{} package already fetched").format(uri.path()))
continue
if uri.is_absolute_path():
url = str(pkg_uri)
url = str(uri.path())
else:
url = os.path.join(os.path.dirname(repodb.get_repo_url(repo)), str(uri.path()))
......
......@@ -113,7 +113,7 @@ def __getpackageurl(package):
def fetch_remote_file(package, errors):
try:
uri = inary.file.File.make_uri(__getpackageurlbinman(package))
uri = inary.file.File.make_uri(__getpackageurl_binman(package))
except PackageNotFound:
errors.append(package)
ctx.ui.info(_("{} could not be found").format(package), color="red")
......
......@@ -88,7 +88,7 @@ def install_pkg_names(A, reinstall=False, extra=False):
ctx.ui.notify(ui.packagestogo, order=order)
ignore_dep = ctx.config.get_option('ignore_dependency')
ignore_dep = ctx.config.get_option('ignore_dependency') # Fixme: Fuck
conflicts = []
if not ctx.get_option('ignore_package_conflicts'):
......
......@@ -32,8 +32,8 @@ import inary.ui as ui
def remove(A, ignore_dep=False, ignore_safety=False):
"""
Removes the given packages from the system
@param packages: list of package names -> list_of_strings
@param ignore_dependency: removes packages without looking into theirs reverse deps if True
@param A: list of package names -> list_of_strings
@param ignore_dep: removes packages without looking into theirs reverse deps if True
@param ignore_safety: system.base packages can also be removed if True
"""
inary.db.historydb.HistoryDB().create_history("remove")
......@@ -105,6 +105,7 @@ def plan_remove(A):
# install / reinstall
installdb = inary.db.installdb.InstallDB()
packagedb = inary.db.packagedb.PackageDB()
G_f = pgraph.PGraph(installdb) # construct G_f
......
......@@ -17,13 +17,17 @@ import gettext
__trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import inary.errors
import inary.context as ctx
import inary.db
import inary.data
import inary.errors
import inary.file
import inary.ui
import inary.uri
import inary.util as util
@util.locked
def add_repo(name, indexuri, at=None):
import re
......@@ -103,7 +107,7 @@ def __update_repo(repo, force=False):
repouri = repodb.get_repo(repo).indexuri.get_uri()
try:
index.read_uri_of_repo(repouri, repo)
except inary.file.AlreadyHaveException as e:
except inary.file.AlreadyHaveException:
ctx.ui.info(_('{} repository information is up-to-date.').format(repo))
if force:
ctx.ui.info(_('Updating database at any rate as requested'))
......
......@@ -72,6 +72,7 @@ def search_file(term):
packages -> list_of_tuples
@param term: used to search file -> list_of_strings
>>> import inary.operations
>>> files = inary.operation.search.search_file("kvm-")
>>> print files
......
......@@ -35,7 +35,6 @@ __trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
# INARY
import inary
import inary.errors
import inary.sxml.xmlext as xmlext
import inary.sxml.xmlfile as xmlfile
......
......@@ -66,7 +66,7 @@ class XmlFile(object):
self.doc = iks.parseString(str(file))
return self.doc
except Exception as e:
raise Error(_("File '{}' has invalid XML").format(file))
raise Error(_("File '{}' has invalid XML: {}").format(file,e))
def readxml(self, uri, tmpDir='/tmp', sha1sum=False,
compress=None, sign=None, copylocal=False):
......
......@@ -66,7 +66,7 @@ class XmlFile(object):
self.doc = minidom.parseString(file)
return self.doc.documentElement
except Exception as e:
raise Error(_("File '{}' has invalid XML").format(file))
raise Error(_("File '{}' has invalid XML: {}").format(file,e))
def readxml(self, uri, tmpDir='/tmp', sha1sum=False,
compress=None, sign=None, copylocal=False):
......
......@@ -21,6 +21,7 @@ import fnmatch
import hashlib
import operator
import os
import platform
import re
import shutil
import struct
......@@ -1120,7 +1121,6 @@ def get_vm_info():
import subprocess
except ImportError:
raise Exception(_("Module: \"subprocess\" can not import"))
if platform.system() == 'Linux':
try:
proc = subprocess.Popen(["free"],
......
......@@ -20,6 +20,7 @@ __trans = gettext.translation('inary', fallback=True)
_ = __trans.gettext
import inary
import inary.errors
# Basic rule is:
# p > (no suffix) > m > rc > pre > beta > alpha
......
git+https://github.com/Zaryob/scom-api.git
git+https://github.com/Zaryob/catbox.git
requests
#git+https://github.com/Zaryob/scom-api.git
#git+https://github.com/Zaryob/catbox.git
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment