SVN: Add a set of Subdirectories but only specific files - jenkins

I have a subfolder with a lot of subfolders in it. Each subfolder has an settings.ini file in it. Every once in a while a new subfodler with a Ini-File and a lot of other files and subirectories are added, i want to automatically add and commit it via jenkins, but only the folder and the ini.
C:/Program Files (x86)
-horst
--kevin
---settings.ini
--georg
---settings.ini
--heinz
---settings.ini
--herbert
---settings.ini
...
I tried:
svn.exe --quiet --password %SVNPW% --username "%SVNUSER%" add --depth infinity --parents "C:/Program Files (x86)/horst/*/settings.ini"
But this is not working, I get the message:
svn: E720123: Can't make directory 'C:/Program Files (x86)/horst/*'
Is there another solution, what am I doing wrong
regard Nils

This does the trick
cd "C:/Program Files (x86)/horst"
dir /B /S settings.ini > file_list.txt
%SVN% --quiet --password %SVNPW% --username "%SVNUSER%" add --depth infinity --parents --targets file_list.txt
I created a list of targets I want to add and let SVN crawl it.
Nils

Related

Unix. Parse file with full paths to SHA256 checksums files. Run command in each path/file

I have a file file.txt with filenames ending with *.sha256, including the full paths of each file. This is a toy example:
file.txt:
/path/a/9b/x3.sha256
/path/7c/7j/y2.vcf.gz.sha256
/path/e/g/7z.sha256
Each line has a different path/file. The *.sha256 files have checksums.
I want to run the command "sha256sum -c" on each of these *.sha256 files and write the output to an output_file.txt. However, this command only accepts the name of the .sha256 file, not the name including its full path. I have tried the following:
while read in; do
sha256sum -c "$in" >> output_file.txt
done < file.txt
but I get:
"sha256sum: WARNING: 1 listed file could not be read"
which is due to the path included in the command.
Any suggestion is welcome
#!/bin/bash
while read in
do
thedir=$(dirname "$in")
thefile=$(basename "$in")
cd "$thedir"
sha256sum -c "$thefile" >>output_file.txt
done < file.txt
Modify your code to extract the directory and file parts of your in variable.

Can't add credentials.yml.enc file to VCS

I follow this tutorial to deploy my rails application using capistrano and ruby-mine, one step required to generate encrypted credentials.yml.enc and add it to VCS, but I can't add it using ruby-mine even git add however the file is not present in gitignore file.
You find bellow content of gitignore file, the credentials.yml.enc is part of config directory
>> find . -name ".gitignore" -exec cat {} +
/shelf/
/workspace.xml
/dataSources/
/dataSources.local.xml
/httpRequests/
/sassc
/sass-spec
VERSION
.DS_Store
.sass-cache
*.gem
*.gcno
.svn/*
.cproject
.project
.settings/
*.db
*.aps
GNUmakefile.in
GNUmakefile
/aclocal.m4
/autom4te.cache/
/src/config.h
/config.h.in
/config.log
/config.status
/configure
/libtool
/m4/libtool.m4
/m4/ltoptions.m4
/m4/ltsugar.m4
/m4/ltversion.m4
/m4/lt~obsolete.m4
/script/ar-lib
/script/compile
/script/config.guess
/script/config.sub
/script/depcomp
/script/install-sh
/script/ltmain.sh
/script/missing
/script/test-driver
/src/stamp-h1
/src/Makefile.in
/src/Makefile
libsass/*
*.o
*.lo
*.so
*.dll
*.a
*.suo
*.sdf
*.opendb
*.opensdf
a.out
libsass.js
tester
tester.exe
build/
config.h.in*
lib/pkgconfig/
bin/*
.deps/
.libs/
win/bin
*.user
win/*.db
sassc++
libsass.la
src/support/libsass.pc
sassc/
sass-spec/
installer
.idea
/bin
/.bundle
/db/*.sqlite3
/db/*.sqlite3-journal
/db/*.sqlite3-*
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
/storage/*
!/storage/.keep
/public/assets
.byebug_history
/config/master.key
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
>> cat .gitignore
.idea
/bin
/.bundle
/db/*.sqlite3
/db/*.sqlite3-journal
/db/*.sqlite3-*
/log/*
/tmp/*
!/log/.keep
!/tmp/.keep
/tmp/pids/*
!/tmp/pids/
!/tmp/pids/.keep
/storage/*
!/storage/.keep
/public/assets
.byebug_history
/config/master.key
/public/packs
/public/packs-test
/node_modules
/yarn-error.log
yarn-debug.log*
.yarn-integrity
Any help is appreciated, thanks in advance
There is a possibility that the whole folder(and its
subdirectories)/the extension **.enc is excluded in gitignore.
Is the file present when you look at git status. If yes, you'll
need to git add the file before you do a git commit.
Is the file committed already, but not yet pushed?
These are some things on top of my head. Please post some more details to dig this up!

Unit not found: 'System.pas' or binary equivalents (.dcu) : Compiling on jenkins

I'm using Jenkins to generate automatic build every 15 minutes for a test project.
When compiling for Delphi itself does not give a problem, now when I run by jenkins it gives the following problem ...
C:\Program Files (x86)\Embarcadero\RAD
Studio\7.0\Bin\CodeGear.Delphi.Targets(136,3): error : Project1.dpr(1)
Fatal: F1027 Unit not found: 'System.pas' or binary equivalents (.dcu)
I have already tried to run by windows command this way.
cd "C:\Users\carlos.santos\Desktop\teste"
call build.bat
And Build.bat in this way.
call "C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\bin\rsvars.bat"
msbuild "Project1.dproj" /p:config=Release /p:Warn=0
I have already tried to run by the Rad Studio plugin itself for Jenkins this way and it also did not work.
I have already seen in some forums that if I have many paths or do not have the default paths of Delphi in Library path can be a problem, but I have tested this too and nothing ..
Here are the paths I have.
$ (BDS) \ lib; $ (BDS) \ Imports; $ (BDS) \ Lib \ Indy10; $
(BDSCOMMONDIR) \ Dcp; $ (BDS) \ include; $ (BDS) \ RaveReports \ Lib;
$ (BDSCOMMONDIR) \ Bpl; $(BDS)\lib\debug; $(BDS)\bin; $(DELPHI)\Bin;
The Content of rsvars.bat are there:
#SET BDS=C:\Program Files (x86)\Embarcadero\RAD Studio\7.0
#SET BDSCOMMONDIR=C:\Users\Public\Documents\RAD Studio\7.0
#SET FrameworkDir=C:\Windows\Microsoft.NET\Framework\v2.0.50727
#SET FrameworkVersion=v2.0.50727
#SET FrameworkSDKDir=
#SET PATH=%FrameworkDir%;%FrameworkSDKDir%;%PATH%
#SET LANGDIR=EN
I have third party component installed in my Delphi, but I do not know if it influences anything. Anyone who can help me will be grateful.
the difference between the properties executed by jenkins and cmd are these:
it was resolved putting the paramether _EnvLibraryPath with my Delphi
LibraryPath parameter on msbuild call, example:
call "C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\bin\rsvars.bat"
msbuild "C:\Users\carlos.santos\Desktop\teste\Project1.dproj" /p:_EnvLibraryPath="C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib\EN;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib"
There may be another cause for that same problem.
I have just experienced it and solved it.
In my case, it was related to the fact that I had another configuration besides Release and Debug, i.e. ReleaseConsumer.
My build command included specifying the configuration:
DoJenkinsTasks "US2D_GUI" "Config=ReleaseConsumer;Platform=Win64"
Now, I got that same error as mentioned above.
The cause is that it can't find the ReleaseConsumer folder with dcu files.
I solved it by creating, under c:\Program Files (x86)\Embarcadero\Studio\19.0\lib\win64\, a new folder releaseConsumer and copying all dcu files from release to it.
Run msbuild with the /v:diagnostic option, and you will see that none of the default environment paths are set:
Initial Properties:
___ResourcePath =
__ObjectPath =
__ResourcePath =
_EnvDCPOutput =
_EnvLibraryPath =
_EnvNamespace =
_EnvPackageOutput =
_ObjectPath =
_OutputDRCFiles = false
_ProjectFiles = #(DelphiCompile)
_ResolveGENTLBBindingsTarget =
This is because you are missing the %APPDATA%\CodeGear directory on your build server (under the user that is running the builds).
Particularly, you need the CodeGear\BDS\7.0\EnvOptions.proj settings file, which contains all the environment variables.
Put that in place and you'll see msbuild's diagnostics shows properties like this one:
Initial Properties:
___ResourcePath = C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib;\Imports;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\Imports;C:\Users\Public\Documents\RAD Studio\7.0\Dcp;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\include;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\lib;C:\Program Files (x86)\Embarcadero\RAD Studio\7.0\Lib\Indy10;

tar: unable to include folder but exclude content

I have a project folder with several directories
- archive
- include
- lib
- src
- src/obj (obj is a subdirectory of src)
I would like tar to pack these directories and their contents into a main.tar, then I will the main.tar into the archive directory.
tar cvz \
--exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*" \
-f main.tar \
./archive ./include ./lib ./src
I would like to exclude the contents of the archive directory but still package the empty directory itself. You can see I am also excluding some other stuff from various places, OSX likes to write .DS_Store files everywhere on my filesystem and I occasionally make copies of files and append .obsolete to the end while working on a new version.
Unfortunately, the empty archive directory is not included in main.tar.
According to this thread, my command should work.
How can the files be excluded from archive but the empty directory be packed into the tar file?
edit
The following fails:
--exclude="./archive/*"
The following works:
--exclude="./archive/*.*"
So the whole command is:
tar cvz \
--exclude="*.obsolete" --exclude="*DS_Store" --exclude="./archive/*.*" \
-f main.tar \
./archive ./include ./lib ./src

Unpack tar.gz folder to part of filename

I have a file dagens_130325.tar.gz containing the folder dagens. In one folder I have hundreds of these daily info. I would like to unpack dagens_130325.tar.gz/dagens to 130325 with all the files inside. Then 130326 etc.
Is there a way to do it?
Not sure this is the right stack where to ask this kind of question, however try with
tar -zxvf dagens_130325.tar.gz -C /tmp/130325 dagens
This way, the folder dagens for the archive dagens_130325.tar.gz is going to be extracted into /tmp/130325. However, note that the target folder must exist, otherwise the command will fail
So, supposedly you have 4 archives in the form dagens_1.tar.gz, dagens_2.tar.gz, ..., you can write an extract.sh file containing
#!/bin/bash
for i in {1..4}
do
mkdir /tmp/$i
FILE="dagens_$i.tar.gz"
tar -zxvf $FILE -C /tmp/$i dagens
done
Having this file the execute permission, being in the same folder as your archives and executing it should produced the result you asked.
This was the solution I came up with in the end
#!/bin/bash
search_dir=/yourdir/with/tar.gz
for entry in "$search_dir"/*.tar.gz
do
substring=$(basename "$entry")
echo $substring
sub2=${substring:7:6}
tar -xvzf $substring
rm -rf $sub2
mv dagens $sub2
done
use
#!/bin/bash
for file in dagens_*.tar.gz
do
from=${file%_*} #removes chars after _
to=${file#*_} #removes chars before _
to=${to%.t*} #removes chars after .t (.tar.gz)
tar -zxf $file --show-transformed --transform "s/$from/$to/"
done

Resources