Skip to content

Commit

Permalink
Update relative paths
Browse files Browse the repository at this point in the history
  • Loading branch information
Javagedes committed Jan 16, 2024
1 parent 80207cf commit e65ab9e
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions edk2toollib/database/tables/instanced_inf_table.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,6 @@ def _insert_db_rows(self, session: Session, env_id, inf_entries) -> int:
all_packages = {package.name: package for package in session.query(Package).all()}
all_repos = {(repo.name, repo.path): repo for repo in session.query(Repository).filter(Repository.path is not None).all()}
local_repo = session.query(Repository).filter_by(path = None).first()
if local_repo is None:
logging.error("Could not find local repo??")
for e in inf_entries:
# Could parse a Windows INF file, which is not a EDKII INF file
# and won't have a guid. GUIDS are required for INFs so we can
Expand All @@ -102,9 +100,10 @@ def _insert_db_rows(self, session: Session, env_id, inf_entries) -> int:
repo = package.repository
else:
def filter_search(repo: Repository):
"""Return the Repository that contains the INF file."""
if repo.path is None:
return False
return Path(e["PATH"]).is_relative_to(repo.path)
return Path(self.pathobj.WorkspacePath, repo.path).as_posix() in Path(e["FULL_PATH"]).as_posix()
repo = next(
filter(filter_search, all_repos.values()),
local_repo # Default
Expand Down Expand Up @@ -249,6 +248,7 @@ def to_posix(path):
to_return.append({
"DSC": Path(self.dsc).name,
"PATH": Path(inf).as_posix(),
"FULL_PATH": full_inf,
"GUID": infp.Dict.get("FILE_GUID", ""),
"NAME": infp.Dict["BASE_NAME"],
"LIBRARY_CLASS": library_class,
Expand Down

0 comments on commit e65ab9e

Please sign in to comment.