]> git.ipfire.org Git - people/stevee/pakfire.git/commitdiff
Merge branch 'master' of ssh://git.ipfire.org/pub/git/pakfire
authorMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Feb 2013 22:24:57 +0000 (23:24 +0100)
committerMichael Tremer <michael.tremer@ipfire.org>
Tue, 19 Feb 2013 22:24:57 +0000 (23:24 +0100)
Makeconfig
Makefile
python/pakfire/client/builder.py
python/pakfire/client/test.py [deleted file]
python/pakfire/packages/file.py
python/pakfire/packages/packager.py
python/pakfire/packages/solv.py
python/pakfire/server.py
python/pakfire/util.py
runpychecker.sh [deleted file]

index 0c67353160f453b5243a05e5a303f792f77a4583..e717238f696a2c696ee160f9248e0d92918f0fc2 100644 (file)
@@ -39,6 +39,8 @@ ifeq "$(DEBIAN)" "1"
 else
        PYTHON_DIR = $(LIBDIR)/python$(PYTHON_VERSION)/site-packages
 endif
+PYTHON_FILES   = $(addsuffix /*.py,$(addprefix python/,$(PYTHON_MODULES)))
+PYTHON_FILES  += tools/pakfire-multicall.py
 
 # The place, where all internally used scripts and bins are copied.
 SCRIPT_DIR     = $(PREFIX)/lib/$(PACKAGE_NAME)
@@ -47,5 +49,4 @@ TOP := $(dir $(lastword $(MAKEFILE_LIST)))
 
 # A list of all files that contain translations and need to
 # be indexed.
-TRANS_FILES  = $(addsuffix /*.py,$(addprefix python/,$(PYTHON_MODULES)))
-TRANS_FILES += python/src/*.c tools/pakfire-multicall.py
+TRANS_FILES  = $(PYTHON_FILES) python/src/*.c
index 581332ceed5ec28f7a5c7a7275c2a6c816d969e1..c873463130d4d63884a985456774a49bae48ba15 100644 (file)
--- a/Makefile
+++ b/Makefile
@@ -39,8 +39,8 @@ install: build
        done
 
 .PHONY: check
-check:
-       ./runpychecker.sh
+check: all
+       PYTHONPATH=python/src/ pylint -E python/pakfire
 
 .PHONY: po
 po:
index 9798cc48e3e413d0ac2b929c59089306b5650e5c..9aefa1c4fd228d4dc9d2182655eac02358ffae7f 100644 (file)
@@ -408,7 +408,7 @@ class ClientBuilder(object):
 
                                # Check if the download checksum matches (if provided).
                                if self.build_source_hash512:
-                                       h = hashlib.sha512()
+                                       h = hashlib.new("sha512")
                                        f = open(tmpfile, "rb")
                                        while True:
                                                buf = f.read(BUFFER_SIZE)
diff --git a/python/pakfire/client/test.py b/python/pakfire/client/test.py
deleted file mode 100644 (file)
index 8bf5fd4..0000000
+++ /dev/null
@@ -1,54 +0,0 @@
-#!/usr/bin/python
-
-import random
-import sys
-import time
-
-def fork_builder(*args, **kwargs):
-       cb = ClientBuilder(*args, **kwargs)
-
-       try:
-               cb()
-       except Exception, e:
-               print e
-               sys.exit(1)
-
-class ClientBuilder(object):
-       def __init__(self, id):
-               self.id = id
-
-       def __call__(self, *args):
-               print "Running", self.id, args
-
-               time.sleep(2)
-
-               if random.choice((False, False, False, True)):
-                       raise Exception, "Process died"
-
-
-import multiprocessing
-
-
-processes = []
-
-while True:
-       # Check if there are at least 2 processes running.
-       if len(processes) < 2:
-               process = multiprocessing.Process(target=fork_builder, args=(len(processes),))
-
-               process.daemon = True
-               process.start()
-
-               processes.append(process)
-
-       print len(processes), "in process list:", processes
-
-       for process in processes:
-               time.sleep(0.5)
-
-               print process.name, "is alive?", process.is_alive()
-
-               if not process.is_alive():
-                       print "Removing process", process
-                       print "  Exitcode:", process.exitcode
-                       processes.remove(process)
index 55f9694505f63d1c1499d976258fc5455b96c7e2..7cf3630c3f145f69b86874785b846d1704bed815 100644 (file)
@@ -46,6 +46,8 @@ class FilePackage(base.Package):
                This class is a wrapper that reads package data from the (outer)
                tarball and should never be used solely.
        """
+       _type = None
+
        def __init__(self, pakfire, repo, filename):
                base.Package.__init__(self, pakfire, repo)
                self.filename = os.path.abspath(filename)
@@ -132,7 +134,8 @@ class FilePackage(base.Package):
                        payload_archive = tar.InnerTarFile.open(fileobj=payload)
 
                else:
-                       raise Exception, "Unhandled payload compression type: %s" % payload_compression
+                       raise Exception, "Unhandled payload compression type: %s" % \
+                               self.payload_compression
 
                return payload_archive
 
@@ -211,7 +214,7 @@ class FilePackage(base.Package):
                                                continue
 
                                        # Calc hash of the current configuration file.
-                                       config_hash1 = hashlib.sha512()
+                                       config_hash1 = hashlib.new("sha512")
                                        f = open(target)
                                        while True:
                                                buf = f.read(BUFFER_SIZE)
index a4566028e3ecd30f7260d8e2b8a31ab88be49331..c8e1c7814bccb9d9bbe3f3df1c18684687755f8a 100644 (file)
@@ -104,7 +104,7 @@ class Packager(object):
                        # Calculating the hash sum of the added file
                        # and store it in the chksums file.
                        f = open(filename)
-                       h = hashlib.sha512()
+                       h = hashlib.new("sha512")
                        while True:
                                buf = f.read(BUFFER_SIZE)
                                if not buf:
@@ -164,7 +164,7 @@ class Packager(object):
                        # Calculate SHA512 hash of regular files.
                        if m.isreg():
                                mobj = datafile.extractfile(m)
-                               h = hashlib.sha512()
+                               h = hashlib.new("sha512")
 
                                while True:
                                        buf = mobj.read(BUFFER_SIZE)
index 85bf487c5e5185c6eacc643eec6606e1392501e0..af2c9474db508aff1e5025b59c37275ec1feafb0 100644 (file)
@@ -134,10 +134,6 @@ class SolvPackage(base.Package):
 
                return vendor
 
-       @property
-       def uuid(self):
-               return self.solvable.get_uuid()
-
        @property
        def build_host(self):
                return self.solvable.get_buildhost()
index 64e3dd5198b4a9bf222b8e44ecb2dbdfde85cc2c..edc070fd8cb44a68b4bb4aac8cb7a2a931967e9f 100644 (file)
@@ -82,7 +82,8 @@ class Source(object):
 
        @property
        def path(self):
-               h = hashlib.sha1(self.url)
+               h = hashlib.new("sha1")
+               h.update(self.url)
 
                # XXX path is to be changed
                return "/var/cache/pakfire/sources/%s" % h.hexdigest()
index 9fa011a279a710a493a64df7267da803fd2f6b03..84128cd9c7418e4afbadc39e969903a57f40cd23 100644 (file)
@@ -197,7 +197,7 @@ def format_speed(s):
        return "%sB/s" % format_size(s)
 
 def calc_hash1(filename=None, data=None):
-       h = hashlib.sha1()
+       h = hashlib.new("sha1")
 
        if filename:
                f = open(filename)
diff --git a/runpychecker.sh b/runpychecker.sh
deleted file mode 100755 (executable)
index 383be9f..0000000
+++ /dev/null
@@ -1,8 +0,0 @@
-#!/bin/bash
-
-pychecker --only --limit 1000 \
-       --maxlines 500 --maxargs 20 --maxbranches 80 --maxlocals 60 --maxreturns 20 \
-       --no-callinit --no-local --no-shadow --no-shadowbuiltin \
-       --no-import --no-miximport --no-pkgimport --no-reimport \
-       --no-argsused --no-varargsused --no-override \
-       $(find pakfire -name "*.py" )