Skip to content

Commit 0d1fa94

Browse files
MK8S-25: Revert unnecessary Python buildchain changes
Revert buildchain/buildchain/targets/directory.py and repository.py to their original state. These files were modified in earlier commits to support index.html file creation, but that approach has been replaced with nginx location directives. The Python changes are no longer needed.
1 parent c4bb3c7 commit 0d1fa94

File tree

2 files changed

+1
-54
lines changed

2 files changed

+1
-54
lines changed

buildchain/buildchain/targets/directory.py

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,9 @@
44
"""Provides operations on directories."""
55

66

7-
import subprocess
87
from pathlib import Path
98
from typing import Any
109

11-
from buildchain import coreutils
1210
from buildchain import types
1311
from buildchain import utils
1412

@@ -37,7 +35,6 @@ def task(self) -> types.TaskDict:
3735
{
3836
"title": utils.title_with_target1("MKDIR"),
3937
"actions": [(self._run, [task["targets"][0]])],
40-
"clean": [self._clean_with_details],
4138
"uptodate": [True],
4239
}
4340
)
@@ -46,45 +43,3 @@ def task(self) -> types.TaskDict:
4643
@staticmethod
4744
def _run(directory: Path) -> None:
4845
directory.mkdir(exist_ok=True)
49-
50-
def _clean_with_details(self) -> None:
51-
"""Clean directory with detailed error reporting if removal fails."""
52-
directory = self.targets[0]
53-
if not directory.exists():
54-
return
55-
56-
try:
57-
# Try to remove the directory
58-
coreutils.rm_rf(directory)
59-
except Exception as exc:
60-
# If removal fails, show detailed tree view of what's still there
61-
print(f"ERROR: Cannot remove directory '{directory}' - {exc}")
62-
print("Directory contents:")
63-
try:
64-
# Use the 'tree' command if available, otherwise use 'ls -la'
65-
try:
66-
result = subprocess.run(
67-
["tree", "-a", str(directory)],
68-
capture_output=True,
69-
text=True,
70-
timeout=30,
71-
check=False,
72-
)
73-
if result.returncode == 0:
74-
print(result.stdout)
75-
else:
76-
raise subprocess.CalledProcessError(result.returncode, "tree")
77-
except (subprocess.CalledProcessError, FileNotFoundError):
78-
# Fall back to ls -la if tree is not available
79-
result = subprocess.run(
80-
["ls", "-la", str(directory)],
81-
capture_output=True,
82-
text=True,
83-
timeout=30,
84-
check=False,
85-
)
86-
print(result.stdout)
87-
except Exception as list_exc:
88-
print(f"Could not list directory contents: {list_exc}")
89-
# Re-raise the original exception
90-
raise

buildchain/buildchain/targets/repository.py

Lines changed: 1 addition & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,14 +33,13 @@
3333
import abc
3434
import operator
3535
from pathlib import Path
36-
from typing import Any, List, Optional, Sequence, Tuple
36+
from typing import Any, List, Optional, Sequence
3737

3838
from buildchain import config
3939
from buildchain import coreutils
4040
from buildchain import constants
4141
from buildchain import types
4242
from buildchain import utils
43-
from buildchain import versions
4443
from buildchain import docker_command
4544

4645
from . import base
@@ -207,13 +206,6 @@ def clean() -> None:
207206
task["file_dep"].extend([self.get_rpm_path(pkg) for pkg in self.packages])
208207
return task
209208

210-
@property
211-
def execution_plan(self) -> List[types.TaskDict]:
212-
tasks = [self.build_repo()]
213-
if self._packages:
214-
tasks.extend(self.build_packages())
215-
return tasks
216-
217209
def build_packages(self) -> List[types.TaskDict]:
218210
"""Build the RPMs from SRPMs."""
219211
tasks = [self._mkdir_repo_root(), self._mkdir_repo_arch()]

0 commit comments

Comments
 (0)