mirror of
git://git.yoctoproject.org/layerindex-web.git
synced 2025-07-19 20:59:01 +02:00
import_otherdistro: fix handling of garbage in description values
I came across several spec files in Clear Linux that has a PNG file in the description value. No idea how that got there, but avoid choking and ignore the garbage description if this happens. Signed-off-by: Paul Eggleton <paul.eggleton@linux.intel.com>
This commit is contained in:
parent
19944b2281
commit
4196ed7945
|
@ -18,6 +18,7 @@ import tempfile
|
||||||
import glob
|
import glob
|
||||||
import shutil
|
import shutil
|
||||||
import subprocess
|
import subprocess
|
||||||
|
import string
|
||||||
from distutils.version import LooseVersion
|
from distutils.version import LooseVersion
|
||||||
|
|
||||||
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
|
sys.path.insert(0, os.path.realpath(os.path.join(os.path.dirname(__file__), '..')))
|
||||||
|
@ -247,10 +248,11 @@ def update_recipe_file(path, recipe, repodir, raiseexceptions=False):
|
||||||
# We want to stop parsing the description when we hit another macro,
|
# We want to stop parsing the description when we hit another macro,
|
||||||
# but we do want to allow bracketed macro expressions within the description
|
# but we do want to allow bracketed macro expressions within the description
|
||||||
# (e.g. %{name})
|
# (e.g. %{name})
|
||||||
if line.startswith('%') and len(line) > 1 and line[1] != '{':
|
if line.startswith('%') and len(line) > 1 and line[1] != '{' and line[1].islower():
|
||||||
indesc = False
|
indesc = False
|
||||||
elif not line.startswith('#'):
|
elif not line.startswith('#'):
|
||||||
desc.append(line)
|
desc.append(line)
|
||||||
|
continue
|
||||||
|
|
||||||
if ':' in line and not line.startswith('%'):
|
if ':' in line and not line.startswith('%'):
|
||||||
key, value = line.split(':', 1)
|
key, value = line.split(':', 1)
|
||||||
|
@ -276,7 +278,11 @@ def update_recipe_file(path, recipe, repodir, raiseexceptions=False):
|
||||||
elif key.startswith('source'):
|
elif key.startswith('source'):
|
||||||
sources.append(expand(value))
|
sources.append(expand(value))
|
||||||
|
|
||||||
recipe.description = expand(' '.join(desc).rstrip())
|
if desc and desc[0][0] in string.printable:
|
||||||
|
recipe.description = expand(' '.join(desc).rstrip())
|
||||||
|
else:
|
||||||
|
logger.warning('%s: description appears to be garbage' % path)
|
||||||
|
recipe.description = ''
|
||||||
recipe.save()
|
recipe.save()
|
||||||
|
|
||||||
saved_patches = []
|
saved_patches = []
|
||||||
|
|
Loading…
Reference in New Issue
Block a user