22
33import debug # pyflakes:ignore
44
5+ import csv
56import datetime
67import os
78import shutil
@@ -41,8 +42,11 @@ def handle(self, *args, **options):
4142 self .stdout .write (f"Clean up { tmpdir } manually" )
4243 exit (- 1 )
4344
45+ redirects = []
4446 for item in self .get_work_items ():
45- replaced = item .title .endswith (" SUPERSEDED" ) or item .doc_time .date () == datetime .date (2007 ,7 ,30 )
47+ replaced = item .title .endswith (
48+ " SUPERSEDED"
49+ ) or item .doc_time .date () == datetime .date (2007 , 7 , 30 )
4650 title = item .title
4751 if title .endswith (" - SUPERSEDED" ):
4852 title = title [: - len (" - SUPERSEDED" )]
@@ -93,20 +97,34 @@ def handle(self, *args, **options):
9397 os .makedirs (dest .parent , exist_ok = True )
9498 shutil .copy (source , dest )
9599
100+ redirects .append (
101+ [
102+ f"www.ietf.org/about/groups/iesg/statements/{ item .slug } " ,
103+ f"https://datatracker.ietf.org/group/iesg/statements/{ name } " ,
104+ 302 ,
105+ ]
106+ )
107+
96108 shutil .rmtree (tmpdir )
109+ with open ("iesg_statement_redirects.csv" , "w" , newline = "" ) as f :
110+ csvwriter = csv .writer (f )
111+ for row in redirects :
112+ csvwriter .writerow (row )
97113
98114 def get_work_items (self ):
99- Item = namedtuple ("Item" , "doc_time source_filename title" )
115+ Item = namedtuple ("Item" , "doc_time source_filename title slug " )
100116 items = []
101117 dressed_rows = " " .join (
102118 self .cut_paste_from_www ().expandtabs (1 ).split (" " )
103119 ).split ("\n " )
120+ old_slugs = self .get_old_slugs ()
104121 # Rube-Goldberg-esque dance to deal with conflicting directions of the scrape and
105122 # what order we want the result to sort to
106123 dressed_rows .reverse ()
124+ old_slugs .reverse ()
107125 total_times_date_seen = Counter ([row .split (" " )[0 ] for row in dressed_rows ])
108126 count_date_seen_so_far = Counter ()
109- for row in dressed_rows :
127+ for row , slug in zip ( dressed_rows , old_slugs ) :
110128 date_part = row .split (" " )[0 ]
111129 title_part = row [len (date_part ) + 1 :]
112130 datetime_args = list (map (int , date_part .replace ("-0" , "-" ).split ("-" )))
@@ -120,6 +138,7 @@ def get_work_items(self):
120138 doc_time ,
121139 f"{ date_part } -{ total_times_date_seen [date_part ] - count_date_seen_so_far [date_part ]} .md" ,
122140 title_part ,
141+ slug ,
123142 )
124143 )
125144 return items
@@ -187,3 +206,69 @@ def cut_paste_from_www(self):
1872062000-11-20 A New IETF Work Area
1882072000-08-29 Guidance on Interim IETF Working Group Meetings and Conference Calls - SUPERSEDED
1892082000-08-29 IESG Guidance on the Moderation of IETF Working Group Mailing Lists"""
209+
210+ def get_old_slugs (self ):
211+ return [
212+ "support-documents" ,
213+ "interim-meetings-guidance" ,
214+ "ethertypes" ,
215+ "second-report-on-the-rfc-8989-experiment" ,
216+ "interim-meetings-guidance-2023-01-27" ,
217+ "statement-on-restricting-access" ,
218+ "handling-ballot-positions" ,
219+ "report-on-rfc8989-experiment" ,
220+ "email-addresses-ietf-domain" ,
221+ "on-inclusive-language" ,
222+ "internet-draft-authorship" ,
223+ "processing-errata-ietf-stream" ,
224+ "last-call-guidance" ,
225+ "statement-on-oppressive-exclusionary-language" ,
226+ "interim-meetings-guidance-2020-05-01" ,
227+ "meeting-photography-policy" ,
228+ "interim-meetings-guidance-2018-01-11" ,
229+ "open-source-repositories-license" ,
230+ "support-documents-2016-11-13" ,
231+ "interim-meetings-guidance-2016-02-05" ,
232+ "interim-meetings-guidance-2016-01-11" ,
233+ "maximizing-encrypted-access" ,
234+ "internet-draft-authorship-2015-06-11" ,
235+ "designating-rfcs-historic" ,
236+ "iesg-discuss-criteria" ,
237+ "writable-mib-module" ,
238+ "anti-harassment-policy" ,
239+ "ethertypes-2012-10-25" ,
240+ "internet-draft-removal" ,
241+ "designating-rfcs-historic-2011-10-20" ,
242+ "designating-rfcs-historic-2011-06-27" ,
243+ "rfc-metadata-errata" ,
244+ "document-shepherds" ,
245+ "assignable-codepoints-addresses-names" ,
246+ "nomcom-eligibility-day-passes" ,
247+ "copyright-2009-09-08" ,
248+ "reserving-resources-examples" ,
249+ "interim-meetings-guidance-2008-09-02" ,
250+ "processing-rfc-errata" ,
251+ "spam-control-2008-04-14" ,
252+ "registration-requests-uris" ,
253+ "urn-namespaces-registry" ,
254+ "off-topic-postings" ,
255+ "appeals-actions-decisions" ,
256+ "experimental-congestion-control" ,
257+ "area-director-sponsoring-documents" ,
258+ "last-call-guidance-2007-01-15" ,
259+ "normative-informative-references" ,
260+ "disruptive-posting" ,
261+ "spam-control-2006-01-09" ,
262+ "auth48" ,
263+ "syntax-format-definitions" ,
264+ "idn" ,
265+ "copyright-2002-11-27" ,
266+ "spam-control-2002-03-13" ,
267+ "design-teams" ,
268+ "formal-languages-use" ,
269+ "sub-ip-area-2001-03-21" ,
270+ "sub-ip-area-2000-11-20" ,
271+ "sub-ip-area-2000-12-06" ,
272+ "interim-meetings-guidance-2000-08-29" ,
273+ "mailing-lists-moderation" ,
274+ ]
0 commit comments