Preserve fuel bucket and sapling origin metadata
This commit is contained in:
parent
1a9d281d18
commit
5ff7eca20b
1 changed files with 237 additions and 0 deletions
45
tools/plugin_item_origin.py
Normal file
45
tools/plugin_item_origin.py
Normal file
|
|
@ -0,0 +1,45 @@
|
|||
"""Assemble the item-origin fix onto an exact retained Wild Update JARVIS archive."""
|
||||
import argparse
|
||||
from pathlib import Path
|
||||
|
||||
from plugin_wild_update import digest, read_archive, write_archive
|
||||
|
||||
ROOT = "com/dunerealms/jarvis/"
|
||||
ENTRIES = {
|
||||
ROOT + "ItemOriginRemainders.class",
|
||||
ROOT + "ItemOriginRemainders$Burn.class",
|
||||
ROOT + "QuestObservations.class",
|
||||
}
|
||||
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description=__doc__)
|
||||
commands = parser.add_subparsers(dest="action", required=True)
|
||||
pack = commands.add_parser("extract")
|
||||
pack.add_argument("built", type=Path)
|
||||
pack.add_argument("output", type=Path)
|
||||
install = commands.add_parser("assemble")
|
||||
install.add_argument("baseline", type=Path)
|
||||
install.add_argument("baseline_sha")
|
||||
install.add_argument("patch", type=Path)
|
||||
install.add_argument("patch_sha")
|
||||
install.add_argument("output", type=Path)
|
||||
args = parser.parse_args()
|
||||
if args.action == "extract":
|
||||
compiled = read_archive(args.built.read_bytes())
|
||||
result = write_archive({name: compiled[name] for name in ENTRIES})
|
||||
else:
|
||||
baseline, patch = args.baseline.read_bytes(), args.patch.read_bytes()
|
||||
if digest(baseline) != args.baseline_sha or digest(patch) != args.patch_sha:
|
||||
raise ValueError("Unexpected baseline or provenance overlay")
|
||||
retained, overlay = read_archive(baseline), read_archive(patch)
|
||||
if overlay.keys() != ENTRIES or ROOT + "QuestLoginSettle.class" not in retained:
|
||||
raise ValueError("Expected the three provenance classes and retained Wild Update login hooks")
|
||||
result = write_archive(retained | overlay)
|
||||
with args.output.open("xb") as target:
|
||||
target.write(result)
|
||||
print(digest(result))
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Loading…
Reference in a new issue

Staff