Alexander Skwar wrote on Wed, Aug 04, 2010 at 21:23:50 +0200:
> Hi.
> 
> 2010/8/4 Daniel Shahaf <d...@daniel.shahaf.name>
> 
> > No.  That file is auto-generated from libsvn_fs_fs/*.sql (IIRC, by
> > build/transform_sql.py).
> >
> > (And, apparently, the autogeneration mechanism has changed, since in trunk 
> > I get
> >
> > % grep REP_CACHE_DB_SQL .../subversion/libsvn_fs_fs/*h
> > src/svn/trunk.d/subversion/libsvn_fs_fs/rep-cache-db.h:#define 
> > REP_CACHE_DB_SQL_DECLARE_STATEMENTS(varname) \
> >
> > .)
> 
> Hm. I ran transform_sql.py manually like so:
> 
> cd build
> ./transform_sql.py ../subversion/libsvn_fs_fs/rep-cache-db.sql foo.h2
> 
> or
> ~/.software/Python-2.5.2/bin/python2.5 transform_sql.py
> ../subversion/libsvn_fs_fs/rep-cache-db.sql foo.h3
> 
> or
> /opt/csw/bin/python2.5 transform_sql.py
> ../subversion/libsvn_fs_fs/rep-cache-db.sql foo.h4
> 
> or
> /usr/bin/python2.4 transform_sql.py
> ../subversion/libsvn_fs_fs/rep-cache-db.sql foo.h4
> 
> In all these cases, the generated "foo.*" file is fine.
> 
> Ah!
> 
> --($ ~/Source/subversion-1.6.12/build)-- grep -r transform_sql ..
> ../build/transform_sql.py:# transform_sql.py -- create a header file
> with the appropriate SQL variables
> ../build/generator/gen_win.py:    import transform_sql
> ../build/generator/gen_win.py:      transform_sql.main(open(sql + '.sql', 
> 'r'),
> ../Makefile.in:     $(top_srcdir)/build/transform_sql.sh $< < $< >
> $(top_srcdir)/$@
> ../Makefile:        $(top_srcdir)/build/transform_sql.sh $< < $< >
> $(top_srcdir)/$@
> 
> It's *NOT* the Python .py file which is run, but the .sh Shell
> script!
> 
> And it's this script, which doesn't work!
> 
> --($ ~/Source/subversion-1.6.12/build)-- /bin/sh -x ./transform_sql.sh
>  ../subversion/libsvn_fs_fs/rep-cache-db.sql
> + basename ../subversion/libsvn_fs_fs/rep-cache-db.sql
> + + trtr  [a-z]. _+
> [A-Z]
> tr - _
> varname=rep_cZche_db_sql
> […]
> 
> What you can see here, is that varname is already wrong!
> 
> From the sh file:
> 
> varname=`basename $1 | tr "[a-z]" "[A-Z]" | tr "-" "_" | tr "." "_"`
> 
> Okay. It's using "tr", which is:
> --($ ~/Source/subversion-1.6.12/build)-- which tr
> /usr/xpg6/bin/tr
> 
> And now pay attention:
> 
> --($ ~/Source/subversion-1.6.12/build)--
> E=../subversion/libsvn_fs_fs/rep-cache-db.sql
> 
> --($ ~/Source/subversion-1.6.12/build)-- basename $E
> rep-cache-db.sql
> 
> --($ ~/Source/subversion-1.6.12/build)-- basename $E | tr "[a-z]" "[A-Z]"
> rep-cZche-db.sql
> 
> And now I use GNU tr:
> 
> --($ ~/Source/subversion-1.6.12/build)-- basename $E | gtr "[a-z]" "[A-Z]"
> REP-CACHE-DB.SQL
> 
> Hmmmm.....
> 
> It's not a GNUism. If I use /usr/bin/tr instead of /usr/xpg6/bin/tr or
> /usr/xpg4/bin/tr, then it also works.
> 

Could we use the tr that configure finds?

> Seeing that "tr" doesn't always work the same way, maybe it would
> be useful to use something else? Eg. perl, which seems to be the most
> "portable"?
> 
> --($ ~/Source/subversion-1.6.12/build)-- date | sed 'y/[a-z]/[A-Z]/'
> Mittwoch,  4. August 2010 21:10 Uhr CEST
> 
> -> sed didn't work
> 

How about 'sed -e s/a/A/ -e s/b/B/ -e ... -e s/z/Z/'?

> --($ ~/Source/subversion-1.6.12/build)-- date | /usr/bin/awk '{print
> toupper($0)}'
> Mittwoch,  4. August 2010 21:09 Uhr CEST
> 
> -> awk also didn't work
> 
> But perl works.
> 

Right now, we don't require Perl (at all) and we require Python only from
developers (but not from folks who download our tarballs).  

> --($ ~/Source/subversion-1.6.12/build)-- date | perl -pe 'tr/a-z/A-Z/; '
> MITTWOCH,  4. AUGUST 2010 21:21 UHR CEST
> 
> And it would allow to combine the seperate tr commands, eg.:
> 
> varname=`basename $1 | perl -pe 'tr/a-z/A-Z/; tr/-/_/; tr/./_/;'`
> 
> Does it make sense to file this as a bug?
> 

Yes, feel free to file a bug and/or summarize the issue on d...@.

Daniel
(see also 
http://subversion.apache.org/docs/community-guide/general.html#patches)

> cheers,
> 
> Alexander
> --
> ↯    Lifestream (Twitter, Blog, …) ↣ http://alexs77.soup.io/     ↯
> ↯ Chat (Jabber/Google Talk) ↣ a.sk...@gmail.com , AIM: alexws77  ↯

Reply via email to