235
235
self.display(self.__doc__)
236
236
raise QueueActionError(extended_info)
238
def _makeTag(self, queue_item):
239
"""Compose an upload type tag for `queue_item`.
241
A source upload without binaries is tagged as "S-".
242
A binary upload without source is tagged as "-B."
243
An upload with both source and binaries is tagged as "SB".
244
An upload with a package copy job is tagged as "X-".
246
# XXX cprov 2006-07-31: source_tag and build_tag ('S' & 'B')
247
# are necessary simply to keep the format legaxy.
248
# We may discuss a more reasonable output format later
249
# and avoid extra boring code. The IDRQ.displayname should
250
# do should be enough.
251
if queue_item.package_copy_job is not None:
263
source_tag[bool(queue_item.contains_source)] +
264
binary_tag[bool(queue_item.contains_build)])
238
266
def displayItem(self, queue_item):
239
267
"""Display one line summary of the queue item provided."""
268
tag = self._makeTag(queue_item)
242
269
displayname = queue_item.displayname
243
270
version = queue_item.displayversion
244
271
age = DurationFormatterAPI(
245
272
datetime.now(pytz.timezone('UTC')) -
246
273
queue_item.date_created).approximateduration()
248
# XXX cprov 2006-07-31: source_tag and build_tag ('S' & 'B')
249
# are necessary simply to keep the format legaxy.
250
# We may discuss a more reasonable output format later
251
# and avoid extra boring code. The IDRQ.displayname should
252
# do should be enough.
253
if queue_item.contains_source:
255
275
if queue_item.contains_build:
257
276
displayname = "%s (%s)" % (queue_item.displayname,
258
277
queue_item.displayarchs)
260
self.display("%8d | %s%s | %s | %s | %s" %
261
(queue_item.id, source_tag, build_tag,
262
displayname.ljust(20)[:20], version.ljust(20)[:20],
279
self.display("%8d | %s | %s | %s | %s" %
280
(queue_item.id, tag, displayname.ljust(20)[:20],
281
version.ljust(20)[:20], age))
265
283
def displayInfo(self, queue_item, only=None):
266
284
"""Displays additional information about the provided queue item.