From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id 8B8E458973 for ; Sun, 7 Feb 2016 18:55:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id A854321C0B7; Sun, 7 Feb 2016 18:55:32 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id BBE5E21C0B7 for ; Sun, 7 Feb 2016 18:55:31 +0000 (UTC) Received: from oystercatcher.gentoo.org (unknown [IPv6:2a01:4f8:202:4333:225:90ff:fed9:fc84]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 70669340806 for ; Sun, 7 Feb 2016 18:55:30 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by oystercatcher.gentoo.org (Postfix) with ESMTP id 354EB8F4 for ; Sun, 7 Feb 2016 18:55:28 +0000 (UTC) From: "Brian Dolbec" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "Brian Dolbec" Message-ID: <1454869979.f8198d98b7d195b0b42fecf648022fd5bcd4e4a8.dolsen@gentoo> Subject: [gentoo-commits] proj/portage:repoman commit in: pym/repoman/modules/vcs/cvs/, pym/repoman/modules/vcs/, ... X-VCS-Repository: proj/portage X-VCS-Files: pym/repoman/actions.py pym/repoman/modules/vcs/changes.py pym/repoman/modules/vcs/cvs/changes.py pym/repoman/modules/vcs/svn/changes.py X-VCS-Directories: pym/repoman/modules/vcs/ pym/repoman/modules/vcs/cvs/ pym/repoman/ pym/repoman/modules/vcs/svn/ X-VCS-Committer: dolsen X-VCS-Committer-Name: Brian Dolbec X-VCS-Revision: f8198d98b7d195b0b42fecf648022fd5bcd4e4a8 X-VCS-Branch: repoman Date: Sun, 7 Feb 2016 18:55:28 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 247f29b9-379c-4514-845c-caae334e9a14 X-Archives-Hash: b009984a3c988bf83f7cdbf13502745a commit: f8198d98b7d195b0b42fecf648022fd5bcd4e4a8 Author: Brian Dolbec gentoo org> AuthorDate: Sun Feb 7 18:32:59 2016 +0000 Commit: Brian Dolbec gentoo org> CommitDate: Sun Feb 7 18:32:59 2016 +0000 URL: https://gitweb.gentoo.org/proj/portage.git/commit/?id=f8198d98 repoman: Migrate thick_manifest to the vcs Changes classes pym/repoman/actions.py | 53 ++-------------------------------- pym/repoman/modules/vcs/changes.py | 5 ++++ pym/repoman/modules/vcs/cvs/changes.py | 19 ++++++++++++ pym/repoman/modules/vcs/svn/changes.py | 42 +++++++++++++++++++++++++++ 4 files changed, 68 insertions(+), 51 deletions(-) diff --git a/pym/repoman/actions.py b/pym/repoman/actions.py index 15a0d04..20116db 100644 --- a/pym/repoman/actions.py +++ b/pym/repoman/actions.py @@ -131,7 +131,8 @@ class Actions(object): print() elif not self.repo_settings.repo_config.thin_manifest: logging.debug("perform: Calling thick_manifest()") - self.thick_manifest(myupdates, myheaders, no_expansion, expansion) + self.vcs_settings.changes.thick_manifest(myupdates, myheaders, + no_expansion, expansion) logging.info("myupdates: %s", myupdates) logging.info("myheaders: %s", myheaders) @@ -570,56 +571,6 @@ class Actions(object): pass - def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): - if self.vcs_settings.vcs == 'cvs': - headerstring = "'\$(Header|Id).*\$'" - elif self.vcs_settings.vcs == "svn": - svn_keywords = dict((k.lower(), k) for k in [ - "Rev", - "Revision", - "LastChangedRevision", - "Date", - "LastChangedDate", - "Author", - "LastChangedBy", - "URL", - "HeadURL", - "Id", - "Header", - ]) - - for myfile in myupdates: - - # for CVS, no_expansion contains files that are excluded from expansion - if self.vcs_settings.vcs == "cvs": - if myfile in no_expansion: - continue - - # for SVN, expansion contains files that are included in expansion - elif self.vcs_settings.vcs == "svn": - if myfile not in expansion: - continue - - # Subversion keywords are case-insensitive - # in svn:keywords properties, - # but case-sensitive in contents of files. - enabled_keywords = [] - for k in expansion[myfile]: - keyword = svn_keywords.get(k.lower()) - if keyword is not None: - enabled_keywords.append(keyword) - - headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords) - - myout = repoman_getstatusoutput( - "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile))) - if myout[0] == 0: - myheaders.append(myfile) - - print("%s have headers that will change." % green(str(len(myheaders)))) - print( - "* Files with headers will" - " cause the manifests to be changed and committed separately.") def clear_attic(self, myheaders): diff --git a/pym/repoman/modules/vcs/changes.py b/pym/repoman/modules/vcs/changes.py index 76ad591..77d7dc1 100644 --- a/pym/repoman/modules/vcs/changes.py +++ b/pym/repoman/modules/vcs/changes.py @@ -69,3 +69,8 @@ class ChangesBase(object): def expansion(self): '''Override this function as needed''' return {} + + def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): + '''Create a thick manifest''' + pass + diff --git a/pym/repoman/modules/vcs/cvs/changes.py b/pym/repoman/modules/vcs/cvs/changes.py index 3ef91cc..6accd4a 100644 --- a/pym/repoman/modules/vcs/cvs/changes.py +++ b/pym/repoman/modules/vcs/cvs/changes.py @@ -41,3 +41,22 @@ class Changes(ChangesBase): return self._unadded self._unadded = portage.cvstree.findunadded(self._tree, recursive=1, basedir="./") return self._unadded + def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): + headerstring = "'\$(Header|Id).*\$'" + + for myfile in myupdates: + + # for CVS, no_expansion contains files that are excluded from expansion + if myfile in no_expansion: + continue + + myout = repoman_getstatusoutput( + "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile))) + if myout[0] == 0: + myheaders.append(myfile) + + print("%s have headers that will change." % green(str(len(myheaders)))) + print( + "* Files with headers will" + " cause the manifests to be changed and committed separately.") + diff --git a/pym/repoman/modules/vcs/svn/changes.py b/pym/repoman/modules/vcs/svn/changes.py index 9a0efbf..6b25a21 100644 --- a/pym/repoman/modules/vcs/svn/changes.py +++ b/pym/repoman/modules/vcs/svn/changes.py @@ -64,3 +64,45 @@ class Changes(ChangesBase): if elem.startswith("?") or elem.startswith("I")] del svnstatus return self._unadded + + def thick_manifest(self, myupdates, myheaders, no_expansion, expansion): + svn_keywords = dict((k.lower(), k) for k in [ + "Rev", + "Revision", + "LastChangedRevision", + "Date", + "LastChangedDate", + "Author", + "LastChangedBy", + "URL", + "HeadURL", + "Id", + "Header", + ]) + + for myfile in myupdates: + # for SVN, expansion contains files that are included in expansion + if myfile not in expansion: + continue + + # Subversion keywords are case-insensitive + # in svn:keywords properties, + # but case-sensitive in contents of files. + enabled_keywords = [] + for k in expansion[myfile]: + keyword = svn_keywords.get(k.lower()) + if keyword is not None: + enabled_keywords.append(keyword) + + headerstring = "'\$(%s).*\$'" % "|".join(enabled_keywords) + + myout = repoman_getstatusoutput( + "egrep -q %s %s" % (headerstring, portage._shell_quote(myfile))) + if myout[0] == 0: + myheaders.append(myfile) + + print("%s have headers that will change." % green(str(len(myheaders)))) + print( + "* Files with headers will" + " cause the manifests to be changed and committed separately.") +