Index: cros_mark_as_stable.py |
diff --git a/cros_mark_as_stable.py b/cros_mark_as_stable.py |
index 7e170d2952d8bae8f0a06cdf928555831745b536..67390bec09c1ab5def3a88f4d89d08821a12f6aa 100755 |
--- a/cros_mark_as_stable.py |
+++ b/cros_mark_as_stable.py |
@@ -319,15 +319,13 @@ class EBuild(object): |
"""Sets up data about an ebuild from its path.""" |
from portage.versions import pkgsplit |
unused_path, self.category, self.pkgname, filename = path.rsplit('/', 3) |
- unused_pkgname, version_no_rev, rev = pkgsplit( |
+ unused_pkgname, self.version_no_rev, rev = pkgsplit( |
filename.replace('.ebuild', '')) |
self.ebuild_path_no_version = os.path.join( |
os.path.dirname(path), self.pkgname) |
- self.ebuild_path_no_revision = '%s-%s' % (self.ebuild_path_no_version, |
sosa
2010/12/09 19:09:04
No. This is used by cros_mark_chrome_as_stable.
|
- version_no_rev) |
self.current_revision = int(rev.replace('r', '')) |
- self.version = '%s-%s' % (version_no_rev, rev) |
+ self.version = '%s-%s' % (self.version_no_rev, rev) |
self.package = '%s/%s' % (self.category, self.pkgname) |
self.ebuild_path = path |
@@ -449,17 +447,18 @@ class EBuildStableMarker(object): |
OSError: Error occurred while creating a new ebuild. |
IOError: Error occurred while writing to the new revved ebuild file. |
Returns: |
- True if the revved package is different than the old ebuild. |
+ If the revved package is different than the old ebuild, return the full |
+ revved package name, including the version number. Otherwise, return None. |
""" |
if self._ebuild.is_stable: |
- new_stable_ebuild_path = '%s-r%d.ebuild' % ( |
- self._ebuild.ebuild_path_no_revision, |
- self._ebuild.current_revision + 1) |
+ stable_version_no_rev = self._ebuild.version_no_rev |
else: |
# If given unstable ebuild, use 0.0.1 rather than 9999. |
- new_stable_ebuild_path = '%s-0.0.1-r%d.ebuild' % ( |
- self._ebuild.ebuild_path_no_version, |
- self._ebuild.current_revision + 1) |
+ stable_version_no_rev = '0.0.1' |
sosa
2010/12/09 19:09:04
extra line
davidjames
2010/12/21 19:48:29
Looks like an artifact of rietveld -- there's no e
|
+ new_version = '%s-r%d' % (stable_version_no_rev, |
+ self._ebuild.current_revision + 1) |
+ new_stable_ebuild_path = '%s-%s.ebuild' % ( |
+ self._ebuild.ebuild_path_no_version, new_version) |
_Print('Creating new stable ebuild %s' % new_stable_ebuild_path) |
unstable_ebuild_path = ('%s-9999.ebuild' % |
@@ -475,7 +474,6 @@ class EBuildStableMarker(object): |
if 0 == RunCommand(diff_cmd, exit_code=True, redirect_stdout=True, |
redirect_stderr=True, print_cmd=gflags.FLAGS.verbose): |
os.unlink(new_stable_ebuild_path) |
diandersAtChromium
2010/12/10 23:58:54
Leave in explicit return of None?
davidjames
2010/12/21 19:48:29
Done.
|
- return False |
else: |
_Print('Adding new stable ebuild to git') |
_SimpleRunCommand('git add %s' % new_stable_ebuild_path) |
@@ -484,7 +482,7 @@ class EBuildStableMarker(object): |
_Print('Removing old ebuild from git') |
_SimpleRunCommand('git rm %s' % old_ebuild_path) |
- return True |
+ return '%s-%s' % (self._ebuild.package, new_version) |
@classmethod |
def CommitChange(cls, message): |
@@ -556,10 +554,11 @@ def main(argv): |
_Print('Working on %s' % ebuild.package) |
worker = EBuildStableMarker(ebuild) |
commit_id = ebuild.GetCommitId() |
- if worker.RevWorkOnEBuild(commit_id): |
+ new_package = worker.RevWorkOnEBuild(commit_id) |
+ if new_package: |
message = _GIT_COMMIT_MESSAGE % (ebuild.package, commit_id) |
worker.CommitChange(message) |
- revved_packages.append(ebuild.package) |
+ revved_packages.append('=%s' % new_package) |
except (OSError, IOError): |
Warning('Cannot rev %s\n' % ebuild.package, |