Skip to content

Commit

Permalink
Default to name plus email for changesauthor
Browse files Browse the repository at this point in the history
Modify default behavior of changesgenerate to add packager's name AND
email, instead of only the former, in the header of generated changes
entries when used along with the changesauthor parameter in the _service
file. This aligns with what OSC's vc script does since long time ago.

Signed-off-by: Luciano Santos <[email protected]>
  • Loading branch information
luc14n0 committed Feb 14, 2023
1 parent 4b04a4b commit 8714802
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions TarSCM/changes.py
Original file line number Diff line number Diff line change
Expand Up @@ -231,25 +231,39 @@ def get_changesauthor(self, args):
return args.changesauthor

# return changesauthor if set by osc
if os.getenv('VC_MAILADDR'):
logging.debug("Found changesauthor in VC_MAILADDR='%s'",
os.environ['VC_MAILADDR'])
return os.environ['VC_MAILADDR']
if os.getenv('VC_REALNAME') and os.getenv('VC_MAILADDR'):
logging.debug("Found changesauthor in VC_REALNAME='%s' and "
"VC_MAILADDR='%s'" % (os.environ['VC_REALNAME'],
os.environ['VC_MAILADDR']))

return (os.environ['VC_REALNAME'] + ' <'
+ os.environ['VC_MAILADDR'] + '>')

# return default changesauthor if running on server side
if os.getenv('OBS_SERVICE_DAEMON'):
logging.debug("Running in daemon mode. Using DEFAULT_AUHTOR='%s'",
Cli.DEFAULT_AUTHOR)
return Cli.DEFAULT_AUTHOR

# exit if running locally (non server mode) and now changesauthor
# could be determined
# exit if running locally (non server mode) and no changesauthor could
# be determined, hint user on what to do
raise SystemExit(
"""No changesauthor defined!\n"""
"""You can define it by:\n"""
""" * configure 'email=' in ~/.config/osc/oscrc """
"""in your default api section\n"""
""" * configure <param name="changesauthor">"""
"""...</param> in your _service file\n"""
""" * using '--changesauthor' on the cli\n"""
"""No 'changesauthor' has been defined! You can do it by:\n\n"""
""" Configuring:\n"""
""" * 'realname' and 'email' for the default API section """
"""(api.opensuse.org) -- or whatever OBS instance you're\n"""
""" working with -- in your """
"""OSCRC file with:\n\n"""
""" osc config "https://api.opensuse.org" realname """
""""John Doe"\n"""
""" osc config "https://api.opensuse.org" email """
""""[email protected]"\n\n"""
""" * '<param name="changesauthor">John Doe """
"""&lt;[email protected]&gt;</param> under the """
"""obs_scm/tar_scm service\n"""
""" in your _service file;\n"""
""" Passing:\n"""
""" '--changesauthor "John Doe <[email protected]"' on the """
"""CLI, when using the obs_scm/"""
"""tar_scm script manually.\n"""
)

0 comments on commit 8714802

Please sign in to comment.