How to check out a CVS repository in Windows with Unix line endings with Jenkins?
Asked Answered
B

2

6

I've got a Jenkins instance running on Windows and for one item, I need to check out from a CVS repository. As it is, the built-in CVS plugin for Jenkins is checking it out with Windows CRLF line endings. However, some of what needs to be done requires that the files have Unix style LF line endings.

Running a dos2unix like utility over the entire repository seems painful to do safely and reliably.

I could use Cygwin's cvs to do it by running a shell script build step, but I would prefer something better integrated with Jenkins.

So, short of writing up a script to call an external CVS, or fixing it afterwards with dos2unix, can Jenkins check out a CVS repository with Unix line endings on Windows?

Edit:

I've since come across this bug report indicating that this issue has been known since 2012 and not much has been done about it. I'll leave the question open in case someone does know of an alternative to what I've already mentioned.

Briareus answered 13/7, 2015 at 18:56 Comment(0)
E
1

I've added dos2unix steps pretty often in my build scripts for windows (automake chain is very sensitive to this stuff), it might seem a bit ugly/fragile, but it's ok I think for a Jenkins build : if it breaks because of new files you'll get build issues.

In my experience, there are always a couple of platform specific steps in the build, so a bit of custom code to support windows seems ok.

An alternative might be to tag your files as "binary" on the CVS server (-kb flag) and make sure they are encoded correctly up there, this will avoid any transcoding at checkout time, but it seems more intrusive to me. I haven't actually used this for sources, I think it might mess the "diff" command.

A last idea might be to look more precisely at what tools are expecting the LF style endings on your win box, there might be mingW or windows versions you could deploy that support CRLF.

My vote still goes to the dos2unix solution overall.

Existent answered 21/9, 2015 at 16:57 Comment(1)
Hmm, not quite what I was hoping for. Tagging as binary is something I hadn't thought of, but I think I would prefer to use dos2unix locally instead. At least some of the files I'm having trouble with are bash scripts. I think I will look into mingW.Briareus
J
0

If you don't want to make all your files binary in the repository, you can do each checkout or update as binary by adding "-kb" to the command.

Jeniferjeniffer answered 20/3, 2020 at 17:19 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.