pkgmgr-kunrunic 0.1.1.dev4__tar.gz → 0.1.1.dev6__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.
Files changed (35) hide show
  1. {pkgmgr_kunrunic-0.1.1.dev4/pkgmgr_kunrunic.egg-info → pkgmgr_kunrunic-0.1.1.dev6}/PKG-INFO +1 -1
  2. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/__init__.py +1 -1
  3. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/cli.py +7 -7
  4. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/config.py +8 -0
  5. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/release.py +26 -1
  6. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6/pkgmgr_kunrunic.egg-info}/PKG-INFO +1 -1
  7. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/plugin/export_cksum.py +55 -7
  8. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/plugin/export_pkgstore.py +92 -4
  9. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/LICENSE +0 -0
  10. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/README.md +0 -0
  11. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/__main__.py +0 -0
  12. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/collectors/__init__.py +0 -0
  13. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/collectors/base.py +0 -0
  14. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/collectors/checksums.py +0 -0
  15. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/points.py +0 -0
  16. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/shell_integration.py +0 -0
  17. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/snapshot.py +0 -0
  18. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/templates/pkg.yaml.sample +0 -0
  19. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/templates/pkgmgr.yaml.sample +0 -0
  20. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr/watch.py +0 -0
  21. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr_kunrunic.egg-info/SOURCES.txt +0 -0
  22. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr_kunrunic.egg-info/dependency_links.txt +0 -0
  23. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr_kunrunic.egg-info/entry_points.txt +0 -0
  24. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr_kunrunic.egg-info/not-zip-safe +0 -0
  25. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr_kunrunic.egg-info/requires.txt +0 -0
  26. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pkgmgr_kunrunic.egg-info/top_level.txt +0 -0
  27. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/plugin/export_source_review.py +0 -0
  28. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/pyproject.toml +0 -0
  29. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/setup.cfg +0 -0
  30. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/tests/test_cli_install.py +0 -0
  31. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/tests/test_config.py +0 -0
  32. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/tests/test_progress.py +0 -0
  33. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/tests/test_release.py +0 -0
  34. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/tests/test_snapshot.py +0 -0
  35. {pkgmgr_kunrunic-0.1.1.dev4 → pkgmgr_kunrunic-0.1.1.dev6}/tools/echo_args.py +0 -0
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pkgmgr-kunrunic
3
- Version: 0.1.1.dev4
3
+ Version: 0.1.1.dev6
4
4
  Summary: Package management workflow scaffold.
5
5
  Author: pkgmgr maintainers
6
6
  License: MIT License
@@ -13,4 +13,4 @@ __all__ = [
13
13
  "points",
14
14
  ]
15
15
 
16
- __version__ = "0.1.1.dev4"
16
+ __version__ = "0.1.1.dev6"
@@ -220,24 +220,24 @@ def _handle_snapshot(args):
220
220
  def _handle_create_pkg(args):
221
221
  cfg = config.load_main(args.config)
222
222
  release.create_pkg(cfg, args.pkg_id)
223
- _run_auto_actions(cfg, "create_pkg", config_path=args.config)
223
+ _run_auto_actions(cfg, "create_pkg", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "create_pkg"})
224
224
  return 0
225
225
 
226
226
  def _handle_update_pkg(args):
227
227
  cfg = config.load_main(args.config)
228
228
  if args.release:
229
229
  release.finalize_pkg_release(cfg, args.pkg_id)
230
- _run_auto_actions(cfg, "update_pkg_release", config_path=args.config)
230
+ _run_auto_actions(cfg, "update_pkg_release", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "update_pkg_release"})
231
231
  return 0
232
232
  release.update_pkg(cfg, args.pkg_id)
233
- _run_auto_actions(cfg, "update_pkg", config_path=args.config)
233
+ _run_auto_actions(cfg, "update_pkg", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "update_pkg"})
234
234
  return 0
235
235
 
236
236
 
237
237
  def _handle_close_pkg(args):
238
238
  cfg = config.load_main(args.config)
239
239
  release.close_pkg(cfg, args.pkg_id)
240
- _run_auto_actions(cfg, "close_pkg", config_path=args.config)
240
+ _run_auto_actions(cfg, "close_pkg", config_path=args.config, context={"pkg_id": args.pkg_id, "event": "close_pkg"})
241
241
  return 0
242
242
 
243
243
 
@@ -274,16 +274,16 @@ def _handle_actions(args):
274
274
  return 0
