* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/
@ 2014-06-02 6:05 Brian Dolbec
0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2014-06-02 6:05 UTC (permalink / raw
To: gentoo-commits
commit: 1369a76925496f835dd7076029926f57f9605f8a
Author: Brian Dolbec <dolsen <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 2 06:04:27 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 2 06:04:27 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=1369a769
repoman/main.py: Create FileChecks class
Move file checks code block to a new checks/directories/ module
---
pym/repoman/checks/directories/__init__.py | 0
pym/repoman/checks/directories/files.py | 77 ++++++++++++++++++++++++++++++
pym/repoman/main.py | 48 +++----------------
3 files changed, 84 insertions(+), 41 deletions(-)
diff --git a/pym/repoman/checks/directories/__init__.py b/pym/repoman/checks/directories/__init__.py
new file mode 100644
index 0000000..e69de29
diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py
new file mode 100644
index 0000000..62f6169
--- /dev/null
+++ b/pym/repoman/checks/directories/files.py
@@ -0,0 +1,77 @@
+
+'''repoman/checks/diretories/files.py
+
+'''
+
+import io
+
+from portage import _encodings, _unicode_encode
+from portage import os
+
+
+
+class FileChecks(object):
+
+ def __init__(self, qatracker, repoman_settings, repo_settings, portdb,
+ vcs_settings, vcs_new_changed):
+ '''
+ @param qatracker: QATracker instance
+ @param repoman_settings: settings instance
+ @param repo_settings: repository settings instance
+ @param portdb: portdb instance
+ '''
+ self.portdb = portdb
+ self.qatracker = qatracker
+ self.repo_settings = repo_settings
+ self.repoman_settings = repoman_settings
+ self.vcs_settings = vcs_settings
+ self.vcs_new_changed = vcs_new_changed
+
+
+ def check(self, checkdir, checkdirlist, checkdir_relative):
+ '''Checks the ebuild sources and files for errors
+
+ @param xpkg: the pacakge being checked
+ @param checkdir: string, directory path
+ @param checkdir_relative: repolevel determined path
+ '''
+ for y_file in checkdirlist:
+ index = self.repo_settings.repo_config.find_invalid_path_char(y_file)
+ if index != -1:
+ y_relative = os.path.join(checkdir_relative, y_file)
+ if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative):
+ # If the file isn't in the VCS new or changed set, then
+ # assume that it's an irrelevant temporary file (Manifest
+ # entries are not generated for file names containing
+ # prohibited characters). See bug #406877.
+ index = -1
+ if index != -1:
+ self.qatracker.add_error("file.name",
+ "%s/%s: char '%s'" % (checkdir, y_file, y_file[index]))
+
+ if not (y_file in ("ChangeLog", "metadata.xml")
+ or y_file.endswith(".ebuild")):
+ continue
+ f = None
+ try:
+ line = 1
+ f = io.open(
+ _unicode_encode(
+ os.path.join(checkdir, y_file),
+ encoding=_encodings['fs'], errors='strict'),
+ mode='r', encoding=_encodings['repo.content'])
+ for l in f:
+ line += 1
+ except UnicodeDecodeError as ue:
+ s = ue.object[:ue.start]
+ l2 = s.count("\n")
+ line += l2
+ if l2 != 0:
+ s = s[s.rfind("\n") + 1:]
+ self.qatracker.add_error("file.UTF8",
+ "%s/%s: line %i, just after: '%s'" % (checkdir, y_file, line, s))
+ finally:
+ if f is not None:
+ f.close()
+ return
+
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index ffb9929..9db52c0 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -45,6 +45,7 @@ from portage.package.ebuild.digestgen import digestgen
from portage.eapi import eapi_has_iuse_defaults, eapi_has_required_use
from repoman.argparser import parse_args
+from repoman.checks.directories.files import FileChecks
from repoman.checks.ebuilds.checks import run_checks, checks_init
from repoman.checks.ebuilds.fetches import FetchChecks
from repoman.checks.ebuilds.isebuild import IsEbuild
@@ -325,50 +326,15 @@ for xpkg in effective_scanlist:
# Sort ebuilds in ascending order for the KEYWORDS.dropped check.
ebuildlist = sorted(pkgs.values())
ebuildlist = [pkg.pf for pkg in ebuildlist]
-
- for y in checkdirlist:
- index = repo_settings.repo_config.find_invalid_path_char(y)
- if index != -1:
- y_relative = os.path.join(checkdir_relative, y)
- if vcs_settings.vcs is not None and not vcs_new_changed(y_relative):
- # If the file isn't in the VCS new or changed set, then
- # assume that it's an irrelevant temporary file (Manifest
- # entries are not generated for file names containing
- # prohibited characters). See bug #406877.
- index = -1
- if index != -1:
- qatracker.add_error("file.name",
- "%s/%s: char '%s'" % (checkdir, y, y[index]))
-
- if not (y in ("ChangeLog", "metadata.xml") or y.endswith(".ebuild")):
- continue
- f = None
- try:
- line = 1
- f = io.open(
- _unicode_encode(
- os.path.join(checkdir, y),
- encoding=_encodings['fs'], errors='strict'),
- mode='r', encoding=_encodings['repo.content'])
- for l in f:
- line += 1
- except UnicodeDecodeError as ue:
- s = ue.object[:ue.start]
- l2 = s.count("\n")
- line += l2
- if l2 != 0:
- s = s[s.rfind("\n") + 1:]
- qatracker.add_error("file.UTF8",
- "%s/%s: line %i, just after: '%s'" % (checkdir, y, line, s))
- finally:
- if f is not None:
- f.close()
-
-###############
+#######################
+ filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+ vcs_settings, vcs_new_changed)
+ filescheck.check(checkdir, checkdirlist, checkdir_relative)
+#######################
status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
status_check.check(check_ebuild_notadded)
eadded.extend(status_check.eadded)
-###############
+
#################
fetchcheck = FetchChecks(qatracker, repoman_settings, repo_settings, portdb,
vcs_settings, vcs_new_changed)
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/
@ 2014-06-02 15:01 Tom Wijsman
0 siblings, 0 replies; 3+ messages in thread
From: Tom Wijsman @ 2014-06-02 15:01 UTC (permalink / raw
To: gentoo-commits
commit: 73e780a802ba843d5778be44c81644a9f909a7bf
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 2 15:00:12 2014 +0000
Commit: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
CommitDate: Mon Jun 2 15:00:12 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=73e780a8
repoman: Fix up files check's changeset variable propagation
---
pym/repoman/checks/directories/files.py | 6 ++++--
pym/repoman/main.py | 10 ++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py
index 62f6169..71c01d0 100644
--- a/pym/repoman/checks/directories/files.py
+++ b/pym/repoman/checks/directories/files.py
@@ -28,7 +28,7 @@ class FileChecks(object):
self.vcs_new_changed = vcs_new_changed
- def check(self, checkdir, checkdirlist, checkdir_relative):
+ def check(self, checkdir, checkdirlist, checkdir_relative, changed, new):
'''Checks the ebuild sources and files for errors
@param xpkg: the pacakge being checked
@@ -39,7 +39,9 @@ class FileChecks(object):
index = self.repo_settings.repo_config.find_invalid_path_char(y_file)
if index != -1:
y_relative = os.path.join(checkdir_relative, y_file)
- if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative):
+ invcs = self.vcs_settings.vcs is not None
+ inchangeset = self.vcs_new_changed(y_relative, changed, new)
+ if invcs and not inchangeset:
# If the file isn't in the VCS new or changed set, then
# assume that it's an irrelevant temporary file (Manifest
# entries are not generated for file names containing
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index c5a6ea6..90cf85b 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -315,10 +315,6 @@ for xpkg in effective_scanlist:
ebuildlist = sorted(pkgs.values())
ebuildlist = [pkg.pf for pkg in ebuildlist]
#######################
- filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
- vcs_settings, vcs_new_changed)
- filescheck.check(checkdir, checkdirlist, checkdir_relative)
-#######################
status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
status_check.check(check_ebuild_notadded)
eadded.extend(status_check.eadded)
@@ -1220,6 +1216,12 @@ else:
print()
sys.exit(1)
+ #######################
+ filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+ vcs_settings, vcs_new_changed)
+ filescheck.check(checkdir, checkdirlist, checkdir_relative, mychanged, mynew)
+ #######################
+
# Manifests need to be regenerated after all other commits, so don't commit
# them now even if they have changed.
mymanifests = set()
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/
@ 2014-06-02 15:44 Brian Dolbec
0 siblings, 0 replies; 3+ messages in thread
From: Brian Dolbec @ 2014-06-02 15:44 UTC (permalink / raw
To: gentoo-commits
commit: 4dab973e26b91724087899e2adfdf41a6add01ca
Author: Tom Wijsman <tomwij <AT> gentoo <DOT> org>
AuthorDate: Mon Jun 2 15:00:12 2014 +0000
Commit: Brian Dolbec <brian.dolbec <AT> gmail <DOT> com>
CommitDate: Mon Jun 2 15:42:51 2014 +0000
URL: http://git.overlays.gentoo.org/gitweb/?p=proj/portage.git;a=commit;h=4dab973e
repoman: Fix up files check's changeset variable propagation
---
pym/repoman/checks/directories/files.py | 6 ++++--
pym/repoman/main.py | 10 ++++++----
2 files changed, 10 insertions(+), 6 deletions(-)
diff --git a/pym/repoman/checks/directories/files.py b/pym/repoman/checks/directories/files.py
index 62f6169..71c01d0 100644
--- a/pym/repoman/checks/directories/files.py
+++ b/pym/repoman/checks/directories/files.py
@@ -28,7 +28,7 @@ class FileChecks(object):
self.vcs_new_changed = vcs_new_changed
- def check(self, checkdir, checkdirlist, checkdir_relative):
+ def check(self, checkdir, checkdirlist, checkdir_relative, changed, new):
'''Checks the ebuild sources and files for errors
@param xpkg: the pacakge being checked
@@ -39,7 +39,9 @@ class FileChecks(object):
index = self.repo_settings.repo_config.find_invalid_path_char(y_file)
if index != -1:
y_relative = os.path.join(checkdir_relative, y_file)
- if self.vcs_settings.vcs is not None and not self.vcs_new_changed(y_relative):
+ invcs = self.vcs_settings.vcs is not None
+ inchangeset = self.vcs_new_changed(y_relative, changed, new)
+ if invcs and not inchangeset:
# If the file isn't in the VCS new or changed set, then
# assume that it's an irrelevant temporary file (Manifest
# entries are not generated for file names containing
diff --git a/pym/repoman/main.py b/pym/repoman/main.py
index dfdf6ad..4f25adb 100755
--- a/pym/repoman/main.py
+++ b/pym/repoman/main.py
@@ -313,10 +313,6 @@ for xpkg in effective_scanlist:
ebuildlist = sorted(pkgs.values())
ebuildlist = [pkg.pf for pkg in ebuildlist]
#######################
- filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
- vcs_settings, vcs_new_changed)
- filescheck.check(checkdir, checkdirlist, checkdir_relative)
-#######################
status_check = VCSStatus(vcs_settings, checkdir, checkdir_relative, xpkg, qatracker)
status_check.check(check_ebuild_notadded)
eadded.extend(status_check.eadded)
@@ -1218,6 +1214,12 @@ else:
print()
sys.exit(1)
+ #######################
+ filescheck = FileChecks(qatracker, repoman_settings, repo_settings, portdb,
+ vcs_settings, vcs_new_changed)
+ filescheck.check(checkdir, checkdirlist, checkdir_relative, mychanged, mynew)
+ #######################
+
# Manifests need to be regenerated after all other commits, so don't commit
# them now even if they have changed.
mymanifests = set()
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-02 15:44 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-06-02 15:44 [gentoo-commits] proj/portage:repoman commit in: pym/repoman/, pym/repoman/checks/directories/ Brian Dolbec
-- strict thread matches above, loose matches on Subject: below --
2014-06-02 15:01 Tom Wijsman
2014-06-02 6:05 Brian Dolbec
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox