[mythtv] Ticket #7010: ./cpsvndir causes errors with checkinstall for themes

Peter Stokes mythtv at dadeos.co.uk
Wed Sep 9 17:53:07 UTC 2009


On 9 Sep 2009, at 03:10, David Engel wrote:

> On Tue, Sep 08, 2009 at 10:19:10PM +0100, Peter Stokes wrote:
>> On 8 Sep 2009, at 17:19, David Engel wrote:
>> using the "cp -R" during a second pass. The first pass only handles
>> directories (by virtue of the "find -type d"), so that's fairly
>> straight forward. The second pass processes all other files (by
>> virtue of the "find ! -type d"), "cp -R" is then used in recursive
>> mode, as none the filenames will correspond to directories the
>> "recursivness" is not what is desirable. However, in recursive mode
>> "cp" maintains symbolic links.
>
> I don't see the need for two separate passes since directories are
> checked for within the one loop.  As for the symlinks, wouldn't "-P"
> be more appropriate?

The problem appears to be that "if [ -d "$file" ];" returns true for  
symbolic links that refer to directories. This results in the cpsvndir  
script creating a directory for the symbolic link, which is incorrect.

It is necessary to use the "-R" option on Mac, from the Mac man page  
for cp "-P    If the -R option is specified, no symbolic links are  
followed.  This is the default." (see: http://developer.apple.com/mac/library/documentation/Darwin/Reference/ManPages/man1/cp.1.html 
)


>> Whilst symbolic links are not currently being used in the current
>> usage of cpsvndir, I personally use cpsvndir to "install" mythweb
>> into the apache hosting directory and mythweb does contain a
>> resource symbolic link ("mythplugins/mythweb/skins/grey/img/music").
>
> Please try the current version in svn with "-P" or "-R" and let me
> know if that works for you.

The current version of the script does not work for me with the "-R"  
options added.

Another difference between the implementation that I proposed and the  
current version surrounds the usage of the "basename" utility. Whilst  
using "basename" yields identical results to the equivalent "cp -R"  
using "${1##*/}" syntax allows distinction between "mydir" and "mydir/".

                                 |  "mydir" | "mydir/" |
basename "{$1}" |  "mydir"  | "mydir"  |
${1##*/}                 |  "mydir"  | ""           |

I used this difference to allow me to install the contents of the  
mythweb directory into a directory with a different name (i.e. "sh  
cpsvndir mythweb/ destination"). The "basename" implementation only  
allows for creating a destination directory that contains the source  
directory.

In case you are willing to accept the implementation that I proposed,  
I attached a patch to Ticket #7010 which I suspect will make the  
implementation execute on "dash" and it appears that someone has  
verified that to be the case.


>> Another concern I have thought of is that the "cpsimple" and
>> "cpsvndir" scripts probably behave quiet differently now. But, as I
>> have already hinted, I could not fathom the reason why the
>> "cpsimple" script is required as the "cpsvndir" script appeared to
>> work for me on Windows (but then again my original proposed
>> "cpsvndir" script also "worked on my machine" ;-).
>
> I'm going to leave the Windows stuff up to someone who actually uses
> it.  I try my best, and usually succeed, to avoid it.

Fair enough...

> David
> -- 
> David Engel
> david at istwok.net

Thanks

Peter
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mythtv.org/pipermail/mythtv-dev/attachments/20090909/182bf4d3/attachment.htm>


More information about the mythtv-dev mailing list