[opensuse-buildservice] Copypac'ing a package that is a link and preserve that link (and why does that not work when using osc copypac -K aka --keep-link)
Hi all, today we stumbled upon a snag in osc copypac. The task was to copy a package, that is a link with a link diff, to another project within the same (private) buildservice instance. In our case the link was to a package on the openSUSE buildservice. We found that using "osc copypac -e" works as expected, the resulting package is no longer a link. We also found that using no options (no -e, no -K) copies the link, i.e. the new package is still a link with a link diff, pointing to the original target. But we found that using -K, which is also called --keep-link, does not keep the link. Instead we had the same result as when calling osc copypac with -e. Unfortunately, the man page is pretty confusing here. -K, --keep-link keep the source link in target, this also expands the source But this is also not consistent, we got the same state three times while copying another package, i.e. copying with "-e", "-K" or without options resulted in a package that was no link anymore. We found no consistent explanation for that behaviour. I'll try to set up a reproducible example on the openSUSE build service tomorrow. In the meantime, can someone please explain what "-K" aka "--keep-link" is supposed to do? Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
Hi, On 2018-09-05 22:37:19 +0200, Johannes Kastl wrote:
today we stumbled upon a snag in osc copypac. The task was to copy a package, that is a link with a link diff, to another project within the same (private) buildservice instance. In our case the link was to a package on the openSUSE buildservice.
We found that using "osc copypac -e" works as expected, the resulting package is no longer a link.
Yes, that's the intended behavior.
We also found that using no options (no -e, no -K) copies the link, i.e. the new package is still a link with a link diff, pointing to the original target.
Yes, that's the intended behavior.
But we found that using -K, which is also called --keep-link, does not keep the link. Instead we had the same result as when calling osc copypac with -e.
Yes, that's the intended behavior if the new/target package is _not_ a link (see below).
Unfortunately, the man page is pretty confusing here.
-K, --keep-link keep the source link in target, this also expands the source
But this is also not consistent, we got the same state three times while copying another package, i.e. copying with "-e", "-K" or without options resulted in a package that was no link anymore. We found no consistent explanation for that behaviour.
I'll try to set up a reproducible example on the openSUSE build service tomorrow.
In the meantime, can someone please explain what "-K" aka "--keep-link" is supposed to do?
Let's assume we run "osc copypac -K sprj spkg tprj tpkg". This does the following: Case 1: tprj/tpkg is a link Case 1.1: tprj/tpkg is a branch That is, tpkg contains a _link file. Let's assume the _link points to the foo/bar package. After running the copypac, tprj/tpkg contains the _link file (*) and all files from sprj/spkg's "expanded" revision. The tprj/tpkg package is still a branch that points to the foo/bar package. (*) the _link file might have a different baserev (this is done so that we do not end up with a broken link) Case 1.2: tprj/tpkg is not a branch Again, it keeps/updates the _link file in the tprj/tpkg package. For the details have a look at sub keeplink in BSSrcServer/Link.pm :) Case 2: tprj/tpkg is not a link In this case, "osc copypac -K sprj spkg tprj tpkg" is the same as "osc copypac -e sprj spkg tprj tpkg". Marcus -- To unsubscribe, e-mail: opensuse-buildservice+unsubscribe@opensuse.org To contact the owner, e-mail: opensuse-buildservice+owner@opensuse.org
Marcus Hüwe wrote: [Long, detailed and very helpful explanation snipped] Thanks Marcus, that helps a lot to understand what the option means. If have prepared a PR to make the documentation a little easier to understand. https://github.com/openSUSE/osc/pull/443 '-K', '--keep-link', action='store_true', Only useful if the target already exists. If the target is a link or branch, keep the source link in target. If not, the target will have expanded sources and will not be a link. Kind Regards, Johannes -- Johannes Kastl Linux Consultant & Trainer Tel.: +49 (0) 151 2372 5802 Mail: kastl@b1-systems.de B1 Systems GmbH Osterfeldstraße 7 / 85088 Vohburg / http://www.b1-systems.de GF: Ralph Dehner / Unternehmenssitz: Vohburg / AG: Ingolstadt,HRB 3537
participants (2)
-
Johannes Kastl
-
Marcus Hüwe