[Uludag-commits] r15606 - in branches/pisi-db/pisi: . db
uludag-commits at pardus.org.tr
uludag-commits at pardus.org.tr
3 Eki 2007 Çar 13:26:08 EEST
Author: faik
Date: Wed Oct 3 13:26:07 2007
New Revision: 15606
Modified:
branches/pisi-db/pisi/config.py
branches/pisi-db/pisi/configfile.py
branches/pisi-db/pisi/constants.py
branches/pisi-db/pisi/db/filesdb.py
branches/pisi-db/pisi/db/installdb.py
branches/pisi-db/pisi/db/repodb.py
Log:
info_dir
We do not have a database, we will have some managable text info files. Create
info_dir if not exists.
Modified: branches/pisi-db/pisi/config.py
=================================================================
--- branches/pisi-db/pisi/config.py (original)
+++ branches/pisi-db/pisi/config.py Wed Oct 3 13:26:07 2007
@@ -92,8 +92,8 @@
def lib_dir(self):
return self.subdir(self.values.dirs.lib_dir)
- def db_dir(self):
- return self.subdir(self.values.dirs.db_dir)
+ def info_dir(self):
+ return self.subdir(self.values.dirs.info_dir)
def archives_dir(self):
return self.subdir(self.values.dirs.archives_dir)
Modified: branches/pisi-db/pisi/configfile.py
=================================================================
--- branches/pisi-db/pisi/configfile.py (original)
+++ branches/pisi-db/pisi/configfile.py Wed Oct 3 13:26:07 2007
@@ -35,7 +35,7 @@
#
#[directories]
#lib_dir = /var/lib/pisi
-#db_dir = /var/db/pisi
+#info_dir = "/var/lib/pisi/info"
#archives_dir = /var/cache/pisi/archives
#packages_dir = /var/cache/pisi/packages
#compiled_packages_dir = "/var/cache/pisi/packages"
@@ -87,7 +87,7 @@
"Default values for [directories] section"
lib_dir = "/var/lib/pisi"
log_dir = "/var/log"
- db_dir = "/var/db/pisi"
+ info_dir = "/var/lib/pisi/info"
archives_dir = "/var/cache/pisi/archives"
packages_dir = "/var/cache/pisi/packages"
compiled_packages_dir = "/var/cache/pisi/packages"
Modified: branches/pisi-db/pisi/constants.py
=================================================================
--- branches/pisi-db/pisi/constants.py (original)
+++ branches/pisi-db/pisi/constants.py Wed Oct 3 13:26:07 2007
@@ -81,7 +81,6 @@
self.__c.install_tar_lzma = "install.tar.lzma"
self.__c.mirrors_conf = "/etc/pisi/mirrors.conf"
self.__c.config_pending = "configpending"
- self.__c.info_dir = "info"
self.__c.files_db = "files.db"
self.__c.repos = "repos"
Modified: branches/pisi-db/pisi/db/filesdb.py
=================================================================
--- branches/pisi-db/pisi/db/filesdb.py (original)
+++ branches/pisi-db/pisi/db/filesdb.py Wed Oct 3 13:26:07 2007
@@ -51,7 +51,7 @@
del self.filesdb[md5.new(f.path).digest()]
def destroy(self):
- files_db = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir, ctx.const.files_db)
+ files_db = os.path.join(ctx.config.info_dir(), ctx.const.files_db)
if os.path.exists(files_db):
os.unlink(files_db)
@@ -63,11 +63,7 @@
if isinstance(self.filesdb, shelve.DbfilenameShelf):
return
- info_dir = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir)
- if not os.path.exists(info_dir):
- os.makedirs(info_dir)
-
- files_db = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir, ctx.const.files_db)
+ files_db = os.path.join(ctx.config.info_dir(), ctx.const.files_db)
if not os.path.exists(files_db):
flag = "n"
Modified: branches/pisi-db/pisi/db/installdb.py
=================================================================
--- branches/pisi-db/pisi/db/installdb.py (original)
+++ branches/pisi-db/pisi/db/installdb.py Wed Oct 3 13:26:07 2007
@@ -72,7 +72,7 @@
return dict(map(lambda x:pisi.util.parse_package_name(x), os.listdir(packages_path)))
def __generate_config_pending(self):
- pending_info_path = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir, ctx.const.config_pending)
+ pending_info_path = os.path.join(ctx.config.info_dir(), ctx.const.config_pending)
if os.path.exists(pending_info_path):
return open(pending_info_path, "r").read().split()
return []
@@ -178,11 +178,7 @@
self.__write_config_pending()
def __write_config_pending(self):
- pending_info_dir = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir)
- if not os.path.exists(pending_info_dir):
- os.makedirs(pending_info_dir)
-
- pending_info_file = os.path.join(pending_info_dir, ctx.const.config_pending)
+ pending_info_file = os.path.join(ctx.config.info_dir(), ctx.const.config_pending)
pending = open(pending_info_file, "w")
for pkg in set(self.confing_pending_db):
pending.write("%s\n" % pkg)
Modified: branches/pisi-db/pisi/db/repodb.py
=================================================================
--- branches/pisi-db/pisi/db/repodb.py (original)
+++ branches/pisi-db/pisi/db/repodb.py Wed Oct 3 13:26:07 2007
@@ -71,14 +71,16 @@
return order
def _update(self, doc):
- repos_file = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir, ctx.const.repos)
+ repos_file = os.path.join(ctx.config.info_dir(), ctx.const.repos)
open(repos_file, "w").write("%s\n" % doc.toPrettyString())
self.repos = self._get_repos()
def _get_doc(self):
- repos_file = os.path.join(ctx.config.lib_dir(), ctx.const.info_dir, ctx.const.repos)
+ repos_file = os.path.join(ctx.config.info_dir(), ctx.const.repos)
+ if not os.path.exists(repos_file):
+ return piksemel.newDocument("REPOS")
return piksemel.parse(repos_file)
-
+
def _get_repos(self):
repo_doc = self._get_doc()
order = {}
Uludag-commits mesaj listesiyle ilgili
daha fazla bilgi