Skip to content

Commit

Permalink
fix a bunch of mundane bugs
Browse files Browse the repository at this point in the history
* bumb db rev
* fix var arg parameters (no idea why these changes were required)
* make lzma stuff work on Mac OS
* moar refactoring
* move package back to top-level pkg
* light.sh: non interactive
  • Loading branch information
examachine committed Feb 22, 2017
1 parent d45202b commit fc4bb3d
Show file tree
Hide file tree
Showing 12 changed files with 37 additions and 23 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
build
tmp
.#*
pisi-index.xml*
*.pisi

6 changes: 3 additions & 3 deletions pisi/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@

# PiSi version

__version__ = "1.1.1"
__version__ = "1.1.2"

__dbversion__ = "1.1_beta8"
__filesdbversion__ = "1.0.5" # yes, this is the real bottleneck
__dbversion__ = "1.1.2"
__filesdbversion__ = "1.1.2" # yes, this is the real bottleneck

__all__ = [ 'api', 'config', 'packagedb', 'installdb', 'search' ]

Expand Down
5 changes: 4 additions & 1 deletion pisi/actionsapi/pisitools.py
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,10 @@ def dodir(destinationDirectory):

def dodoc(*sourceFiles):
'''inserts the files in the list of files into /usr/share/doc/PACKAGE'''
readable_insinto(join_path(get.installDIR(), '/usr/share/doc', get.srcTAG()), sourceFiles)
ctx.ui.debug("%s -> %s" %
(str(sourceFiles),
join_path(get.installDIR(), '/usr/share/doc', get.srcTAG())))
readable_insinto(join_path(get.installDIR(), '/usr/share/doc', get.srcTAG()), *sourceFiles)

def doexe(sourceFile, destinationDirectory):
'''insert a executable file into destination directory'''
Expand Down
6 changes: 4 additions & 2 deletions pisi/actionsapi/pisitoolsfunctions.py
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ def executable_insinto(destinationDirectory, *sourceFiles):
makedirs(destinationDirectory)

#print '****', destinationDirectory, sourceFiles
for sourceFile in list(sourceFiles):
for sourceFile in sourceFiles:
#print 'pkgsrcDIR()=',get.sourceDIR()
sourceFile = join_path(get.sourceDIR(), sourceFile)
#print 'sourceFile,destDir=',sourceFile, destinationDirectory
Expand All @@ -74,7 +74,9 @@ def readable_insinto(destinationDirectory, *sourceFiles):
if not can_access_directory(destinationDirectory):
makedirs(destinationDirectory)

for sourceFile in list(sourceFiles):
print '* readable_insinto', destinationDirectory, sourceFiles
for sourceFile in sourceFiles:
print '* installing', sourceFile
sourceFile = join_path(get.sourceDIR(), sourceFile)
for source in glob.glob(sourceFile):
system('install -m0644 "%s" %s' % (source, destinationDirectory))
Expand Down
18 changes: 14 additions & 4 deletions pisi/archive.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,23 @@ def unpack_dir(self, target_dir):
rmode = 'r:bz2'
elif self.type == 'tarlzma':
rmode = 'r:'
self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
ret, out, err = util.run_batch("lzma d %s %s" % (self.file_path + ctx.const.lzma_suffix,
self.file_path))
if util.is_osx():
lzma = "lzma -d"
ret, out, err = util.run_batch("lzma -d -k " + self.file_path)

else:
lzma = "lzma d"
ret, out, err = util.run_batch("lzma d %s %s" %
(self.file_path +
ctx.const.lzma_suffix,
self.file_path))
if ret != 0:
raise LZMAError(err)
else:
raise ArchiveError(_("Archive type not recognized"))
self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)

