Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(540)

Unified Diff: cros_mark_as_stable.py

Issue 4449001: Add 0.0.1 logic to new cros_mark. (Closed) Base URL: http://git.chromium.org/git/crosutils.git@master
Patch Set: Created 10 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | cros_mark_as_stable_unittest.py » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: cros_mark_as_stable.py
diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py
index 9a3ab5221ccd69cd72296f89411ac98c389d3665..56a589c68214d2485ea7ec123a02e382a4ecfce0 100755
--- a/cros_mark_as_stable.py
+++ b/cros_mark_as_stable.py
@@ -93,8 +93,12 @@ def _BestEBuild(ebuilds):
return winner
-def _FindStableEBuilds(files):
- """Return a list of stable ebuilds from specified list of files.
+def _FindUprevCandidates(files):
+ """Return a list of uprev candidates from specified list of files.
+
+ Usually an uprev candidate is a the stable ebuild in a cros_workon directory.
+ However, if no such stable ebuild exists (someone just checked in the 9999
+ ebuild), this is the unstable ebuild.
Args:
files: List of files.
@@ -131,7 +135,8 @@ def _FindStableEBuilds(files):
if not unstable_ebuilds:
Die('Missing 9999 ebuild in %s' % os.path.dirname(path))
if not stable_ebuilds:
- Die('Missing stable ebuild in %s' % os.path.dirname(path))
+ Warning('Missing stable ebuild in %s' % os.path.dirname(path))
+ return unstable_ebuilds[0]
if stable_ebuilds:
return stable_ebuilds[0]
@@ -153,7 +158,7 @@ def _BuildEBuildDictionary(overlays, all, packages):
for package_dir, dirs, files in os.walk(overlay):
# Add stable ebuilds to overlays[overlay].
paths = [os.path.join(package_dir, path) for path in files]
- ebuild = _FindStableEBuilds(paths)
+ ebuild = _FindUprevCandidates(paths)
# If the --all option isn't used, we only want to update packages that
# are in packages.
@@ -377,8 +382,8 @@ class _EBuild(object):
else:
# Has no revision so we stripped the version number instead.
ebuild_no_version = ebuild_no_rev
- ebuild_no_rev = ebuild_path.rpartition('.ebuild')[0]
- rev_string = "0"
+ ebuild_no_rev = ebuild_path.rpartition('9999.ebuild')[0] + '0.0.1'
+ rev_string = '0'
revision = int(rev_string)
return (ebuild_no_rev, ebuild_no_version, revision)
@@ -448,8 +453,10 @@ class EBuildStableMarker(object):
_Print('Adding new stable ebuild to git')
_SimpleRunCommand('git add %s' % new_ebuild_path)
- _Print('Removing old ebuild from git')
- _SimpleRunCommand('git rm %s' % old_ebuild_path)
+ if self._ebuild.is_stable:
+ _Print('Removing old ebuild from git')
+ _SimpleRunCommand('git rm %s' % old_ebuild_path)
+
return True
def CommitChange(self, message):
« no previous file with comments | « no previous file | cros_mark_as_stable_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698