public inbox for gentoo-portage-dev@lists.gentoo.org
 help / color / mirror / Atom feed
* [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories
@ 2014-12-13 17:33 Arfrever Frehtes Taifersar Arahesis
  2014-12-13 18:43 ` Zac Medico
  2014-12-14  7:21 ` Arfrever Frehtes Taifersar Arahesis
  0 siblings, 2 replies; 5+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2014-12-13 17:33 UTC (permalink / raw
  To: Gentoo Portage Development


[-- Attachment #1.1: Type: Text/Plain, Size: 160 bytes --]

[[[
emerge --info: Check metadata/timestamp.chk in all repositories.

1 use of deprecated PORTDIR has been deleted.
]]]

--
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: portage.patch --]
[-- Type: text/x-patch, Size: 1288 bytes --]

--- pym/_emerge/actions.py
+++ pym/_emerge/actions.py
@@ -1452,6 +1452,7 @@
 	vardb = trees[eroot]["vartree"].dbapi
 	portdb = trees[eroot]['porttree'].dbapi
 	bindb = trees[eroot]["bintree"].dbapi
+	repos = portdb.settings.repositories
 	for x in myfiles:
 		any_match = False
 		cp_exists = bool(vardb.match(x.cp))
@@ -1554,13 +1555,12 @@
 			line += ",%10d free" % (vm_info["swap.free"] // 1024,)
 		append(line)
 
-	lastSync = portage.grabfile(os.path.join(
-		settings["PORTDIR"], "metadata", "timestamp.chk"))
-	if lastSync:
-		lastSync = lastSync[0]
-	else:
-		lastSync = "Unknown"
-	append("Timestamp of tree: %s" % (lastSync,))
+	for repo in repos:
+		timestamp_file = os.path.join(repo.location, "metadata", "timestamp.chk")
+		if os.path.isfile(timestamp_file):
+			last_sync = portage.grabfile(timestamp_file)
+			if last_sync:
+				append("Timestamp of repository %s: %s" % (repo.name, last_sync[0]))
 
 	# Searching contents for the /bin/sh provider is somewhat
 	# slow. Therefore, use the basename of the symlink target
@@ -1707,7 +1707,6 @@
 		append("%s %s" % \
 			((cp + ":").ljust(cp_max_len + 1), versions))
 
-	repos = portdb.settings.repositories
 	append("Repositories:\n")
 	for repo in repos:
 		append(repo.info_string())

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories
  2014-12-13 17:33 [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories Arfrever Frehtes Taifersar Arahesis
@ 2014-12-13 18:43 ` Zac Medico
  2014-12-14  7:21 ` Arfrever Frehtes Taifersar Arahesis
  1 sibling, 0 replies; 5+ messages in thread
From: Zac Medico @ 2014-12-13 18:43 UTC (permalink / raw
  To: gentoo-portage-dev

On 12/13/2014 09:33 AM, Arfrever Frehtes Taifersar Arahesis wrote:
> [[[
> emerge --info: Check metadata/timestamp.chk in all repositories.
> 
> 1 use of deprecated PORTDIR has been deleted.
> ]]]
> 
> --
> Arfrever Frehtes Taifersar Arahesis
> 

LGTM.

However, I dislike the os.path.isfile() call, because it's a redundant
stat call. Can't we just call grabfile, and ignore any exception that it
may raise?
-- 
Thanks,
Zac


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories
  2014-12-13 17:33 [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories Arfrever Frehtes Taifersar Arahesis
  2014-12-13 18:43 ` Zac Medico
@ 2014-12-14  7:21 ` Arfrever Frehtes Taifersar Arahesis
  2014-12-14 17:57   ` Zac Medico
  2014-12-15 14:09   ` Brian Dolbec
  1 sibling, 2 replies; 5+ messages in thread
From: Arfrever Frehtes Taifersar Arahesis @ 2014-12-14  7:21 UTC (permalink / raw
  To: Gentoo Portage Development


[-- Attachment #1.1: Type: Text/Plain, Size: 197 bytes --]

New patch without os.path.isfile().

[[[
emerge --info: Check metadata/timestamp.chk in all repositories.

1 use of deprecated PORTDIR has been deleted.
]]]

--
Arfrever Frehtes Taifersar Arahesis

[-- Attachment #1.2: portage.patch --]
[-- Type: text/x-patch, Size: 1210 bytes --]

--- pym/_emerge/actions.py
+++ pym/_emerge/actions.py
@@ -1452,6 +1452,7 @@
 	vardb = trees[eroot]["vartree"].dbapi
 	portdb = trees[eroot]['porttree'].dbapi
 	bindb = trees[eroot]["bintree"].dbapi
+	repos = portdb.settings.repositories
 	for x in myfiles:
 		any_match = False
 		cp_exists = bool(vardb.match(x.cp))
@@ -1554,13 +1555,10 @@
 			line += ",%10d free" % (vm_info["swap.free"] // 1024,)
 		append(line)
 
-	lastSync = portage.grabfile(os.path.join(
-		settings["PORTDIR"], "metadata", "timestamp.chk"))
-	if lastSync:
-		lastSync = lastSync[0]
-	else:
-		lastSync = "Unknown"
-	append("Timestamp of tree: %s" % (lastSync,))
+	for repo in repos:
+		last_sync = portage.grabfile(os.path.join(repo.location, "metadata", "timestamp.chk"))
+		if last_sync:
+			append("Timestamp of repository %s: %s" % (repo.name, last_sync[0]))
 
 	# Searching contents for the /bin/sh provider is somewhat
 	# slow. Therefore, use the basename of the symlink target
@@ -1707,7 +1705,6 @@
 		append("%s %s" % \
 			((cp + ":").ljust(cp_max_len + 1), versions))
 
-	repos = portdb.settings.repositories
 	append("Repositories:\n")
 	for repo in repos:
 		append(repo.info_string())

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 819 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories
  2014-12-14  7:21 ` Arfrever Frehtes Taifersar Arahesis
@ 2014-12-14 17:57   ` Zac Medico
  2014-12-15 14:09   ` Brian Dolbec
  1 sibling, 0 replies; 5+ messages in thread
From: Zac Medico @ 2014-12-14 17:57 UTC (permalink / raw
  To: gentoo-portage-dev

On 12/13/2014 11:21 PM, Arfrever Frehtes Taifersar Arahesis wrote:
> New patch without os.path.isfile().
> 
> [[[
> emerge --info: Check metadata/timestamp.chk in all repositories.
> 
> 1 use of deprecated PORTDIR has been deleted.
> ]]]
> 
> --
> Arfrever Frehtes Taifersar Arahesis
> 

LGTM. Thanks for eliminating the os.path.isfile() call.
-- 
Thanks,
Zac


^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories
  2014-12-14  7:21 ` Arfrever Frehtes Taifersar Arahesis
  2014-12-14 17:57   ` Zac Medico
@ 2014-12-15 14:09   ` Brian Dolbec
  1 sibling, 0 replies; 5+ messages in thread
From: Brian Dolbec @ 2014-12-15 14:09 UTC (permalink / raw
  To: gentoo-portage-dev

[-- Attachment #1: Type: text/plain, Size: 385 bytes --]

On Sun, 14 Dec 2014 08:21:24 +0100
Arfrever Frehtes Taifersar Arahesis <arfrever.fta@gmail.com> wrote:

> New patch without os.path.isfile().
> 
> [[[
> emerge --info: Check metadata/timestamp.chk in all repositories.
> 
> 1 use of deprecated PORTDIR has been deleted.
> ]]]
> 
> --
> Arfrever Frehtes Taifersar Arahesis


yeah, lg, merge
-- 
Brian Dolbec <dolsen>


[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 951 bytes --]

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2014-12-15 14:10 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-12-13 17:33 [gentoo-portage-dev] [PATCH] emerge --info: Check metadata/timestamp.chk in all repositories Arfrever Frehtes Taifersar Arahesis
2014-12-13 18:43 ` Zac Medico
2014-12-14  7:21 ` Arfrever Frehtes Taifersar Arahesis
2014-12-14 17:57   ` Zac Medico
2014-12-15 14:09   ` Brian Dolbec

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox