genesis-devtools 0.2.1__tar.gz → 0.2.2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- genesis_devtools-0.2.2/ChangeLog +7 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/PKG-INFO +1 -1
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/builder/dependency.py +78 -2
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/builder/packer.py +7 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/conftest.py +20 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_dependency.py +33 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/PKG-INFO +1 -1
- genesis_devtools-0.2.2/genesis_devtools.egg-info/pbr.json +1 -0
- genesis_devtools-0.2.1/ChangeLog +0 -7
- genesis_devtools-0.2.1/genesis_devtools.egg-info/pbr.json +0 -1
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/.github/workflows/publish-to-pypi.yml +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/.github/workflows/tests.yml +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/AUTHORS +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/LICENSE +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/README.md +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/data/stands/stand-small.yaml +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/genesis.yaml +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/images/genesis_base/bootstrap.sh +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/images/genesis_base/genesis-bootstrap.service +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/images/genesis_base/genesis-root-autoresize.service +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/images/genesis_base/install_genesis_base.sh +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/images/genesis_base/root_autoresize.sh +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/backup.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/builder/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/builder/base.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/builder/builder.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/cmd/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/cmd/cli.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/constants.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/driver/base.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/driver/libvirt.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/libvirt/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/libvirt/constants.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/libvirt/libvirt.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/logger.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/debian_12/debian-12.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/debian_12/plugins.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/genesis_base/genesis-base.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/genesis_base/plugins.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/genesis_core/genesis-core.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/genesis_core/plugins.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/genesis_custom/genesis-custom.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/genesis_custom/plugins.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/ubuntu_24/plugins.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/ubuntu_24/ubuntu-24.pkr.hcl +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/stand/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/stand/models.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/__init__.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_basic.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_builder.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_packer.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/utils.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/SOURCES.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/dependency_links.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/entry_points.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/not-zip-safe +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/requires.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/top_level.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/requirements.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/setup.cfg +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/setup.py +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/test-requirements.txt +0 -0
- {genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/tox.ini +0 -0
|
@@ -75,6 +75,82 @@ class LocalPathDependency(base.AbstractDependency):
|
|
|
75
75
|
return cls(path, img_dest)
|
|
76
76
|
|
|
77
77
|
|
|
78
|
+
class LocalEnvPathDependency(base.AbstractDependency):
|
|
79
|
+
"""Local path dependency item."""
|
|
80
|
+
|
|
81
|
+
def __init__(
|
|
82
|
+
self,
|
|
83
|
+
env_path: str,
|
|
84
|
+
img_dest: str,
|
|
85
|
+
work_dir: str,
|
|
86
|
+
optional: bool = False,
|
|
87
|
+
) -> None:
|
|
88
|
+
super().__init__()
|
|
89
|
+
self._env_path = env_path
|
|
90
|
+
self._img_dest = img_dest
|
|
91
|
+
self._optional = optional
|
|
92
|
+
self._work_dir = work_dir
|
|
93
|
+
self._local_path = None
|
|
94
|
+
self._path = None
|
|
95
|
+
|
|
96
|
+
@property
|
|
97
|
+
def img_dest(self) -> str | None:
|
|
98
|
+
"""Destination for the image."""
|
|
99
|
+
return self._img_dest
|
|
100
|
+
|
|
101
|
+
@property
|
|
102
|
+
def local_path(self) -> str | None:
|
|
103
|
+
"""Local path to the dependency."""
|
|
104
|
+
return self._local_path
|
|
105
|
+
|
|
106
|
+
def fetch(self, output_dir: str) -> None:
|
|
107
|
+
"""Fetch the dependency."""
|
|
108
|
+
path = os.environ.get(self._env_path)
|
|
109
|
+
if not path or not os.path.exists(path):
|
|
110
|
+
if not self._optional:
|
|
111
|
+
raise ValueError(
|
|
112
|
+
f"Environment variable {self._env_path} not found"
|
|
113
|
+
)
|
|
114
|
+
return
|
|
115
|
+
|
|
116
|
+
self._path = path
|
|
117
|
+
|
|
118
|
+
if not os.path.isabs(path):
|
|
119
|
+
path = os.path.join(self._work_dir, path)
|
|
120
|
+
|
|
121
|
+
if os.path.isdir(path):
|
|
122
|
+
name = os.path.basename(path)
|
|
123
|
+
shutil.copytree(path, os.path.join(output_dir, name))
|
|
124
|
+
self._local_path = os.path.join(output_dir, name)
|
|
125
|
+
else:
|
|
126
|
+
shutil.copy(path, output_dir)
|
|
127
|
+
self._local_path = os.path.join(output_dir, os.path.basename(path))
|
|
128
|
+
|
|
129
|
+
def __str__(self):
|
|
130
|
+
return f"Local path -> {self._path}"
|
|
131
|
+
|
|
132
|
+
@classmethod
|
|
133
|
+
def from_config(
|
|
134
|
+
cls, dep_config: tp.Dict[str, tp.Any], work_dir: str
|
|
135
|
+
) -> "LocalEnvPathDependency":
|
|
136
|
+
"""Create a dependency item from configuration."""
|
|
137
|
+
if "path" not in dep_config or "env" not in dep_config["path"]:
|
|
138
|
+
raise ValueError(
|
|
139
|
+
"Environment variable not found in dependency configuration"
|
|
140
|
+
)
|
|
141
|
+
|
|
142
|
+
env_path = dep_config["path"]["env"]
|
|
143
|
+
optional = dep_config.get("optional", False)
|
|
144
|
+
img_dest = dep_config["dst"]
|
|
145
|
+
|
|
146
|
+
return cls(
|
|
147
|
+
env_path=env_path,
|
|
148
|
+
img_dest=img_dest,
|
|
149
|
+
optional=optional,
|
|
150
|
+
work_dir=work_dir,
|
|
151
|
+
)
|
|
152
|
+
|
|
153
|
+
|
|
78
154
|
class HttpDependency(base.AbstractDependency):
|
|
79
155
|
"""HTTP dependency item."""
|
|
80
156
|
|
|
@@ -115,7 +191,7 @@ class HttpDependency(base.AbstractDependency):
|
|
|
115
191
|
@classmethod
|
|
116
192
|
def from_config(
|
|
117
193
|
cls, dep_config: tp.Dict[str, tp.Any], work_dir: str
|
|
118
|
-
) -> "
|
|
194
|
+
) -> "HttpDependency":
|
|
119
195
|
"""Create a dependency item from configuration."""
|
|
120
196
|
if "http" not in dep_config or "src" not in dep_config["http"]:
|
|
121
197
|
raise ValueError("URL not found in dependency configuration")
|
|
@@ -170,7 +246,7 @@ class GitDependency(base.AbstractDependency):
|
|
|
170
246
|
@classmethod
|
|
171
247
|
def from_config(
|
|
172
248
|
cls, dep_config: tp.Dict[str, tp.Any], work_dir: str
|
|
173
|
-
) -> "
|
|
249
|
+
) -> "GitDependency":
|
|
174
250
|
"""Create a dependency item from configuration."""
|
|
175
251
|
if "git" not in dep_config or "src" not in dep_config["git"]:
|
|
176
252
|
raise ValueError(
|
|
@@ -136,6 +136,13 @@ class PackerBuilder(base.DummyImageBuilder):
|
|
|
136
136
|
# Data provisioners
|
|
137
137
|
provisioners = []
|
|
138
138
|
for i, dep in enumerate(deps):
|
|
139
|
+
if not dep.local_path:
|
|
140
|
+
self._logger.warn(
|
|
141
|
+
f"Dependency {dep.img_dest} has no local path "
|
|
142
|
+
"and will be skipped"
|
|
143
|
+
)
|
|
144
|
+
continue
|
|
145
|
+
|
|
139
146
|
tmp_dest = os.path.join(
|
|
140
147
|
"/tmp/", os.path.basename(dep.img_dest) + f"_{i}"
|
|
141
148
|
)
|
|
@@ -87,3 +87,23 @@ build:
|
|
|
87
87
|
"""
|
|
88
88
|
cfg = yaml.safe_load(fixture)
|
|
89
89
|
return cfg["build"]
|
|
90
|
+
|
|
91
|
+
|
|
92
|
+
@pytest.fixture
|
|
93
|
+
def build_env_config() -> tp.Dict[str, tp.Any]:
|
|
94
|
+
fixture = """
|
|
95
|
+
build:
|
|
96
|
+
deps:
|
|
97
|
+
- dst: /opt/genesis_devtools
|
|
98
|
+
optional: false
|
|
99
|
+
path:
|
|
100
|
+
env: PATH_FROM_ENV
|
|
101
|
+
elements:
|
|
102
|
+
- images:
|
|
103
|
+
- name: genesis-core
|
|
104
|
+
format: raw
|
|
105
|
+
profile: ubuntu_24
|
|
106
|
+
script: images/install.sh
|
|
107
|
+
"""
|
|
108
|
+
cfg = yaml.safe_load(fixture)
|
|
109
|
+
return cfg["build"]
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_dependency.py
RENAMED
|
@@ -113,3 +113,36 @@ class TestDependency:
|
|
|
113
113
|
assert os.path.exists("/tmp/___deps_dir/genesis_templates")
|
|
114
114
|
finally:
|
|
115
115
|
shutil.rmtree("/tmp/___deps_dir")
|
|
116
|
+
|
|
117
|
+
def test_env_path_from_config(
|
|
118
|
+
self, build_env_config: tp.Dict[str, tp.Any]
|
|
119
|
+
) -> None:
|
|
120
|
+
work_dir = "/tmp/work_dir"
|
|
121
|
+
dep = deps.LocalEnvPathDependency.from_config(
|
|
122
|
+
build_env_config["deps"][0],
|
|
123
|
+
work_dir,
|
|
124
|
+
)
|
|
125
|
+
|
|
126
|
+
assert dep.img_dest == "/opt/genesis_devtools"
|
|
127
|
+
assert dep._env_path == "PATH_FROM_ENV"
|
|
128
|
+
assert dep.local_path is None
|
|
129
|
+
|
|
130
|
+
def test_env_path_fetch(
|
|
131
|
+
self, build_env_config: tp.Dict[str, tp.Any]
|
|
132
|
+
) -> None:
|
|
133
|
+
os.makedirs("/tmp/genesis_core_test_dir", exist_ok=True)
|
|
134
|
+
os.environ["PATH_FROM_ENV"] = "/tmp/genesis_core_test_dir"
|
|
135
|
+
|
|
136
|
+
dep = deps.LocalEnvPathDependency.from_config(
|
|
137
|
+
build_env_config["deps"][0],
|
|
138
|
+
"/tmp",
|
|
139
|
+
)
|
|
140
|
+
|
|
141
|
+
os.makedirs("/tmp/___deps_dir", exist_ok=True)
|
|
142
|
+
dep.fetch("/tmp/___deps_dir")
|
|
143
|
+
|
|
144
|
+
try:
|
|
145
|
+
assert os.path.exists("/tmp/___deps_dir/genesis_core_test_dir")
|
|
146
|
+
finally:
|
|
147
|
+
shutil.rmtree("/tmp/genesis_core_test_dir")
|
|
148
|
+
shutil.rmtree("/tmp/___deps_dir")
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"git_version": "790bb67", "is_release": false}
|
genesis_devtools-0.2.1/ChangeLog
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"git_version": "714f58f", "is_release": false}
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis/images/genesis_base/root_autoresize.sh
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/libvirt/__init__.py
RENAMED
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/infra/libvirt/constants.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/debian_12/plugins.pkr.hcl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/packer/ubuntu_24/plugins.pkr.hcl
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_builder.py
RENAMED
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools/tests/unit/test_packer.py
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/dependency_links.txt
RENAMED
|
File without changes
|
{genesis_devtools-0.2.1 → genesis_devtools-0.2.2}/genesis_devtools.egg-info/entry_points.txt
RENAMED
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|
|
File without changes
|