Skip to content

Conversation

@rshrotey-IBM
Copy link
Collaborator

@rshrotey-IBM rshrotey-IBM commented Aug 29, 2025

Summary:

  • Add a script to automatically generate patches to be committed to the port repos
  • File finds the relevant commit-ids and generates the patches provided the source repo is setup correctly (please read instr- uctions)

Testing: Able to generate the patch files as expected

Limitation: Won't work in detached state

What type of PR is this? (check all applicable)

  • Refactor
  • Feature
  • Bug Fix
  • Optimization
  • Content Update

Category

  • zopen build framework
  • zopen package manager
  • Documentation
  • CI/CD
  • Tools

Description

Related Issues

[optional] Are there any post-deployment tasks or follow-up actions required?

…ools

Summary:
* Add a script to automatically generate patches to be committed
  to the port repos
* File finds the relevant commit-ids and generates the patches
  provided the source repo is setup correctly (please read instr-
  uctions)

Testing: Able to generate the patch files as expected

Limitation: Won't work in detached state

Signed-off-by: Rahul-Shrotey <[email protected]>
@sachintu47
Copy link
Collaborator

sachintu47 commented Sep 5, 2025

@rshrotey-IBM It didnt work for me. I got below error

/home/sachint/test_gen_patch/meta>tools/generate_patches.sh -p /home/sachint/zostool_dev/dnf5port/ -s /home/sachint/zostool_dev/dnf5port/dnf5/
~/zostool_dev/dnf5port/dnf5 ~/test_gen_patch/meta
fatal: ambiguous argument '(no': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
Usage: grep [OPTION]... PATTERNS [FILE]...
Try 'grep --help' for more information.
fatal: ambiguous argument '(no': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
fatal: ambiguous argument '(no': unknown revision or path not in the working tree.
Use '--' to separate paths from revisions, like this:
'git <command> [<revision>...] -- [<file>...]'
ERROR: Something is wrong, BASE_COMMIT, PATCHED_COMMIT and CURRENT_COMMIT needed but are not set

Source code is checked out to a tagged version

@rshrotey-IBM
Copy link
Collaborator Author

@sachintu47 - The script expects the source repository to be setup in a specific format, otherwise it may fail to work. The source repo should not be in a detached state, i.e. you should be on a branch for the script to work properly. Please follow these steps. -

1. Apply all the patches and generate source code repo using zopen build command

2. Commit the files modified by zopen build in #1. Dev/bug fix changes should be done on top of this commit

3. Once changes are ready, create new commit(s)

4. Use this script to generate patch for files modified in step 3

@IgorTodorovskiIBM
Copy link
Member

Looks good overall:
A couple of suggestions:

  • A --dry-run option would be useful if the user wants to see what patches would be created without creating them.
  • The default behaviour is to clobber existing files. Should there be a --no-clobber option in case users just want to create patches for new file changes.
  • What happens if you have a file of the same name in different directories? src/foo and lib/foo. Will both the patches be created as patches/foo.patch?

…ools

* Incorporate review comments

Signed-off-by: Rahul-Shrotey <[email protected]>
@rshrotey-IBM
Copy link
Collaborator Author

rshrotey-IBM commented Oct 7, 2025

Looks good overall: A couple of suggestions:

  • A --dry-run option would be useful if the user wants to see what patches would be created without creating them.
    Done
  • The default behaviour is to clobber existing files. Should there be a --no-clobber option in case users just want to create patches for new file changes.
    I haven't yet encountered a situation where I wanted to generate patches for just the newly created files. It's always been - regenerate the patches for all the modified files in a commit. But if this feature is needed I'd be happy to add it.
  • What happens if you have a file of the same name in different directories? src/foo and lib/foo. Will both the patches be created as patches/foo.patch?
    Yes, it will generate both the files, patches/src/foo.patch and patches/lib/foo.patch

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.

4 participants