Also promote wrap files.

pull/2334/head
Jussi Pakkanen 7 years ago
parent 5b9d79b902
commit 164fb9a150
  1. 17
      mesonbuild/mesonlib.py
  2. 14
      mesonbuild/wrap/wraptool.py
  3. 4
      run_unittests.py
  4. 2
      test cases/unit/13 promote/subprojects/s2/subprojects/athing.wrap

@ -901,13 +901,18 @@ def detect_subprojects(spdir_name, current_dir='', result=None):
basename = os.path.split(trial)[1]
if trial == 'packagecache':
continue
if not os.path.isdir(trial):
continue
if basename in result:
result[basename].append(trial)
append_this = True
if os.path.isdir(trial):
detect_subprojects(spdir_name, trial, result)
elif trial.endswith('.wrap') and os.path.isfile(trial):
basename = os.path.splitext(basename)[0]
else:
result[basename] = [trial]
detect_subprojects(spdir_name, trial, result)
append_this = False
if append_this:
if basename in result:
result[basename].append(trial)
else:
result[basename] = [trial]
return result
class OrderedSet(collections.MutableSet):

@ -145,11 +145,15 @@ def info(name):
print(' ', v['branch'], v['revision'])
def do_promotion(from_path, spdir_name):
sproj_name = os.path.split(from_path)[1]
outputdir = os.path.join(spdir_name, sproj_name)
if os.path.exists(outputdir):
sys.exit('Output dir %s already exists. Will not overwrite.' % outputdir)
shutil.copytree(from_path, outputdir, ignore=shutil.ignore_patterns('subprojects'))
if os.path.isfile(from_path):
assert(from_path.endswith('.wrap'))
shutil.copy(from_path, spdir_name)
elif os.path.isdir(from_path):
sproj_name = os.path.split(from_path)[1]
outputdir = os.path.join(spdir_name, sproj_name)
if os.path.exists(outputdir):
sys.exit('Output dir %s already exists. Will not overwrite.' % outputdir)
shutil.copytree(from_path, outputdir, ignore=shutil.ignore_patterns('subprojects'))
def promote(argument):
path_segment, subproject_name = os.path.split(argument)

@ -1661,6 +1661,10 @@ int main(int argc, char **argv) {
self.assertFalse(os.path.isdir(scommondir))
subprocess.check_call(self.wrap_command + ['promote', 'subprojects/s2/subprojects/scommon'], cwd=workdir)
self.assertTrue(os.path.isdir(scommondir))
promoted_wrap = os.path.join(spdir, 'athing.wrap')
self.assertFalse(os.path.isfile(promoted_wrap))
subprocess.check_call(self.wrap_command + ['promote', 'athing'], cwd=workdir)
self.assertTrue(os.path.isfile(promoted_wrap))
self.init(workdir)
self.build()

@ -0,0 +1,2 @@
The contents of this wrap file are never evaluated so they
can be anything.
Loading…
Cancel
Save