275
275
 
276
276
 
277
- def _run_auto_actions(cfg, event, config_path=None):
277
+ def _run_auto_actions(cfg, event, config_path=None, context=None):
278
278
  auto_actions = cfg.get("auto_actions") or {}
279
279
  names = auto_actions.get(event) or []
280
280
  if not names:
281
281
  return []
282
- return release.run_actions(cfg, names, config_path=config_path)
282
+ return release.run_actions(cfg, names, config_path=config_path, context=context)
283
283
 
284
284
 
285
285
  def _print_actions(actions):
286
- ordered = sorted(actions.keys())
286
+ ordered = sorted([name for name in actions.keys() if not str(name).startswith("auto_")])
287
287
  print("[actions] available:")
288
288
  for idx, name in enumerate(ordered, 1):
289
289
  entries = actions.get(name) or []
@@ -26,6 +26,8 @@ except Exception:
26
26
 
27
27
  MAIN_TEMPLATE = """\
28
28
  pkg_release_root: ~/PKG/RELEASE
29
+ git:
30
+ repo_url: "https://github.com/org/repo"
29
31
  sources:
30
32
  - /path/to/source-A
31
33
  - /path/to/source-B
@@ -104,6 +106,7 @@ collectors:
104
106
 
105
107
  MAIN_DEFAULTS = {
106
108
  "pkg_release_root": None,
109
+ "git": {"repo_url": None},
107
110
  "sources": [],
108
111
  "source": {"exclude": []},
109
112
  "artifacts": {"root": None, "targets": [], "exclude": []},
@@ -199,6 +202,10 @@ def _validate_main_config(data):
199
202
  raise RuntimeError("pkg_release_root is required (path string)")
200
203
  cfg["pkg_release_root"] = str(pkg_root)
201
204
 
205
+ git_cfg = cfg.get("git") if isinstance(cfg.get("git"), dict) else {}
206
+ repo_url = git_cfg.get("repo_url")
207
+ cfg["git"] = {"repo_url": str(repo_url) if repo_url else None}
208
+
202
209
  cfg["sources"] = _ensure_list_of_strings(cfg.get("sources"), "sources")
203
210
  src = cfg.get("source") if isinstance(cfg.get("source"), dict) else {}
204
211
  cfg["source"] = {"exclude": _ensure_list_of_strings(src.get("exclude"), "source.exclude")}
@@ -404,5 +411,6 @@ def describe_expected_fields():
404
411
  - cwd: working directory (optional)
405
412
  - env: key/value env overrides for that command only (optional)
406
413
  auto_actions: mapping of lifecycle events to action names (create_pkg/update_pkg/update_pkg_release/close_pkg)
414
+ git.repo_url: base repository URL for commit links (per system)
407
415
  """
408
416
  ).strip()
@@ -285,7 +285,7 @@ def collect_for_pkg(cfg, pkg_id, collectors=None):
285
285
 
286
286
 
287
287
 
288
- def run_actions(cfg, names, extra_args=None, config_path=None):
288
+ def run_actions(cfg, names, extra_args=None, config_path=None, context=None):
289
289
  """Run configured actions by name. Returns result list."""
290
290
  actions = cfg.get("actions", {}) or {}
291
291
  if not names:
@@ -297,6 +297,7 @@ def run_actions(cfg, names, extra_args=None, config_path=None):
297
297
  quoted = [shlex.quote(str(arg)) for arg in extra_args]
298
298
  extra_suffix = " " + " ".join(quoted)
299
299
  results = []
300
+ context = context or {}
300
301
  for name in names:
301
302
  entries = actions.get(name)
302
303
  if not entries:
@@ -315,6 +316,9 @@ def run_actions(cfg, names, extra_args=None, config_path=None):
315
316
  if not cmd:
316
317
  print("[actions] skip empty cmd for %s #%d" % (name, idx + 1))
317
318
  continue
319
+ cmd = _render_action_value(cmd, context)
320
+ cwd = _render_action_value(cwd, context)
321
+ env = _render_action_env(env, context)
318
322
  if config_path:
319
323
  env = dict(env or {})
320
324
  env.setdefault("PKGMGR_CONFIG", config_path)
@@ -331,6 +335,24 @@ def run_actions(cfg, names, extra_args=None, config_path=None):
331
335
  return results
332
336
 
333
337
 
