diff options
author | Zac Medico <zmedico@gentoo.org> | 2007-12-28 10:45:06 +0000 |
---|---|---|
committer | Zac Medico <zmedico@gentoo.org> | 2007-12-28 10:45:06 +0000 |
commit | b569a9fcd6093bc5b92299dd2f034a96662a3f89 (patch) | |
tree | 0c72bb0c94da00b427845748fefff35c12150f3e | |
parent | a026a4e0c40a5b0c00ead3490ce5a100597c014d (diff) | |
download | portage-b569a9fcd6093bc5b92299dd2f034a96662a3f89.tar.gz portage-b569a9fcd6093bc5b92299dd2f034a96662a3f89.tar.bz2 portage-b569a9fcd6093bc5b92299dd2f034a96662a3f89.zip |
Minor code readablity enhancements:
* Use relative_path and full_path variables for files being checked
instead of spreading code like x+"/files/"+y all over the place.
* Use stat.S_IMODE with octal 0111 instead of hex 0x0248 in the
file.executable checks.
svn path=/main/trunk/; revision=9060
-rwxr-xr-x | bin/repoman | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/bin/repoman b/bin/repoman index d5d073b81..c4453f992 100755 --- a/bin/repoman +++ b/bin/repoman @@ -1099,9 +1099,11 @@ for x in scanlist: for y in filesdirlist: if not y.startswith("digest-"): continue - if os.stat(checkdir+"/files/"+y)[0] & 0x0248: + relative_path = os.path.join(x, "files", y) + full_path = os.path.join(repodir, relative_path) + if stat.S_IMODE(os.stat(full_path).st_mode) & 0111: stats["file.executable"] += 1 - fails["file.executable"].append(x+"/files/"+y) + fails["file.executable"].append(relative_path) mykey = catdir + "/" + y[7:] if y[7:] not in ebuildlist: @@ -1233,9 +1235,11 @@ for x in scanlist: allmasked = True for y in ebuildlist: - if os.stat(checkdir+"/"+y+".ebuild")[0] & 0x0248: + relative_path = os.path.join(x, y + ".ebuild") + full_path = os.path.join(repodir, relative_path) + if stat.S_IMODE(os.stat(full_path).st_mode) & 0111: stats["file.executable"] += 1 - fails["file.executable"].append(x+"/"+y+".ebuild") + fails["file.executable"].append(relative_path) if isCvs and y not in eadded: #ebuild not added to cvs stats["ebuild.notadded"]=stats["ebuild.notadded"]+1 @@ -1515,8 +1519,6 @@ for x in scanlist: for mybad in mybadrestrict: fails["RESTRICT.invalid"].append(x+"/"+y+".ebuild: %s" % mybad) # Syntax Checks - relative_path = os.path.join(x, y + ".ebuild") - full_path = os.path.join(repodir, relative_path) f = open(full_path, 'rb') try: for check_name, e in run_checks(f, os.stat(full_path).st_mtime): |