🐛 fix(thirdparty): preserve optional manifest fields
This commit is contained in:
parent
91b0ea7458
commit
33dd5bb6ba
|
|
@ -18,7 +18,7 @@ with open(sys.argv[1], encoding="utf-8") as fh:
|
|||
|
||||
for entry in data["sources"]:
|
||||
print(
|
||||
"\t".join(
|
||||
"\x1f".join(
|
||||
[
|
||||
entry["id"],
|
||||
entry["snapshot_dir"],
|
||||
|
|
@ -125,7 +125,13 @@ git checkout -B "$TARGET_BRANCH" "origin/$TARGET_BRANCH"
|
|||
|
||||
mkdir -p "codex/skills/.sources"
|
||||
|
||||
while IFS=$'\t' read -r source_id snapshot_dir sync_mode source_list skills_subdir output_name platform_config template_root data_dir scripts_dir; do
|
||||
sources_file="$tmp_dir/sources.tsv"
|
||||
if ! emit_sources_tsv > "$sources_file"; then
|
||||
echo "ERROR: failed to load third-party manifest: $MANIFEST_PATH" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
while IFS=$'\x1f' read -r source_id snapshot_dir sync_mode source_list skills_subdir output_name platform_config template_root data_dir scripts_dir; do
|
||||
[ -n "$source_id" ] || continue
|
||||
|
||||
if [ -f "$source_list" ]; then
|
||||
|
|
@ -134,10 +140,10 @@ while IFS=$'\t' read -r source_id snapshot_dir sync_mode source_list skills_subd
|
|||
rm -rf "codex/skills/$name"
|
||||
done < "$source_list"
|
||||
fi
|
||||
done < <(emit_sources_tsv)
|
||||
done < "$sources_file"
|
||||
|
||||
declare -A owners=()
|
||||
while IFS=$'\t' read -r source_id snapshot_dir sync_mode source_list skills_subdir output_name platform_config template_root data_dir scripts_dir; do
|
||||
while IFS=$'\x1f' read -r source_id snapshot_dir sync_mode source_list skills_subdir output_name platform_config template_root data_dir scripts_dir; do
|
||||
[ -n "$source_id" ] || continue
|
||||
|
||||
git archive --format=tar "origin/${THIRDPARTY_BRANCH}" "$snapshot_dir" | tar -xf - -C "$tmp_dir"
|
||||
|
|
@ -192,7 +198,7 @@ while IFS=$'\t' read -r source_id snapshot_dir sync_mode source_list skills_subd
|
|||
esac
|
||||
|
||||
printf "%s\n" "${names[@]}" | sort > "$source_list"
|
||||
done < <(emit_sources_tsv)
|
||||
done < "$sources_file"
|
||||
|
||||
git add codex/skills
|
||||
|
||||
|
|
|
|||
|
|
@ -81,7 +81,7 @@ with open(sys.argv[1], encoding="utf-8") as fh:
|
|||
|
||||
for entry in data["sources"]:
|
||||
print(
|
||||
"\t".join(
|
||||
"\x1f".join(
|
||||
[
|
||||
entry["id"],
|
||||
entry["upstream_repo"],
|
||||
|
|
@ -124,7 +124,7 @@ if ! emit_sources_tsv > "$sources_file"; then
|
|||
fi
|
||||
|
||||
changed=0
|
||||
while IFS=$'\t' read -r source_id upstream_repo upstream_ref snapshot_dir sync_mode; do
|
||||
while IFS=$'\x1f' read -r source_id upstream_repo upstream_ref snapshot_dir sync_mode; do
|
||||
[ -n "$source_id" ] || continue
|
||||
|
||||
gh_repo=""
|
||||
|
|
|
|||
|
|
@ -92,6 +92,12 @@ class ThirdpartySkillsPipelineTests(unittest.TestCase):
|
|||
text.index('git checkout -B "$TARGET_BRANCH" "origin/$TARGET_BRANCH"'),
|
||||
)
|
||||
|
||||
def test_sync_script_uses_non_whitespace_separator_for_optional_fields(self):
|
||||
text = SYNC_SCRIPT.read_text(encoding="utf-8")
|
||||
self.assertIn('"\\x1f".join(', text)
|
||||
self.assertIn("while IFS=$'\\x1f' read -r", text)
|
||||
self.assertNotIn("while IFS=$'\\t' read -r", text)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
unittest.main()
|
||||
|
|
|
|||
Loading…
Reference in New Issue