Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add replay command to replay stored transactions #1536

Merged
merged 5 commits into from
Jun 19, 2024

Conversation

kontura
Copy link
Contributor

@kontura kontura commented Jun 7, 2024

I am proposing to name the command replay because in my opinion it nicely conveys the functionality and it has continuity with the dnf4 command. However I am not against discussing other names.

In comparison to dnf4 the command:

  • is no longer a history subcommand, it is a standalone command.
  • accepts as an argument a path to a directory where the transaction is
    stored. This is because now any transaction can be stored using the
    --store option which also stores the elements (packages, groups..)
    of the transaction.

This is the CLI for replying serialized transactions. The same API is already used by system upgrade and history undo.
It is required to enable a lot of CI tests but I will work on that once we decide on the command name.

@kontura kontura marked this pull request as draft June 7, 2024 11:17
@kontura kontura marked this pull request as ready for review June 10, 2024 06:59
@kontura kontura assigned kontura and unassigned kontura Jun 10, 2024
@j-mracek j-mracek self-assigned this Jun 10, 2024
settings.set_ignore_installed(ignore_installed->get_value());

try {
context.get_goal()->add_serialized_transaction(transaction_path + TRANSACTION_JSON, settings);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not right - transaction_path + TRANSACTION_JSON. It incorrectly merge path and file name even with default setting to cirrent directory and file transactiontransaction.json.

The second problem is with permissions - -rw-------. 1 root root 166 Jun 11 13:59 tmptransaction.json
I would prefer to grand a read permissions to everyone. But this is related to Goal method.

doc/commands/replay.8.rst Outdated Show resolved Hide resolved
Copy link
Contributor

@j-mracek j-mracek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good, but there are some parts that could be improved.

@kontura
Copy link
Contributor Author

kontura commented Jun 12, 2024

I have added a new commit which adds error handling for paring of the JSON serialized transaction. It introduces REPLAY_PARSE goal action and MALFORMED goal problem.

@kontura
Copy link
Contributor Author

kontura commented Jun 12, 2024

Rebased to fix the builddep plugin failing build.

@kontura
Copy link
Contributor Author

kontura commented Jun 12, 2024

Rebased again to fix new conflicts.

@kontura
Copy link
Contributor Author

kontura commented Jun 12, 2024

Added --skip-broken flag.

doc/changes.rst Outdated
@@ -203,6 +203,9 @@ Changes to individual commands

``history``
* ``undo`` subcommand now accepts ``--ignore-extras`` and ``--ignore-installed`` like original ``history replay`` command.
* ``store`` subcommand now outputs a directory with transaction JSON file instead of a single transaction JSON file directly.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Somehow it is not clear to me. What about:
store subcommand accepts directory path as an argument instead of file path. The default is ...

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have updated it and added a new line about the --output option.

doc/changes.rst Outdated
@@ -203,6 +203,9 @@ Changes to individual commands

``history``
* ``undo`` subcommand now accepts ``--ignore-extras`` and ``--ignore-installed`` like original ``history replay`` command.
* ``store`` subcommand now outputs a directory with transaction JSON file instead of a single transaction JSON file directly.
* ``replay`` subcommand was moved to a standalone ``replay`` command, that now accepts a path to a directory instead of a single file.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor or optional - What about to replace of a single file by of a file path.

doc/changes.rst Outdated
@@ -203,6 +203,9 @@ Changes to individual commands

``history``
* ``undo`` subcommand now accepts ``--ignore-extras`` and ``--ignore-installed`` like original ``history replay`` command.
* ``store`` subcommand now outputs a directory with transaction JSON file instead of a single transaction JSON file directly.
* ``replay`` subcommand was moved to a standalone ``replay`` command, that now accepts a path to a directory instead of a single file.
The directory can be created with ``--store`` option and in addition to the JSON transaction can contain packages, group and environments used in the transaction.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe that transaction can is incorrect and there should be transaction, it can.

In comparison to dnf4 the command:
- is no longer a `history` subcommand, it is a standalone command.
- accepts as an argument a path to a directory where the transaction is
  stored. This is because now any transaction can be stored using the
  `--store` option which also stores the elements (packages, groups..)
  of the transaction.
This allows referencing from other files.
Copy link
Contributor

@j-mracek j-mracek left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@j-mracek j-mracek added this pull request to the merge queue Jun 19, 2024
Merged via the queue into rpm-software-management:main with commit 01f0c59 Jun 19, 2024
10 of 15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants