Matthias Andreas Benkard | a1e8443 | 2023-12-05 21:12:16 +0100 | [diff] [blame] | 1 | // SPDX-FileCopyrightText: © 2023 Matthias Andreas Benkard <code@mail.matthias.benkard.de> |
| 2 | // |
| 3 | // SPDX-License-Identifier: GPL-3.0-or-later |
| 4 | |
| 5 | package eu.mulk.jgvariant.tool; |
| 6 | |
| 7 | import static java.util.logging.Level.WARNING; |
| 8 | |
| 9 | import java.util.logging.Logger; |
| 10 | import picocli.CommandLine; |
| 11 | |
| 12 | /** |
| 13 | * A command line tool to read and manipulate GVariant-formatted files. |
| 14 | * |
Matthias Andreas Benkard | 6146428 | 2024-03-02 13:50:21 +0100 | [diff] [blame] | 15 | * <p>Implements a tool called {@code jgvariant} that can be used to manipulate GVariant-formatted |
| 16 | * files from the command line. |
Matthias Andreas Benkard | 716fc32 | 2023-12-12 19:13:01 +0100 | [diff] [blame] | 17 | * |
Matthias Andreas Benkard | a1e8443 | 2023-12-05 21:12:16 +0100 | [diff] [blame] | 18 | * <p>Also provides ways to manipulate OSTree repositories. |
Matthias Andreas Benkard | 716fc32 | 2023-12-12 19:13:01 +0100 | [diff] [blame] | 19 | * |
Matthias Andreas Benkard | 8e5f1f5 | 2024-03-02 14:54:34 +0100 | [diff] [blame^] | 20 | * <h2>Usage Examples</h2> |
| 21 | * |
| 22 | * <h3>Dumping the contents of an OSTree summary file</h3> |
Matthias Andreas Benkard | 716fc32 | 2023-12-12 19:13:01 +0100 | [diff] [blame] | 23 | * |
| 24 | * {@snippet lang="sh" : |
| 25 | * $ jgvariant ostree summary read ./jgvariant-ostree/src/test/resources/ostree/summary |
| 26 | * } |
| 27 | * |
| 28 | * <p>Output: |
| 29 | * |
| 30 | * {@snippet lang="json" : |
| 31 | * { |
| 32 | * "entries": [ |
| 33 | * { |
| 34 | * "ref": "mulkos/1.x/amd64", |
| 35 | * "value": { |
| 36 | * "checksum": "66ff167ff35ce87daac817447a9490a262ee75f095f017716a6eb1a9d9eb3350", |
| 37 | * "metadata": { |
| 38 | * "fields": { |
| 39 | * "ostree.commit.timestamp": 1640537170 |
| 40 | * } |
| 41 | * }, |
| 42 | * "size": 214 |
| 43 | * } |
| 44 | * } |
| 45 | * ], |
| 46 | * "metadata": { |
| 47 | * "fields": { |
| 48 | * "ostree.summary.last-modified": 1640537300, |
| 49 | * "ostree.summary.tombstone-commits": false, |
| 50 | * "ostree.static-deltas": { |
| 51 | * "3d3b3329dca38871f29aeda1bf5854d76c707fa269759a899d0985c91815fe6f-66ff167ff35ce87daac817447a9490a262ee75f095f017716a6eb1a9d9eb3350": "03738040e28e7662e9c9d2599c530ea974e642c9f87e6c00cbaa39a0cdac8d44", |
| 52 | * "31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52": "f481144629474bd88c106e45ac405ebd75b324b0655af1aec14b31786ae1fd61", |
| 53 | * "31c8835d5c9d2c6687a50091c85142d1b2d853ff416a9fb81b4ee30754510d52-3d3b3329dca38871f29aeda1bf5854d76c707fa269759a899d0985c91815fe6f": "2c6a07bc1cf4d7ce7d00f82d7d2d6d156fd0e31d476851b46dc2306b181b064a" |
| 54 | * }, |
| 55 | * "ostree.summary.mode": "bare", |
| 56 | * "ostree.summary.indexed-deltas": true |
| 57 | * } |
| 58 | * } |
| 59 | * } |
| 60 | * } |
Matthias Andreas Benkard | 8e5f1f5 | 2024-03-02 14:54:34 +0100 | [diff] [blame^] | 61 | * |
| 62 | * <h3>Adding a static delta to an OSTree summary file</h3> |
| 63 | * |
| 64 | * <p>Static delta <code>3...</code> (in hex), between commits <code>1...</code> and <code>2... |
| 65 | * </code>: |
| 66 | * |
| 67 | * {@snippet lang="sh" : |
| 68 | * $ jgvariant ostree summary add-static-delta ./jgvariant-ostree/src/test/resources/ostree/summary 3333333333333333333333333333333333333333333333333333333333333333 2222222222222222222222222222222222222222222222222222222222222222 1111111111111111111111111111111111111111111111111111111111111111 |
| 69 | * } |
| 70 | * |
| 71 | * <p>Static delta <code>3...</code> (in hex), between the empty commit and <code>2...</code>: |
| 72 | * |
| 73 | * {@snippet lang="sh" : |
| 74 | * $ jgvariant ostree summary add-static-delta ./jgvariant-ostree/src/test/resources/ostree/summary 4444444444444444444444444444444444444444444444444444444444444444 2222222222222222222222222222222222222222222222222222222222222222 |
| 75 | * } |
Matthias Andreas Benkard | a1e8443 | 2023-12-05 21:12:16 +0100 | [diff] [blame] | 76 | */ |
| 77 | public final class Main { |
| 78 | static { |
| 79 | Logger.getGlobal().setLevel(WARNING); |
| 80 | } |
| 81 | |
| 82 | public static void main(String[] args) { |
| 83 | int exitCode = new CommandLine(new MainCommand()).execute(args); |
| 84 | System.exit(exitCode); |
| 85 | } |
| 86 | |
| 87 | private Main() {} |
| 88 | } |