This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "IPFire 3.x development tree".
The branch, master has been updated
via fb625c5cf37b13b111ad96ad8721d58ea4a2cb88 (commit)
via 96e949b731d9d21615680edb07e3f8403fa8d8d9 (commit)
via 3a80e064f3c40bdb632c517a11d23f9a693ed806 (commit)
via 9ceab1e796c975b564c1fd6a59baec9bf7306402 (commit)
via 1696050cd46c9f1648a43b4173487a06822e7f0b (commit)
via 590c45fb03cfba19953118383e6728078c75c8cf (commit)
via 1967b9ef77292e97757fddc9fc09c3e6519bce08 (commit)
from be8c754c0720c3eca6bf02b6dedc1615d5738301 (commit)
Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.
- Log -----------------------------------------------------------------
commit fb625c5cf37b13b111ad96ad8721d58ea4a2cb88
Merge: 96e949b731d9d21615680edb07e3f8403fa8d8d9 3a80e064f3c40bdb632c517a11d23f9a693ed806
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Fri Apr 2 15:59:35 2010 +0200
Merge branch 'naoki-shell'
commit 96e949b731d9d21615680edb07e3f8403fa8d8d9
Merge: 590c45fb03cfba19953118383e6728078c75c8cf 9ceab1e796c975b564c1fd6a59baec9bf7306402
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Fri Apr 2 15:59:26 2010 +0200
Merge commit 'stevee/openssl'
commit 3a80e064f3c40bdb632c517a11d23f9a693ed806
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Fri Apr 2 15:56:25 2010 +0200
naoki: General code cleanup.
Did some checks with pychecker and fixed them.
No functional changes at all.
commit 9ceab1e796c975b564c1fd6a59baec9bf7306402
Author: Schantl Stefan <Stevee(a)ipfire.org>
Date: Fri Apr 2 15:31:27 2010 +0200
openssl: Enable md2.
nmap needs the md2 header file to build successfully.
Fixes issue #607.
commit 1696050cd46c9f1648a43b4173487a06822e7f0b
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Fri Apr 2 14:33:46 2010 +0200
naoki: Change behaviour of shell command.
Did some more changes on the Environment class.
commit 590c45fb03cfba19953118383e6728078c75c8cf
Author: Schantl Stefan <Stevee(a)ipfire.org>
Date: Wed Mar 31 16:43:33 2010 +0200
ccache: Set max size up to 2GB.
commit 1967b9ef77292e97757fddc9fc09c3e6519bce08
Author: Michael Tremer <michael.tremer(a)ipfire.org>
Date: Sat Mar 27 15:06:37 2010 +0100
naoki: Add shell command.
-----------------------------------------------------------------------
Summary of changes:
naoki/__init__.py | 73 ++++++------
naoki/backend.py | 25 +++--
naoki/chroot.py | 262 ++++++++++++++++++++++++++++--------------
naoki/constants.py | 2 +
naoki/logger.py | 2 +-
naoki/terminal.py | 37 ++++++
naoki/util.py | 10 ++
pkgs/Functions | 2 +
pkgs/Targets | 3 +
pkgs/core/ccache/ccache.nm | 3 +
pkgs/core/openssl/openssl.nm | 1 +
tools/chroot-shell | 21 ++++
tools/runpychecker.sh | 8 ++
13 files changed, 319 insertions(+), 130 deletions(-)
create mode 100755 tools/chroot-shell
create mode 100755 tools/runpychecker.sh
Difference in files:
diff --git a/naoki/__init__.py b/naoki/__init__.py
index 23e5485..cc26d17 100644
--- a/naoki/__init__.py
+++ b/naoki/__init__.py
@@ -6,6 +6,7 @@ import sys
import time
import backend
+import chroot
import logger
import terminal
import util
@@ -16,6 +17,7 @@ class Naoki(object):
def __init__(self):
# First, setup the logging
self.logging = logger.Logging(self)
+ self.log = self.logging.log
# Second, parse the command line options
self.cli = terminal.Commandline(self)
@@ -30,13 +32,14 @@ class Naoki(object):
# If there is no action provided, exit
if not args.has_key("action"):
self.cli.help()
- sys.exit(1)
+ return 1
actionmap = {
"build" : self.call_build,
"toolchain" : self.call_toolchain,
"package" : self.call_package,
"source" : self.call_source,
+ "shell" : self.call_shell,
}
return actionmap[args.action.name](args.action)
@@ -44,7 +47,7 @@ class Naoki(object):
def call_toolchain(self, args):
if not args.has_key("action"):
self.cli.help()
- sys.exit(1)
+ return 1
actionmap = {
"build" : self.call_toolchain_build,
@@ -113,21 +116,21 @@ class Naoki(object):
% (len(packages), [package.name for package in packages]))
for package in packages:
- package.download()
+ environ = package.getEnvironment()
- for package in packages:
- environ = chroot.Environment(package)
-
if not environ.toolchain.exists:
self.log.error("You need to build or download a toolchain first.")
continue
+ if args.shell:
+ return environ.shell([])
+
environ.build()
def call_package(self, args):
if not args.has_key("action"):
self.cli.help()
- sys.exit(1)
+ return 1
actionmap = {
"info" : self.call_package_info,
@@ -203,7 +206,7 @@ Release : %(release)s
print package.name
def call_package_tree(self, args):
- print backend.deptree(backend.parse_package(backend.get_package_names()))
+ print backend.deptree(backend.parse_package(backend.get_package_names(), naoki=self))
def call_package_groups(self, args):
groups = backend.get_group_names()
@@ -253,31 +256,31 @@ Release : %(release)s
self.log.info("Removing %s..." % file)
os.remove(os.path.join(TARBALLDIR, file))
- def _build(self, packages, force=False):
- requeue = []
- packages = package.depsort(packages)
- while packages:
- # Get first package that is to be done
- build = chroot.Environment(packages.pop(0))
-
- if not build.toolchain.exists:
- self.log.error("You need to build or download a toolchain first.")
- return
-
- if build.package.isBuilt:
- if not force:
- self.log.info("Skipping already built package %s..." % build.package.name)
- continue
- self.log.warn("Package is already built. Will overwrite.")
-
- if not build.package.canBuild:
- self.log.warn("Cannot build package %s." % build.package.name)
- if not self.packages:
- self.log.error("Blah")
- return
- self.log.warn("Requeueing. %s" % build.package.name)
- self.packages.append(build.package)
- continue
+ def call_shell(self, args):
+ environ = chroot.ShellEnvironment(naoki=self)
+
+ actionmap = {
+ "clean" : self.call_shell_clean,
+ "extract" : self.call_shell_extract,
+ "enter" : self.call_shell_enter,
+ }
+
+ if args.action.name in ("enter", "execute"):
+ environ.init(clean=False)
+
+ return actionmap[args.action.name](environ, args.action)
+
+ def call_shell_clean(self, environ, args):
+ return environ.clean()
+
+ def call_shell_extract(self, environ, args):
+ if args.packages == ["all"]:
+ args.packages = backend.get_package_names()
+
+ packages = backend.parse_package(args.packages, naoki=self)
+ for package in backend.depsolve(packages, recursive=True):
+ package.naoki = self
+ package.extract(environ.chrootPath())
- self.log.info("Building %s..." % build.package.name)
- build.build()
+ def call_shell_enter(self, environ, args):
+ return environ.shell()
diff --git a/naoki/backend.py b/naoki/backend.py
index 813c8fc..0b9aa63 100644
--- a/naoki/backend.py
+++ b/naoki/backend.py
@@ -30,12 +30,12 @@ def find_package_info(name, toolchain=False):
return PackageInfo(name, repo=repo)
-def find_package(name, toolchain=False):
+def find_package(name, naoki, toolchain=False):
package = find_package_info(name, toolchain)
if package:
- package = backend.Package(package)
+ return package.getPackage(naoki)
- return package
+ return None
def parse_package_info(names, toolchain=False):
packages = []
@@ -204,8 +204,8 @@ class PackageInfo(object):
self.arch = arches.current["name"]
- #def __cmp__(self, other):
- # return cmp(self.name, other.name)
+ def __cmp__(self, other):
+ return cmp(self.name, other.name)
def __repr__(self):
return "<PackageInfo %s>" % self.name
@@ -284,7 +284,7 @@ class PackageInfo(object):
def _dependencies(self, s, recursive=False, toolchain=False):
c = s + "_CACHE"
if not self._data.has_key(c):
- deps = parse_package(self._data.get(s).split(" "), toolchain=toolchain)
+ deps = parse_package_info(self._data.get(s).split(" "), toolchain=toolchain)
self._data.update({c : depsolve(deps, recursive)})
return self._data.get(c)
@@ -398,6 +398,8 @@ class PackageInfo(object):
class Package(object):
def __init__(self, name, naoki, toolchain=False):
self.info = find_package_info(name, toolchain)
+
+ assert naoki
self.naoki = naoki
#self.log.debug("Initialized package object %s" % name)
@@ -411,15 +413,19 @@ class Package(object):
def __getattr__(self, attr):
return getattr(self.info, attr)
+ @property
+ def name(self):
+ return self.info.name
+
def build(self):
- environment = chroot.Environment(self)
+ environment = chroot.PackageEnvironment(self)
environment.build()
def download(self):
download(self.info.objects, logger=self.log)
def extract(self, dest):
- files = [os.path.join(PACKAGESDIR, file) for file in self.package_files]
+ files = [os.path.join(PACKAGESDIR, file) for file in self.info.package_files]
if not files:
return
@@ -427,6 +433,9 @@ class Package(object):
util.do("%s --root=%s %s" % (os.path.join(TOOLSDIR, "decompressor"),
dest, " ".join(files)), shell=True)
+ def getEnvironment(self, *args, **kwargs):
+ return chroot.PackageEnvironment(self, *args, **kwargs)
+
@property
def log(self):
return self.naoki.logging.getBuildLogger(self.info.id)
diff --git a/naoki/chroot.py b/naoki/chroot.py
index efcaf07..0bf9145 100644
--- a/naoki/chroot.py
+++ b/naoki/chroot.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
+import fcntl
import grp
import logging
import os
@@ -14,49 +15,40 @@ from exception import *
from logger import getLog
class Environment(object):
- def __init__(self, package):
- self.package = package
- self.naoki = self.package.naoki
+ kernel_version = os.uname()[2]
- self.arch = arches.current
+ def __init__(self, naoki, arch=arches.current):
+ self.arch = arch
self.config = config
+ self.naoki = naoki
+
+ self.initialized = False
+ self.__buildroot = None
self.toolchain = Toolchain(self.arch["name"])
- # mount/umount
- self.umountCmds = [
- "umount -n %s" % self.chrootPath("proc"),
- "umount -n %s" % self.chrootPath("sys"),
- "umount -n %s" % self.chrootPath("usr", "src", "cache"),
- "umount -n %s" % self.chrootPath("usr", "src", "ccache"),
- "umount -n %s" % self.chrootPath("usr", "src", "packages"),
- "umount -n %s" % self.chrootPath("usr", "src", "pkgs"),
- "umount -n %s" % self.chrootPath("usr", "src", "src"),
- "umount -n %s" % self.chrootPath("usr", "src", "tools"),
- ]
- self.mountCmds = [
- "mount -n -t proc naoki_chroot_proc %s" % self.chrootPath("proc"),
- "mount -n -t sysfs naoki_chroot_sysfs %s" % self.chrootPath("sys"),
- "mount -n --bind %s %s" % (os.path.join(CACHEDIR), self.chrootPath("usr", "src", "cache")),
- "mount -n --bind %s %s" % (os.path.join(CCACHEDIR), self.chrootPath("usr", "src", "ccache")),
- "mount -n --bind %s %s" % (os.path.join(PACKAGESDIR), self.chrootPath("usr", "src", "packages")),
- "mount -n --bind %s %s" % (os.path.join(PKGSDIR), self.chrootPath("usr", "src", "pkgs")),
- "mount -n --bind %s %s" % (os.path.join(BASEDIR, "src"), self.chrootPath("usr", "src", "src")),
- "mount -n --bind %s %s" % (os.path.join(TOOLSDIR), self.chrootPath("usr", "src", "tools")),
- ]
+ # Create initial directory that we can set the lock
+ util.mkdir(self.chrootPath())
- self.buildroot = "buildroot.%d" % random.randint(0, 1024)
+ # Lock environment. Throws exception if function cannot set the lock.
+ self.lock()
- self.log.debug("Setting up environment %s..." % self.chrootPath())
+ def init(self, clean=True):
+ marker = self.chrootPath(".initialized")
+ self.log.debug("Initialize environment %s..." % self.chrootPath())
- if os.path.exists(self.chrootPath()):
+ if clean:
self.clean()
+ # If marker exists, we won't reinit again
+ if os.path.exists(marker):
+ return
+
# create dirs
dirs = (
CACHEDIR,
+ CCACHEDIR,
PACKAGESDIR,
- self.chrootPath(self.buildroot),
self.chrootPath("bin"),
self.chrootPath("etc"),
self.chrootPath("proc"),
@@ -94,49 +86,76 @@ class Environment(object):
self.toolchain.adjust(self.chrootPath())
- def clean(self):
- util.rm(self.chrootPath())
+ # Set marker
+ util.touch(marker)
- def make(self, target):
- file = "/usr/src%s" % self.package.info.filename[len(BASEDIR):]
+ @property
+ def buildroot(self):
+ if not self.__buildroot:
+ self.__buildroot = "buildroot.%s" % util.random_string()
- return self.doChroot("make -C %s -f %s %s" % \
- (os.path.dirname(file), file, target), shell=True)
+ return self.__buildroot
+
+ def lock(self):
+ self.log.debug("Trying to lock environment")
+
+ try:
+ self._lock = open(self.chrootPath(".lock"), "a+")
+ except IOError, e:
+ return 0
- def doChroot(self, command, shell=True, *args, **kwargs):
- ret = None
try:
- # XXX Should be globally defined
- env = config.environment.copy()
+ fcntl.lockf(self._lock.fileno(), fcntl.LOCK_EX | fcntl.LOCK_NB)
+ except IOError, e:
+ raise BuildRootLocked, "Environment is locked by another process"
+
+ return 1
+
+ def clean(self):
+ if os.path.exists(self.chrootPath()):
+ util.rm(self.chrootPath())
+
+ @property
+ def environ(self):
+ env = config.environment.copy()
+ env.update({
+ "HOME" : "/root",
+ "BASEDIR" : "/usr/src",
+ "PKGROOT" : "/usr/src/pkgs",
+ "TOOLS_DIR" : "/tools_%s" % self.arch["name"],
+ "TARGET" : "%s-ipfire-linux-gnu" % self.arch["machine"],
+ "TARGET_MACHINE" : self.arch["machine"],
+ "PATH" : CHROOT_PATH + ":/tools_%(arch)s/sbin:/tools_%(arch)s/bin" \
+ % { "arch" : self.arch["name"], },
+ "BUILDROOT" : "/%s" % self.buildroot,
+ "CHROOT" : "1",
+ "CFLAGS" : self.arch["cflags"],
+ "CXXFLAGS" : self.arch["cxxflags"],
+ "PKG_ARCH" : self.arch["name"],
+ })
+
+ ccache_path = os.path.join("tools_%s" % self.arch["name"],
+ "usr", "ccache", "bin")
+ if os.path.exists(self.chrootPath(ccache_path)):
env.update({
- "HOME" : "/root",
- "BASEDIR" : "/usr/src",
- "PKGROOT" : "/usr/src/pkgs",
- "TOOLS_DIR" : "/tools_%s" % self.arch["name"],
- "TARGET" : "%s-ipfire-linux-gnu" % self.arch["machine"],
- "TARGET_MACHINE" : self.arch["machine"],
- "PATH" : "/sbin:/bin:/usr/sbin:/usr/bin:/tools_%(arch)s/sbin:/tools_%(arch)s/bin" \
- % { "arch" : self.arch["name"], },
- "BUILDROOT" : "/%s" % self.buildroot,
- "CHROOT" : "1",
- "CFLAGS" : self.arch["cflags"],
- "CXXFLAGS" : self.arch["cxxflags"],
- "PKG_ARCH" : self.arch["name"],
+ "PATH" : "/%s:%s" % (ccache_path, env["PATH"]),
+ "CCACHE_DIR" : "/usr/src/ccache",
})
- ccache_path = os.path.join("tools_%s" % self.arch["name"],
- "usr", "ccache", "bin")
- if os.path.exists(self.chrootPath(ccache_path)):
- env.update({
- "PATH" : "/%s:%s" % (ccache_path, env["PATH"]),
- "CCACHE_DIR" : "/usr/src/ccache",
- })
+ return env
+
+ def doChroot(self, command, shell=True, *args, **kwargs):
+ self.init()
+
+ ret = None
+ try:
+ env = self.environ
if kwargs.has_key("env"):
env.update(kwargs.pop("env"))
self._mountall()
-
+
if not kwargs.has_key("chrootPath"):
kwargs["chrootPath"] = self.chrootPath()
@@ -145,20 +164,21 @@ class Environment(object):
finally:
self._umountall()
-
+
return ret
def chrootPath(self, *args):
- return os.path.join(BUILDDIR, "environments", self.package.info.id, *args)
+ raise NotImplementedError
def _setupDev(self):
+ self.log.debug("Setting up /dev and /proc")
+
# files in /dev
util.rm(self.chrootPath("dev"))
util.mkdir(self.chrootPath("dev", "pts"))
util.mkdir(self.chrootPath("dev", "shm"))
prevMask = os.umask(0000)
- kernel_version = os.uname()[2]
devNodes = [
(stat.S_IFCHR | 0666, os.makedev(1, 3), "dev/null"),
(stat.S_IFCHR | 0666, os.makedev(1, 7), "dev/full"),
@@ -170,7 +190,7 @@ class Environment(object):
]
# make device node for el4 and el5
- if kernel_version < "2.6.19":
+ if self.kernel_version < "2.6.19":
devNodes.append((stat.S_IFCHR | 0666, os.makedev(5, 2), "dev/ptmx"))
for i in devNodes:
@@ -182,28 +202,11 @@ class Environment(object):
os.symlink("/proc/self/fd/2", self.chrootPath("dev", "stderr"))
os.symlink("/proc/self/fd", self.chrootPath("dev", "fd"))
- if kernel_version >= "2.6.19":
+ if self.kernel_version >= "2.6.19":
os.symlink("/dev/pts/ptmx", self.chrootPath("dev", "ptmx"))
os.umask(prevMask)
- # mount/umount
- for devUnmtCmd in (
- "umount -n %s" % self.chrootPath("dev", "pts"),
- "umount -n %s" % self.chrootPath("dev", "shm")):
- if devUnmtCmd not in self.umountCmds:
- self.umountCmds.append(devUnmtCmd)
-
- mountopt = "gid=%d,mode=0620,ptmxmode=0666" % grp.getgrnam("tty").gr_gid
- if kernel_version >= "2.6.29":
- mountopt += ",newinstance"
-
- for devMntCmd in (
- "mount -n -t devpts -o %s naoki_chroot_devpts %s" % (mountopt, self.chrootPath("dev", "pts")),
- "mount -n -t tmpfs naoki_chroot_shmfs %s" % self.chrootPath("dev", "shm")):
- if devMntCmd not in self.mountCmds:
- self.mountCmds.append(devMntCmd)
-
def _setupUsers(self):
## XXX Could be done better
self.log.debug("Creating users")
@@ -246,20 +249,83 @@ class Environment(object):
def _mountall(self):
"""mount 'normal' fs like /dev/ /proc/ /sys"""
+ self.log.debug("Mounting chroot")
for cmd in self.mountCmds:
util.do(cmd, shell=True)
def _umountall(self):
"""umount all mounted chroot fs."""
+ self.log.debug("Umounting chroot")
for cmd in self.umountCmds:
util.do(cmd, raiseExc=0, shell=True)
+ @property
+ def log(self):
+ return getLog()
+
+ def shell(self, args=[]):
+ command = "chroot %s /usr/src/tools/chroot-shell %s" % \
+ (self.chrootPath(), " ".join(args))
+
+ for key, val in self.environ.items():
+ command = "%s=\"%s\" " % (key, val) + command
+
+ try:
+ self._mountall()
+
+ shell = os.system(command)
+ return os.WEXITSTATUS(shell)
+
+ finally:
+ self._umountall()
+
+ @property
+ def umountCmds(self):
+ ret = (
+ "umount -n %s" % self.chrootPath("proc"),
+ "umount -n %s" % self.chrootPath("sys"),
+ "umount -n %s" % self.chrootPath("usr", "src", "cache"),
+ "umount -n %s" % self.chrootPath("usr", "src", "ccache"),
+ "umount -n %s" % self.chrootPath("usr", "src", "packages"),
+ "umount -n %s" % self.chrootPath("usr", "src", "pkgs"),
+ "umount -n %s" % self.chrootPath("usr", "src", "tools"),
+ "umount -n %s" % self.chrootPath("dev", "pts"),
+ "umount -n %s" % self.chrootPath("dev", "shm")
+ )
+
+ return ret
+
+ @property
+ def mountCmds(self):
+ ret = [
+ "mount -n -t proc naoki_chroot_proc %s" % self.chrootPath("proc"),
+ "mount -n -t sysfs naoki_chroot_sysfs %s" % self.chrootPath("sys"),
+ "mount -n --bind %s %s" % (CACHEDIR, self.chrootPath("usr", "src", "cache")),
+ "mount -n --bind %s %s" % (CCACHEDIR, self.chrootPath("usr", "src", "ccache")),
+ "mount -n --bind %s %s" % (PACKAGESDIR, self.chrootPath("usr", "src", "packages")),
+ "mount -n --bind %s %s" % (PKGSDIR, self.chrootPath("usr", "src", "pkgs")),
+ "mount -n --bind %s %s" % (TOOLSDIR, self.chrootPath("usr", "src", "tools")),
+ ]
+
+ mountopt = "gid=%d,mode=0620,ptmxmode=0666" % grp.getgrnam("tty").gr_gid
+ if self.kernel_version >= "2.6.29":
+ mountopt += ",newinstance"
+
+ ret.extend([
+ "mount -n -t devpts -o %s naoki_chroot_devpts %s" % (mountopt, self.chrootPath("dev", "pts")),
+ "mount -n -t tmpfs naoki_chroot_shmfs %s" % self.chrootPath("dev", "shm")])
+
+ return ret
+
def extractAll(self):
- packages = [p.getPackage(self.naoki) \
- for p in self.package.info.dependencies_all]
+ raise NotImplementedError
- for package in packages:
- package.extract(self.chrootPath())
+
+class PackageEnvironment(Environment):
+ def __init__(self, package, *args, **kwargs):
+ self.package = package
+
+ Environment.__init__(self, naoki=package.naoki, *args, **kwargs)
def build(self):
self.package.download()
@@ -280,11 +346,35 @@ class Environment(object):
if config["cleanup_on_success"]:
self.clean()
+ def chrootPath(self, *args):
+ return os.path.join(BUILDDIR, "environments", self.package.info.id, *args)
+
+ def extractAll(self):
+ packages = [p.getPackage(self.naoki) \
+ for p in self.package.info.dependencies_all]
+
+ for package in packages:
+ package.extract(self.chrootPath())
+
+ def make(self, target):
+ file = "/usr/src%s" % self.package.info.filename[len(BASEDIR):]
+
+ return self.doChroot("make -C %s -f %s %s" % \
+ (os.path.dirname(file), file, target), shell=True)
+
@property
def log(self):
return self.package.log
+class ShellEnvironment(Environment):
+ def chrootPath(self, *args):
+ return os.path.join(BUILDDIR, "environments", "shell", *args)
+
+ def extractAll(self):
+ pass
+
+
class Toolchain(object):
def __init__(self, arch):
util.mkdir(TOOLCHAINSDIR)
diff --git a/naoki/constants.py b/naoki/constants.py
index c8de3ae..b3c8a71 100644
--- a/naoki/constants.py
+++ b/naoki/constants.py
@@ -22,6 +22,8 @@ PATCHESDIR = os.path.join(CACHEDIR, "patches")
CONFIGFILE = os.path.join(CONFIGDIR, "naoki.conf")
+CHROOT_PATH = "/sbin:/bin:/usr/sbin:/usr/bin"
+
def calc_parallelism():
"""
Calculate how many processes to run
diff --git a/naoki/logger.py b/naoki/logger.py
index 1153ef1..faff1d5 100644
--- a/naoki/logger.py
+++ b/naoki/logger.py
@@ -19,7 +19,7 @@ class Logging(object):
self.setup()
def setup(self):
- self.naoki.log = self.log = logging.getLogger()
+ self.log = logging.getLogger()
log_ini = config["log_config_file"]
if os.path.exists(log_ini):
diff --git a/naoki/terminal.py b/naoki/terminal.py
index c979cbd..e6aa0c5 100644
--- a/naoki/terminal.py
+++ b/naoki/terminal.py
@@ -134,6 +134,29 @@ class _Argument(object):
raise NotImplementedError
+class Argument(_Argument):
+ def __init__(self, name, **kwargs):
+ _Argument.__init__(self, name, [], **kwargs)
+
+ def parse(self, args):
+ self._parsed = True
+
+ if len(args) >= 1:
+ self._parsed_args = args[:1]
+
+ return args[1:]
+
+ def value(self):
+ if self._parsed_args:
+ return self._parsed_args[0]
+
+ return []
+
+ @property
+ def help_line(self):
+ return self.name
+
+
class Option(_Argument):
def parse(self, args):
self._parsed = True
@@ -257,6 +280,7 @@ class Commandline(object):
arguments=[
Option("withdeps", ["--with-deps"], help="Build all dependencies first if needed"),
Option("onlydeps", ["--only-deps"], help="Build only dependencies that belong to a package"),
+ Option("shell", ["-s", "--shell"], help="Change into a chroot environment"),
List("packages", help="Give a list of packages to build or say 'all'"),
]),
@@ -324,6 +348,19 @@ class Commandline(object):
parsers=[
Parser("cron", help="Command that gets called by cron"),
]),
+
+ # Shell
+ Parser("shell",
+ help="Shell environment",
+ parsers=[
+ Parser("clean", help="Cleanup the environment"),
+ Parser("extract",
+ help="Extract packages",
+ arguments=[
+ List("packages", help="Give a list of packages")
+ ]),
+ Parser("enter", help="Enter into environment"),
+ ]),
])
self.parser = parser
diff --git a/naoki/util.py b/naoki/util.py
index 5898727..b5b3427 100644
--- a/naoki/util.py
+++ b/naoki/util.py
@@ -3,8 +3,10 @@
import ctypes
import fcntl
import os
+import random
import select
import shutil
+import string
import subprocess
import sys
import time
@@ -199,3 +201,11 @@ class ChildPreExec(object):
condPersonality(self.personality)
condChroot(self.chrootPath)
condChdir(self.cwd)
+
+def random_string(length=5):
+ ret = ""
+ while length:
+ ret += random.choice(string.hexdigits)
+ length -= 1
+
+ return ret
diff --git a/pkgs/Functions b/pkgs/Functions
index e79a5a0..b8e63df 100644
--- a/pkgs/Functions
+++ b/pkgs/Functions
@@ -88,6 +88,8 @@ define DO_INSTALL
@echo "# $(PKG_NAME) - Install started"
@echo "#####################################################################"
+ -mkdir -pv $(BUILDROOT)
+
$(STAGE_INSTALL)
$(DO_INSTALL_INIT)
diff --git a/pkgs/Targets b/pkgs/Targets
index 0f2314a..95fcb38 100644
--- a/pkgs/Targets
+++ b/pkgs/Targets
@@ -42,6 +42,9 @@ package: $(if $(TOOLCHAIN),$(STAGE_DONE),$$(STAGE_PACKAGE_TARGETS))
shell: $(OBJECTS)
$(if $(STAGE_PREPARE),$(DO_PREPARE))
+prepare:
+ $(if $(STAGE_PREPARE),$(DO_PREPARE))
+
$(STAGE_DONE): $(OBJECTS)
$(if $(STAGE_PREPARE),$(DO_PREPARE))
$(if $(STAGE_BUILD),$(DO_BUILD))
diff --git a/pkgs/core/ccache/ccache.nm b/pkgs/core/ccache/ccache.nm
index 3e9c455..27dc215 100644
--- a/pkgs/core/ccache/ccache.nm
+++ b/pkgs/core/ccache/ccache.nm
@@ -45,6 +45,9 @@ endef
PKG_TARBALL = $(THISAPP).tar.gz
+# Sets ccache max size up to 2 GB
+CFLAGS += -DDEFAULT_MAXSIZE=2097152
+
CONFIGURE_OPTIONS += \
--mandir=/usr/share
diff --git a/pkgs/core/openssl/openssl.nm b/pkgs/core/openssl/openssl.nm
index 46cb5e4..00ed631 100644
--- a/pkgs/core/openssl/openssl.nm
+++ b/pkgs/core/openssl/openssl.nm
@@ -85,6 +85,7 @@ define STAGE_BUILD
shared \
zlib-dynamic \
enable-camellia \
+ enable-md2 \
enable-seed \
enable-tlsext \
enable-rfc3779 \
diff --git a/tools/chroot-shell b/tools/chroot-shell
new file mode 100755
index 0000000..e9ab9e0
--- /dev/null
+++ b/tools/chroot-shell
@@ -0,0 +1,21 @@
+#!/bin/bash
+
+cat <<EOF
+
+ You are now dropped to a chrooted shell of the package's environment.
+
+ The sources have been extracted to /usr/src and maybe there are files left
+ from a last (broken) build. Nothing of that content will be saved after
+ you left the shell.
+
+ You can leave the environment by typing "exit" or Ctrl-D.
+
+EOF
+
+# Setting nice environment
+export PS1="naoki-chroot \w> "
+
+# Change to directory the user will most likely work in
+cd /usr/src
+
+exec /bin/bash --login
diff --git a/tools/runpychecker.sh b/tools/runpychecker.sh
new file mode 100755
index 0000000..449dd9d
--- /dev/null
+++ b/tools/runpychecker.sh
@@ -0,0 +1,8 @@
+#!/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 \
+ naoki/*.py
hooks/post-receive
--
IPFire 3.x development tree