sysmocom-archiver: cleanup whitespaces
This commit is contained in:
parent
12c250ece5
commit
cadbd162ed
|
@ -1,6 +1,6 @@
|
|||
# This file is used for archiving sources ,patches,and logs to tarball.
|
||||
# It also output building environment to xxx.dump.data and create xxx.diff.gz to record
|
||||
# all content in ${S} to a diff file.
|
||||
# It also output building environment to xxx.dump.data and create xxx.diff.gz to record
|
||||
# all content in ${S} to a diff file.
|
||||
|
||||
ARCHIVE_EXCLUDE_FROM ?= ".pc autom4te.cache"
|
||||
ARCHIVE_TYPE ?= "TAR SRPM"
|
||||
|
@ -12,7 +12,7 @@ def get_bb_inc(d):
|
|||
import re
|
||||
import os
|
||||
import shutil
|
||||
|
||||
|
||||
bbinc = []
|
||||
pat=re.compile('require\s*([^\s]*\.*)(.*)')
|
||||
work_dir = d.getVar('WORKDIR', True)
|
||||
|
@ -22,12 +22,12 @@ def get_bb_inc(d):
|
|||
bb_inc = os.path.join(script_logs,'bb_inc')
|
||||
bb.mkdirhier(script_logs)
|
||||
bb.mkdirhier(bb_inc)
|
||||
|
||||
|
||||
def find_file(dir,file):
|
||||
for root, dirs, files in os.walk(dir):
|
||||
if file in files:
|
||||
return os.path.join(root,file)
|
||||
|
||||
return os.path.join(root,file)
|
||||
|
||||
def get_inc (file):
|
||||
f = open(file,'r')
|
||||
for line in f.readlines():
|
||||
|
@ -58,15 +58,15 @@ def get_bb_inc(d):
|
|||
def get_series(d):
|
||||
'''copy patches and series file to a pointed directory which will be archived to tarball in ${WORKDIR}'''
|
||||
import shutil
|
||||
|
||||
|
||||
src_patches=[]
|
||||
pf = d.getVar('PF', True)
|
||||
work_dir = d.getVar('WORKDIR', True)
|
||||
s = d.getVar('S',True)
|
||||
dest = os.path.join(work_dir, pf + '-series')
|
||||
dest = os.path.join(work_dir, pf + '-series')
|
||||
shutil.rmtree(dest, ignore_errors=True)
|
||||
bb.mkdirhier(dest)
|
||||
|
||||
|
||||
src_uri = d.getVar('SRC_URI', True).split()
|
||||
fetch = bb.fetch2.Fetch(src_uri, d)
|
||||
locals = (fetch.localpath(url) for url in fetch.urls)
|
||||
|
@ -76,7 +76,7 @@ def get_series(d):
|
|||
tmp_list = src_patches
|
||||
else:
|
||||
tmp_list = src_patches[1:]
|
||||
|
||||
|
||||
for patch in tmp_list:
|
||||
try:
|
||||
shutil.copy(patch,dest)
|
||||
|
@ -94,7 +94,7 @@ def get_applying_patches(d):
|
|||
|
||||
pf = d.getVar('PF', True)
|
||||
work_dir = d.getVar('WORKDIR', True)
|
||||
dest = os.path.join(work_dir, pf + '-patches')
|
||||
dest = os.path.join(work_dir, pf + '-patches')
|
||||
shutil.rmtree(dest, ignore_errors=True)
|
||||
bb.mkdirhier(dest)
|
||||
|
||||
|
@ -137,7 +137,7 @@ def get_source_from_downloads(d,stage_name):
|
|||
def do_tarball(workdir,srcdir,tarname):
|
||||
'''tar "srcdir" under "workdir" to "tarname"'''
|
||||
import tarfile
|
||||
|
||||
|
||||
sav_dir = os.getcwd()
|
||||
os.chdir(workdir)
|
||||
if (len(os.listdir(srcdir))) != 0:
|
||||
|
@ -149,10 +149,10 @@ def do_tarball(workdir,srcdir,tarname):
|
|||
os.chdir(sav_dir)
|
||||
return tarname
|
||||
|
||||
def archive_sources_from_directory(d,stage_name):
|
||||
def archive_sources_from_directory(d,stage_name):
|
||||
'''archive sources codes tree to tarball when tarball of $P doesn't exist in $DL_DIR'''
|
||||
import shutil
|
||||
|
||||
|
||||
s = d.getVar('S',True)
|
||||
work_dir=d.getVar('WORKDIR', True)
|
||||
PF = d.getVar('PF',True)
|
||||
|
@ -220,12 +220,12 @@ def archive_logs(d,logdir,bbinc=False):
|
|||
tarname = do_tarball(work_dir,log_dir,tarname)
|
||||
if bbinc:
|
||||
shutil.rmtree(logdir, ignore_errors=True)
|
||||
return tarname
|
||||
return tarname
|
||||
|
||||
def get_licenses(d):
|
||||
'''get licenses for running .bb file'''
|
||||
licenses = d.getVar('LICENSE', 1).replace('&', '|')
|
||||
licenses = licenses.replace('(', '').replace(')', '')
|
||||
licenses = licenses.replace('(', '').replace(')', '')
|
||||
clean_licenses = ""
|
||||
for x in licenses.split():
|
||||
if x.strip() == '' or x == 'CLOSED':
|
||||
|
@ -235,12 +235,11 @@ def get_licenses(d):
|
|||
if '|' in clean_licenses:
|
||||
clean_licenses = clean_licenses.replace('|','')
|
||||
return clean_licenses
|
||||
|
||||
|
||||
def move_tarball_deploy(d,tarball_list):
|
||||
'''move tarball in location to ${DEPLOY_DIR}/sources'''
|
||||
import shutil
|
||||
|
||||
|
||||
if tarball_list is []:
|
||||
return
|
||||
target_sys = d.getVar('TARGET_SYS', True)
|
||||
|
@ -260,9 +259,9 @@ def check_archiving_type(d):
|
|||
'''check the type for archiving package('tar' or 'srpm')'''
|
||||
try:
|
||||
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() not in d.getVar('ARCHIVE_TYPE', True).split():
|
||||
raise AttributeError
|
||||
raise AttributeError
|
||||
except AttributeError:
|
||||
bb.fatal("\"SOURCE_ARCHIVE_PACKAGE_TYPE\" is \'tar\' or \'srpm\', no other types")
|
||||
bb.fatal("\"SOURCE_ARCHIVE_PACKAGE_TYPE\" is \'tar\' or \'srpm\', no other types")
|
||||
|
||||
def store_package(d,package_name):
|
||||
'''store tarbablls name to file "tar-package"'''
|
||||
|
@ -290,10 +289,10 @@ def archive_sources_patches(d,stage_name):
|
|||
'''archive sources and patches to tarball. stage_name will append strings ${stage_name} to ${PR} as middle name. for example, zlib-1.4.6-prepatch(stage_name).tar.gz '''
|
||||
import shutil
|
||||
|
||||
check_archiving_type(d)
|
||||
check_archiving_type(d)
|
||||
if not_tarball(d):
|
||||
return
|
||||
|
||||
|
||||
source_tar_name = archive_sources(d,stage_name)
|
||||
if stage_name == "prepatch":
|
||||
if d.getVar('PATCHES_ARCHIVE_WITH_SERIES',True).upper() == 'TRUE':
|
||||
|
@ -304,7 +303,7 @@ def archive_sources_patches(d,stage_name):
|
|||
bb.fatal("Please define 'PATCHES_ARCHIVE_WITH_SERIES' is strings 'True' or 'False' ")
|
||||
else:
|
||||
patch_tar_name = ''
|
||||
|
||||
|
||||
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() not in 'SRPM':
|
||||
move_tarball_deploy(d,[source_tar_name,patch_tar_name])
|
||||
else:
|
||||
|
@ -329,7 +328,7 @@ def archive_scripts_logs(d):
|
|||
tarlog = archive_logs(d,temp_dir,False)
|
||||
else:
|
||||
return
|
||||
|
||||
|
||||
if d.getVar('SOURCE_ARCHIVE_PACKAGE_TYPE', True).upper() not in 'SRPM':
|
||||
move_tarball_deploy(d,[tarlog])
|
||||
|
||||
|
@ -389,11 +388,11 @@ def create_diff_gz(d):
|
|||
shutil.copy(i, dest)
|
||||
except IOError:
|
||||
os.system('fakeroot cp -rf ' + i + " " + dest )
|
||||
|
||||
|
||||
bb.note("Creating .diff.gz in ${DEPLOY_DIR_SRC}/${P}-${PR}.diff.gz")
|
||||
cmd = "LC_ALL=C TZ=UTC0 diff --exclude-from=" + work_dir + "/temp/exclude-from-file -Naur " + s + '.org' + ' ' + s + " | gzip -c > " + diff_file
|
||||
d.setVar('DIFF', cmd + "\n")
|
||||
d.setVarFlag('DIFF', 'func', '1')
|
||||
d.setVarFlag('DIFF', 'func', '1')
|
||||
bb.build.exec_func('DIFF', d)
|
||||
shutil.rmtree(s + '.org', ignore_errors=True)
|
||||
|
||||
|
@ -417,7 +416,7 @@ python do_archive_scripts_logs(){
|
|||
archive_scripts_logs(d)
|
||||
}
|
||||
|
||||
# This function will run when user want to know what variable and functions in a running task are and also can get a diff file including
|
||||
# This function will run when user want to know what variable and functions in a running task are and also can get a diff file including
|
||||
# all content a package should include.
|
||||
python do_dumpdata_create_diff_gz(){
|
||||
dumpdata(d)
|
||||
|
|
Loading…
Reference in New Issue