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

osc co -D,-r checks out wrong revision #1713

Closed
jengelh opened this issue Feb 20, 2025 · 3 comments · Fixed by #1714
Closed

osc co -D,-r checks out wrong revision #1713

jengelh opened this issue Feb 20, 2025 · 3 comments · Fixed by #1714
Labels

Comments

@jengelh
Copy link
Contributor

jengelh commented Feb 20, 2025

Versions

  • Operating system: openSUSE Tumbleweed 20250218 amd64
  • Packages: osc-1.12.1-1.1.noarch

Observed behavior/To Reproduce

$ osc log -D games/wadptr
...
----------------------------------------------------------------------------
r3 | jengelh | 2011-07-03 12:56:10 | daf6afc36da366c6ad3e35673456c47b | 2.3 | 

$ osc co -D games/wadptr -rdaf6afc36da366c6ad3e35673456c47b -o xyz
fatal: not a git repository (or any parent up to mount point /dev)
Stopping at filesystem boundary (GIT_DISCOVERY_ACROSS_FILESYSTEM not set).
Creating xyz
Restoring _link to xyz
Restoring wadptr-2.4.tar.xz to xyz
Restoring wadptr-automake.diff to xyz
Restoring wadptr.changes to xyz
Restoring wadptr.spec to xyz
done.

Expected behavior

r3/daf6afc36da366c6ad3e35673456c47b was version 2.3. Produce a file xyz/wadptr-2.3.tar.{xz|gz|etc}.

@jengelh jengelh added the Bug label Feb 20, 2025
@dmach
Copy link
Contributor

dmach commented Feb 21, 2025

I was able to resolve the correct file list with the following patch:

diff --git a/osc/commandline.py b/osc/commandline.py
index 5e69df34..29c139ce 100644
--- a/osc/commandline.py
+++ b/osc/commandline.py
@@ -5515,7 +5515,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
 
         elif package:
             if opts.deleted:
-                checkout_deleted_package(apiurl, project, package, opts.output_dir)
+                checkout_deleted_package(apiurl, project, package, opts.output_dir, revision=rev)
             else:
                 if opts.current_dir:
                     project_dir = None
diff --git a/osc/core.py b/osc/core.py
index ca07dd2e..ce0a86e2 100644
--- a/osc/core.py
+++ b/osc/core.py
@@ -6299,8 +6299,8 @@ def get_rpmlint_log(apiurl: str, proj: str, pkg: str, repo: str, arch: str):
     return f.read()
 
 
-def checkout_deleted_package(apiurl: str, proj: str, pkg: str, dst):
-    pl = meta_get_filelist(apiurl, proj, pkg, deleted=True)
+def checkout_deleted_package(apiurl: str, proj: str, pkg: str, dst, *, revision: Optional[str] = None):
+    pl = meta_get_filelist(apiurl, proj, pkg, revision=revision, deleted=True)
     query = {}
     query['deleted'] = 1

Unfortunately, the older sources do not seem to be available.
This works:
$ osc api 'https://api.opensuse.org/source/games/wadptr/wadptr-2.4.tar.xz?deleted=1' > wadptr-2.4.tar.xz
But this ends up with 404:
osc api 'https://api.opensuse.org/source/games/wadptr/wadptr-2.3.tar.xz?deleted=1'

@jengelh
Copy link
Contributor Author

jengelh commented Feb 21, 2025

Huh? The file exists just fine:

$ osc api 'https://api.opensuse.org/source/games/wadptr/wadptr-2.3.tar.xz?deleted=1&rev=3' | hexdump -C
…
00005850  b2 41 8c 85 b1 c4 67 fb  02 00 00 00 00 04 59 5a  |.A....g.......YZ|
00005860

Again, osc "just" needs to provide the proper revision.

@dmach
Copy link
Contributor

dmach commented Feb 21, 2025

🤦 sorry, it's Friday :)
I forgot to specify the "rev" parameter while downloading the file.
Yes, it works just fine.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants