[Bug 231452] New: osc commands should return exit status
https://bugzilla.novell.com/show_bug.cgi?id=231452 Summary: osc commands should return exit status Product: openSUSE.org Version: unspecified Platform: Other OS/Version: Other Status: NEW Severity: Enhancement Priority: P5 - None Component: BuildService AssignedTo: poeml@novell.com ReportedBy: jblunck@novell.com QAContact: adrian@novell.com osc commands should return a meaningful exit status. Commands like status should return if the package is modified or not. Example: jblunck@hasse:~/opensuse/Kernel:HEAD$ osc status M kernel-source/kabi.tar.bz2 ? kernel-source/.#sync-Kernel-stable# jblunck@hasse:~/opensuse/Kernel:HEAD$ echo $? 1 jblunck@hasse:~/opensuse/Kernel:HEAD$ osc commit Sending kabi.tar.bz2 Transmitting file data .. jblunck@hasse:~/opensuse/Kernel:HEAD$ osc status ? kernel-source/.#sync-Kernel-stable# jblunck@hasse:~/opensuse/Kernel:HEAD$ echo $? 0 jblunck@hasse:~/opensuse/Kernel:HEAD$ -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231452 poeml@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|NEW |ASSIGNED ------- Comment #1 from poeml@novell.com 2007-02-07 07:44 MST ------- I think it is difficult to come up with a meaningful exit code for the status command, because there are many cases. But returning 1 instead of 0 for the diff command makes sense. It would behave like diffutils diff itself, which shouldn't surprose anyone... even though svn diff does not do this. Index: osc/commandline.py =================================================================== --- osc/commandline.py (revision 1092) +++ osc/commandline.py (working copy) @@ -286,6 +286,7 @@ args = parseargs(args) pacs = findpacs(args) + found_difference = False for p in pacs: if p.todo == []: for i in p.filenamelist: @@ -300,8 +301,12 @@ d.append(get_source_file_diff(p.dir, filename, p.rev)) if d: print ''.join(d) + found_difference = True + if found_difference: + sys.exit(1) + def repourls(args): """repourls: shows URLs on which to access the .repos files -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
https://bugzilla.novell.com/show_bug.cgi?id=231452 poeml@novell.com changed: What |Removed |Added ---------------------------------------------------------------------------- Status|ASSIGNED |RESOLVED Resolution| |FIXED ------- Comment #2 from poeml@novell.com 2007-04-25 14:22 MST ------- The diff command does this since a while. To check for modified files, I recommend to use osc diff >/dev/null and it will exit with 1 if files are in modified state. I hope this is a sufficient solution for you. -- Configure bugmail: https://bugzilla.novell.com/userprefs.cgi?tab=email ------- You are receiving this mail because: ------- You are on the CC list for the bug, or are watching someone who is.
participants (1)
-
bugzilla_noreply@novell.com