remove xmill use bz2 instead.
bz2 compresses better too ;). -rw-r--r-- 1 root root 102629 Nis 11 12:20 pisi-index.xmi -rw-r--r-- 1 root root 40 Nis 11 12:20 pisi-index.xmi.sha1sum -rw-r--r-- 1 root root 1182237 Nis 11 12:20 pisi-index.xml -rw-r--r-- 1 root root 86920 Nis 13 20:03 pisi-index.xml.bz2 -rw-r--r-- 1 root root 40 Nis 13 20:04 pisi-index.xml.bz2.sha1sum
This commit is contained in:
+1
-1
@@ -304,7 +304,7 @@ def index(dirs=None, output = 'pisi-index.xml', skip_sources=False):
|
|||||||
repo_dir = str(repo_dir)
|
repo_dir = str(repo_dir)
|
||||||
ctx.ui.info(_('* Building index of PISI files under %s') % repo_dir)
|
ctx.ui.info(_('* Building index of PISI files under %s') % repo_dir)
|
||||||
index.index(repo_dir, skip_sources)
|
index.index(repo_dir, skip_sources)
|
||||||
index.write(output, sha1sum=True, compress=File.xmill, sign=File.detached)
|
index.write(output, sha1sum=True, compress=File.bz2, sign=File.detached)
|
||||||
ctx.ui.info(_('* Index file written'))
|
ctx.ui.info(_('* Index file written'))
|
||||||
|
|
||||||
def add_repo(name, indexuri):
|
def add_repo(name, indexuri):
|
||||||
|
|||||||
+19
-9
@@ -20,6 +20,7 @@ like all pisi classes, it has been programmed in a non-restricting way
|
|||||||
|
|
||||||
import os
|
import os
|
||||||
import types
|
import types
|
||||||
|
import bz2
|
||||||
|
|
||||||
import gettext
|
import gettext
|
||||||
__trans = gettext.translation('pisi', fallback=True)
|
__trans = gettext.translation('pisi', fallback=True)
|
||||||
@@ -53,7 +54,7 @@ class InvalidSignature(pisi.Error):
|
|||||||
class File:
|
class File:
|
||||||
|
|
||||||
(read, write) = range(2) # modes
|
(read, write) = range(2) # modes
|
||||||
(xmill, sevenzip) = range(2) # compress enums
|
(bz2, sevenzip) = range(2) # compress enums
|
||||||
|
|
||||||
(detached, whatelse) = range(2)
|
(detached, whatelse) = range(2)
|
||||||
|
|
||||||
@@ -68,13 +69,16 @@ class File:
|
|||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
def decompress(localfile, compress):
|
def decompress(localfile, compress):
|
||||||
if compress == File.xmill:
|
if compress == File.bz2:
|
||||||
pisi.util.run_batch('xdemill -f ' + localfile)
|
if not localfile.endswith(".bz2"):
|
||||||
if not localfile.endswith('.xmi'):
|
raise Error(_("bz2 compressed filename must end with '.bz2'"))
|
||||||
raise Error(_("xmill compressed filename must end with '.xmi'"))
|
|
||||||
localfile = localfile[:-4] + '.xml'
|
open(localfile[:-4], "w").write(bz2.BZ2File(localfile).read())
|
||||||
|
localfile = localfile[:-4]
|
||||||
|
|
||||||
elif compress == File.sevenzip:
|
elif compress == File.sevenzip:
|
||||||
raise Error(_("sevenzip compression not supported yet"))
|
raise Error(_("sevenzip compression not supported yet"))
|
||||||
|
|
||||||
return localfile
|
return localfile
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -156,16 +160,22 @@ class File:
|
|||||||
"this method must be called at the end of operation"
|
"this method must be called at the end of operation"
|
||||||
self.__file__.close()
|
self.__file__.close()
|
||||||
if self.mode == File.write:
|
if self.mode == File.write:
|
||||||
if self.compress == File.xmill:
|
if self.compress == File.bz2:
|
||||||
pisi.util.run_batch('xcmill -9 -f ' + self.localfile)
|
bc = bz2.BZ2Compressor()
|
||||||
self.localfile = self.localfile[:-4] + '.xmi'
|
bc.compress(open(self.localfile).read())
|
||||||
|
|
||||||
|
self.localfile = self.localfile + ".bz2"
|
||||||
|
open(self.localfile, "w").write(bc.flush())
|
||||||
|
|
||||||
elif self.compress == File.sevenzip:
|
elif self.compress == File.sevenzip:
|
||||||
raise Error(_("sevenzip compression not supported yet"))
|
raise Error(_("sevenzip compression not supported yet"))
|
||||||
|
|
||||||
if self.sha1sum:
|
if self.sha1sum:
|
||||||
sha1 = pisi.util.sha1_file(self.localfile)
|
sha1 = pisi.util.sha1_file(self.localfile)
|
||||||
cs = file(self.localfile + '.sha1sum', 'w')
|
cs = file(self.localfile + '.sha1sum', 'w')
|
||||||
cs.write(sha1)
|
cs.write(sha1)
|
||||||
cs.close()
|
cs.close()
|
||||||
|
|
||||||
if self.sign==File.detached:
|
if self.sign==File.detached:
|
||||||
pisi.util.run_batch('gpg --detach-sig ' + self.localfile)
|
pisi.util.run_batch('gpg --detach-sig ' + self.localfile)
|
||||||
|
|
||||||
|
|||||||
+1
-1
@@ -65,7 +65,7 @@ class Index(XmlFile):
|
|||||||
urlfile = file(pisi.util.join_path(tmpdir, 'uri'), 'w')
|
urlfile = file(pisi.util.join_path(tmpdir, 'uri'), 'w')
|
||||||
urlfile.write(filename) # uri
|
urlfile.write(filename) # uri
|
||||||
self.read(filename, tmpDir=tmpdir, sha1sum=not force,
|
self.read(filename, tmpDir=tmpdir, sha1sum=not force,
|
||||||
compress=File.xmill, sign=File.detached)
|
compress=File.bz2, sign=File.detached)
|
||||||
if not repo:
|
if not repo:
|
||||||
repo = self.distribution.name()
|
repo = self.distribution.name()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user