openSUSE / osc

The Command Line Interface to work with an Open Build Service
http://openbuildservice.org/
GNU General Public License v2.0
169 stars 185 forks source link

osc fails when expanding a bad link #170

Closed tuminoid closed 9 years ago

tuminoid commented 9 years ago

osc 0.152 fails when expanding a package with bad link.

Checking out project/package:

$ osc co <project> <package>
Link "<project>/<package>" cannot be expanded:
 _link is bad
Use "osc repairlink" to fix merge conflicts.

When checking the whole project out:

$ osc co <project>
A    <project>/<package>
Traceback (most recent call last):
  File "/usr/bin/osc", line 41, in <module>
    r = babysitter.run(osccli)
  File "/usr/lib/python2.7/dist-packages/osc/babysitter.py", line 61, in run
    return prg.main(argv)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 343, in main
    return self.cmd(args)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 366, in cmd
    retval = self.onecmd(argv)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 500, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 1230, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/usr/lib/python2.7/dist-packages/osc/commandline.py", line 4151, in do_checkout
    meta=opts.meta)
  File "/usr/lib/python2.7/dist-packages/osc/core.py", line 4704, in checkout_package
    p.update(revision, server_service_files, size_limit)
  File "/usr/lib/python2.7/dist-packages/osc/core.py", line 2206, in update
    rfiles = self.__get_files(root)
  File "/usr/lib/python2.7/dist-packages/osc/core.py", line 2075, in __get_files
    int(i.get('size')), int(i.get('mtime')), skipped))
TypeError: int() argument must be a string or a number, not 'NoneType'

Repairlink does nothing meaningful either:

$ cd <project>/<package>
$ osc repairlink
BuildService API error: source link never worked

osc up -e fails just like osc co <project>:

$ osc up -e
Traceback (most recent call last):
  File "/usr/bin/osc", line 41, in <module>
    r = babysitter.run(osccli)
  File "/usr/lib/python2.7/dist-packages/osc/babysitter.py", line 61, in run
    return prg.main(argv)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 343, in main
    return self.cmd(args)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 366, in cmd
    retval = self.onecmd(argv)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 500, in onecmd
    return self._dispatch_cmd(handler, argv)
  File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 1230, in _dispatch_cmd
    return handler(argv[0], opts, *args)
  File "/usr/lib/python2.7/dist-packages/osc/commandline.py", line 4572, in do_update
    p.update(rev, opts.server_side_source_service_files, opts.limit_size)
  File "/usr/lib/python2.7/dist-packages/osc/core.py", line 2206, in update
    rfiles = self.__get_files(root)
  File "/usr/lib/python2.7/dist-packages/osc/core.py", line 2075, in __get_files
    int(i.get('size')), int(i.get('mtime')), skipped))
TypeError: int() argument must be a string or a number, not 'NoneType'

Together with openSUSE/open-build-service#1074, said package is basically untouchable, unless you delete entire package along with history.

marcus-h commented 9 years ago

On 2015-08-31 22:58:55 -0700, Tuomo Tanskanen wrote:

$ osc co A / Traceback (most recent call last): File "/usr/bin/osc", line 41, in r = babysitter.run(osccli) File "/usr/lib/python2.7/dist-packages/osc/babysitter.py", line 61, in run return prg.main(argv) File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 343, in main return self.cmd(args) File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 366, in cmd retval = self.onecmd(argv) File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 500, in onecmd return self._dispatch_cmd(handler, argv) File "/usr/lib/python2.7/dist-packages/osc/cmdln.py", line 1230, in _dispatch_cmd return handler(argv[0], opts, *args) File "/usr/lib/python2.7/dist-packages/osc/commandline.py", line 4151, in do_checkout meta=opts.meta) File "/usr/lib/python2.7/dist-packages/osc/core.py", line 4704, in checkout_package p.update(revision, server_service_files, size_limit) File "/usr/lib/python2.7/dist-packages/osc/core.py", line 2206, in update rfiles = self.__get_files(root) File "/usr/lib/python2.7/dist-packages/osc/core.py", line 2075, in __get_files int(i.get('size')), int(i.get('mtime')), skipped)) TypeError: int() argument must be a string or a number, not 'NoneType'

Hmm this probably indicates that the filelist provided by the srcserver
is "broken" (a stat() call failed).
What's the output of
curl -u <username> https://<apiurl>/source/<project>/<package>
tuminoid commented 9 years ago

@marcus-h Sorry, I had to get it fixed (only choice was to remove the package and recreate it). However in https://github.com/openSUSE/open-build-service/issues/1074#issuecomment-136596876 you can see the osc api call, which is pretty close to curling it.

Sources might've gotten broken by doing a cleanup with obs_admin --remove-old-sources. It seems that it doesn't take links into account and file was lost that way.

marcus-h commented 9 years ago

On 2015-09-07 06:30:01 -0700, Tuomo Tanskanen wrote:

Sources might've gotten broken by doing a cleanup with obs_admin --remove-old-sources. It seems that it doesn't take links into account and file was lost that way.

Ah ok - please add to #1074 that you used "obs_admin --remove-old-sources". Now, osc handles this error more "gracefully" (see commit e697a70921a70fe1f9fafa447013dcd9622f103e).