Bug 1038852 - Client should be able to read srcdir and transdir from zanata.xml
Summary: Client should be able to read srcdir and transdir from zanata.xml
Status: CLOSED CURRENTRELEASE
Alias: None
Product: Fedora
Classification: Fedora
Component: zanata-client
Version: 22
Hardware: Unspecified
OS: Unspecified
unspecified
medium
Target Milestone: ---
Assignee: Patrick Huang
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Keywords:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2013-12-05 23:56 UTC by Ding-Yi Chen
Modified: 2016-01-21 01:40 UTC (History)
3 users (show)

(edit)
Clone Of:
(edit)
Last Closed: 2016-01-21 01:40:20 UTC


Attachments (Terms of Use)


External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Bugzilla 1038459 None None None Never
Red Hat Bugzilla 1110627 None None None Never

Internal Trackers: 1038459 1110627

Description Ding-Yi Chen 2013-12-05 23:56:54 UTC
Description of problem:
Default source and translation directories should be default to '.'.
In other words, -s and -t are not required. to make push and pull work.
Just like the behavior with maven and Python clients.


Version-Release number of selected component (if applicable):
zanata-client-2.2.0

How reproducible:
Always

Steps to Reproduce:
1. Go to a zanata project directory
2. zanata-cli push
3.

Actual results:
Return help for zanata push

Expected results:
Actually do the push, as if -s . -t . are given.

Additional info:

Comment 1 Sean Flanigan 2013-12-06 00:20:01 UTC
One of the reasons for making these options required is because "." is not the best default directory for podir projects, where the correct srcDir is often "pot".  

If we make srcDir optional, we should probably put in a special case which checks for source files starting with "pot/" which might be a sign that the user got the srcDir wrong.

On a related note, it may or may not be a good idea to make srcDir/transDir optional for the *pull* command, because writing files is more destructive than uploading them.

Comment 2 Patrick Huang 2013-12-06 00:27:57 UTC
I think we need to add options to zanata.xml. If user really want to save themselves from typing some options each time, they can store it in zanata.xml. For existing maven client users, they may have that defined in pom file. In which case we may need to define a priority on conflict settings.

Comment 3 Patrick Huang 2013-12-06 00:30:34 UTC
storing options in zanata.xml also eliminate the need of remembering two set of option style. Maven style (-Dzanata.someOption) vs. generic CLI style (-o or --option).

Comment 4 Ding-Yi Chen 2013-12-06 04:48:27 UTC
(In reply to Sean Flanigan from comment #1)
> One of the reasons for making these options required is because "." is not
> the best default directory for podir projects, where the correct srcDir is
> often "pot".  

True. Thing get even worse for "File" project type, as you can see the translation documents added to source documents. If you push again and again.

> If we make srcDir optional, we should probably put in a special case which
> checks for source files starting with "pot/" which might be a sign that the
> user got the srcDir wrong.
> 
> On a related note, it may or may not be a good idea to make srcDir/transDir
> optional for the *pull* command, because writing files is more destructive
> than uploading them.

Well on the other hand, maven plugin does assume both dir are '.'. Shall we make their behavior consistent?

BTW, I think Patrick's approach is right. It not only save the users from typing srcDir and transDir again and again, but also prevent users from forgetting to specify both dir or type it wrong.

Comment 5 Sean Flanigan 2013-12-06 05:58:40 UTC
(In reply to Ding-Yi Chen from comment #4)
> (In reply to Sean Flanigan from comment #1)
> > One of the reasons for making these options required is because "." is not
> > the best default directory for podir projects, where the correct srcDir is
> > often "pot".  
> 
> True. Thing get even worse for "File" project type, as you can see the
> translation documents added to source documents. If you push again and again.

Yes.  That's why the File project type, as presently implemented, requires that source and trans dirs be non-overlapping.  Defaulting srcDir and transDir to "." violates that, so we would have to deal with that one way or another.
 
> > If we make srcDir optional, we should probably put in a special case which
> > checks for source files starting with "pot/" which might be a sign that the
> > user got the srcDir wrong.
> > 
> > On a related note, it may or may not be a good idea to make srcDir/transDir
> > optional for the *pull* command, because writing files is more destructive
> > than uploading them.
> 
> Well on the other hand, maven plugin does assume both dir are '.'. Shall we
> make their behavior consistent?

It depends what you mean by consistent.  If you mean both of them will read srcDir/transDir from zanata.xml, sure, that should be safe.

If you mean they will both default to ".", that could lead to users overwriting the wrong files, and it doesn't work for File projects because of the overlap problem.

> BTW, I think Patrick's approach is right. It not only save the users from
> typing srcDir and transDir again and again, but also prevent users from
> forgetting to specify both dir or type it wrong.

Yes.

Comment 6 Sean Flanigan 2013-12-06 06:02:38 UTC
(In reply to Patrick Huang from comment #2)
> I think we need to add options to zanata.xml. If user really want to save
> themselves from typing some options each time, they can store it in
> zanata.xml. For existing maven client users, they may have that defined in
> pom file. In which case we may need to define a priority on conflict
> settings.

From a runtime point of view, there's not much to distinguish between a setting in pom.xml versus a setting on the mvn command line.  And the general rule is that command line options should override configuration files.  

So I think we should have this:
  *command line options* take precedence over
  *pom.xml* which takes precedence over
  *zanata.xml*.

But it should be very unusual to have one setting in pom.xml and a conflicting setting in zanata.xml.  We should have a warning whenever the user overrides a setting from zanata.xml, at least for something as important as srcDir/transDir.

Comment 7 Sean Flanigan 2013-12-06 06:14:26 UTC
If the user specifies srcDir/transDir via the commandline or pom.xml, we should offer to update zanata.xml with srcDir/transDir.  Or at least tell the user that these options can go in the file.

Comment 8 Ding-Yi Chen 2013-12-10 00:34:44 UTC
(In reply to Sean Flanigan from comment #7)
> If the user specifies srcDir/transDir via the commandline or pom.xml, we
> should offer to update zanata.xml with srcDir/transDir.  Or at least tell
> the user that these options can go in the file.

"Offer update" might add extra complication. However, I agree that an informative message such as:

srcDir: <srcDir Specified in command line option>
Put <srcDir>SOURCE_DIRECTORY_OF_YOUR_PROJECT</srcDir> in zanata.xml, so you do not need to specify this in command line options.

Comment 9 Patrick Huang 2014-08-06 01:28:44 UTC
https://github.com/zanata/zanata-client/pull/27

Comment 10 Ding-Yi Chen 2014-08-27 00:41:29 UTC
VERIFIED with commit 7ab5819cefde4b76a6256cc5ecd5e15435b5df73

Comment 11 Fedora End Of Life 2015-01-09 22:42:00 UTC
This message is a notice that Fedora 19 is now at end of life. Fedora 
has stopped maintaining and issuing updates for Fedora 19. It is 
Fedora's policy to close all bug reports from releases that are no 
longer maintained. Approximately 4 (four) weeks from now this bug will
be closed as EOL if it remains open with a Fedora 'version' of '19'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 19 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 12 Jaroslav Reznik 2015-03-03 17:20:10 UTC
This bug appears to have been reported against 'rawhide' during the Fedora 22 development cycle.
Changing version to '22'.

More information and reason for this action is here:
https://fedoraproject.org/wiki/Fedora_Program_Management/HouseKeeping/Fedora22


Note You need to log in before you can comment on or make changes to this bug.