Skip to content

Commit

Permalink
Change build order
Browse files Browse the repository at this point in the history
  • Loading branch information
maccelf committed Jun 18, 2024
1 parent e842886 commit 964c220
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 8 deletions.
19 changes: 16 additions & 3 deletions alws/build_planner.py
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,9 @@ async def init_build_repos(self):
platform.id,
)
for arch in self._request_platforms_arch_list[platform.name]:
if arch == 'src':
continue

tasks.append(self.create_build_repo(platform, arch, 'rpm'))
tasks.append(
self.create_build_repo(
Expand Down Expand Up @@ -447,7 +450,10 @@ async def _add_single_project(
mock_options['definitions'] = {}
dist_taken_by_user = mock_options['definitions'].get('dist', False)
for platform in self._platforms:
for arch in self._request_platforms_arch_list[platform.name]:
arches = self._request_platforms_arch_list[platform.name]
if ref.ref_type != BuildTaskRefType.SRPM_URL:
arches.insert(0, 'src')
for arch in arches:
modules = self._modules_by_platform_arch.get(
(platform.name, arch), []
)
Expand Down Expand Up @@ -660,9 +666,16 @@ async def build_dependency_map(self):
# - All architectures should have dependencies
# between their own tasks to ensure correct build order.
all_tasks = []
priority_arches = ['src', 'i686']
for platform_task_cache in self._tasks_cache.values():
first_arch = 'i686'
first_arch_tasks = platform_task_cache.get('i686')
first_arch = None
first_arch_tasks = None
for arch in priority_arches:
first_arch_tasks = platform_task_cache.get(arch)
if first_arch_tasks:
first_arch = arch
break

if not first_arch_tasks:
first_arch = next(iter(platform_task_cache))
first_arch_tasks = platform_task_cache.get(first_arch)
Expand Down
12 changes: 10 additions & 2 deletions alws/crud/build_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -338,13 +338,21 @@ def get_repo(repo_arch, is_debug):
and build_repo.debug == is_debug
)

arch_repo = get_repo(task_arch, False)
debug_repo = get_repo(task_arch, True)
arch_repo = None
debug_repo = None
if task_arch != 'src':
arch_repo = get_repo(task_arch, False)
debug_repo = get_repo(task_arch, True)
src_repo = get_repo("src", False)
arch_packages_tasks = []
src_packages_tasks = []
debug_packages_tasks = []
for artifact in task_artifacts:
if task_arch == 'src':
if artifact.arch == "src":
src_packages_tasks.append(pulp_client.create_entity(artifact))
break
continue
if artifact.arch == "src":
if built_srpm_url is None:
src_packages_tasks.append(pulp_client.create_entity(artifact))
Expand Down
1 change: 1 addition & 0 deletions alws/crud/test.py
Original file line number Diff line number Diff line change
Expand Up @@ -179,6 +179,7 @@ async def create_test_tasks_for_build_id(db: AsyncSession, build_id: int):
select(models.BuildTask.id).where(
models.BuildTask.build_id == build_id,
models.BuildTask.status == BuildTaskStatus.COMPLETED,
models.BuildTask.arch != 'src',
)
)
)
Expand Down
12 changes: 9 additions & 3 deletions alws/routers/build_node.py
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,18 @@ async def get_task(
"email": task.build.owner.email,
},
}
supported_arches = request.supported_arches
if 'src' in request.supported_arches:
supported_arches.remove('src')
task_arch = task.arch
if task_arch == 'src':
task_arch = supported_arches[0]
for repo in itertools.chain(task.platform.repos, task.build.repos):
if repo.arch == task.arch and repo.type != "build_log":
if repo.arch == task_arch and repo.type != "build_log":
response["repositories"].append(repo)
for build in task.build.linked_builds:
for repo in build.repos:
if repo.arch == task.arch and repo.type != "build_log":
if repo.arch == task_arch and repo.type != "build_log":
response["repositories"].append(repo)
if task.build.platform_flavors:
for flavour in task.build.platform_flavors:
Expand All @@ -120,7 +126,7 @@ async def get_task(
flavour.data["definitions"]
)
for repo in flavour.repos:
if repo.arch == task.arch:
if repo.arch == task_arch:
response["repositories"].append(repo)

# TODO: Get rid of this fixes when all affected builds would be processed
Expand Down

0 comments on commit 964c220

Please sign in to comment.