Skip to content

Commit 7448784

Browse files
committed
Default to name plus email for changesauthor
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]>
1 parent 4b04a4b commit 7448784

File tree

1 file changed

+27
-13
lines changed

1 file changed

+27
-13
lines changed

TarSCM/changes.py

Lines changed: 27 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -231,25 +231,39 @@ def get_changesauthor(self, args):
231231
return args.changesauthor
232232

233233
# return changesauthor if set by osc
234-
if os.getenv('VC_MAILADDR'):
235-
logging.debug("Found changesauthor in VC_MAILADDR='%s'",
236-
os.environ['VC_MAILADDR'])
237-
return os.environ['VC_MAILADDR']
234+
if os.getenv('VC_REALNAME') and os.getenv('VC_MAILADDR'):
235+
logging.debug("Found changesauthor in VC_REALNAME='%s' and " \
236+
"VC_MAILADDR='%s'" % (os.environ['VC_REALNAME'],
237+
os.environ['VC_MAILADDR']))
238+
239+
return (os.environ['VC_REALNAME'] + ' <' +
240+
os.environ['VC_MAILADDR'] + '>')
238241

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

245-
# exit if running locally (non server mode) and now changesauthor
246-
# could be determined
248+
# exit if running locally (non server mode) and no changesauthor could
249+
# be determined, hint user on what to do
247250
raise SystemExit(
248-
"""No changesauthor defined!\n"""
249-
"""You can define it by:\n"""
250-
""" * configure 'email=' in ~/.config/osc/oscrc """
251-
"""in your default api section\n"""
252-
""" * configure <param name="changesauthor">"""
253-
"""...</param> in your _service file\n"""
254-
""" * using '--changesauthor' on the cli\n"""
251+
"""No 'changesauthor' has been defined! You can do it by:\n\n"""
252+
""" Configuring:\n"""
253+
""" * 'realname' and 'email' for the default API section """
254+
"""(api.opensuse.org) -- or whatever OBS instance you're\n"""
255+
""" working with -- in your """
256+
"""OSCRC file with:\n\n"""
257+
""" osc config "https://api.opensuse.org" realname """
258+
""""John Doe"\n"""
259+
""" osc config "https://api.opensuse.org" email """
260+
""""[email protected]"\n\n"""
261+
""" * '<param name="changesauthor">John Doe """
262+
"""&lt;[email protected]&gt;</param> under the """
263+
"""obs_scm/tar_scm service\n"""
264+
""" in your _service file;\n"""
265+
""" Passing:\n"""
266+
""" '--changesauthor "John Doe <[email protected]"' on the """
267+
"""CLI, when using the obs_scm/"""
268+
"""tar_scm script manually.\n"""
255269
)

0 commit comments

Comments
 (0)