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

Son de-Ÿişiklikler. Detaylar ChangeLog dosyas-±nda

üst 7de85174
2018-04-01 Suleyman Poyraz <nipalensisaquila@gmail.com>
* xmlext ile düzenlemeler:
-> inary.data.specfile:
- translations.xml dosyasını okurken xmlext kullanıyor.
-> inary.db.installdb, inary.db.sourcedb:
- Geçirilmesi unutulan satırlar yeniden ele alındı
-> inary.db.repodb:
- Yarı yarıya xmlext ile çalışıyor.
* Eklenenler:
-> inary.db.filesdb:
- has_file fonksiyonu eklendi. Databasede dosya var mı yok mu
kontrol etmek için birebir.
-> inary.sxml.xmlext:
- removeChild fonksiyonu eklendi. removeChildText ve removeAttribute
fonkdiyonları üzerinde çalışılıyor.
-> checkelf scripti:
- pardus döneminde kullannılan ve paketin dependency'lerini ldd ve pc
dosyalarına bakarak döndüren bir tool.
* Silinenler:
-> inary.analyzer:
- gereksiz olan ctypes_analyzer ile pkgconfig silindi. Pkgconfig yerine
checkelf script olarak alındı.
* Hata düzeltmeleri:
-> dbus exception için python3'de farklı bir class açılmış. Ona oygun olarak
except satırları değiştirildi.
-> op_wrapper:
inary.operations.operations olarak yeniden adlandırıldı.
2018-03-29 Suleyman Poyraz <nipalensisaquila@gmail.com>
* Darara (new tag= inary-1.0_rc3):
* historydb:
-> Hataya sebeb olan satırlar düzeltildi.
* Hata düzeltmeleri:
-> xmlext'ye geçirilmeyen bazı kısımlar düzeltildi.
ve bu dönüşüme bağlı hatalar yamandı.
-> atomicoperations içindeki hatalar düzeltildi.
* Testler:
-> Portage'ın runTests betiği incelenip inary için daha
uygun yeni bir betik yazıldı
-> setup.py içerisinde test sınıfı eklendi. Kararlılığı sağlandı.
2018-03-28 Suleyman Poyraz <nipalensisaquila@gmail.com>
* Hata düzeltmeleri:
-> Kodlama hataları ele alındı, arada anlamsız gelen çıktılar düzeltildi
* Lisans:
-> GPLv3 yapıldı, eski developerlerin kullandığı Copyright da eklendi.
* Hata düzeltmeleri:
-> Kodlama hataları ele alındı, arada anlamsız gelen çıktılar düzeltildi
* Lisans:
-> GPLv3 yapıldı, eski developerlerin kullandığı Copyright da eklendi.
2018-03-15 Suleyman Poyraz <nipalensisaquila@gmail.com>
* fetcher.py:
......
......@@ -20,9 +20,10 @@ Legend:
- GoLang Tools
+ Python Language Tools
+ Ruby Language Tools
- Use gem agent
+ Perl Language Tools
+ CMake Tools
/ unit test
+ unit test
+ source building
+ Detailed build log file
+ package module
......@@ -95,9 +96,9 @@ Legend:
+ write meaningful localtext datas
+ return meaningful localtext summaries and descriptions
+ revised interface
/ Error handling
+ Error handling
+ improved error handling, check routines, hooks, format/print routines
/ write a meaningful traceback output
+ write a meaningful traceback output
+ xmlfile support (read/write)
+ string member, in addition to tag/attribute members
+ replace specfile with new specfile using autoxml
......
# -*- coding: utf-8 -*-
#
# Main fork Pisi: Copyright (C) 2005 - 2011, Tubitak/UEKAE
#
# Copyright (C) 2016 - 2018, Suleyman POYRAZ (Zaryob)
#
# This program is free software; you can redistribute it and/or modify it under
# the terms of the GNU General Public License as published by the Free
# Software Foundation; either version 3 of the License, or (at your option)
# any later version.
#
# Please read the COPYING file.
#
"ctype analyzer"
class CTypes:
def __init__(self, fname):
"""Analyze ctypes. Find libraries and load"""
self.library_handle ={}
self.library_names = {}
self.name = name
try:
import ctypes
import ctypes.util
except ImportError:
try:
ctypes.cdll
except:
raise Exception(_("Module \"ctypes\" can not import"))
def find_library(self):
fname = self.library_names.get(name)
if fname is None:
fname = ctypes.util.find_library(name)
if fname is None:
fname = False
self.library_names[name] = fname
if fname is False:
return None
return fname
def LoadLibrary(name):
handle = self.library_handle.get(name)
if handle is None:
handle = ctypes.CDLL(name, use_errno=True)
self.library_handles[name] = handle
return handle
# -*- coding: utf-8 -*-
"""
Forensic finder Sulin harici dağıtımlara paket kurulumunda
sorun yaşamadan işimizi halletmemizi sağlayabilir.
mevcut repodaki paketlerin files listesine bakılarak yüklü paket
listesi çıkartılabilir bence.
"""
import hashlib
import os
import sys
......@@ -25,10 +30,10 @@ IGNORE_DIRS = ('/root',
'/var/lock/subsys',
'/var/spool',
'/var/cache',
'/var/db/comar3/scripts',
'/var/db/comar3/apps',
'/var/db/scom3/scripts',
'/var/db/scom3/apps',
'/var/lib/mysql/mysql',
'/etc/mudur/services')
'/etc/scomd/services')
IGNORE_EXTS = ('.pyc',
'.pid')
......@@ -61,8 +66,7 @@ def find_unowned(rootdir, last_unowned):
continue
filepath = os.path.join(root, name)
if filepath not in all_files and filepath not in last_unowned:
sys.stdout.write("UNOWNED %s\n" % filepath)
sys.stdout.flush()
ctx.ui.info("UNOWNED %s\n" % filepath)
def find_corrupted(rootdir, last_changed):
for package in inary.db.installdb.InstallDB().list_installed():
......@@ -73,15 +77,13 @@ def find_corrupted(rootdir, last_changed):
if not filepath.startswith(rootdir):
continue
if filepath not in last_changed or last_changed[filepath] != get_hash(filepath):
sys.stdout.write("CHANGED %s %s %s\n" % (get_hash(filepath), package, filepath))
sys.stdout.flush()
ctx.ui.info("CHANGED %s %s %s\n" % (get_hash(filepath), package, filepath))
for filepath in check['missing']:
filepath = '/' + filepath
if not filepath.startswith(rootdir):
continue
sys.stdout.write("MISSING {0} {1}\n".format(package, filepath))
sys.stdout.flush()
ctx.ui.info("MISSING {0} {1}\n".format(package, filepath))
def forensics(rootdir='/',logfile='logfile'):
if not rootdir.endswith('/'):
......
......@@ -19,7 +19,6 @@ import gettext
__trans = gettext.translation("inary", fallback=True)
_ = __trans.gettext
import ctypes
from ctypes import c_char_p, c_int, c_size_t, c_void_p
import ctypes.util
......
This diff is collapsed.
......@@ -20,9 +20,7 @@ _ = __trans.gettext
import inary
#Analyzers
import inary.analyzer.ctypes_analyzer
import inary.analyzer.forensic
import inary.analyzer.pkgconfig
import inary.atomicoperations
import inary.blacklist
......@@ -158,7 +156,7 @@ from inary.operations.helper import calculate_download_sizes, get_package_requir
from inary.operations.history import get_takeback_plan
from inary.operations.info import info
from inary.operations.install import get_install_order
from inary.operations.op_wrappers import *
from inary.operations.operations import *
from inary.operations.remove import get_remove_order
from inary.operations.upgrade import get_upgrade_order, get_base_upgrade_order
from inary.operations.search import *
......@@ -977,6 +977,7 @@ def update_repo(repo, force=False):
if updated:
inary.db.regenerate_caches()
def __update_repo(repo, force=False):
ctx.ui.action(_('Updating repository: {}').format(repo))
ctx.ui.notify(inary.ui.updatingrepo, name = repo)
......@@ -995,6 +996,7 @@ def __update_repo(repo, force=False):
return False
inary.db.historydb.HistoryDB().update_repo(repo, repouri, "update")
repodb.check_distribution(repo)
try:
......
......@@ -20,7 +20,7 @@ _ = __trans.gettext
import inary.atomicoperations
import inary.operations.check
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
import inary.cli.command as command
import inary.context as ctx
import inary.util as util
......@@ -75,7 +75,7 @@ class Check(command.Command, metaclass=command.autocommand):
component = ctx.get_option('component')
if component:
installed = op_wrappers.list_installed()
installed = operations.list_installed()
component_pkgs = self.componentdb.get_union_packages(component,
walk=True)
pkgs = list(set(installed) & set(component_pkgs))
......@@ -83,7 +83,7 @@ class Check(command.Command, metaclass=command.autocommand):
pkgs = self.args
else:
ctx.ui.info(_('Checking all installed packages') + '\n')
pkgs = op_wrappers.list_installed()
pkgs = operations.list_installed()
necessary_permissions = True
......
......@@ -23,7 +23,7 @@ import inary.cli.command as command
import inary.cli.build as build
import inary.context as ctx
import inary.db
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class EmergeUp(build.Build, metaclass=command.autocommand):
__doc__ = _("""Build and upgrade INARY source packages from repository
......@@ -79,7 +79,7 @@ You can also give the name of a component.
ctx.ui.info(_('Outputting binary packages in the package cache.'))
ctx.config.options.output_dir = ctx.config.cached_packages_dir()
repos = op_wrappers.list_repos()
repos = operations.list_repos()
inary.atomicoperations.update_repos(repos, ctx.get_option('force'))
inary.atomicoperations.emerge(emerge_up_list)
......@@ -22,7 +22,7 @@ import inary.cli.command as command
import inary.context as ctx
import inary.db
import inary.data.pgraph as pgraph
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class Graph(command.Command, metaclass=command.autocommand):
__doc__ = _("""Graph package relations
......@@ -78,7 +78,7 @@ the package in graphviz format to 'pgraph.dot'.
if self.args:
a = self.args
else:
a = op_wrappers.list_available(repo)
a = operations.list_available(repo)
else:
# Graph from installed packages database
packagedb = inary.db.installdb.InstallDB()
......@@ -88,7 +88,7 @@ the package in graphviz format to 'pgraph.dot'.
else:
# if A is empty, then graph all packages
ctx.ui.info(_('Plotting a graph of relations among all installed packages'))
a = op_wrappers.list_installed()
a = operations.list_installed()
g = pgraph.package_graph(a, packagedb,
ignore_installed = ctx.get_option('ignore_installed'), reverse = ctx.get_option('reverse'))
......
......@@ -23,7 +23,7 @@ import inary.context as ctx
import inary.util as util
import inary.atomicoperations
import inary.db
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class ListAvailable(command.Command, metaclass=command.autocommand):
__doc__ = _("""List available packages in the repositories
......@@ -65,7 +65,7 @@ all repositories.
self.print_packages(arg)
else:
# print for all repos
for repo in op_wrappers.list_repos():
for repo in operations.list_repos():
ctx.ui.info(util.colorize(_("\n Repository : {}\n"), "blue").format(str(repo)))
self.print_packages(repo)
......@@ -78,9 +78,9 @@ all repositories.
except Exception as e:
return
else:
l = op_wrappers.list_available(repo)
l = operations.list_available(repo)
installed_list = op_wrappers.list_installed()
installed_list = operations.list_installed()
# maxlen is defined dynamically from the longest package name (#9021)
if l:
......
......@@ -21,7 +21,7 @@ _ = __trans.gettext
import inary.cli.command as command
import inary.context as ctx
import inary.db
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class ListNewest(command.Command, metaclass=command.autocommand):
__doc__ = _("""List newest packages in the repositories
......@@ -58,7 +58,7 @@ packages from all repositories.
self.print_packages(arg)
else:
# print for all repos
for repo in op_wrappers.list_repos():
for repo in operations.list_repos():
self.print_packages(repo)
def print_packages(self, repo):
......@@ -69,7 +69,7 @@ packages from all repositories.
else:
since = None
l = op_wrappers.list_newest(repo, since)
l = operations.list_newest(repo, since)
if not l:
return
......
......@@ -19,7 +19,7 @@ _ = __trans.gettext
import inary.cli.command as command
import inary.context as ctx
import inary.data.pgraph
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class ListPending(command.Command, metaclass=command.autocommand):
__doc__ = _("""List pending packages
......@@ -35,7 +35,7 @@ Lists packages waiting to be configured.
def run(self):
self.init(database = True, write = False)
A = op_wrappers.list_pending()
A = operations.list_pending()
if len(A):
for p in inary.data.pgraph.generate_pending_order(A):
sys.stdout.write(p)
......
......@@ -22,7 +22,7 @@ import inary.cli.command as command
import inary.blacklist
import inary.context as ctx
import inary.db
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class ListUpgrades(command.Command, metaclass=command.autocommand):
__doc__ = _("""List packages to be upgraded
......@@ -51,7 +51,7 @@ Lists the packages that will be upgraded.
def run(self):
self.init(database = True, write = False)
upgradable_pkgs = op_wrappers.list_upgradable()
upgradable_pkgs = operations.list_upgradable()
component = ctx.get_option('component')
if component:
......
......@@ -21,7 +21,7 @@ _ = __trans.gettext
import inary.cli.command as command
import inary.context as ctx
import inary.atomicoperations
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
class UpdateRepo(command.Command, metaclass=command.autocommand):
__doc__ = _("""Update repository databases
......@@ -55,6 +55,6 @@ If no repository is given, all repositories are updated.
if self.args:
repos = self.args
else:
repos = op_wrappers.list_repos()
repos = operations.list_repos()
inary.atomicoperations.update_repos(repos, ctx.get_option('force'))
......@@ -21,7 +21,7 @@ _ = __trans.gettext
import inary.cli.command as command
import inary.context as ctx
import inary.db
import inary.operations.op_wrappers as op_wrappers
import inary.operations.operations as operations
import inary.atomicoperations
class Upgrade(command.PackageOp, metaclass=command.autocommand):
......@@ -87,7 +87,7 @@ expanded to package names.
if not ctx.get_option('bypass_update_repo'):
ctx.ui.info(_('Updating repositories'))
repos = op_wrappers.list_repos()
repos = operations.list_repos()
inary.atomicoperations.update_repos(repos)
else:
ctx.ui.info(_('Will not update repositories'))
......
......@@ -27,6 +27,7 @@ import os.path
# inary modules
import inary.sxml.xmlfile as xmlfile
import inary.sxml.xmlext as xmlext
import inary.sxml.autoxml as autoxml
import inary.context as ctx
import inary.analyzer.dependency
......@@ -37,12 +38,6 @@ import inary.data.group as group
import inary.util as util
import inary.db
try:
import ciksemel
parser = "ciksemel"
except:
import xml.dom.minidom as minidom
parser = "minidom"
class Error(inary.errors.Error):
pass
......@@ -428,60 +423,30 @@ class SpecFile(xmlfile.XmlFile, metaclass=autoxml.autoxml):
def getSourceRelease(self):
return self.history[0].release
def _set_i18n(self, tag, inst, parser="ciksemel"):
if parser=="ciksemel":
try:
for summary in tag.tags("Summary"):
inst.summary[summary.getAttribute("xml:lang")] = summary.firstChild().data()
for desc in tag.tags("Description"):
inst.description[desc.getAttribute("xml:lang")] = desc.firstChild().data()
except AttributeError:
raise Error(_("translations.xml file is badly formed."))
else:
try:
for summary in tag.getElementsByTagName("Summary"):
inst.summary[summary.getAttribute("xml:lang")] = summary.childNodes[0].data
for desc in tag.getElementsByTagName("Description"):
inst.description[desc.getAttribute("xml:lang")] = desc.childNodes[0].data
except AttributeError:
raise Error(_("translations.xml file is badly formed."))
def _set_i18n(self, tag, inst):
try:
for summary in xmlext.getTagByName(tag, "Summary"):
inst.summary[xmlext.getNodeAttribute(summary, "xml:lang")] = xmlext.getNodeText(summary)
for desc in xmlext.getTagByName(tag, "Description"):
inst.description[xmlext.getNodeAttribute(desc, "xml:lang")] = xmlext.getNodeText(desc)
except AttributeError as e:
raise Error(_("translations.xml {} file is badly formed.").format(e))
def read_translations(self, path):
if not os.path.exists(path):
return
if parser=="ciksemel":
doc = ciksemel.parse(path)
if doc.getTag("Source").getTagData("Name") == self.source.name:
# Set source package translations
self._set_i18n(doc.getTag("Source"), self.source)
for pak in doc.tags("Package"):
for inst in self.packages:
if inst.name == pak.getTagData("Name"):
self._set_i18n(pak, inst)
break
else:
try:
doc = minidom.parse(path).documentElement
except ExpatError as err:
raise Error(_("File '{0}' has invalid XML: {1}").format(path, err) )
if doc.getElementsByTagName("Source")[0].getElementsByTagName("Name")[0].firstChild.data == self.source.name:
# Set source package translations
self._set_i18n(doc.getElementsByTagName("Source")[0], self.source, parser="minidom")
#FIXME: How can we fix it
for pak in doc.childNodes:
if pak.nodeType == pak.ELEMENT_NODE and pak.tagName == "Package":
for inst in self.packages:
if inst.name == pak.getElementsByTagName("Name")[0].firstChild.data:
self._set_i18n(pak, inst, parser="minidom")
break
doc = xmlext.parse(path)
if xmlext.getNodeText(xmlext.getNode(doc, "Source"), "Name") == self.source.name:
# Set source package translations
self._set_i18n(xmlext.getNode(doc, "Source"), self.source)
for pak in xmlext.getTagByName(doc, "Package"):
for inst in self.packages:
if inst.name == xmlext.getNodeText(pak, "Name"):
self._set_i18n(pak, inst)
break
def __str__(self):
s = _('Name: {0}, version: {1}, release: {2}\n').format(
......
......@@ -52,6 +52,13 @@ class FilesDB(lazydb.LazyDB):
key=hashlib.md5(path.encode('utf-8')).hexdigest()
return self.filesdb.get(key), path
def has_file(self, path):
key=hashlib.md5(path.encode('utf-8')).hexdigest()
if key in self.filesdb:
return True
else:
return False
def search_file(self, term):
pkg, path = self.get_file(term)
if pkg:
......
......@@ -173,13 +173,7 @@ class InstallDB(lazydb.LazyDB):
def get_install_tar_hash(self, package):
metadata_xml = os.path.join(self.package_path(package), ctx.const.metadata_xml)
try:
import ciksemel
meta_doc = ciksemel.parse(metadata_xml)
except:
import xml.dom.minidom as minidom
meta_doc = minidom.parse(metadata_xml).documentElement
meta_doc = xmlext.parse(metadata_xml)
return self.__get_install_tar_hash(meta_doc)
......@@ -194,7 +188,7 @@ class InstallDB(lazydb.LazyDB):
metadata_xml = os.path.join(self.package_path(package), ctx.const.metadata_xml)
meta_doc = xmlext.parse(metadata_xml)
return self.__get_version(meta_doc)
def get_files(self, package):
......@@ -260,13 +254,8 @@ class InstallDB(lazydb.LazyDB):
return info
def __make_dependency(self, depStr):
try:
import ciksemel
node = ciksemel.parseString(depStr)
except:
import xml.dom.minidom as minidom
node = minidom.parseString(depStr).documentElement
node = xmlext.parseString(depStr)
dependency = inary.analyzer.dependency.Dependency()
dependency.package = xmlext.getNodeText(node)
......
......@@ -29,6 +29,10 @@ import inary.sxml.xmlext as xmlext
import inary.uri
import inary.util as util
"""
xmlext içine tag için remove eklenene kadar böyle
"""
try:
import ciksemel
parser = "ciksemel"
......@@ -56,48 +60,17 @@ class RepoOrder:
def add(self, repo_name, repo_url, repo_type="remote"):
if parser == "ciksemel":
repo_doc = self._get_doc()
try:
node = [x for x in repo_doc.tags("Repo")][-1]
repo_node = node.appendTag("Repo")
except IndexError:
repo_node = repo_doc.insertTag("Repo")
name_node = repo_node.insertTag("Name")
name_node.insertData(repo_name)
url_node = repo_node.insertTag("Url")
url_node.insertData(repo_url)
name_node = repo_node.insertTag("Status")
name_node.insertData("active")
media_node = repo_node.insertTag("Media")
media_node.insertData(repo_type)
else:
repo_doc = self._get_doc().ownerDocument
repo_node = repo_doc.createElement("Repo")
repo_doc = self._get_doc()
name_node = repo_doc.createElement("Name")
name_node.appendChild(repo_doc.createTextNode(repo_name))
repo_node.appendChild(name_node)
repo_node = xmlext.addNode(repo_doc, "Repo")
url_node = repo_doc.createElement("Url")
url_node.appendChild(repo_doc.createTextNode(repo_url))
repo_node.appendChild(url_node)
xmlext.addText(repo_node, "Name", repo_name)
status_node = repo_doc.createElement("Status")
status_node.appendChild(repo_doc.createTextNode("active"))
repo_node.appendChild(status_node)
xmlext.addText(repo_node, "Url", repo_url)
media_node = repo_doc.createElement("Media")
media_node.appendChild(repo_doc.createTextNode(repo_type))
repo_node.appendChild(media_node)
xmlext.addText(repo_node, "Status", "active")
repo_doc.childNodes[0].appendChild(repo_node)
xmlext.addText(repo_node, "Media", repo_type)
self._update(repo_doc)
......@@ -132,24 +105,13 @@ class RepoOrder:
def get_status(self, repo_name):
repo_doc = self._get_doc()
if parser=="ciksemel":
for r in repo_doc.tags("Repo"):
if r.getTagData("Name") == repo_name:
status_node = r.getTag("Status")
if status_node:
status = status_node.firstChild().data()
if status in ["active", "inactive"]:
return status
else:
for r in repo_doc.childNodes:
if r.nodeType == r.ELEMENT_NODE and r.tagName == "Repo":
if r.getElementsByTagName("Name")[0].firstChild.data == repo_name:
status_node = r.getElementsByTagName("Status")
if status_node:
status = status_node[0].childNodes[0].data
if status in ["active", "inactive"]:
return status
for r in xmlext.getTagByName(repo_doc, "Repo"):
if xmlext.getNodeText(r, "Name") == repo_name:
status_node = xmlext.getNode(r, "Status")
if status_node:
status = xmlext.getNodeText(status_node)
if status in ["active", "inactive"]:
return status
return "inactive"
......@@ -179,11 +141,7 @@ class RepoOrder:
def _update(self, doc):
repos_file = os.path.join(ctx.config.info_dir(), ctx.const.repos)
if parser=="ciksemel":
open(repos_file, "w").write("{}\n".format(doc.toPrettyString()))
else:
open(repos_file, "w").write("{}\n".format(doc.toprettyxml().strip()))
open(repos_file, "w").write("{}\n".format(xmlext.toPretty(doc)))
self._doc = None
self.repos = self._get_repos()
......@@ -192,17 +150,10 @@ class RepoOrder:
if self._doc is None:
repos_file = os.path.join(ctx.config.info_dir(), ctx.const.repos)
if os.path.exists(repos_file):
if parser=="ciksemel":
self._doc = ciksemel.parse(repos_file)
else:
self._doc = minidom.parse(repos_file).documentElement
self._doc = xmlext.parse(repos_file)
else:
if parser=="ciksemel":
self._doc = ciksemel.newDocument("REPOS")
else:
impl = minidom.getDOMImplementation()
dom = impl.createDocument(None, "REPOS", None)
self._doc = dom.documentElement
self._doc = xmlext.newDocument("REPOS")
return self._doc
......@@ -210,20 +161,11 @@ class RepoOrder:
repo_doc = self._get_doc()
order = {}