Den lör 21 jan. 2023 kl 10:31 skrev Bo Berglund <bo.bergl...@gmail.com>:

> I have a script, which is used in our installer creation process and it
> works as
> follows (on Windows):
>
> - Create a new target directory
> - Run svn commands to get the needed files into that dir
> - Run svn command to download the installer engine binary into its own dir
> - Run svn command to download the installer script itself
> - Start the installer engine with the script as argument
>
> This produces a new installation file in the installers directory.
>
> The svn command I am using is svn export since I don't want to create a
> versioned container and I also want to collect files from various different
> locations including documentation which will be part of the installer.
>
> What I would like to know is if there is an svn export command switch of
> some
> kind that can be used to export a set of files in one go if they reside in
> the
> same subversion directory?
>
> Right now I am repeating the following typical sequence, where the svn
> commands
> have to be run *inside* the target directory (variable SVNREPO has been
> set to
> the repository URL earlier):
>
> if EXIST Manager rmdir /s /q Manager
> mkdir Manager
> cd Manager
> svn export %SVNREPO%/Manager.exe .\
> if errorlevel 1 goto error
> svn export %SVNREPO%/ssleay32.dll .\
> if errorlevel 1 goto error
> svn export %SVNREPO%/libeay32.dll .\
> if errorlevel 1 goto error
> svn export %SVNREPO%/doc/Manager_instructions.pdf .\
>
> So to get these 4 files I have to issue 4 different svn commands...
>
> And I have had to create the target dir and move into it before doing this
> because otherwise the command instead of creating a subdir to stuff the
> file
> into exports the source file into a file named as the directory it is
> supposed
> to go into...
>
> Example:
> svn --force export %SVNREPO%/ssleay32.dll TargetDir
>
> This creates a *file* TargetDir with the content of ssleay32.dll instead of
> ssleay32.dll inside of TargetDir
>
> I would like to use a single svn command per source dir and get all the
> needed
> files from there at the same time according to a supplied list.
>
> Is this possible at all?


I believe you can do this using the svn:externals property. I have the
following repository layout
[root]
+-- manyfiles
|     +--- 1file
|     +--- 2file
|     +--- 3file
|     +--- 4file
|     +--- 5file
+--- somefiles

The manyfiles directory contains 5 different files. The somefiles directory
contains none, however it has the svn:externals property set to point to
each of the files needed for the installation script (1file, 3file, 5file):
$ svn proplist -v somefiles
Properties on 'somefiles':
  svn:externals
    ^/manyfiles/1file 1file
    ^/manyfiles/3file 3file
    ^/manyfiles/5file 5file

I can now do
$ svn export REPOPATH/somefiles

This will give me a directory tree containing the requested files:
+--- somefiles
      +--- 1file
      +--- 3file
      +--- 5file

Obviously, you can get creative in your external definitions, for example
pegging to a specific revision. See the SVN Book for the full syntax:
https://svnbook.red-bean.com/en/1.7/svn.advanced.externals.html

Of course this means that you now have two places to maintain your build
scripts; both the actual script do to the build process and the
svn:externals property. You must decide if the additional burden of
splitting out the file list to SVN is worth the effort. (You could
potentially have the directory "somefiles" in the repository without the
svn:externals property, check it out as a working copy, set the
svn:externals property as part of the script and do an svn up to get all
the files).

Kind regards,
Daniel Sahlberg

Reply via email to