git-import-srpm: script to create branches in source repos from sRPMs revision.#781
git-import-srpm: script to create branches in source repos from sRPMs revision.#781casasnovas wants to merge 4 commits intomasterfrom
Conversation
|
I don't have time for a full review today but I'll get back to this PR in the next days :) |
… revisions. Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
ea15c23 to
06ab679
Compare
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
06ab679 to
2ac523b
Compare
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
|
I would generally encourage to run |
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
7fa6737 to
2d8f5e6
Compare
|
Oops that's embarassing, I thought my I should have fixed all Let me know if there is anything else you'd like me to change, and thanks for the review! If you're happy with it I'll squash the intermediate commits, I just did them to facilitate iterative reviews. |
|
This tool seems very similar to: https://honk.sigxcpu.org/piki/projects/git-buildpackage/ It works to some extends with RPM on my system, I can make a demo if curious. |
That looks nice, I didn't know it existed :) Trying it on qemu isn't really successful here though: quentin@laptop-tuxedo repos/qemu-rpms $ gbp import-srpm -v ./ 1
gbp:debug: Trying to import an unpacked srpm from './'
gbp:debug: Found spec file ./SPECS/qemu.spec
gbp:debug: ['git', 'rev-parse', '--show-cdup']
gbp:debug: ['git', 'rev-parse', '--is-bare-repository']
gbp:debug: ['git', 'rev-parse', '--git-dir']
gbp:debug: ['git', 'for-each-ref', '--format=%(refname:short)', 'refs/heads/']
gbp:debug: ['git', 'status', '--porcelain']
gbp:error: File '0001-usb-fix-setup_len-init-CVE-2020-14364.patch' listed in spec not foundThe file is present inside SOURCES/ and I didn't find any options to make it look at the right place. My main worry is that we'd still need to wrap it into something that does branch deduplication, branch name creation, git history stitching to upstream tags and likely it doesn't support idempotency (creating same git sha1 for same starting point + patch). I'm happy to use it as the backend instead of the Another tiny cons is the sheer amount of dependencies installing git-buildpackage brought in, here it's a tiny self-contained script. |
It's coming from debian world and has been adapted to RPMs I have been using it along gbs long time ago it was a great experience, see in action: https://youtu.be/DLaD0hHY_F8?t=106#
Let me give a try, I should be manageable.
unsure
yes, It would requires extra distro integration (i am on it, in my idle time). |
|
@fallen any other comments? I'm hoping to move forwards with this PR and potentially add automatic branch importing later. If there are already existing tools that do the job better, I'm happy to use them in a future step. |
Well better has to be defined but I managed to use gbp along qemu (need some teaks on my f43), feel free to call me if you want to reproduce, meanwhile here is the overall flow: import1st I run: See history of:
Patch queueFrom this we can generate a patch queue: See patches applied on upstream: Refresh patches (And spec)And export the serie of patches back to packaging branch (with git context): Build againCheck, it will generate files again in SOURCES and SPECS Which is same inputs used in xcp-ng-rpm In theory a srpm should be rebuildable from git too (WIP) |
|
Thanks @rzr for going through with this! From what I can tell, there is indeed a lack of idempotency when creating the branches, although maybe that could be work-arounded in the tool itself. My take on this is that |
|
Would it be acceptable if I moved this script into https://github.com/xcp-ng/hypervisor-dev, and just add some hooks to some github workflows to run it automatically for the packages we (Hypervisor&Kernel) support/maintain? This way we (H&K team) can work on our own automation and explore ways to improve our developer experience without this being perceived as a shared process impacting any other teams. And when the platform team works on this topic in the future, there won't be things in the way, and we can simply remove our hooks. What do you guys think? |
I think that's consistent with the outcome of the discussions we had on the topic all together. |
|
Maybe the script should be renamed, today its name is quite close to existing What about aligning with similar "import to git" scripts like |
…itory.
On Debian derivatives, you'll need:
sudo apt-get install rpm
Simply run it inside a SRPM git repository and give it a revision (can be
tag, branch, sha1, ...), e.g.:
```bash
CODE_REPO_PATH=/path/to/linux/repo SRPM_REPO_PATH=/path/kernel/srpm/repo git-import-srpm XS-8.2.1
```
To import all releases as branches, just pass --all:
```bash
git-import-srpm --all
```
By default, the `SRPM_REPO_PATH` is the current working directory. If no
`CODE_REPO_PATH` is given, a default path is inferred that is
`${SRPM_REPO_PATH}/../(linux|xen|qemu)` (depending on the package being
imported).
The script was used import all branches of qemu, xen and the Linux kernel
released in current and prior XCP versions, e.g.:
- xen branch example: https://github.com/xcp-ng/xen/tree/xen/xcpng-4.17.5-23.1/base
- qemu branch example: https://github.com/xcp-ng/qemu-dp/tree/qemu/xcpng-4.2.1-5.2.15.2/base
- linux branch example: https://github.com/xcp-ng/linux/tree/linux/xcpng-4.19.19-8.0.32.1/base
The script gives idempotent runs, reconstructed git sha1 will stay the same
across runs for a given srpm revision. The script will not touch any of your
repository worktrees or indexes, so it is safe to run any time even if you are
working in the source repo (patches are applied separately in a temporary worktree).
Note that for each srpm revision, the script will create two branches in the source
repository, in the form:
<product>/(xcpng|xenserver)-<version>/(pre-base|base)
The pre-base ref will point to the upstream commit that was used as basis
by the source RPM before applying patches. Effectively, the patch-set
applied by a source rpm can be rev-listed with `git log /pre-base../base`
which allows see-ing how the patchset evolved over time.
You can use `git-review-rebase` easily on two imports to see the changes in
the patch-queues.
Original pull-request was on the
[xcp](xcp-ng/xcp#781) repository but after
discussion with the OS&Platform team, it was agreed it is better to have it
here. Sub-sequent work could try and add github workflows to run this
script automatically when we notice new SRPMs from XenServer, but right now
it is a manual process (so is running [import_srpm.py](https://github.com/xcp-ng/xcp/blob/master/scripts/import_srpm.py)).
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
|
PR moved to the hypervisor-dev repository: |
…itory.
On Debian derivatives, you'll need:
sudo apt-get install rpm
Simply run it inside a SRPM git repository and give it a revision (can be
tag, branch, sha1, ...), e.g.:
```bash
CODE_REPO_PATH=/path/to/linux/repo SRPM_REPO_PATH=/path/kernel/srpm/repo git-import-srpm XS-8.2.1
```
To import all releases as branches, just pass --all:
```bash
git-import-srpm --all
```
By default, the `SRPM_REPO_PATH` is the current working directory. If no
`CODE_REPO_PATH` is given, a default path is inferred that is
`${SRPM_REPO_PATH}/../(linux|xen|qemu)` (depending on the package being
imported).
The script was used import all branches of qemu, xen and the Linux kernel
released in current and prior XCP versions, e.g.:
- xen branch example: https://github.com/xcp-ng/xen/tree/xen/xcpng-4.17.5-23.1/base
- qemu branch example: https://github.com/xcp-ng/qemu-dp/tree/qemu/xcpng-4.2.1-5.2.15.2/base
- linux branch example: https://github.com/xcp-ng/linux/tree/linux/xcpng-4.19.19-8.0.32.1/base
The script gives idempotent runs, reconstructed git sha1 will stay the same
across runs for a given srpm revision. The script will not touch any of your
repository worktrees or indexes, so it is safe to run any time even if you are
working in the source repo (patches are applied separately in a temporary worktree).
Note that for each srpm revision, the script will create two branches in the source
repository, in the form:
<product>/(xcpng|xenserver)-<version>/(pre-base|base)
The pre-base ref will point to the upstream commit that was used as basis
by the source RPM before applying patches. Effectively, the patch-set
applied by a source rpm can be rev-listed with `git log /pre-base../base`
which allows see-ing how the patchset evolved over time.
You can use `git-review-rebase` easily on two imports to see the changes in
the patch-queues.
Original pull-request was on the
[xcp](xcp-ng/xcp#781) repository but after
discussion with the OS&Platform team, it was agreed it is better to have it
here. Sub-sequent work could try and add github workflows to run this
script automatically when we notice new SRPMs from XenServer, but right now
it is a manual process (so is running [import_srpm.py](https://github.com/xcp-ng/xcp/blob/master/scripts/import_srpm.py)).
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
…itory.
On Debian derivatives, you'll need:
sudo apt-get install rpm
Simply run it inside a SRPM git repository and give it a revision (can be
tag, branch, sha1, ...), e.g.:
```bash
CODE_REPO_PATH=/path/to/linux/repo SRPM_REPO_PATH=/path/kernel/srpm/repo git-import-srpm XS-8.2.1
```
To import all releases as branches, just pass --all:
```bash
git-import-srpm --all
```
By default, the `SRPM_REPO_PATH` is the current working directory. If no
`CODE_REPO_PATH` is given, a default path is inferred that is
`${SRPM_REPO_PATH}/../(linux|xen|qemu)` (depending on the package being
imported).
The script was used import all branches of qemu, xen and the Linux kernel
released in current and prior XCP versions, e.g.:
- xen branch example: https://github.com/xcp-ng/xen/tree/xen/xcpng-4.17.5-23.1/base
- qemu branch example: https://github.com/xcp-ng/qemu-dp/tree/qemu/xcpng-4.2.1-5.2.15.2/base
- linux branch example: https://github.com/xcp-ng/linux/tree/linux/xcpng-4.19.19-8.0.32.1/base
The script gives idempotent runs, reconstructed git sha1 will stay the same
across runs for a given srpm revision. The script will not touch any of your
repository worktrees or indexes, so it is safe to run any time even if you are
working in the source repo (patches are applied separately in a temporary worktree).
Note that for each srpm revision, the script will create two branches in the source
repository, in the form:
<product>/(xcpng|xenserver)-<version>/(pre-base|base)
The pre-base ref will point to the upstream commit that was used as basis
by the source RPM before applying patches. Effectively, the patch-set
applied by a source rpm can be rev-listed with `git log /pre-base../base`
which allows see-ing how the patchset evolved over time.
You can use `git-review-rebase` easily on two imports to see the changes in
the patch-queues.
Original pull-request was on the
[xcp](xcp-ng/xcp#781) repository but after
discussion with the OS&Platform team, it was agreed it is better to have it
here. Sub-sequent work could try and add github workflows to run this
script automatically when we notice new SRPMs from XenServer, but right now
it is a manual process (so is running [import_srpm.py](https://github.com/xcp-ng/xcp/blob/master/scripts/import_srpm.py)).
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
…itory.
On Debian derivatives, you'll need:
sudo apt-get install rpm
Simply run it inside a SRPM git repository and give it a revision (can be
tag, branch, sha1, ...), e.g.:
```bash
CODE_REPO_PATH=/path/to/linux/repo SRPM_REPO_PATH=/path/kernel/srpm/repo git-import-srpm XS-8.2.1
```
To import all releases as branches, just pass --all:
```bash
git-import-srpm --all
```
By default, the `SRPM_REPO_PATH` is the current working directory. If no
`CODE_REPO_PATH` is given, a default path is inferred that is
`${SRPM_REPO_PATH}/../(linux|xen|qemu)` (depending on the package being
imported).
The script was used import all branches of qemu, xen and the Linux kernel
released in current and prior XCP versions, e.g.:
- xen branch example: https://github.com/xcp-ng/xen/tree/xen/xcpng-4.17.5-23.1/base
- qemu branch example: https://github.com/xcp-ng/qemu-dp/tree/qemu/xcpng-4.2.1-5.2.15.2/base
- linux branch example: https://github.com/xcp-ng/linux/tree/linux/xcpng-4.19.19-8.0.32.1/base
The script gives idempotent runs, reconstructed git sha1 will stay the same
across runs for a given srpm revision. The script will not touch any of your
repository worktrees or indexes, so it is safe to run any time even if you are
working in the source repo (patches are applied separately in a temporary worktree).
Note that for each srpm revision, the script will create two branches in the source
repository, in the form:
<product>/(xcpng|xenserver)-<version>/(pre-base|base)
The pre-base ref will point to the upstream commit that was used as basis
by the source RPM before applying patches. Effectively, the patch-set
applied by a source rpm can be rev-listed with `git log /pre-base../base`
which allows see-ing how the patchset evolved over time.
You can use `git-review-rebase` easily on two imports to see the changes in
the patch-queues.
Original pull-request was on the
[xcp](xcp-ng/xcp#781) repository but after
discussion with the OS&Platform team, it was agreed it is better to have it
here. Sub-sequent work could try and add github workflows to run this
script automatically when we notice new SRPMs from XenServer, but right now
it is a manual process (so is running [import_srpm.py](https://github.com/xcp-ng/xcp/blob/master/scripts/import_srpm.py)).
Signed-off-by: Quentin Casasnovas <quentin.casasnovas@vates.tech>
On Debian derivatives, you'll need:
sudo apt-get install rpm
Simply run it inside a SRPM git repository and give it a revision (can be
tag, branch, sha1, ...), e.g.:
To import all releases as branches, just pass
--all:By default, the
SRPM_REPO_PATHis the current working directory. If noCODE_REPO_PATHis given, a default path is inferred that is${SRPM_REPO_PATH}/../(linux|xen|qemu)(depending on the product).The script was used import all branches of qemu, xen and the Linux kernel
released in current and prior XCP versions, e.g.:
The script gives idempotent runs, reconstructed git sha1 will stay the same
across runs for a given srpm revision. The script will not touch any of your
repository worktrees or indexes, so it is safe to run any time even if you are
working in the source repo (patches are applied separately in a temporary worktree).
Note that for each srpm revision, the script will create two branches in the source
repository, in the form:
The
pre-baseref will point to the upstream commit that was used as basis bythe source RPM before applying patches. Effectively, the patch-set applied by
a source rpm can be rev-listed with
git log .../pre-base../basewhich allowssee-ing how the patchset evolved over time.
Signed-off-by: Quentin Casasnovas quentin.casasnovas@vates.tech