338
+ def _render_action_value(value, context):
339
+ if not value or not context:
340
+ return value
341
+ text = str(value)
342
+ for key, val in context.items():
343
+ text = text.replace("{%s}" % key, str(val))
344
+ return text
345
+
346
+
347
+ def _render_action_env(env, context):
348
+ if not env or not isinstance(env, dict):
349
+ return env
350
+ rendered = {}
351
+ for k, v in env.items():
352
+ rendered[k] = _render_action_value(v, context)
353
+ return rendered
354
+
355
+
334
356
  def _parse_action_entry(entry):
335
357
  if isinstance(entry, dict):
336
358
  cmd = entry.get("cmd")
@@ -1007,6 +1029,9 @@ def update_pkg(cfg, pkg_id):
1007
1029
  os.makedirs(updates_dir)
1008
1030
 
1009
1031
  git_info, git_files = _collect_git_hits(pkg_cfg, pkg_dir)
1032
+ repo_url = (cfg.get("git") or {}).get("repo_url")
1033
+ if repo_url:
1034
+ git_info["repo_url"] = repo_url
1010
1035
  release_files = _collect_release_files(pkg_dir, pkg_cfg)
1011
1036
 
1012
1037
  release_bundle = _prepare_release(pkg_dir, pkg_cfg)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: pkgmgr-kunrunic
3
- Version: 0.1.1.dev4
3
+ Version: 0.1.1.dev6
4
4
  Summary: Package management workflow scaffold.
5
5
  Author: pkgmgr maintainers
6
6
  License: MIT License
@@ -2,8 +2,10 @@
2
2
  # -*- coding: utf-8 -*-
3
3
  import argparse
4
4
  import os
5
+ import re
5
6
  import subprocess
6
7
  import sys
8
+ import time
7
9
  from copy import copy
8
10
 
9
11
  try:
@@ -96,6 +98,53 @@ def _cksum(path):
96
98
  return parts[0], parts[1], " ".join(parts[2:])
97
99
 
98
100
 
101
+ def _normalize_excel_template(excel_arg, pkg_dir):
102
+ path_template = excel_arg
103
+ if os.sep not in path_template:
104
+ export_dir = os.path.join(pkg_dir, "export")
105
+ path_template = os.path.join(export_dir, path_template)
106
+ if not path_template.lower().endswith(".xlsx"):
107
+ path_template = path_template + ".xlsx"
108
+ return path_template
109
+
110
+
111
+ def _next_version(path_template):
112
+ dir_path = os.path.dirname(path_template) or "."
113
+ name_template = os.path.basename(path_template)
114
+ regex = re.escape(name_template)
115
+ regex = regex.replace(re.escape("{YYYYMMDD}"), r"\d{8}")
116
+ regex = regex.replace(re.escape("{date}"), r"\d{8}")
117
+ regex = regex.replace(re.escape("{version}"), r"v(\d+)")
118
+ regex = "^" + regex + "$"
119
+ max_ver = 0
120
+ if os.path.isdir(dir_path):
121
+ for name in os.listdir(dir_path):
122
+ m = re.match(regex, name)
123
+ if not m:
124
+ continue
125
+ try:
126
+ ver = int(m.group(1))
127
+ except Exception:
128
+ continue
129
+ if ver > max_ver:
130
+ max_ver = ver
131
+ return max_ver + 1
132
+
133
+
134
+ def _resolve_excel_path(excel_arg, pkg_dir):
135
+ date_str = time.strftime("%Y%m%d", time.localtime())
136
+ template_path = _normalize_excel_template(excel_arg, pkg_dir)
137
+ if "{version}" in template_path:
138
+ version = _next_version(template_path)
139
+ else:
140
+ version = None
141
+ output_path = template_path
142
+ output_path = output_path.replace("{YYYYMMDD}", date_str).replace("{date}", date_str)
143
+ if version is not None:
144
+ output_path = output_path.replace("{version}", "v%d" % version)
145
+ return output_path
146
+
147
+
99
148
  def _default_styles():
100
149
  base_font = Font(name="맑은 고딕", size=11)
101
150
  bold_font = Font(name="맑은 고딕", size=11, bold=True)
@@ -262,7 +311,11 @@ def main(argv=None):
262
311
  parser = argparse.ArgumentParser(description="Export cksum results into an Excel template.")
263
312
  parser.add_argument("--config", help="pkgmgr main config path")
264
313
  parser.add_argument("--pkg-id", required=True, help="pkg id (resolved via pkg_release_root)")
