###############################################################################
name = pakfire
-version = 0.9.23
-release = 6
+version = 0.9.24
+release = 1
maintainer = Michael Tremer <michael.tremer@ipfire.org>
groups = System/Packaging
+++ /dev/null
-From 88bf3753008602b4ee219fc9a1917102befcfd84 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Wed, 2 Jan 2013 20:16:14 +0100
-Subject: [PATCH] Add some useful perl macros.
-
----
- macros/perl.macro | 9 +++++++++
- 1 file changed, 9 insertions(+)
- create mode 100644 macros/perl.macro
-
-diff --git a/macros/perl.macro b/macros/perl.macro
-new file mode 100644
-index 0000000..c1be59f
---- /dev/null
-+++ b/macros/perl.macro
-@@ -0,0 +1,9 @@
-+# Perl constants.
-+perl = /usr/bin/perl
-+
-+perl_sitearch = %(eval "$(%{perl} -V:installsitearch)"; echo ${installsitearch})
-+perl_sitelib = %(eval "$(%{perl} -V:installsitelib)"; echo ${installsitelib})
-+perl_vendorarch = %(eval "$(%{perl} -V:installvendorarch)"; echo ${installvendorarch})
-+perl_vendorlib = %(eval "$(%{perl} -V:installvendorlib)"; echo ${installvendorlib})
-+perl_archlib = %(eval "$(%{perl} -V:installarchlib)"; echo ${installarchlib})
-+perl_privlib = %(eval "$(%{perl} -V:installprivlib)"; echo ${installprivlib})
---
-1.7.11.7
-
+++ /dev/null
-From cae350969fc6ae01b1f4a10927c43340f1ca0592 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Thu, 26 Jul 2012 20:49:25 +0200
-Subject: [PATCH 1/4] Rework parallelism decision function and move it into
- the System class.
-
----
- po/pakfire.pot | 128 +++++++++++++++++++++-------------------
- python/pakfire/cli.py | 1 +
- python/pakfire/packages/make.py | 3 +-
- python/pakfire/system.py | 16 +++++
- python/pakfire/util.py | 13 ----
- 5 files changed, 85 insertions(+), 76 deletions(-)
-
-diff --git a/po/pakfire.pot b/po/pakfire.pot
-index 495f5cd..c1c67fb 100644
---- a/po/pakfire.pot
-+++ b/po/pakfire.pot
-@@ -8,7 +8,7 @@ msgid ""
- msgstr ""
- "Project-Id-Version: PACKAGE VERSION\n"
- "Report-Msgid-Bugs-To: \n"
--"POT-Creation-Date: 2012-07-26 17:09+0200\n"
-+"POT-Creation-Date: 2012-07-26 19:43+0200\n"
- "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
- "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
- "Language-Team: LANGUAGE <LL@li.org>\n"
-@@ -428,11 +428,11 @@ msgstr ""
- msgid "Enabled"
- msgstr ""
-
--#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1050
-+#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1051
- msgid "Priority"
- msgstr ""
-
--#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1095
-+#: ../python/pakfire/cli.py:348 ../python/pakfire/cli.py:1096
- msgid "Packages"
- msgstr ""
-
-@@ -659,228 +659,232 @@ msgstr ""
- msgid "Memory"
- msgstr ""
-
--#: ../python/pakfire/cli.py:964 ../python/pakfire/server.py:311
-+#: ../python/pakfire/cli.py:963
-+msgid "Parallelism"
-+msgstr ""
-+
-+#: ../python/pakfire/cli.py:965 ../python/pakfire/server.py:311
- msgid "Native arch"
- msgstr ""
-
--#: ../python/pakfire/cli.py:966
-+#: ../python/pakfire/cli.py:967
- msgid "Default arch"
- msgstr ""
-
--#: ../python/pakfire/cli.py:968 ../python/pakfire/server.py:313
-+#: ../python/pakfire/cli.py:969 ../python/pakfire/server.py:313
- msgid "Supported arches"
- msgstr ""
-
--#: ../python/pakfire/cli.py:981
-+#: ../python/pakfire/cli.py:982
- msgid "Your IP address"
- msgstr ""
-
--#: ../python/pakfire/cli.py:986
-+#: ../python/pakfire/cli.py:987
- msgid "You are authenticated to the build service:"
- msgstr ""
-
--#: ../python/pakfire/cli.py:992
-+#: ../python/pakfire/cli.py:993
- msgid "User name"
- msgstr ""
-
--#: ../python/pakfire/cli.py:993
-+#: ../python/pakfire/cli.py:994
- msgid "Real name"
- msgstr ""
-
--#: ../python/pakfire/cli.py:994
-+#: ../python/pakfire/cli.py:995
- msgid "Email address"
- msgstr ""
-
--#: ../python/pakfire/cli.py:995
-+#: ../python/pakfire/cli.py:996
- msgid "Registered"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1002
-+#: ../python/pakfire/cli.py:1003
- msgid "You could not be authenticated to the build service."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1023
-+#: ../python/pakfire/cli.py:1024
- msgid "No ongoing jobs found."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1026
-+#: ../python/pakfire/cli.py:1027
- msgid "Active build jobs"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1032
-+#: ../python/pakfire/cli.py:1033
- msgid "No jobs found."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1035
-+#: ../python/pakfire/cli.py:1036
- msgid "Recently processed build jobs"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1042
-+#: ../python/pakfire/cli.py:1043
- #, python-format
- msgid "A build with ID %s could not be found."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1045
-+#: ../python/pakfire/cli.py:1046
- #, python-format
- msgid "Build: %(name)s"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1049 ../python/pakfire/cli.py:1077
-+#: ../python/pakfire/cli.py:1050 ../python/pakfire/cli.py:1078
- msgid "State"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1053
-+#: ../python/pakfire/cli.py:1054
- msgid "Jobs"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1066
-+#: ../python/pakfire/cli.py:1067
- #, python-format
- msgid "A job with ID %s could not be found."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1073
-+#: ../python/pakfire/cli.py:1074
- #, python-format
- msgid "Job: %(name)s"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1078 ../python/pakfire/packages/base.py:107
-+#: ../python/pakfire/cli.py:1079 ../python/pakfire/packages/base.py:107
- #: ../python/pakfire/transaction.py:404
- msgid "Arch"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1083 ../python/pakfire/packages/base.py:142
-+#: ../python/pakfire/cli.py:1084 ../python/pakfire/packages/base.py:142
- msgid "Build host"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1088
-+#: ../python/pakfire/cli.py:1089
- msgid "Time created"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1089
-+#: ../python/pakfire/cli.py:1090
- msgid "Time started"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1090
-+#: ../python/pakfire/cli.py:1091
- msgid "Time finished"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1091
-+#: ../python/pakfire/cli.py:1092
- msgid "Duration"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1119
-+#: ../python/pakfire/cli.py:1120
- msgid "Invalid error code given."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1122
-+#: ../python/pakfire/cli.py:1123
- #, python-format
- msgid "Reponse from the server: %s"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1128
-+#: ../python/pakfire/cli.py:1129
- msgid "Pakfire daemon command line interface."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1156
-+#: ../python/pakfire/cli.py:1157
- msgid "Pakfire key command line interface."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1200 ../python/pakfire/cli.py:1210
-+#: ../python/pakfire/cli.py:1201 ../python/pakfire/cli.py:1211
- msgid "Import a key from file."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1202
-+#: ../python/pakfire/cli.py:1203
- msgid "The real name of the owner of this key."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1204
-+#: ../python/pakfire/cli.py:1205
- msgid "The email address of the owner of this key."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1212
-+#: ../python/pakfire/cli.py:1213
- msgid "Filename of that key to import."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1218
-+#: ../python/pakfire/cli.py:1219
- msgid "Export a key to a file."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1220
-+#: ../python/pakfire/cli.py:1221
- msgid "The ID of the key to export."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1222
-+#: ../python/pakfire/cli.py:1223
- msgid "Write the key to this file."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1224
-+#: ../python/pakfire/cli.py:1225
- msgid "Export the secret key, too."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1230
-+#: ../python/pakfire/cli.py:1231
- msgid "Delete a key from the local keyring."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1232
-+#: ../python/pakfire/cli.py:1233
- msgid "The ID of the key to delete."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1238
-+#: ../python/pakfire/cli.py:1239
- msgid "List all imported keys."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1244
-+#: ../python/pakfire/cli.py:1245
- msgid "Sign one or more packages."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1246
-+#: ../python/pakfire/cli.py:1247
- msgid "Key that is used sign the package(s)."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1248
-+#: ../python/pakfire/cli.py:1249
- msgid "Package(s) to sign."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1254
-+#: ../python/pakfire/cli.py:1255
- msgid "Verify one or more packages."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1258
-+#: ../python/pakfire/cli.py:1259
- msgid "Package(s) to verify."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1265
-+#: ../python/pakfire/cli.py:1266
- msgid "Generating the key may take a moment..."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1314
-+#: ../python/pakfire/cli.py:1315
- #, python-format
- msgid "Signing %s..."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1331
-+#: ../python/pakfire/cli.py:1332
- #, python-format
- msgid "Verifying %s..."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1341
-+#: ../python/pakfire/cli.py:1342
- msgid "This signature is valid."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1344
-+#: ../python/pakfire/cli.py:1345
- msgid "Unknown key"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1345
-+#: ../python/pakfire/cli.py:1346
- msgid "Could not check if this signature is valid."
- msgstr ""
-
--#: ../python/pakfire/cli.py:1348 ../python/pakfire/keyring.py:96
-+#: ../python/pakfire/cli.py:1349 ../python/pakfire/keyring.py:96
- #, python-format
- msgid "Created: %s"
- msgstr ""
-
--#: ../python/pakfire/cli.py:1352 ../python/pakfire/keyring.py:99
-+#: ../python/pakfire/cli.py:1353 ../python/pakfire/keyring.py:99
- #, python-format
- msgid "Expires: %s"
- msgstr ""
-@@ -1216,26 +1220,26 @@ msgstr ""
- msgid "Template does not exist: %s"
- msgstr ""
-
--#: ../python/pakfire/packages/make.py:80
-+#: ../python/pakfire/packages/make.py:81
- msgid "Package name is undefined."
- msgstr ""
-
--#: ../python/pakfire/packages/make.py:83
-+#: ../python/pakfire/packages/make.py:84
- msgid "Package version is undefined."
- msgstr ""
-
--#: ../python/pakfire/packages/make.py:420
-+#: ../python/pakfire/packages/make.py:421
- #, python-format
- msgid "Searching for automatic dependencies for %s..."
- msgstr ""
-
--#: ../python/pakfire/packages/make.py:474
-+#: ../python/pakfire/packages/make.py:475
- #, python-format
- msgid "Regular experession is invalid and has been skipped: %s"
- msgstr ""
-
- #. Let the user know what has been done.
--#: ../python/pakfire/packages/make.py:490
-+#: ../python/pakfire/packages/make.py:491
- #, python-format
- msgid "Filter '%(pattern)s' filtered %(dep)s."
- msgstr ""
-diff --git a/python/pakfire/cli.py b/python/pakfire/cli.py
-index a808975..419e9a0 100644
---- a/python/pakfire/cli.py
-+++ b/python/pakfire/cli.py
-@@ -960,6 +960,7 @@ class CliClient(Cli):
- ret.append(" %s:" % _("Hardware information"))
- ret.append(" %-16s: %s" % (_("CPU model"), system.cpu_model))
- ret.append(" %-16s: %s" % (_("Memory"), util.format_size(system.memory)))
-+ ret.append(" %-16s: %s" % (_("Parallelism"), system.parallelism))
- ret.append("")
- ret.append(" %-16s: %s" % (_("Native arch"), system.native_arch))
- if not system.arch == system.native_arch:
-diff --git a/python/pakfire/packages/make.py b/python/pakfire/packages/make.py
-index 43aca8a..263527a 100644
---- a/python/pakfire/packages/make.py
-+++ b/python/pakfire/packages/make.py
-@@ -45,6 +45,7 @@ from file import SourcePackage
-
- from pakfire.constants import *
- from pakfire.i18n import _
-+from pakfire.system import system
-
- class MakefileBase(Package):
- def __init__(self, pakfire, filename):
-@@ -57,7 +58,7 @@ class MakefileBase(Package):
- environ = self.pakfire.environ
- environ.update({
- "BASEDIR" : os.path.dirname(self.filename),
-- "PARALLELISMFLAGS" : "-j%s" % util.calc_parallelism(),
-+ "PARALLELISMFLAGS" : "-j%d" % system.parallelism,
- })
-
- # Open and parse the makefile.
-diff --git a/python/pakfire/system.py b/python/pakfire/system.py
-index 4d533dd..44d43a2 100644
---- a/python/pakfire/system.py
-+++ b/python/pakfire/system.py
-@@ -150,6 +150,22 @@ class System(object):
- def get_mountpoint(self, path):
- return Mountpoint(path)
-
-+ @property
-+ def parallelism(self):
-+ """
-+ Calculates how many processes should be run
-+ simulatneously when compiling.
-+ """
-+ # Check how many processes would fit into the
-+ # memory when each process takes up to 500MB.
-+ multiplicator = self.memory / (500 * 1024 * 1024)
-+ multiplicator = round(multiplicator)
-+
-+ # Count the number of online CPU cores.
-+ cpucount = os.sysconf("SC_NPROCESSORS_CONF")
-+
-+ return min(multiplicator, cpucount * 2)
-+
-
- # Create an instance of this class to only keep it once in memory.
- system = System()
-diff --git a/python/pakfire/util.py b/python/pakfire/util.py
-index 2581ece..9fa011a 100644
---- a/python/pakfire/util.py
-+++ b/python/pakfire/util.py
-@@ -296,16 +296,3 @@ def scriptlet_interpreter(scriptlet):
- break
-
- return interpreter
--
--def calc_parallelism():
-- """
-- Calculate how many processes to run
-- at the same time.
--
-- We take the log10(number of processors) * factor
-- """
-- num = os.sysconf("SC_NPROCESSORS_CONF")
-- if num == 1:
-- return 2
--
-- return num
---
-1.7.11.4
-
+++ /dev/null
-From 2eceee39ef4d78e77101ece088d7833f1b83fdad Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Tue, 2 Oct 2012 22:04:43 +0200
-Subject: [PATCH 2/4] lexer: Add shell commands with %(echo 123..).
-
-It is possible to use shell commands, just like $(...) in shell.
-It's a handy feature when you need some output of a tool
-in a variable.
-
-Every time the variable is expanded, the command is called.
-It is not ensured that the personality is the same as in
-the build environment.
----
- python/pakfire/packages/lexer.py | 37 ++++++++++++++++++++++++++++++++++++-
- 1 file changed, 36 insertions(+), 1 deletion(-)
-
-diff --git a/python/pakfire/packages/lexer.py b/python/pakfire/packages/lexer.py
-index 09a8215..af6dda0 100644
---- a/python/pakfire/packages/lexer.py
-+++ b/python/pakfire/packages/lexer.py
-@@ -6,6 +6,8 @@ import re
- from pakfire.constants import *
- from pakfire.i18n import _
-
-+import pakfire.chroot
-+
- import logging
- #log = logging.getLogger("pakfire.lexer")
- log = logging.getLogger("pakfire")
-@@ -90,7 +92,7 @@ LEXER_UNEXPORT = re.compile(r"^unexport\s+([A-Za-z0-9_\-]+)$")
- LEXER_INCLUDE = re.compile(r"^include\s+(.+)$")
-
- LEXER_VARIABLE = re.compile(r"\%\{([A-Za-z0-9_\-]+)\}")
--LEXER_SHELL = re.compile(r"\%\(.*\)")
-+LEXER_SHELL = re.compile(r"\%\((.*)\)")
-
- LEXER_IF_IF = re.compile(r"^if\s+(.*)\s+(==|!=)\s+(.*)\s*")
- LEXER_IF_ELIF = re.compile(r"^elif\s+(.*)\s*(==|!=)\s*(.*)\s*")
-@@ -204,6 +206,18 @@ class Lexer(object):
- if s is None:
- return ""
-
-+ # First run all embedded commands.
-+ while s:
-+ m = re.search(LEXER_SHELL, s)
-+ if not m:
-+ break
-+
-+ command = m.group(1)
-+ result = self.exec_command(command)
-+
-+ s = s.replace("%%(%s)" % command, result or "")
-+
-+ # Then expand the variables.
- while s:
- m = re.search(LEXER_VARIABLE, s)
- if not m:
-@@ -214,6 +228,27 @@ class Lexer(object):
-
- return s
-
-+ def exec_command(self, command):
-+ # Expand all variables in the command.
-+ command = self.expand_string(command)
-+
-+ # If the command is empty, we don't do anything.
-+ if not command:
-+ return
-+
-+ # Do we need to chroot and change personality?
-+ try:
-+ output = pakfire.chroot.do(command, shell=True, returnOutput=1, logger=log)
-+
-+ except Error:
-+ return
-+
-+ # Strip newline.
-+ if output:
-+ output = output.rstrip("\n")
-+
-+ return output
-+
- def get_var(self, key, default=None, raw=False):
- definitions = {}
- definitions.update(self.root.definitions)
---
-1.7.11.4
-
+++ /dev/null
-From b59029f9d6c226a70f333e52db43dd62fb89dcc8 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Tue, 2 Oct 2012 22:07:24 +0200
-Subject: [PATCH 3/4] macros: Add python variables.
-
----
- macros/python.macro | 15 +++++++++++++++
- 1 file changed, 15 insertions(+)
- create mode 100644 macros/python.macro
-
-diff --git a/macros/python.macro b/macros/python.macro
-new file mode 100644
-index 0000000..1b417f2
---- /dev/null
-+++ b/macros/python.macro
-@@ -0,0 +1,15 @@
-+# A bunch of predefined things for Python.
-+
-+# Python 3 constants.
-+python3 = /usr/bin/python3
-+
-+python3_sitearch = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
-+python3_sitelib = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
-+python3_version = %(%{python3} -c "import sys; sys.stdout.write(sys.version[:3])")
-+
-+# Python 2 constants.
-+python = /usr/bin/python2
-+
-+python_sitearch = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
-+python_sitelib = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
-+python_version = %(%{python} -c "import sys; sys.stdout.write(sys.version[:3])")
---
-1.7.11.4
-
+++ /dev/null
-From 7ac1cb68d8dfc00d7189abb63f8af710ed276385 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Tue, 2 Oct 2012 22:07:50 +0200
-Subject: [PATCH 4/4] macros: Add templates for python packages.
-
----
- macros/templates.macro | 20 ++++++++++++++++++++
- 1 file changed, 20 insertions(+)
-
-diff --git a/macros/templates.macro b/macros/templates.macro
-index 794619b..a2388b9 100644
---- a/macros/templates.macro
-+++ b/macros/templates.macro
-@@ -87,4 +87,24 @@ packages
- %{datadir}/doc
- end
- end
-+
-+ template PYTHON
-+ summary = Python bindings from the %{name} package.
-+ description = %{summary}
-+
-+ files
-+ %{python_sitearch}
-+ %{python_sitelib}
-+ end
-+ end
-+
-+ template PYTHON3
-+ summary = Python 3 bindings from the %{name} package.
-+ description = %{summary}
-+
-+ files
-+ %{python3_sitearch}
-+ %{python3_sitelib}
-+ end
-+ end
- end
---
-1.7.11.4
-
+++ /dev/null
-From bd629777539347ab8da89616d6cd724c44c04f5c Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Tue, 2 Oct 2012 23:11:56 +0200
-Subject: [PATCH 5/6] Fix caching scriptlets.
-
-Fixes #10117.
-
-Scriptlets have not been executed when the package has
-not been available (i.e. had to be downloaded).
----
- python/pakfire/actions.py | 13 +++++++++++--
- 1 file changed, 11 insertions(+), 2 deletions(-)
-
-diff --git a/python/pakfire/actions.py b/python/pakfire/actions.py
-index 9fda261..b8d0fb3 100644
---- a/python/pakfire/actions.py
-+++ b/python/pakfire/actions.py
-@@ -140,8 +140,17 @@ class ActionScript(Action):
- script_action = None
-
- def init(self):
-- # Load the scriplet.
-- self.scriptlet = self.pkg.get_scriptlet(self.script_action)
-+ self._scriptlet = None
-+
-+ @property
-+ def scriptlet(self):
-+ """
-+ Load the scriplet.
-+ """
-+ if self._scriptlet is None:
-+ self._scriptlet = self.pkg.get_scriptlet(self.script_action)
-+
-+ return self._scriptlet
-
- def get_lang(self):
- if not self.scriptlet:
---
-1.7.11.4
-
+++ /dev/null
-From e9e430d4fd5b09327f57651726ffac1b7874ae01 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Wed, 3 Oct 2012 00:45:11 +0200
-Subject: [PATCH 6/6] python: Byte-compile all files in sitelib.
-
-For files which are located elsewhere, it is required
-to call:
- python_bytecompile <path1> <path2>... (Python 2)
-or
- python3_bytecompile <path1> <path2>... (Python 3)
----
- macros/build.macro | 12 ++++++-
- macros/python.macro | 3 ++
- tools/py-compile | 90 +++++++++++++++++++++++++++++------------------------
- 3 files changed, 64 insertions(+), 41 deletions(-)
-
-diff --git a/macros/build.macro b/macros/build.macro
-index 6987068..4e4d830 100644
---- a/macros/build.macro
-+++ b/macros/build.macro
-@@ -46,7 +46,17 @@ def MACRO_INSTALL_LOGROTATE_FILES
- end
-
- def MACRO_PYTHON_COMPILE
-- # XXX TODO
-+ if [ -x "%{python3}" ]; then
-+ %{python3_bytecompile} \
-+ %{BUILDROOT}%{python3_sitearch} \
-+ %{BUILDROOT}%{python3_sitelib}
-+ fi
-+
-+ if [ -x "%{python}" ]; then
-+ %{python_bytecompile} \
-+ %{BUILDROOT}%{python_sitearch} \
-+ %{BUILDROOT}%{python_sitelib}
-+ fi
- end
-
- MACRO_PERL_CLEANUP
-diff --git a/macros/python.macro b/macros/python.macro
-index 1b417f2..15c1209 100644
---- a/macros/python.macro
-+++ b/macros/python.macro
-@@ -1,7 +1,9 @@
- # A bunch of predefined things for Python.
-+python_bytecompile_script = /usr/lib/pakfire/py-compile
-
- # Python 3 constants.
- python3 = /usr/bin/python3
-+python3_bytecompile = %{python_bytecompile_script} --python=%{python3}
-
- python3_sitearch = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib(1))")
- python3_sitelib = %(%{python3} -c "from distutils.sysconfig import get_python_lib; print(get_python_lib())")
-@@ -9,6 +11,7 @@ python3_version = %(%{python3} -c "import sys; sys.stdout.write(sys.version[:3]
-
- # Python 2 constants.
- python = /usr/bin/python2
-+python_bytecompile = %{python_bytecompile_script} --python=%{python}
-
- python_sitearch = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib(1)")
- python_sitelib = %(%{python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")
-diff --git a/tools/py-compile b/tools/py-compile
-index 66c33ed..5ccd8f9 100755
---- a/tools/py-compile
-+++ b/tools/py-compile
-@@ -1,48 +1,58 @@
- #!/bin/sh
-
--PYTHON=$(which python 2>/dev/null)
-+python_interpreter="python"
-+paths=""
-+
-+while [ $# -gt 0 ]; do
-+ case "${1}" in
-+ --python=*)
-+ python_interpreter=${1#--python=}
-+ ;;
-+ *)
-+ paths="${paths} ${1}"
-+ ;;
-+ esac
-+ shift
-+done
-
--if [ -z "${PYTHON}" ]; then
-- # Python is not present. Fail silently.
-- exit 0
-+if [ -z "${paths}" ]; then
-+ echo >&2 "No path specified!"
-+ exit 1
- fi
-
--files=""
--for i in $*; do
-- if [ -e ${i}c ] && [ -e ${i}o ]; then
-- continue # all files we want are already there
-- fi
-- files="$files $i"
--done
-+if [ "${python_interpreter:0:1}" != "/" ]; then
-+ python_interpreter=$(which ${python_interpreter} 2>/dev/null)
-+fi
-
--if [ -z "${files}" ]; then
-- # No files need to be proceeded.
-- exit 0
-+if [ ! -x "${python_interpreter}" ]; then
-+ echo >&2 "Python interpreter is not executable: ${python_interpreter}"
-+ exit 1
- fi
-
--$PYTHON -c "
--import sys, os, string, py_compile
--
--files = '''$files'''
--print 'Byte-compiling python modules...'
--for file in string.split(files):
-- if not os.path.exists(file) or not (len(file) >= 3 and file[-3:] == '.py'):
-- continue
-- print file,
-- sys.stdout.flush()
-- py_compile.compile(file)
--print" || exit $?
--
--# this will fail for python < 1.5, but that doesn't matter ...
--$PYTHON -O -c "
--import sys, os, string, py_compile
--
--files = '''$files'''
--print 'Byte-compiling python modules (optimised versions) ...'
--for file in string.split(files):
-- if not os.path.exists(file) or not (len(file) >= 3 and file[-3:] == '.py'):
-- continue
-- print file,
-- sys.stdout.flush()
-- py_compile.compile(file)
--print" 2>/dev/null || :
-+tempfile=$(mktemp)
-+trap "rm -f ${tempfile}" EXIT
-+
-+cat > ${tempfile} <<EOF
-+import py_compile
-+import sys
-+
-+for file in sys.argv[1:]:
-+ py_compile.compile(file, doraise=0)
-+EOF
-+
-+filelist=$(find ${paths} -type f -a -name "*.py")
-+
-+# Compile with optimization.
-+${python_interpreter} -O ${tempfile} ${filelist}
-+
-+# Compile without optimization.
-+${python_interpreter} ${tempfile} ${filelist}
-+
-+# Hardlink identical files.
-+for pyc in $(find ${paths} -type f -a -name "*.pyc"); do
-+ pyo="${pyc/.pyc/.pyo}"
-+
-+ if cmp -s "${pyc}" "${pyo}"; then
-+ ln -f "${pyc}" "${pyo}"
-+ fi
-+done
---
-1.7.11.4
-
+++ /dev/null
-From 99c47627b24f5a16897aa85ed83eb3919ea6ea85 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Wed, 3 Oct 2012 01:02:06 +0200
-Subject: [PATCH 7/8] QA: Remove obsoleted python hardlink tool.
-
----
- tools/quality-agent.d/090-python-hardlinks | 20 --------------------
- 1 file changed, 20 deletions(-)
- delete mode 100755 tools/quality-agent.d/090-python-hardlinks
-
-diff --git a/tools/quality-agent.d/090-python-hardlinks b/tools/quality-agent.d/090-python-hardlinks
-deleted file mode 100755
-index e2abf76..0000000
---- a/tools/quality-agent.d/090-python-hardlinks
-+++ /dev/null
-@@ -1,20 +0,0 @@
--#!/bin/bash
--
--. $(dirname ${0})/qa-include
--
--DESC="Python byte-code files could be hardlinked if the optimized one is equal"
--DESC="${DESC} to the other one."
--
--function check() {
-- for py in $(find ${BUILDROOT} -type f -name "*.py"); do
-- if [ -e "${py}c" ] && [ -e "${py}o" ]; then
-- if cmp -s "${py}c" "${py}o"; then
-- log DEBUG " ${py}c -> ${py}o"
-- ln -f "${py}c" "${py}o"
-- fi
-- fi
-- done
--}
--
--run
--
---
-1.7.11.4
-
+++ /dev/null
-From 61918bfab20eaba61bb8ce7e8397a28806d029d2 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Wed, 3 Oct 2012 14:56:41 +0200
-Subject: [PATCH 8/8] py-compile: Make script more robust for errors.
-
----
- tools/py-compile | 8 ++++++--
- 1 file changed, 6 insertions(+), 2 deletions(-)
-
-diff --git a/tools/py-compile b/tools/py-compile
-index 5ccd8f9..2749042 100755
---- a/tools/py-compile
-+++ b/tools/py-compile
-@@ -33,14 +33,18 @@ tempfile=$(mktemp)
- trap "rm -f ${tempfile}" EXIT
-
- cat > ${tempfile} <<EOF
-+import os
- import py_compile
- import sys
-
- for file in sys.argv[1:]:
-+ if not os.path.exists(file):
-+ continue
-+
- py_compile.compile(file, doraise=0)
- EOF
-
--filelist=$(find ${paths} -type f -a -name "*.py")
-+filelist=$(find ${paths} -type f -a -name "*.py" 2>/dev/null)
-
- # Compile with optimization.
- ${python_interpreter} -O ${tempfile} ${filelist}
-@@ -49,7 +53,7 @@ ${python_interpreter} -O ${tempfile} ${filelist}
- ${python_interpreter} ${tempfile} ${filelist}
-
- # Hardlink identical files.
--for pyc in $(find ${paths} -type f -a -name "*.pyc"); do
-+for pyc in $(find ${paths} -type f -a -name "*.pyc" 2>/dev/null); do
- pyo="${pyc/.pyc/.pyo}"
-
- if cmp -s "${pyc}" "${pyo}"; then
---
-1.7.11.4
-
+++ /dev/null
-From 8cc622fa66158e02caf366faa993434cf41d28f3 Mon Sep 17 00:00:00 2001
-From: Michael Tremer <michael.tremer@ipfire.org>
-Date: Sun, 21 Oct 2012 22:19:26 +0200
-Subject: [PATCH] patches: Add platform patches.
-
----
- macros/constants.macro | 2 +-
- 1 file changed, 1 insertion(+), 1 deletion(-)
-
-diff --git a/macros/constants.macro b/macros/constants.macro
-index 74484ea..2163a8b 100644
---- a/macros/constants.macro
-+++ b/macros/constants.macro
-@@ -11,7 +11,7 @@ DIR_SOURCE = %{BASEDIR}
-
- # By default, take all patches from the patches directory
- # in alphabetical order.
--patches = $(find %{DIR_PATCHES} -not -type d 2>/dev/null | sort --version-sort)
-+patches = %(find %{DIR_PATCHES} %{DIR_PATCHES}/%{DISTRO_ARCH} -not -type d -maxdepth 1 2>/dev/null | sort --version-sort)
- sources = %{thisapp}.tar.gz
-
- # Macro definitions
---
-1.7.11.7
-