Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 278127 - Misc portage code cleanup.
Summary: Misc portage code cleanup.
Status: RESOLVED WONTFIX
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Unclassified (show other bugs)
Hardware: All Linux
: High minor (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: Tracker
Depends on:
Blocks:
 
Reported: 2009-07-17 09:10 UTC by Alec Warner (RETIRED)
Modified: 2011-09-22 11:16 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments
replace foo,bar -> foo, bar (comma_spaces.patch,220.97 KB, patch)
2009-07-17 09:13 UTC, Alec Warner (RETIRED)
Details | Diff
"/"+x+":"+foo+".ebuild" -> "/" + x + ":" + foo + ".ebuild" (plus_spacing.patch,159.30 KB, patch)
2009-07-17 10:18 UTC, Alec Warner (RETIRED)
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Alec Warner (RETIRED) archtester gentoo-dev Security 2009-07-17 09:10:39 UTC
Feel free to smack any of these down; but they are things I've wanted to do for a while but never fiddled enough with sed to nail down.
Comment 1 Alec Warner (RETIRED) archtester gentoo-dev Security 2009-07-17 09:13:21 UTC
Created attachment 198262 [details, diff]
replace foo,bar -> foo, bar

* (foo,bar) is ugly as sin, (foo, bar) is pretty.
* so is "from portage.const import foo,bar,baz,your,mom,says,hi"
* Some lines may exceed 80 chars with this patch
* I haven't tested it yet
* More patches coming

# Replace foo,bar with foo, bar
sed -i -re 's/(,)([^ ])/\1 \2/g' $(find . -name "*.py"
Comment 2 Alec Warner (RETIRED) archtester gentoo-dev Security 2009-07-17 09:47:03 UTC
pym/portage/tests/runTests
<snip snip>
----------------------------------------------------------------------
Ran 40 tests in 0.940s

OK
Comment 3 Alec Warner (RETIRED) archtester gentoo-dev Security 2009-07-17 10:18:16 UTC
Created attachment 198279 [details, diff]
"/"+x+":"+foo+".ebuild" -> "/" + x + ":" + foo + ".ebuild"

doing all of +/*- was too destructive, so just + (the majority of the problem areas are string cats).  I am attempting to invent a regex that will transform:

foo + "bar" + baz into stringify("%sbar%s", foo, baz) which Does The Right Thing (drtr).
Comment 4 Zac Medico gentoo-dev 2009-10-09 21:59:08 UTC
(In reply to comment #1)
> # Replace foo,bar with foo, bar
> sed -i -re 's/(,)([^ ])/\1 \2/g' $(find . -name "*.py"

This regex produces a couple classes of false positive that are annoying to sort out:

@@ -1087,7 +1087,7 @@
 		return True
 
 	def get_use(self, pkgname):
-		writemsg("deprecated use of binarytree.get_use()," + \
+		writemsg("deprecated use of binarytree.get_use(), " + \
 			" use dbapi.aux_get() instead", noiselevel=-1)
 		return self.dbapi.aux_get(pkgname, ["USE"])[0].split()
 @@ -387,7 +387,7 @@
 				for x in filter(None, fields[3].replace(
 				"${ORIGIN}", os.path.dirname(obj)).replace(
 				"$ORIGIN", os.path.dirname(obj)).split(":"))])
-			needed = [x for x in fields[4].split(",") if x]
+			needed = [x for x in fields[4].split(", ") if x]
 
 			obj_key = self._obj_key(obj)
 			indexed = True
Comment 5 Sebastian Luther (few) 2011-09-20 11:37:34 UTC
Do you intend to work on that again in the future?
Comment 6 Sebastian Luther (few) 2011-09-22 11:16:09 UTC
Closing after the discussion on IRC.