55import sys
66import urllib .request as urllib
77from collections import defaultdict
8+ from datetime import datetime
89from functools import partial
910from itertools import chain
1011from pathlib import Path
1314from pkgcheck import const as pkgcheck_const
1415from pkgcheck .addons import ArchesAddon , init_addon
1516from pkgcheck .addons .profiles import ProfileAddon
17+ from pkgcheck .addons .git import GitAddon , GitModifiedRepo
1618from pkgcheck .checks import visibility
1719from pkgcheck .scripts import argparse_actions
1820from pkgcore .ebuild .atom import atom
113115)
114116
115117ArchesAddon .mangle_argparser (bugs )
118+ GitAddon .mangle_argparser (bugs )
116119ProfileAddon .mangle_argparser (bugs )
117120
118121
@@ -199,13 +202,18 @@ def cleanup_keywords(self, repo):
199202 keywords .add ("*" )
200203
201204 def file_bug (
202- self , api_key : str , auto_cc_arches : frozenset [str ], block_bugs : list [int ], observer = None
205+ self ,
206+ api_key : str ,
207+ auto_cc_arches : frozenset [str ],
208+ block_bugs : list [int ],
209+ modified_repo : multiplex .tree ,
210+ observer = None ,
203211 ) -> int :
204212 if self .bugno is not None :
205213 return self .bugno
206214 for dep in self .edges :
207215 if dep .bugno is None :
208- dep .file_bug (api_key , auto_cc_arches , (), observer )
216+ dep .file_bug (api_key , auto_cc_arches , (), modified_repo , observer )
209217 maintainers = dict .fromkeys (
210218 maintainer .email for pkg , _ in self .pkgs for maintainer in pkg .maintainers
211219 )
@@ -219,14 +227,25 @@ def file_bug(
219227 if len (summary ) > 90 and len (self .pkgs ) > 1 :
220228 summary = f"{ self .pkgs [0 ][0 ].versioned_atom .cpvstr } and friends: stablereq"
221229
230+ description = ["Please stabilize" , "" ]
231+ if modified_repo is not None :
232+ for pkg , _ in self .pkgs :
233+ with contextlib .suppress (StopIteration ):
234+ match = next (modified_repo .itermatch (pkg .versioned_atom ))
235+ added = datetime .fromtimestamp (match .time )
236+ days_old = (datetime .today () - added ).days
237+ description .append (
238+ f" { pkg .versioned_atom .cpvstr } : no change for { days_old } days, since { added :%Y-%m-%d} "
239+ )
240+
222241 request_data = dict (
223242 Bugzilla_api_key = api_key ,
224243 product = "Gentoo Linux" ,
225244 component = "Stabilization" ,
226245 severity = "enhancement" ,
227246 version = "unspecified" ,
228247 summary = summary ,
229- description = "Please stabilize" ,
248+ description = "\n " . join ( description ). strip () ,
230249 keywords = keywords ,
231250 cf_stabilisation_atoms = "\n " .join (self .lines ()),
232251 assigned_to = maintainers [0 ],
@@ -505,8 +524,9 @@ def observe(node: GraphNode):
505524 )
506525 self .out .flush ()
507526
527+ modified_repo = init_addon (GitAddon , self .options ).cached_repo (GitModifiedRepo )
508528 for node in self .starting_nodes :
509- node .file_bug (api_key , auto_cc_arches , block_bugs , observe )
529+ node .file_bug (api_key , auto_cc_arches , block_bugs , modified_repo , observe )
510530
511531
512532def _load_from_stdin (out : Formatter , err : Formatter ):
0 commit comments