mirror of
https://github.com/Nikolay-Shirokov/cc-1c-skills.git
synced 2026-09-26 20:15:54 +03:00
fix(db-repo, stub-db-create): временные файлы без фиксированных имён
Списки объектов и отчёт db-repo лежали в общем временном каталоге под постоянными именами: параллельный запуск молча подменял список, по которому модель перевыгружает устаревшие исходники, а при отказе платформы навык мог напечатать отчёт предыдущего запуска. Имена получают случайный суффикс — путь и так печатается в вывод. Логи /Out базы-заглушки переехали в каталог самой базы: он уникален на запуск и удаляется вместе с ней, чужой или устаревший лог в вывод не попадёт. Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>
This commit is contained in:
co-authored by
Claude Opus 5.5
parent
eb1796ef94
commit
614206bc5c
@@ -1,4 +1,4 @@
|
||||
# db-repo v1.17 — 1C configuration repository operations
|
||||
# db-repo v1.18 — 1C configuration repository operations
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# NB: движок только 1cv8 — ibcmd работу с хранилищем не поддерживает (нет такого режима).
|
||||
<#
|
||||
@@ -754,7 +754,7 @@ function Write-ReceivedWarning {
|
||||
$owners = Get-OwnerObjects $Received
|
||||
$hasRoot = @($Received | Where-Object { ($_ -split '\.').Count -eq 1 }).Count -gt 0
|
||||
if ($owners.Count -gt 0) {
|
||||
$listPath = Join-Path ([IO.Path]::GetTempPath()) "db-repo-received.txt"
|
||||
$listPath = Join-Path ([IO.Path]::GetTempPath()) "db-repo-received-$(Get-Random).txt"
|
||||
$utf8Bom = New-Object System.Text.UTF8Encoding($true)
|
||||
[System.IO.File]::WriteAllLines($listPath, $owners, $utf8Bom)
|
||||
Write-Host "Исходники в проекте устарели по этим объектам. Перевыгрузите их ПЕРЕД правкой," -ForegroundColor Yellow
|
||||
@@ -843,7 +843,7 @@ $script:ListLimit = 20
|
||||
function Save-ObjectList {
|
||||
param([string[]]$Names, [string]$Key)
|
||||
if (-not $Key) { $Key = 'objects' }
|
||||
$path = Join-Path ([IO.Path]::GetTempPath()) "db-repo-$Key.txt"
|
||||
$path = Join-Path ([IO.Path]::GetTempPath()) "db-repo-$Key-$(Get-Random).txt"
|
||||
$utf8Bom = New-Object System.Text.UTF8Encoding($true)
|
||||
[System.IO.File]::WriteAllLines($path, $Names, $utf8Bom)
|
||||
return $path
|
||||
@@ -1102,7 +1102,7 @@ if ($WithChildren) {
|
||||
switch ($cmd) {
|
||||
'report' {
|
||||
# Отчёт печатается в вывод, поэтому путь нужен только если его хотят сохранить.
|
||||
if (-not $OutputFile) { $OutputFile = Join-Path ([IO.Path]::GetTempPath()) "db-repo-report.$ReportFormat" }
|
||||
if (-not $OutputFile) { $OutputFile = Join-Path ([IO.Path]::GetTempPath()) "db-repo-report-$(Get-Random).$ReportFormat" }
|
||||
}
|
||||
'dump-cfg' { if (-not $OutputFile) { Write-Host "Error: -OutputFile (path to the .cf file) is required for dump-cfg" -ForegroundColor Red; exit 1 } }
|
||||
'add-user' { if (-not $NewUser -or -not $Rights) { Write-Host "Error: -NewUser and -Rights are required for add-user" -ForegroundColor Red; exit 1 } }
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# db-repo v1.17 — 1C configuration repository operations
|
||||
# db-repo v1.18 — 1C configuration repository operations
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
# NB: движок только 1cv8 — ibcmd работу с хранилищем не поддерживает (нет такого режима).
|
||||
"""Работа с хранилищем конфигурации 1С.
|
||||
@@ -674,7 +674,7 @@ def print_received_warning(received):
|
||||
owners = owner_objects(received)
|
||||
has_root = any(len(n.split(".")) == 1 for n in received)
|
||||
if owners:
|
||||
list_path = os.path.join(tempfile.gettempdir(), "db-repo-received.txt")
|
||||
list_path = os.path.join(tempfile.gettempdir(), "db-repo-received-%d.txt" % random.randint(1, 2 ** 31))
|
||||
with open(list_path, "w", encoding="utf-8-sig", newline="\n") as f:
|
||||
f.write("\n".join(owners) + "\n")
|
||||
print("Исходники в проекте устарели по этим объектам. Перевыгрузите их ПЕРЕД правкой,")
|
||||
@@ -760,7 +760,7 @@ LIST_LIMIT = 20
|
||||
def save_object_list(names, key):
|
||||
if not key:
|
||||
key = "objects"
|
||||
path = os.path.join(tempfile.gettempdir(), "db-repo-%s.txt" % key)
|
||||
path = os.path.join(tempfile.gettempdir(), "db-repo-%s-%d.txt" % (key, random.randint(1, 2 ** 31)))
|
||||
with open(path, "w", encoding="utf-8-sig", newline="\n") as f:
|
||||
f.write("\n".join(names) + "\n")
|
||||
return path
|
||||
@@ -1052,7 +1052,7 @@ def main():
|
||||
|
||||
if cmd == "report" and not args.OutputFile:
|
||||
# Отчёт печатается в вывод, поэтому путь нужен только если его хотят сохранить.
|
||||
args.OutputFile = os.path.join(tempfile.gettempdir(), "db-repo-report.%s" % args.ReportFormat)
|
||||
args.OutputFile = os.path.join(tempfile.gettempdir(), "db-repo-report-%d.%s" % (random.randint(1, 2 ** 31), args.ReportFormat))
|
||||
if cmd == "dump-cfg" and not args.OutputFile:
|
||||
print("Error: -OutputFile (path to the .cf file) is required for dump-cfg")
|
||||
sys.exit(1)
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
# stub-db-create v1.13 — Create temp 1C infobase with metadata stubs for EPF/ERF build
|
||||
# stub-db-create v1.14 — Create temp 1C infobase with metadata stubs for EPF/ERF build
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
param(
|
||||
[Parameter(Mandatory)]
|
||||
@@ -1792,7 +1792,7 @@ if ($needCfg) {
|
||||
$cfgDir = Join-Path $TempBasePath "cfg"
|
||||
# LoadConfigFromFiles
|
||||
Write-Host "Loading configuration from files..."
|
||||
$loadLog = Join-Path ([IO.Path]::GetTempPath()) "stub_load_log.txt"
|
||||
$loadLog = Join-Path $TempBasePath "load_log.txt"
|
||||
$loadArgs = "DESIGNER /F`"$TempBasePath`" /LoadConfigFromFiles `"$cfgDir`" /Out `"$loadLog`" /DisableStartupDialogs" + $extraArgString
|
||||
$proc = Invoke-PlatformProcess $V8Path @($loadArgs) -PreQuoted
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
@@ -1804,7 +1804,7 @@ if ($needCfg) {
|
||||
|
||||
# UpdateDBCfg
|
||||
Write-Host "Updating database configuration..."
|
||||
$updateLog = Join-Path ([IO.Path]::GetTempPath()) "stub_update_log.txt"
|
||||
$updateLog = Join-Path $TempBasePath "update_log.txt"
|
||||
$updateArgs = "DESIGNER /F`"$TempBasePath`" /UpdateDBCfg /Out `"$updateLog`" /DisableStartupDialogs" + $extraArgString
|
||||
$proc = Invoke-PlatformProcess $V8Path @($updateArgs) -PreQuoted
|
||||
if ($proc.ExitCode -ne 0) {
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
#!/usr/bin/env python3
|
||||
# stub-db-create v1.13 — Create temp 1C infobase with metadata stubs for EPF/ERF build
|
||||
# stub-db-create v1.14 — Create temp 1C infobase with metadata stubs for EPF/ERF build
|
||||
# Source: https://github.com/Nikolay-Shirokov/cc-1c-skills
|
||||
|
||||
import argparse
|
||||
@@ -1653,7 +1653,7 @@ def main():
|
||||
cfg_dir = os.path.join(temp_base, 'cfg')
|
||||
# LoadConfigFromFiles
|
||||
print('Loading configuration from files...')
|
||||
load_log = os.path.join(tempfile.gettempdir(), 'stub_load_log.txt')
|
||||
load_log = os.path.join(temp_base, 'load_log.txt')
|
||||
result = run_v8(args.V8Path, ['DESIGNER', f'/F"{temp_base}"', '/LoadConfigFromFiles', f'"{cfg_dir}"',
|
||||
'/Out', f'"{load_log}"',
|
||||
'/DisableStartupDialogs'] + [quote_if_needed(a) for a in extra_args])
|
||||
@@ -1673,7 +1673,7 @@ def main():
|
||||
|
||||
# UpdateDBCfg
|
||||
print('Updating database configuration...')
|
||||
update_log = os.path.join(tempfile.gettempdir(), 'stub_update_log.txt')
|
||||
update_log = os.path.join(temp_base, 'update_log.txt')
|
||||
result = run_v8(args.V8Path, ['DESIGNER', f'/F"{temp_base}"', '/UpdateDBCfg', '/Out', f'"{update_log}"',
|
||||
'/DisableStartupDialogs'] + [quote_if_needed(a) for a in extra_args])
|
||||
if result.returncode != 0:
|
||||
|
||||
@@ -21,7 +21,7 @@
|
||||
"Захвачено (30):",
|
||||
"Справочник.Объект20",
|
||||
"… и ещё 10",
|
||||
"db-repo-locked.txt"
|
||||
"db-repo-locked-"
|
||||
],
|
||||
"stdoutNotContains": "Справочник.Объект21"
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user