From: Ovidiu Panait Date: Fri, 15 May 2020 06:30:12 +0000 (+0300) Subject: buildman: Remove _of_#_ from results directory paths X-Git-Tag: v2020.10~139^2~14^2~13 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=7664b03ffc51fa7563969c61fa28bf656af441bd;p=platform%2Fkernel%2Fu-boot.git buildman: Remove _of_#_ from results directory paths Currently, the following scenario will rebuild the first commit even though it is not really necessary - the commit sha or the position in the patchset did not change: $ git am $ tools/buildman/buildman -P -E -W -b master mx6 $ git am $ tools/buildman/buildman -P -E -W -b master mx6 <- will rebuild the first commit as well, even though nothing has changed about it. This is due to the fact that previous results directories get removed when the number of commits change. By removing the _of_#_ part of the directory path, the commits will be rebuilt only if the commit sha or the position in the patchset changes. Also, update the testcase to reflect this change. Signed-off-by: Ovidiu Panait --- diff --git a/tools/buildman/builder.py b/tools/buildman/builder.py index f8e71de..f2756ea 100644 --- a/tools/buildman/builder.py +++ b/tools/buildman/builder.py @@ -70,12 +70,12 @@ As an example, say we are building branch 'us-net' for boards 'sandbox' and like this: us-net/ base directory - 01_of_02_g4ed4ebc_net--Add-tftp-speed-/ + 01_g4ed4ebc_net--Add-tftp-speed-/ sandbox/ u-boot.bin seaboard/ u-boot.bin - 02_of_02_g4ed4ebc_net--Check-tftp-comp/ + 02_g4ed4ebc_net--Check-tftp-comp/ sandbox/ u-boot.bin seaboard/ @@ -487,8 +487,8 @@ class Builder: commit = self.commits[commit_upto] subject = commit.subject.translate(trans_valid_chars) # See _GetOutputSpaceRemovals() which parses this name - commit_dir = ('%02d_of_%02d_g%s_%s' % (commit_upto + 1, - self.commit_count, commit.hash, subject[:20])) + commit_dir = ('%02d_g%s_%s' % (commit_upto + 1, + commit.hash, subject[:20])) elif not self.no_subdirs: commit_dir = 'current' if not commit_dir: @@ -1599,7 +1599,7 @@ class Builder: for dirname in glob.glob(os.path.join(self.base_dir, '*')): if dirname not in dir_list: leaf = dirname[len(self.base_dir) + 1:] - m = re.match('[0-9]+_of_[0-9]+_g[0-9a-f]+_.*', leaf) + m = re.match('[0-9]+_g[0-9a-f]+_.*', leaf) if m: to_remove.append(dirname) return to_remove diff --git a/tools/buildman/test.py b/tools/buildman/test.py index 40811ba..82d25cf 100644 --- a/tools/buildman/test.py +++ b/tools/buildman/test.py @@ -541,7 +541,7 @@ class TestBuild(unittest.TestCase): build.commits = self.commits build.commit_count = len(self.commits) subject = self.commits[1].subject.translate(builder.trans_valid_chars) - dirname ='/%02d_of_%02d_g%s_%s' % (2, build.commit_count, commits[1][0], + dirname ='/%02d_g%s_%s' % (2, build.commit_count, commits[1][0], subject[:20]) self.CheckDirs(build, dirname) @@ -609,9 +609,9 @@ class TestBuild(unittest.TestCase): base_dir = tempfile.mkdtemp() # Add various files that we want removed and left alone - to_remove = ['01_of_22_g0982734987_title', '102_of_222_g92bf_title', - '01_of_22_g2938abd8_title'] - to_leave = ['something_else', '01-something.patch', '01_of_22_another'] + to_remove = ['01_g0982734987_title', '102_g92bf_title', + '01_g2938abd8_title'] + to_leave = ['something_else', '01-something.patch', '01_another'] for name in to_remove + to_leave: _Touch(name)