1010
1111import re
1212import os
13- import shutil
1413import sqlite3
1514import subprocess
1615import yaml
1716from collections import defaultdict
1817from pathlib import Path
1918from typing import Dict , List , Optional , Set , Union
2019from git_bdiff import GitBDiff , GitInfo
21- from get_git_sources import clone_repo , sync_repo
2220
2321
2422class SuiteData :
@@ -36,12 +34,12 @@ class SuiteData:
3634 "-v-" ,
3735 )
3836
39- def __init__ (self , suite_path = None ) -> None :
37+ def __init__ (self , suite_path : Path = None ) -> None :
4038 self .dependencies = {}
4139 self .rose_data = {}
4240 self .suite_path = suite_path
41+ self .source_root = suite_path / "share" / "source"
4342 self .task_states = {}
44- self .temp_directory = None
4543
4644 def get_um_failed_configs (self ) -> Set [str ]:
4745 """
@@ -65,7 +63,7 @@ def read_um_section(self, change: str) -> str:
6563 """
6664 Read through a UM file searching for line
6765 """
68- change = self .temp_directory / "um" / change
66+ change = self .source_root / "um" / change
6967 lines = change .read_text ()
7068 lines = lines .lower ()
7169 try :
@@ -118,7 +116,7 @@ def get_um_owners(self, filename: str) -> Dict:
118116 Read UM Code Owners file and write to a dictionary
119117 """
120118
121- fpath = self .temp_directory / "um" / filename
119+ fpath = self .source_root / "um" / filename
122120 owners_text = fpath .read_text ()
123121
124122 in_owners = False
@@ -179,7 +177,7 @@ def populate_gitbdiff(self) -> None:
179177 if not data ["gitinfo" ].is_main ():
180178 parent = "main"
181179 self .dependencies [dependency ]["gitbdiff" ] = GitBDiff (
182- repo = self .temp_directory / dependency , parent = parent
180+ repo = self .source_root / dependency , parent = parent
183181 ).files ()
184182 else :
185183 self .dependencies [dependency ]["gitbdiff" ] = []
@@ -191,23 +189,9 @@ def populate_gitinfo(self) -> None:
191189
192190 for dependency in self .dependencies :
193191 self .dependencies [dependency ]["gitinfo" ] = GitInfo (
194- self .temp_directory / dependency
192+ self .source_root / dependency
195193 )
196194
197- def clone_sources (self ) -> None :
198- """
199- Clone the sources defined in the dependencies file, to allow reading of files
200- and creation of diffs.
201- If the source is not a github url, then copy it using rsync
202- """
203-
204- for dependency , data in self .dependencies .items ():
205- loc = self .temp_directory / dependency
206- if data ["source" ].endswith (".git" ):
207- clone_repo (data ["source" ], data ["ref" ], loc )
208- else :
209- sync_repo (data ["source" ], data ["ref" ], loc )
210-
211195 def determine_primary_source (self ) -> str :
212196 """
213197 Work out what repo launched the suite based on the what sources are available in
@@ -418,9 +402,3 @@ def run_command(
418402 )
419403 if rval :
420404 return result
421-
422- def cleanup (self ) -> None :
423- """
424- Remove self.temp_directory
425- """
426- shutil .rmtree (self .temp_directory )
0 commit comments