265
- parser.add_argument("--excel", required=True, help="output xlsx path")
314
+ parser.add_argument(
315
+ "--excel",
316
+ required=True,
317
+ help="output xlsx path (supports {YYYYMMDD}/{date} and {version})",
318
+ )
266
319
  parser.add_argument("--template", help="xlsx template path (optional)")
267
320
  args = parser.parse_args(argv)
268
321
 
@@ -288,12 +341,7 @@ def main(argv=None):
288
341
  print("[export_cksum] no release entries found in %s" % pkg_yaml)
289
342
  return 1
290
343
 
291
- excel_path = args.excel
292
- if not excel_path.lower().endswith(".xlsx"):
293
- excel_path = excel_path + ".xlsx"
294
- if os.sep not in excel_path:
295
- export_dir = os.path.join(pkg_dir, "export")
296
- excel_path = os.path.join(export_dir, excel_path)
344
+ excel_path = _resolve_excel_path(args.excel, pkg_dir)
297
345
  template_path = args.template or excel_path
298
346
  template_available = template_path and os.path.exists(template_path)
299
347
  if template_available:
@@ -35,7 +35,14 @@ def _default_release_root():
35
35
  return os.path.join(home, "PKG", "RELEASE")
36
36
 
37
37
 
38
- def _copy_export_dirs(release_root, dest_state_root):
38
+ def _list_pkg_ids(src_state_root):
39
+ pkg_dir = os.path.join(src_state_root, "pkg")
40
+ if not os.path.isdir(pkg_dir):
41
+ return []
42
+ return sorted([name for name in os.listdir(pkg_dir) if os.path.isdir(os.path.join(pkg_dir, name))])
43
+
44
+
45
+ def _copy_export_dirs(release_root, dest_state_root, allowed_pkg_ids=None):
39
46
  if not os.path.isdir(release_root):
40
47
  return
41
48
  pkg_root = os.path.join(dest_state_root, "pkg")
@@ -45,6 +52,8 @@ def _copy_export_dirs(release_root, dest_state_root):
45
52
  pkg_dir = os.path.join(release_root, name)
46
53
  if not os.path.isdir(pkg_dir):
47
54
  continue
55
+ if allowed_pkg_ids is not None and name not in allowed_pkg_ids:
56
+ continue
48
57
  export_dir = os.path.join(pkg_dir, "export")
49
58
  if not os.path.isdir(export_dir):
50
59
  continue
@@ -52,7 +61,65 @@ def _copy_export_dirs(release_root, dest_state_root):
52
61
  _copy_tree(export_dir, dest_export)
53
62
 
54
63
 
55
- def export_pkgstore(src, dest, clean=False, release_root=None):
64
+ def _copy_release_tars(release_root, dest_state_root, allowed_pkg_ids=None):
65
+ if not os.path.isdir(release_root):
66
+ return
67
+ pkg_root = os.path.join(dest_state_root, "pkg")
68
+ if not os.path.exists(pkg_root):
69
+ os.makedirs(pkg_root)
70
+ for name in os.listdir(release_root):
71
+ pkg_dir = os.path.join(release_root, name)
72
+ if not os.path.isdir(pkg_dir):
73
+ continue
74
+ if allowed_pkg_ids is not None and name not in allowed_pkg_ids:
75
+ continue
76
+ release_dir = os.path.join(pkg_dir, "release")
77
+ if not os.path.isdir(release_dir):
78
+ continue
79
+ for base, _, files in os.walk(release_dir):
80
+ for fname in files:
81
+ if not fname.endswith(".tar"):
82
+ continue
83
+ src = os.path.join(base, fname)
84
+ rel = os.path.relpath(src, release_dir)
85
+ dest_tar = os.path.join(pkg_root, name, "release_artifacts", rel)
86
+ dest_parent = os.path.dirname(dest_tar)
87
+ if not os.path.exists(dest_parent):
88
+ os.makedirs(dest_parent)
89
+ shutil.copy2(src, dest_tar)
90
+
91
+
92
+ def _find_readme(pkg_dir):
93
+ for base, _, files in os.walk(pkg_dir):
94
+ for fname in files:
95
+ if fname.lower() == "readme.txt":
96
+ return os.path.join(base, fname)
97
+ return None
98
+
99
+
100
+ def _copy_readme_files(release_root, dest_state_root, system_name, allowed_pkg_ids=None):
101
+ if not os.path.isdir(release_root):
102
+ return
103
+ pkg_root = os.path.join(dest_state_root, "pkg")
104
+ if not os.path.exists(pkg_root):
105
+ os.makedirs(pkg_root)
106
+ for name in os.listdir(release_root):
107
+ pkg_dir = os.path.join(release_root, name)
108
+ if not os.path.isdir(pkg_dir):
109
+ continue
110
+ if allowed_pkg_ids is not None and name not in allowed_pkg_ids:
111
+ continue
112
+ candidate = _find_readme(pkg_dir)
113
+ if not candidate:
114
+ continue
115
+ dest_readme = os.path.join(pkg_root, name, "readme", "README.txt")
116
+ dest_parent = os.path.dirname(dest_readme)
117
+ if not os.path.exists(dest_parent):
118
+ os.makedirs(dest_parent)
119
+ shutil.copy2(candidate, dest_readme)
120
+
121
+
122
+ def export_pkgstore(src, dest, clean=False, release_root=None, system_name=None):
56
123
  if not os.path.isdir(src):
