[Uludag-commits] r7158 - in trunk/pisi/pisi: . cli
svn-uludag at uludag.org.tr
svn-uludag at uludag.org.tr
17 Nis 2006 Pzt 17:49:00 EEST
Author: baris
Date: Mon Apr 17 17:48:57 2006
New Revision: 7158
Modified:
trunk/pisi/pisi/api.py
trunk/pisi/pisi/cli/commands.py
trunk/pisi/pisi/file.py
trunk/pisi/pisi/index.py
Log:
- fix: make using pisi-index.xml (without .bz2 suffix) possible.
- fix: generate pisi-index.xml.sha1sum also
- add an option to skip index signing
Modified: trunk/pisi/pisi/api.py
=================================================================
--- trunk/pisi/pisi/api.py (original)
+++ trunk/pisi/pisi/api.py Mon Apr 17 17:48:57 2006
@@ -295,7 +295,7 @@
ctx.ui.info("OK", False)
return corrupt
-def index(dirs=None, output = 'pisi-index.xml', skip_sources=False):
+def index(dirs=None, output='pisi-index.xml', skip_sources=False, skip_signing=False):
"""accumulate PISI XML files in a directory"""
index = Index()
if not dirs:
@@ -304,7 +304,11 @@
repo_dir = str(repo_dir)
ctx.ui.info(_('* Building index of PISI files under %s') % repo_dir)
index.index(repo_dir, skip_sources)
- index.write(output, sha1sum=True, compress=File.bz2, sign=File.detached)
+
+ if skip_signing:
+ index.write(output, sha1sum=True, compress=File.bz2, sign=None)
+ else:
+ index.write(output, sha1sum=True, compress=File.bz2, sign=File.detached)
ctx.ui.info(_('* Index file written'))
def add_repo(name, indexuri):
Modified: trunk/pisi/pisi/cli/commands.py
=================================================================
--- trunk/pisi/pisi/cli/commands.py (original)
+++ trunk/pisi/pisi/cli/commands.py Mon Apr 17 17:48:57 2006
@@ -730,16 +730,23 @@
self.parser.add_option("-S", "--skip-sources", action="store_true",
default=False,
help=_("do not index pisi spec files."))
+ self.parser.add_option("-G", "--skip-signing", action="store_true",
+ default=False,
+ help=_("do not sign index."))
def run(self):
self.init(database = True, write = False)
from pisi.api import index
if len(self.args)>0:
- index(self.args, ctx.get_option('output'), skip_sources = ctx.get_option('skip_sources'))
+ index(self.args, ctx.get_option('output'),
+ skip_sources = ctx.get_option('skip_sources'),
+ skip_signing = ctx.get_option('skip_signing'))
elif len(self.args)==0:
ctx.ui.info(_('Indexing current directory.'))
- index(['.'], ctx.get_option('output'), skip_sources = ctx.get_option('skip_sources'))
+ index(['.'], ctx.get_option('output'),
+ skip_sources = ctx.get_option('skip_sources'),
+ skip_signing = ctx.get_option('skip_signing'))
self.finalize()
Modified: trunk/pisi/pisi/file.py
=================================================================
--- trunk/pisi/pisi/file.py (original)
+++ trunk/pisi/pisi/file.py Mon Apr 17 17:48:57 2006
@@ -162,13 +162,10 @@
"this method must be called at the end of operation"
self.__file__.close()
if self.mode == File.write:
+ compressed_file = None
if self.compress == File.bz2:
- bz2file = self.localfile + ".bz2"
- bz2.BZ2File(bz2file, "w").write(open(self.localfile, "r").read())
-
- # FIXME: I hate side effects, but this is designed
- # that way :(. -- baris
- self.localfile = bz2file
+ compressed_file = self.localfile + ".bz2"
+ bz2.BZ2File(compressed_file, "w").write(open(self.localfile, "r").read())
elif self.compress == File.sevenzip:
raise Error(_("sevenzip compression not supported yet"))
@@ -178,10 +175,17 @@
cs = file(self.localfile + '.sha1sum', 'w')
cs.write(sha1)
cs.close()
+ if compressed_file:
+ sha1 = pisi.util.sha1_file(compressed_file)
+ cs = file(compressed_file + '.sha1sum', 'w')
+ cs.write(sha1)
+ cs.close()
if self.sign==File.detached:
pisi.util.run_batch('gpg --detach-sig ' + self.localfile)
-
+ if compressed_file:
+ pisi.util.run_batch('gpg --detach-sig ' + compressed_file)
+
@staticmethod
def check_signature(uri, transfer_dir, sign=detached):
if sign==File.detached:
Modified: trunk/pisi/pisi/index.py
=================================================================
--- trunk/pisi/pisi/index.py (original)
+++ trunk/pisi/pisi/index.py Mon Apr 17 17:48:57 2006
@@ -67,8 +67,18 @@
urlfile = file(pisi.util.join_path(tmpdir, 'uri'), 'w')
urlfile.write(filename) # uri
- self.read(filename, tmpDir=tmpdir, sha1sum=not force,
- compress=File.bz2, sign=File.detached)
+
+ # FIXME: This is a mess, we have a compress flag and we have to
+ # use it with filename extention. Because File.decompress also
+ # checks the extension. We really have to go all over the code
+ # and simplify it. -- baris
+ if filename.endswith(".bz2"):
+ self.read(filename, tmpDir=tmpdir, sha1sum=not force,
+ compress=File.bz2, sign=File.detached)
+ else:
+ self.read(filename, tmpDir=tmpdir, sha1sum=not force,
+ compress=None, sign=File.detached)
+
if not repo:
repo = self.distribution.name()
Uludag-commits mesaj listesiyle ilgili
daha fazla bilgi