* [U-Boot] [PATCH 0/2] patman: Various fixes @ 2012-05-23 18:57 Vikram Narayanan 2012-05-23 18:58 ` [U-Boot] [PATCH 1/2] patman: Change the location of patman config file Vikram Narayanan 2012-05-23 19:01 ` [U-Boot] [PATCH 2/2] patman: Handle creation " Vikram Narayanan 0 siblings, 2 replies; 7+ messages in thread From: Vikram Narayanan @ 2012-05-23 18:57 UTC (permalink / raw) To: u-boot This fixes the location of patman config file from ~/.config/patman to ~/.patman. Also addresses the creation of new config file when it isn't present. Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de> Vikram Narayanan (2): patman: Change the location of patman config file patman: Handle creation of patman config file tools/patman/README | 5 ++++- tools/patman/gitutil.py | 18 ++++++++++++++++++ tools/patman/settings.py | 39 +++++++++++++++++++++++++++++++++++---- 3 files changed, 57 insertions(+), 5 deletions(-) -- 1.7.4.1 ^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] patman: Change the location of patman config file 2012-05-23 18:57 [U-Boot] [PATCH 0/2] patman: Various fixes Vikram Narayanan @ 2012-05-23 18:58 ` Vikram Narayanan 2012-05-30 5:34 ` Simon Glass 2012-06-19 20:51 ` Wolfgang Denk 2012-05-23 19:01 ` [U-Boot] [PATCH 2/2] patman: Handle creation " Vikram Narayanan 1 sibling, 2 replies; 7+ messages in thread From: Vikram Narayanan @ 2012-05-23 18:58 UTC (permalink / raw) To: u-boot Move the config file from ~/.config/patman to ~/.patman as it is more appropriate to have it there. Update the same in the README. Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de> --- tools/patman/README | 2 +- tools/patman/settings.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 7ba9e80..1af8665 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -68,7 +68,7 @@ How to configure it For most cases patman will locate and use the file 'doc/git-mailrc' in your U-Boot directory. This contains most of the aliases you will need. -To add your own, create a file ~/.config/patman directory like this: +To add your own, create a file ~/.patman like this: >>>> # patman alias file diff --git a/tools/patman/settings.py b/tools/patman/settings.py index 049c709..f980071 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -69,7 +69,7 @@ def Setup(config_fname=''): """ settings = ConfigParser.SafeConfigParser() if config_fname == '': - config_fname = '%s/.config/patman' % os.getenv('HOME') + config_fname = '%s/.patman' % os.getenv('HOME') if config_fname: settings.read(config_fname) -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] patman: Change the location of patman config file 2012-05-23 18:58 ` [U-Boot] [PATCH 1/2] patman: Change the location of patman config file Vikram Narayanan @ 2012-05-30 5:34 ` Simon Glass 2012-06-13 16:29 ` Vikram Narayanan 2012-06-19 20:51 ` Wolfgang Denk 1 sibling, 1 reply; 7+ messages in thread From: Simon Glass @ 2012-05-30 5:34 UTC (permalink / raw) To: u-boot On Wed, May 23, 2012 at 11:58 AM, Vikram Narayanan <vikram186@gmail.com>wrote: > Move the config file from ~/.config/patman to ~/.patman as it is > more appropriate to have it there. Update the same in the README. > > Signed-off-by: Vikram Narayanan <vikram186@gmail.com> > Cc: Simon Glass <sjg@chromium.org> > Cc: Wolfgang Denk <wd@denx.de> > Acked-by: Simon Glass <sjg@chromium.org> > --- > tools/patman/README | 2 +- > tools/patman/settings.py | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/patman/README b/tools/patman/README > index 7ba9e80..1af8665 100644 > --- a/tools/patman/README > +++ b/tools/patman/README > @@ -68,7 +68,7 @@ How to configure it > For most cases patman will locate and use the file 'doc/git-mailrc' in > your U-Boot directory. This contains most of the aliases you will need. > > -To add your own, create a file ~/.config/patman directory like this: > +To add your own, create a file ~/.patman like this: > > >>>> > # patman alias file > diff --git a/tools/patman/settings.py b/tools/patman/settings.py > index 049c709..f980071 100644 > --- a/tools/patman/settings.py > +++ b/tools/patman/settings.py > @@ -69,7 +69,7 @@ def Setup(config_fname=''): > """ > settings = ConfigParser.SafeConfigParser() > if config_fname == '': > - config_fname = '%s/.config/patman' % os.getenv('HOME') > + config_fname = '%s/.patman' % os.getenv('HOME') > if config_fname: > settings.read(config_fname) > > -- > 1.7.4.1 > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] patman: Change the location of patman config file 2012-05-30 5:34 ` Simon Glass @ 2012-06-13 16:29 ` Vikram Narayanan 0 siblings, 0 replies; 7+ messages in thread From: Vikram Narayanan @ 2012-06-13 16:29 UTC (permalink / raw) To: u-boot Hello Wolfgang, On 5/30/2012 11:04 AM, Simon Glass wrote: > > > On Wed, May 23, 2012 at 11:58 AM, Vikram Narayanan <vikram186@gmail.com > <mailto:vikram186@gmail.com>> wrote: > > Move the config file from ~/.config/patman to ~/.patman as it is > more appropriate to have it there. Update the same in the README. > > Signed-off-by: Vikram Narayanan <vikram186@gmail.com > <mailto:vikram186@gmail.com>> > Cc: Simon Glass <sjg at chromium.org <mailto:sjg@chromium.org>> > Cc: Wolfgang Denk <wd at denx.de <mailto:wd@denx.de>> > > > Acked-by: Simon Glass <sjg at chromium.org <mailto:sjg@chromium.org>> Can you please consider this patch series? Both are acked by Simon. If you have any issues in taking this in, please let me know. Thanks, Vikram > --- > tools/patman/README | 2 +- > tools/patman/settings.py | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) > > diff --git a/tools/patman/README b/tools/patman/README > index 7ba9e80..1af8665 100644 > --- a/tools/patman/README > +++ b/tools/patman/README > @@ -68,7 +68,7 @@ How to configure it > For most cases patman will locate and use the file 'doc/git-mailrc' in > your U-Boot directory. This contains most of the aliases you will > need. > > -To add your own, create a file ~/.config/patman directory like this: > +To add your own, create a file ~/.patman like this: > > >>>> > # patman alias file > diff --git a/tools/patman/settings.py b/tools/patman/settings.py > index 049c709..f980071 100644 > --- a/tools/patman/settings.py > +++ b/tools/patman/settings.py > @@ -69,7 +69,7 @@ def Setup(config_fname=''): > """ > settings = ConfigParser.SafeConfigParser() > if config_fname == '': > - config_fname = '%s/.config/patman' % os.getenv('HOME') > + config_fname = '%s/.patman' % os.getenv('HOME') > if config_fname: > settings.read(config_fname) > > -- > 1.7.4.1 > > > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 1/2] patman: Change the location of patman config file 2012-05-23 18:58 ` [U-Boot] [PATCH 1/2] patman: Change the location of patman config file Vikram Narayanan 2012-05-30 5:34 ` Simon Glass @ 2012-06-19 20:51 ` Wolfgang Denk 1 sibling, 0 replies; 7+ messages in thread From: Wolfgang Denk @ 2012-06-19 20:51 UTC (permalink / raw) To: u-boot Dear Vikram Narayanan, In message <4FBD3372.9090904@gmail.com> you wrote: > Move the config file from ~/.config/patman to ~/.patman as it is > more appropriate to have it there. Update the same in the README. > > Signed-off-by: Vikram Narayanan <vikram186@gmail.com> > Cc: Simon Glass <sjg@chromium.org> > Cc: Wolfgang Denk <wd@denx.de> > --- > tools/patman/README | 2 +- > tools/patman/settings.py | 2 +- > 2 files changed, 2 insertions(+), 2 deletions(-) Applied, thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de If programming was easy, they wouldn't need something as complicated as a human being to do it, now would they? - L. Wall & R. L. Schwartz, _Programming Perl_ ^ permalink raw reply [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] patman: Handle creation of patman config file 2012-05-23 18:57 [U-Boot] [PATCH 0/2] patman: Various fixes Vikram Narayanan 2012-05-23 18:58 ` [U-Boot] [PATCH 1/2] patman: Change the location of patman config file Vikram Narayanan @ 2012-05-23 19:01 ` Vikram Narayanan 2012-06-19 20:52 ` Wolfgang Denk 1 sibling, 1 reply; 7+ messages in thread From: Vikram Narayanan @ 2012-05-23 19:01 UTC (permalink / raw) To: u-boot patman shouts when it couldn't find a $(HOME)/.patman file. Handle it in a sane way by creating a new one for the user. It looks for a user.name and user.email in the global .gitconfig file, waits for the user input if it can't find there. Update the same in the README Signed-off-by: Vikram Narayanan <vikram186@gmail.com> Acked-by: Simon Glass <sjg@chromium.org> Cc: Simon Glass <sjg@chromium.org> Cc: Wolfgang Denk <wd@denx.de> --- tools/patman/README | 3 +++ tools/patman/gitutil.py | 18 ++++++++++++++++++ tools/patman/settings.py | 37 ++++++++++++++++++++++++++++++++++--- 3 files changed, 55 insertions(+), 3 deletions(-) diff --git a/tools/patman/README b/tools/patman/README index 1af8665..86ede78 100644 --- a/tools/patman/README +++ b/tools/patman/README @@ -68,6 +68,9 @@ How to configure it For most cases patman will locate and use the file 'doc/git-mailrc' in your U-Boot directory. This contains most of the aliases you will need. +During the first run patman creates a config file for you by taking the default +user name and email address from the global .gitconfig file. + To add your own, create a file ~/.patman like this: >>>> diff --git a/tools/patman/gitutil.py b/tools/patman/gitutil.py index 48ca998..59eca99 100644 --- a/tools/patman/gitutil.py +++ b/tools/patman/gitutil.py @@ -357,6 +357,24 @@ def GetAliasFile(): fname = os.path.join(GetTopLevel(), fname.strip()) return fname +def GetDefaultUserName(): + """Gets the user.name from .gitconfig file. + + Returns: + User name found in .gitconfig file, or None if none + """ + uname = command.OutputOneLine('git', 'config', '--global', 'user.name') + return uname + +def GetDefaultUserEmail(): + """Gets the user.email from the global .gitconfig file. + + Returns: + User's email found in .gitconfig file, or None if none + """ + uemail = command.OutputOneLine('git', 'config', '--global', 'user.email') + return uemail + def Setup(): """Set up git utils, by reading the alias files.""" settings.Setup('') diff --git a/tools/patman/settings.py b/tools/patman/settings.py index f980071..4dda17b 100644 --- a/tools/patman/settings.py +++ b/tools/patman/settings.py @@ -24,7 +24,7 @@ import os import re import command - +import gitutil def ReadGitAliases(fname): """Read a git alias file. This is in the form used by git: @@ -61,6 +61,33 @@ def ReadGitAliases(fname): fd.close() +def CreatePatmanConfigFile(config_fname): + """Creates a config file under $(HOME)/.patman if it can't find one. + + Args: + config_fname: Default config filename i.e., $(HOME)/.patman + + Returns: + None + """ + name = gitutil.GetDefaultUserName() + if name == None: + name = raw_input("Enter name: ") + + email = gitutil.GetDefaultUserEmail() + + if email == None: + email = raw_input("Enter email: ") + + try: + f = open(config_fname, 'w') + except IOError: + print "Couldn't create patman config file\n" + raise + + print >>f, "[alias]\nme: %s <%s>" % (name, email) + f.close(); + def Setup(config_fname=''): """Set up the settings module by reading config files. @@ -70,8 +97,12 @@ def Setup(config_fname=''): settings = ConfigParser.SafeConfigParser() if config_fname == '': config_fname = '%s/.patman' % os.getenv('HOME') - if config_fname: - settings.read(config_fname) + + if not os.path.exists(config_fname): + print "No config file found ~/.patman\nCreating one...\n" + CreatePatmanConfigFile(config_fname) + + settings.read(config_fname) for name, value in settings.items('alias'): alias[name] = value.split(',') -- 1.7.4.1 ^ permalink raw reply related [flat|nested] 7+ messages in thread
* [U-Boot] [PATCH 2/2] patman: Handle creation of patman config file 2012-05-23 19:01 ` [U-Boot] [PATCH 2/2] patman: Handle creation " Vikram Narayanan @ 2012-06-19 20:52 ` Wolfgang Denk 0 siblings, 0 replies; 7+ messages in thread From: Wolfgang Denk @ 2012-06-19 20:52 UTC (permalink / raw) To: u-boot Dear Vikram Narayanan, In message <4FBD33F2.8000601@gmail.com> you wrote: > patman shouts when it couldn't find a $(HOME)/.patman file. > Handle it in a sane way by creating a new one for the user. > It looks for a user.name and user.email in the global .gitconfig > file, waits for the user input if it can't find there. Update the > same in the README > > Signed-off-by: Vikram Narayanan <vikram186@gmail.com> > Acked-by: Simon Glass <sjg@chromium.org> > Cc: Simon Glass <sjg@chromium.org> > Cc: Wolfgang Denk <wd@denx.de> > --- > tools/patman/README | 3 +++ > tools/patman/gitutil.py | 18 ++++++++++++++++++ > tools/patman/settings.py | 37 ++++++++++++++++++++++++++++++++++--- > 3 files changed, 55 insertions(+), 3 deletions(-) Applied, thanks. Best regards, Wolfgang Denk -- DENX Software Engineering GmbH, MD: Wolfgang Denk & Detlev Zundel HRB 165235 Munich, Office: Kirchenstr.5, D-82194 Groebenzell, Germany Phone: (+49)-8142-66989-10 Fax: (+49)-8142-66989-80 Email: wd at denx.de It is wrong always, everywhere and for everyone to believe anything upon insufficient evidence. - W. K. Clifford, British philosopher, circa 1876 ^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2012-06-19 20:52 UTC | newest] Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2012-05-23 18:57 [U-Boot] [PATCH 0/2] patman: Various fixes Vikram Narayanan 2012-05-23 18:58 ` [U-Boot] [PATCH 1/2] patman: Change the location of patman config file Vikram Narayanan 2012-05-30 5:34 ` Simon Glass 2012-06-13 16:29 ` Vikram Narayanan 2012-06-19 20:51 ` Wolfgang Denk 2012-05-23 19:01 ` [U-Boot] [PATCH 2/2] patman: Handle creation " Vikram Narayanan 2012-06-19 20:52 ` Wolfgang Denk
This is an external index of several public inboxes, see mirroring instructions on how to clone and mirror all data and code used by this external index.