1
0
mirror of https://gitlab.com/fdroid/fdroidserver.git synced 2024-11-14 11:00:10 +01:00

Add srclib proj.prop lines if not already there

This commit is contained in:
Daniel Martí 2013-11-17 23:20:58 +01:00
parent 60f07b49b1
commit b335759816

View File

@ -1650,7 +1650,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
name, subdir = name.split('/',1) name, subdir = name.split('/',1)
libpath = getsrclib(name+'@'+ref, srclib_dir, srclibpaths, subdir, preponly=onserver) libpath = getsrclib(name+'@'+ref, srclib_dir, srclibpaths, subdir, preponly=onserver)
srclibpaths.append((name, number, libpath)) srclibpaths.append((name, number, libpath))
place_srclib(root_dir, number, libpath) place_srclib(root_dir, int(number), libpath)
basesrclib = vcs.getsrclib() basesrclib = vcs.getsrclib()
# If one was used for the main source, add that too. # If one was used for the main source, add that too.
@ -2018,8 +2018,19 @@ def place_srclib(root_dir, number, libpath):
if not number: if not number:
return return
relpath = os.path.relpath(libpath, root_dir) relpath = os.path.relpath(libpath, root_dir)
if subprocess.call(['sed','-i', proppath = os.path.join(root_dir, 'project.properties')
's@\(android\.library\.reference\.'
+str(number)+'\)=.*@\\1='+relpath+'@', with open(proppath, "r") as o:
'project.properties'], cwd=root_dir) != 0: lines = o.readlines()
raise BuildException("Failed to place srclibs in project.properties")
with open(proppath, "w") as o:
placed = False
for line in lines:
if line.startswith('android.library.reference.%d=' % number):
o.write('android.library.reference.%d=%s\n' % (number,relpath))
placed = True
else:
o.write(line)
if not placed:
o.write('android.library.reference.%d=%s\n' % (number,relpath))