57
124
  raise RuntimeError("source not found: %s" % src)
58
125
  if clean and os.path.exists(dest):
@@ -61,7 +128,10 @@ def export_pkgstore(src, dest, clean=False, release_root=None):
61
128
  os.makedirs(dest)
62
129
  _copy_tree(src, dest)
63
130
  if release_root:
64
- _copy_export_dirs(release_root, dest)
131
+ allowed_pkg_ids = _list_pkg_ids(src)
132
+ _copy_export_dirs(release_root, dest, allowed_pkg_ids=allowed_pkg_ids)
133
+ _copy_release_tars(release_root, dest, allowed_pkg_ids=allowed_pkg_ids)
134
+ _copy_readme_files(release_root, dest, system_name, allowed_pkg_ids=allowed_pkg_ids)
65
135
 
66
136
 
67
137
  def main(argv=None):
@@ -74,6 +144,7 @@ def main(argv=None):
74
144
  parser.add_argument("--push", help="rsync target like user@host (pushes to remote)")
75
145
  parser.add_argument("--remote-dest", default="~/data/pkgstore", help="remote pkgstore root (default: ~/data/pkgstore)")
76
146
  parser.add_argument("--identity", help="ssh private key path for rsync (optional)")
147
+ parser.add_argument("--debug", action="store_true", help="print debug info about source contents")
77
148
  args = parser.parse_args(argv)
78
149
  if not args.dest and not args.push:
79
150
  parser.error("--dest is required when --push is not set")
@@ -92,7 +163,19 @@ def main(argv=None):
92
163
  dest_state = os.path.join(dest_root, "state")
93
164
  release_root = os.path.abspath(os.path.expanduser(args.release_root)) if args.release_root else None
94
165
 
95
- export_pkgstore(src, dest_state, clean=args.clean, release_root=release_root)
166
+ if args.debug:
167
+ try:
168
+ items = _list_pkg_ids(src)
169
+ except Exception:
170
+ items = []
171
+ print("[export_pkgstore] src=%s pkg=%s" % (src, ", ".join(items) or "-"))
172
+ export_pkgstore(
173
+ src,
174
+ dest_state,
175
+ clean=args.clean,
176
+ release_root=release_root,
177
+ system_name=system_name,
178
+ )
96
179
  print("[export_pkgstore] synced %s -> %s" % (src, dest_state))
97
180
 
98
181
  if args.push:
@@ -102,12 +185,17 @@ def main(argv=None):
102
185
  else:
103
186
  remote_state = "%s/state" % remote_root
104
187
  src_dir = dest_state.rstrip("/") + "/"
188
+ subprocess.check_call(
189
+ ["ssh", args.push, "mkdir", "-p", remote_state]
190
+ )
105
191
  rsync_cmd = ["rsync", "-avzc", "--delete"]
106
192
  if args.identity:
107
193
  rsync_cmd.extend(["-e", "ssh -i %s" % args.identity])
108
194
  rsync_cmd.extend([src_dir, "%s:%s" % (args.push, remote_state)])
109
195
  print("[export_pkgstore] rsync -> %s" % (remote_state,))
110
196
  subprocess.check_call(rsync_cmd)
197
+ else:
198
+ print("[export_pkgstore] push skipped (no --push)")
111
199
  if tmp_root:
112
200
  shutil.rmtree(tmp_root)
113
201
  return 0