print '* opening tarfile', self.file_path
self.tar = tarfile.open(self.file_path, rmode)
oldwd = os.getcwd()
os.chdir(target_dir)
Expand Down Expand Up @@ -139,7 +148,8 @@ def add_to_archive(self, file_name, arc_name=None):
wmode = 'w:bz2'
elif self.type == 'tarlzma':
wmode = 'w:'
self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
if not util.is_osx():
self.file_path = self.file_path.rstrip(ctx.const.lzma_suffix)
else:
raise ArchiveError(_("Archive type not recognized"))
self.tar = tarfile.open(self.file_path, wmode)
Expand Down
2 changes: 1 addition & 1 deletion pisi/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
from pisi.fetcher import fetch_url
from pisi.uri import URI
from pisi.xmldoc.metadata import MetaData
from pisi.xmldoc.package import Package
import pisi.xmldoc.component as component
from pisi.package import Package
import pisi.archive as archive
import pisi.actionsapi.variables

Expand Down
4 changes: 2 additions & 2 deletions pisi/xmldoc/package.py → pisi/package.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,8 @@
import pisi.context as ctx
import pisi.archive as archive
from pisi.uri import URI
from metadata import MetaData
from files import Files
from pisi.xmldoc.metadata import MetaData
from pisi.xmldoc.files import Files
import pisi.util as util

class Error(pisi.Error):
Expand Down
4 changes: 1 addition & 3 deletions pisi/pxml/autoxml.py
Original file line number Diff line number Diff line change
Expand Up @@ -627,7 +627,7 @@ def initialize():

def decode(node, errs, where):
"""decode from DOM node, the value, watching the spec"""
#text = unicode(readtext(node, token), 'utf8')
#text = unicode(readtext(node, token), 'utf8') # CRUFT FIXME
text = readtext(node, token)
#print 'decoding', token_type, text, type(text), '.'
if text:
Expand All @@ -637,8 +637,6 @@ def decode(node, errs, where):
except Exception, e:
print 'exception', e
value = None
#print 'fuuuuck', text
#if req ==
errs.append(where + ': ' + _('Type mismatch: read text cannot be decoded'))
return value
else:
Expand Down
1 change: 0 additions & 1 deletion pisi/xmldoc/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,5 +35,4 @@ class FileError(pisi.Error):
from component import *
from index import *
from metadata import *
from package import *
from specfile import *
4 changes: 2 additions & 2 deletions pisi/xmldoc/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
import pisi.db.package as packagedb
import pisi.db.source as sourcedb
import pisi.util as util
from package import Package
from pisi.package import Package
from pisi.pxml.xmlfile import XmlFile
from pisi.file import File
import pisi.pxml.autoxml as autoxml
Expand Down Expand Up @@ -122,7 +122,7 @@ def add_package(self, path, repo_uri):

md = metadata.MetaData()
md.read(os.path.join(ctx.config.install_dir(), ctx.const.metadata_xml))
md.package.packageSize = os.path.getsize(path)
md.package.packageSize = long(os.path.getsize(path))
if ctx.config.options and ctx.config.options.absolute_uris:
# FIXME: the name "absolute_uris" does not seem to fit below :/
md.package.packageURI = os.path.realpath(path)
Expand Down
2 changes: 1 addition & 1 deletion pisi/xmldoc/specfile.py
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ def pkg_dir(self):
def installable(self):
"""calculate if pkg is installable currently"""
deps = self.runtimeDependencies()
return pisi.dependency.satisfies_dependencies(self.name, deps)
return pisi.xmldoc.dependency.satisfies_dependencies(self.name, deps)

def __str__(self):
if self.build:
Expand Down
6 changes: 3 additions & 3 deletions tests/light.sh
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
#!/bin/sh
# Author: Eray Ozkural <[email protected]>
dbg=
#dbg=-d
dbg=-d
pwd
PATH=$PATH:.
set -x
rm -rf tmp
mkdir tmp
set -e
pisi-cli -Dtmp $dbg -E --ignore-build-no build tests/zip/pspec.xml tests/unzip/pspec.xml
pisi-cli -Dtmp $dbg index .
pisi-cli -Dtmp $dbg add-repo repo1 pisi-index.xml
pisi-cli -Dtmp $dbg --skip-signing index .
pisi-cli -Dtmp $dbg --yes-all add-repo repo1 pisi-index.xml
pisi-cli -Dtmp $dbg list-repo
pisi-cli -Dtmp $dbg update-repo repo1
pisi-cli -Dtmp $dbg list-available
Expand Down

0 comments on commit fc4bb3d

Please sign in to comment.