)
return True
-def build_kernel(flavour, revision, overlay_dir, parallel_jobs='auto', distcc=False):
+def build_kernel(flavour, revision, overlay_dir, targets, parallel_jobs='auto', distcc=False):
if parallel_jobs == 'auto':
parallel_jobs = DEFAULT_PARALLEL_JOBS
else:
'--overlay-dir', '%s' %(overlay_dir),
]
# add targets
- cmd += [ 'kernel_debug', 'kernel_image', 'kernel_source', 'modules' ]
-
- if GIT_BRANCH_NAME == 'master' or GIT_BRANCH_NAME.startswith('hotfix'):
- cmd += [ 'kernel_doc' ]
+ cmd += targets
logger.info('start compile process for flavour %s revision %s' % (flavour, revision))
logger.info(
'module-assistant unpacked successfully.'
)
- kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj(GIT_BRANCH_NAME)
- kernel_persistence.update_kernel_modules_obj(kernel_revision_obj, ' '.join(extra_modules))
return True
logger.error('No git new id given')
exit(ERROR)
+ OVERLAY_DIR = options.overlay_dir or '/usr/share/kernel-package'
+
+ # add current dir to python search path
+ cmd_folder = os.path.join(os.path.abspath(OVERLAY_DIR), '..')
+ sys.path.insert(0, cmd_folder)
+ os.environ['WORKSPACE']=cmd_folder # needed by kernel_persistence
+ import kernel_persistence
+
GIT_BRANCH_NAME = (
os.environ.get('GIT_BRANCH_NAME') or options.git_branch_name
)
if not GIT_BRANCH_NAME:
- logger.error('No git branch name given')
- exit(ERROR)
+ # try to get it from persistence
+ try:
+ kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj(PB_SUITE)
+ GIT_BRANCH_NAME=kernel_revision_obj.branch
+ except:
+ logger.error('No git branch name given and no persistence for %s neither' % PB_SUITE)
+ exit(ERROR)
+ else:
+ kernel_revision_obj = kernel_persistence.get_last_kernel_revision_obj(PB_SUITE)
+ kernel_persistence.update_kernel_branch_obj(kernel_revision_obj, GIT_BRANCH_NAME))
+
REVISION = os.environ.get('REVISION') or options.revision
if not REVISION:
logger.error('No revision given')
exit(ERROR)
- OVERLAY_DIR = options.overlay_dir or '/usr/share/kernel-package'
GIT_REPO_NAME = os.path.basename(GIT_REPO_PATH)
GIT_REMOTE_BRANCH_NAME = os.path.join('origin', '%s' %(GIT_BRANCH_NAME))
logger.debug('changing dir to %s' %(GIT_TARGET_DIR))
os.chdir(GIT_TARGET_DIR)
- # add current dir to python search path
- cmd_folder = os.path.join(os.path.abspath(OVERLAY_DIR), '..')
- sys.path.insert(0, cmd_folder)
- os.environ['WORKSPACE']=cmd_folder # needed by kernel_persistence
- import kernel_persistence
-
+ if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'kernel_debug', 'kernel_image' ]):
+ exit(ERROR)
if has_extra_modules():
if not install_extra_modules():
logger.error('Error during installation of extra kernel modules')
exit(ERROR)
-
- if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR):
+ if not build_kernel(kernel_flavour, REVISION, OVERLAY_DIR, [ 'modules' ]):
exit(ERROR)
else:
try:
identifier = Column(String(255), unique=True, nullable=False)
last_version = Column(Integer, nullable=False)
branch_name = Column(String(255), nullable=False)
- pb_modules = Column(String(255), nullable=True)
def __init__(self, identifier, last_version, branch_name, pb_modules):
self.identifier = identifier
self.last_version = last_version
self.branch_name = branch_name
- self.pb_modules = pb_modules
def __repr__(self):
- return '<KernelVersion(identifier=\'%s\', last_version=\'%s\', branch_name=\'%s\', pb_modules=\'%s\')>' %(
- self.identifier, self.last_version, self.branch_name, self.pb_modules
+ return '<KernelVersion(identifier=\'%s\', last_version=\'%s\', branch_name=\'%s\')>' %(
+ self.identifier, self.last_version, self.branch_name
)
Base.metadata.create_all(engine)
-def get_last_kernel_revision_obj(branch):
+def get_last_kernel_revision_obj(persistence_identifier):
session = Session()
logger.debug('Getting kernel revision from persistence')
- if branch == 'master' or branch.startswith('hotfix'):
- persistence_identifier = 'master'
- elif branch.startswith('release'):
- persistence_identifier = 'release'
- else:
- # FIXME: feature branch handling
- persistence_identifier = 'develop'
- logger.debug('branch = %s, persistence_identifier = %s' % (branch, persistence_identifier))
-
try:
answ = session.query(KernelVersion).filter(
KernelVersion.identifier == persistence_identifier).one()
finally:
session.close()
-def update_kernel_modules_obj(kernel_version_obj, pb_modules):
+def update_kernel_branch_obj(kernel_version_obj, branch):
session = Session()
- kernel_version_obj.pb_modules = pb_modules
+ kernel_version_obj.branch_name = branch
session.add(kernel_version_obj)
try:
session.commit()
except Exception, error:
- logger.error('Some error happend while commiting pb_modules')
+ logger.error('Some error happend while commiting branch')
logger.exception(error)
return False
else: