* debian/bin/buildcheck.py

- Move from debian/bin/abicheck.py.
  - Extend to do all kind of build checks.
  - Add optional check for image size.
* debian/changelog: Update.
* debian/rules.real: Use debian/bin/buildcheck.py.

svn path=/dists/trunk/linux-2.6/; revision=12830
This commit is contained in:
Bastian Blank 2009-02-18 14:17:21 +00:00
parent 7d24d1946c
commit c4d595ff1a
3 changed files with 70 additions and 8 deletions

View File

@ -1,17 +1,21 @@
#!/usr/bin/env python
#!/usr/bin/python
import fnmatch
import sys
sys.path.append('debian/lib/python')
import fnmatch
import stat
from debian_linux.abi import *
from debian_linux.config import ConfigCoreDump
from debian_linux.debian import *
class checker(object):
def __init__(self, dir, arch, featureset, flavour):
class CheckAbi(object):
def __init__(self, config, dir, arch, featureset, flavour):
self.config = config
self.arch, self.featureset, self.flavour = arch, featureset, flavour
self.config = ConfigCoreDump(fp = file("debian/config.defines.dump"))
self.filename_new = "%s/Module.symvers" % dir
changelog = Changelog(version = VersionLinux)[0]
@ -107,6 +111,63 @@ class checker(object):
for m in ignores:
filtered.update(fnmatch.filter(all, m))
return filtered
class CheckImage(object):
def __init__(self, config, dir, arch, featureset, flavour):
self.dir = dir
self.arch, self.featureset, self.flavour = arch, featureset, flavour
self.config_entry_build = config.merge('build', arch, featureset, flavour)
self.config_entry_image = config.merge('image', arch, featureset, flavour)
def __call__(self, out):
image = self.config_entry_build.get('image-file')
if not image:
# TODO: Bail out
return 0
image = os.path.join(self.dir, image)
fail = 0
fail |= self.check_size(out, image)
return fail
def check_size(self, out, image):
value = self.config_entry_image.get('check-size')
if not value:
return 0
value = int(value)
s = os.stat(image)
if s[stat.ST_SIZE] > value:
out.write('Image too large (%d > %d)! Refusing to continue.\n' % (s[stat.ST_SIZE], value))
return 1
out.write('Image fits (%d). Continuing.\n' % value)
return 0
class Main(object):
def __init__(self, dir, arch, featureset, flavour):
self.args = dir, arch, featureset, flavour
self.config = ConfigCoreDump(fp=file("debian/config.defines.dump"))
def __call__(self):
fail = 0
for c in CheckAbi, CheckImage:
fail |= c(self.config, *self.args)(sys.stdout)
return fail
if __name__ == '__main__':
sys.exit(checker(*sys.argv[1:])(sys.stdout))
sys.exit(Main(*sys.argv[1:])())

1
debian/changelog vendored
View File

@ -95,6 +95,7 @@ linux-2.6 (2.6.28-1~experimental.1) UNRELEASED; urgency=low
[ Bastian Blank ]
* Make gcc-4.3 the default compiler. (closes: #463295)
* Add optional image size check.
-- dann frazier <dannf@debian.org> Fri, 29 Aug 2008 17:02:18 -0600

4
debian/rules.real vendored
View File

@ -145,7 +145,7 @@ $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_$(TYPE): $(STAMPS_DIR)/setu
$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_kernel-package:
cd '$(DIR)'; $(kpkg_image) build
python debian/bin/abicheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
python debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
touch '$@'
$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-s390-tape: BUILD_TARGET = image
@ -154,7 +154,7 @@ $(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain \
$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-s390-tape \
$(STAMPS_DIR)/build_$(ARCH)_$(FEATURESET)_$(FLAVOUR)_plain-xen:
+$(MAKE_CLEAN) -C '$(DIR)' $(JOBS_ARG) $(BUILD_TARGET)
python debian/bin/abicheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
python debian/bin/buildcheck.py $(DIR) $(ARCH) $(FEATURESET) $(FLAVOUR)
touch '$@'
$(STAMPS_DIR)/build-doc: SOURCE_DIR=$(BUILD_DIR)/source