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

Çok canavarca bir geliştirme stilim var.

Çok acaip şekilde license taglarını hep silmişim. Falan filan... Şu ana
kadar offline olarak çalıştım ancak yakında kodlarımı gitlaba global
olarak çekeceğim. ve bundan önce de özgür yazılım için yapmam gerek
çeşitli işler var.
üst a4fea6f6
"Wrote by old Pardus developer Eray Özkural"
HISTORY OF THE DEVELOPMENT BRANCH FORK
======================================
1. Introduction
INARY was the Pardus Linux package manager, I wrote most of it while
working at TUBITAK/UEKAE during 2005-2006 as a researcher, and it took
me about half a year to write it, and another half year to revise it
(80-90% of commit numbers/size), save for build commands, and the
actionsapi library, and I personally made the original 1.0 release at
Pardus, fixing 300+ bugs and wishlist issues. Then, my hopelessly naive
co-workers brought in another maintainer to the team who did
not contribute anything new to the code except for a bugfix somewhere,
but only stripped down some of the new features, mistaking this
destructive act for "maintenance" (he was only a contributor, not an
author). The latter releases do not have much that is new added to the
code, they've only stripped down some features and commands like the
search API. They've also tried to remove my name from the AUTHORS list
and from individual sources, in an attempt to hide my contributions,
pretending that INARY was written collaboratively. It was not. I wrote
most of it, I was the only seasoned programmer who worked on INARY,
amazingly, it turns out that it does take some skill to design an
efficient system tool; I was also one of the few ones who weren't
overtly lazy and did not spend the entire day writing blogs about
irrelevant stuff and drinking tea and tobacco like a state
officer. The Turkish Linux Users Group award for INARY was also given
to me personally, not the team. I left the award trophy as a gesture
of kindness to promote team unity. Since I am not pleased with the
later Pardus release branch that I find to be desecrating my poetic
code, I am reviving the original development branch. I've uploaded the
last development branch I found on my local SVN copies, out of
1.1_beta12. The next release will be 1.2, and then the next major
revision will be called 3.0. I declare the 1.0 and 1.1 releases
and 2.x branch from TUBITAK, which is not truly a major revision to
INARY code, to be obsolete. May its bits rot in peace.
To be absolutely clear, the last release I committed was 1.1beta9,
and it may be found here:
You will find that there have not been many interesting additions since then,
save for some code reorganization that moved files and functions around.
I noticed that most of the latter changes amount to crippleware, and
I am only selectively backporting some stuff like mirror support for the sake
of backwards (back to the future?) compatibility.
2. Novelties in INARY
There are two very interesting generic python novelties I developed
for INARY. The use of metaclasses was essential to both. The first one
is something I call autoxml, and it uses python metaclasses to work
with XML based configuration using Berkeley DB, but the DB is
completely abstracted. It's basically a neat nosql python XML/DB
framework. The other interesting thing is the command framework using
metaclasses, which also worked beautifully. The algorithms are also
pretty compact. I designed and implemented some graph algorithms to
deal with dependency resolution, and so forth. These algorithms make a
pretty useful library, you can write a lot of effective package tools
around the INARY framework, as we proved in the server scripts of
Pardus GNU/Linux distribution.
INARY also has some features not found in any other package manager
that I know of, such as the ability to work with hierarchical
components and metadata information in a clean, non-kludgey way, and
the smooth merging of binary and source package approaches of debian
and gentoo. INARY is sort of like gentoo package tools ported to debian
and debian package tools ported to gentoo, and rewritten in python in
a better way. Admittedly, there are some missing features, the
handling of virtual packages leaves something to be desired, I really
should rewrite that part, it's the same old problem with debian
package resolution, but unlike debian, both dpkg and apt-get layers
are implemented in a single library, no silly perl scripts and the
like. Even making everything pure python scripts was a huge
contribution. Caglar's actionsapi was also quite nice, Caglar was very
hard working, he developed most of the packages himself. Baris
contributed some nice bugfixes and developed most of the build path,
which does something a lot like gentoo. Getting both the binary and
source packages work seamlessly was an important feature of INARY, and
again, not really found in any other package manager the way it is in
Pardus. Although more than 10 years old, I suspect, INARY remains the
most compact, featureful and efficient package manager of all.
3. INARY Design
The design of INARY was based on a document about an XML format
designed by Pardus developers before I joined the team. I saw that it
is basically the same thing as dpkg, so I made a minor revision to the
document, and added a whole lot of features that I had designed as an
addition to dpkg / apt-get, such as the ability to deal with source
packages in the right way, the unique versioning / revisioning schema
of INARY, package / component / is-a models, dependency system, and
proposed to write the project in python. The most critical design and
features belong to me, such as the XML based data structures, autoxml,
the databases, the graph and dependency algorithms, the commands, the
CLI, search API, the first GUI, documents, translations, and so
forth. I am still amazed at how short the code is for what it does,
thank you Guido for python! All those cool python features like list
comprehensions and metaclasses did something for me, after all.
4. Development branch goals
The development branch's goal is to make the Pardus dependencies
optional. My vision for INARY was beyond Pardus, I had designed it as a
replacement for dpkg. It can replace dpkg/apt-get in a debian based system,
or gentoo package manager in a gentoo based system, with some due
effort, of course. Because of their sheer incompetence, TUBITAK later
dropped the INARY based Pardus distribution unwittingly and replaced it
with a Debian based distribution, when what they really needed was a
competent development team that could improve the, IMHO quite
satisfactory, system tools. However, the heart of Pardus is still the
INARY package manager, and naturally the other system tools such as
Gurer's COMAR and MUDUR, Baris's YALI. Those four tools + INARY packages make
a Pardus distro. I will not bother trying to rewrite COMAR and YALI,
but I have other ideas that will make INARY a portable package manager,
which is most of the reason I decided to write it in python. There are,
however, distros that are Pardus derivatives, and I will make a good
effort to support them with a reference implementation of INARY that
they can use or derive from.
5. Remarks
Let me know what you want to call the package manger in English, I'm
considering various alternatives. Kitty, and pussy are among the names
I'm considering. INARY means Packages Intended Successfully as
Intended, but I made that up as a de-acronym for INARY which is an
affectionate word for a cat in Turkish (like pussy), which was a name
decided before I even designed the code, çomar likewise is a slang for
dog in Turkish. I love my INARY, of course. <3
Happy hacking! :3
Mon Mar 12 17:21:59 2018 +0300 5052192f Son bir şans daha versen sevgilim... [Suleyman Poyraz]
diff --git a/inary/db/repodb.py b/inary/db/repodb.py
index 1ed56b04..5aa219a9 100644
--- a/inary/db/repodb.py
+++ b/inary/db/repodb.py
@@ -16,7 +16,8 @@ _ = __trans.gettext
import os
-import ciksemel
+import xml.dom.minidom as minidom
+from xml.parsers.expat import ExpatError
import inary
import inary.uri
@@ -47,33 +48,39 @@ class RepoOrder:
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")
+ #FIXME:Burada bir sakatlık çıkacak
+ node = [x for x in repo_doc.getElementsByTagName("Repo")][-1]
+ repo_node = node.createElement("Repo")
+ except ExpatError as err:
+ raise("Can not created Repo tag: {}".format(err))
- name_node = repo_node.insertTag("Name")
- name_node.insertData(repo_name)
+ name_node = repo_node.createElement("Name")
+ name_node.appendChild(node.createTextNode(repo_name))
+ repo_node.appendChild(name_node)
- url_node = repo_node.insertTag("Url")
- url_node.insertData(repo_url)
+ url_node = repo_node.createElement("Url")
+ url_node.appendChild(node.createTextNode(repo_url))
+ repo_node.appendChild(url_node)
- name_node = repo_node.insertTag("Status")
- name_node.insertData("active")
+ status_node = repo_node.createElement("Status")
+ status_node.appendChild(node.createTextNode("active"))
+ repo_node.appendChild(status_node)
- media_node = repo_node.insertTag("Media")
- media_node.insertData(repo_type)
+ media_node = repo_node.createElement("Media")
+ media_node.appendChild(node.createTextNode(repo_type))
+ repo_node.appendChild(media_node)
self._update(repo_doc)
def set_status(self, repo_name, status):
repo_doc = self._get_doc()
- for r in repo_doc.tags("Repo"):
- if r.getTagData("Name") == repo_name:
- status_node = r.getTag("Status")
+ for r in repo_doc.getElementsByTagName("Repo"):
+ if r.getElementsByTagName("Name")[0].firstChild.data == repo_name:
+ status_node = r.getElementsByTagName("Status")[0].firstChild.data
+ #FIXME: Program burda göt olacak
if status_node:
- status_node.firstChild().hide()
+ status_node.childNodes[0].hide()
status_node.insertData(status)
else:
status_node = r.insertTag("Status")
@@ -83,11 +90,11 @@ class RepoOrder:
def get_status(self, repo_name):
repo_doc = self._get_doc()
- for r in repo_doc.tags("Repo"):
- if r.getTagData("Name") == repo_name:
- status_node = r.getTag("Status")
+ for r in repo_doc.getElementsByTagName("Repo"):
+ if r.getElementsByTagName("Name")[0].firstChild.data == repo_name:
+ status_node = r.getElementsByTagName("Status").firstChild.data
if status_node:
- status = status_node.firstChild().data()
+ status = status_node.childNodes[0].data
if status in ["active", "inactive"]:
return status
return "inactive"
@@ -95,8 +102,8 @@ class RepoOrder:
def remove(self, repo_name):
repo_doc = self._get_doc()
- for r in repo_doc.tags("Repo"):
- if r.getTagData("Name") == repo_name:
+ for r in repo_doc.getElementsByTagName("Repo"):
+ if r.getElementsByTagName("Name")[0].firstChild.data == repo_name:
r.hide()
self._update(repo_doc)
@@ -113,7 +120,7 @@ class RepoOrder:
def _update(self, doc):
repos_file = os.path.join(ctx.config.info_dir(), ctx.const.repos)
- open(repos_file, "w").write("{}\n".format(doc.toPrettyString()))
+ open(repos_file, "w").write("{}\n".format(doc.toprettyxml()))
self._doc = None
self.repos = self._get_repos()
@@ -121,9 +128,11 @@ 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):
- self._doc = ciksemel.parse(repos_file)
+ self._doc = minidom.parse(repos_file).documentElement
else:
- self._doc = ciksemel.newDocument("REPOS")
+ impl = minidom.getDOMImplementation()
+ dom = impl.createDocument(None, "REPOS", None)
+ self._doc = dom.documentElement
return self._doc
@@ -131,10 +140,10 @@ class RepoOrder:
repo_doc = self._get_doc()
order = {}
- for r in repo_doc.tags("Repo"):
- media = r.getTagData("Media")
- name = r.getTagData("Name")
- status = r.getTagData("Status")
+ for r in repo_doc.getElementsByTagName("Repo"):
+ media = r.getElementsByTagName("Media")[0].firstChild.data
+ name = r.getElementsByTagName("Name")[0].firstChild.data
+ status = r.getElementsByTagName("Status")[0].firstChild.data
order.setdefault(media, []).append(name)
return order
@@ -166,11 +175,13 @@ class RepoDB(lazydb.LazyDB):
if not os.path.exists(index_path):
ctx.ui.warning(_("{} repository needs to be updated").format(repo_name))
- return ciksemel.newDocument("INARY")
+ impl = minidom.getDOMImplementation()
+ dom = impl.createDocument(None, "INARY", None)
+ return dom.documentElement
try:
- return ciksemel.parse(index_path)
- except Exception as e:
+ return minidom.parse(index_path)
+ except ExpatError as e:
raise RepoError(_("Error parsing repository index information. Index file does not exist or is malformed."))
def get_repo(self, repo):
@@ -196,25 +207,25 @@ class RepoDB(lazydb.LazyDB):
def get_source_repos(self, only_active=True):
repos = []
for r in self.list_repos(only_active):
- if self.get_repo_doc(r).getTag("SpecFile"):
+ if self.get_repo_doc(r).getElementsByTagName("SpecFile")[0]:
repos.append(r)
return repos
def get_binary_repos(self, only_active=True):
repos = []
for r in self.list_repos(only_active):
- if not self.get_repo_doc(r).getTag("SpecFile"):
+ if not self.get_repo_doc(r).getElementsByTagName("SpecFile")[0]:
repos.append(r)
return repos
- def list_repos(self, only_active=True):
+ def list_repos(self, only_active=True):
temp = []
for x in self.repoorder.get_order():
if not only_active:
temp.append(x)
elif self.repo_active(x) == True:
temp.append(x)
- return temp
+ return temp
def list_repo_urls(self, only_active=True):
repos = []
@@ -241,13 +252,13 @@ class RepoDB(lazydb.LazyDB):
def get_distribution(self, name):
doc = self.get_repo_doc(name)
- distro = doc.getTag("Distribution")
- return distro and distro.getTagData("SourceName")
+ distro = doc.getElementsByTagName("Distribution")[0]
+ return distro.firstChild.data and distro.getElementsByTagName("SourceName")[0].firstChild.data
def get_distribution_release(self, name):
doc = self.get_repo_doc(name)
- distro = doc.getTag("Distribution")
- return distro and distro.getTagData("Version")
+ distro = doc.getElementsByTagName("Distribution")[0]
+ return distro.firstChild.data and distro.getElementsByTagName("Version")[0].firstChild.data
def check_distribution(self, name):
if ctx.get_option('ignore_check'):
@@ -268,4 +279,3 @@ class RepoDB(lazydb.LazyDB):
self.deactivate_repo(name)
raise IncompatibleRepoError(
_("Repository '{}' is not compatible with your distribution. Repository is disabled.").format(name))
-
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005 - 2007, TUBITAK/UEKAE
# Copyright (C) 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
......@@ -25,8 +25,8 @@ _ = __trans.gettext
# FIXME:
# We could traverse through files.xml files of the packages to find the path and
# the package - a linear search - as some well known package managers do. But the current
# file conflict mechanism of inary prevents this and needs a fast has_file function.
# the package - a linear search - as some well known package managers do. But the current
# file conflict mechanism of inary prevents this and needs a fast has_file function.
# So currently filesdb is the only db and we cant still get rid of rebuild-db :/
class FilesDB(lazydb.LazyDB):
......
#!/usr/bin/python
#-*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
# Copyright (C) 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
......@@ -45,7 +45,7 @@ if __name__ == "__main__":
os.chdir(consts.scenarios_path)
args = sys.argv
if len(args) > 1:
if len(args) > 1:
scens = sys.argv[1:]
for scen in scens:
clean_out()
......@@ -53,5 +53,5 @@ if __name__ == "__main__":
print("\n* Running scenario in %s\n" % scen)
module = __import__(scen[:len(scen)-3])
run_scen(module.run)
else:
else:
run_all()
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
# Copyright (C) 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
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, 2006 TUBITAK/UEKAE
# Copyright (C) 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
......@@ -100,4 +100,3 @@ if __name__ == "__main__":
else:
cleanInarys(clean)
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, 2006 TUBITAK/UEKAE
# Copyright (C) 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
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2009-2011 TUBITAK/UEKAE
# Copyright (C) 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
......
#!/usr/bin/env python3
#
# Copyright (C) 2005, TUBITAK/UEKAE
# Copyright (C) 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 2 of the License, or (at your
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006, TUBITAK/UEKAE
# Copyright (C) 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
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2006-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......@@ -27,7 +27,7 @@ class ComponentDBTestCase(testcase.TestCase):
assert self.componentdb.has_component("multimedia.graphics")
def testListComponents(self):
assert set(self.componentdb.list_components("repo1")) == set(["system", "system.base",
assert set(self.componentdb.list_components("repo1")) == set(["system", "system.base",
"system.devel", "util",
"desktop", "desktop.accessibility",
"multimedia", "multimedia.graphics"])
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......@@ -38,7 +38,7 @@ class InstallDBTestCase(testcase.TestCase):
def testListInstalled(self):
inary.api.install(["openssl"])
self.installdb = inary.db.installdb.InstallDB()
assert set(self.installdb.list_installed()) == set(['zlib', 'ca-certificates',
assert set(self.installdb.list_installed()) == set(['zlib', 'ca-certificates',
'run-parts', 'openssl'])
def testGetVersion(self):
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2005, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# Copyright (C) 2008, TUBITAK/UEKAE
# Copyright (C) 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
......
# Copyright (C) 2005 - 2007, TUBITAK/UEKAE
# Copyright (C) 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
......
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010, TUBITAK/UEKAE
# Copyright (C) 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
......
# Copyright (C) 2005, TUBITAK/UEKAE
# Copyright (C) 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
......
# -*- coding: utf-8 -*-
# Copyright (C) 2005, TUBITAK/UEKAE
# Copyright (C) 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
......
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