This is the mail archive of the cygwin-apps mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: ITP dos2unix 5.2.1-1


Christopher Faylor wrote:
On Wed, Mar 16, 2011 at 04:05:17PM -0400, Charles Wilson wrote:
On 3/16/2011 3:32 PM, Christopher Faylor wrote:
On Wed, Mar 16, 2011 at 08:29:51PM +0100, Christian Franke wrote:
An alternative would be to modify cygutils+dos2unix packages such that
the user can select the flavor of dos2unix/unix2dos commands with
/usr/sbin/alternatives. If cygutils is the default if installed this
should not break anything.
Except you would no longer be able to run dos2unix/unix2dos/d2u/u2d from
a non-cygwin context, such as 'naked' cmd.exe or some IDE like Eclipse.

Hey, good idea, assuming that Chuck is amenable. I'd be happy to just
let the package in given that proviso if so.
Uh, let's think about that a minute.

cygutils is pulled in as part of Base (cygutils is not in the Base
category, but it is required by a packages that is: cygwin-doc).  Adding
alternatives as a dep of cygutils would then make alternatives an
implicit part of Base.  alternatives itself brings in no other unsavory
dependencies.

This would be a change, since although alternatives is used by some very
common packages [vim, automake], it's not in the default Base-"only"
(actually, Base+requirements) installation.

It also means that cygwin's dos2unix could no longer be executed from a
non-cygwin context, because of the symlinks.
...
Ah, right.

I didn't get that Eric was referring to this scenario but, regardless,
I should have remembered that alternatives means using symlinks.  Given
the use that d2u is put, I don't think we want to make it a symlink.


Agree, symlinks should be avoided.


Another alternative: Keep hard links as is if cygutils is installed only. If dos2unix is also installed assume that user opted-in to replace the dos2unix and unix2dos commands (and only these) with the linux variant. Undo this change if dos2unix is uninstalled.

This may be possible to handle this in the postinstall/preremove scripts of both packages as follows (dos2unix case only, not tested):

cygutils*.tar: remove dosunix2.exe but keep d2u.exe.

dosunix*.tar: Install dos2unix.exe as e.g. dos2unix-linux.exe

# /etc/postinstall/cygutils.sh:
if cmp -s /usr/bin/dos2unix-linux.exe /usr/bin/dos2unix.exe; then :; else
  ln -f /usr/bin/conv.exe /usr/bin/dos2unix.exe
fi

# /etc/preremove/cygutils.sh:
if cmp -s /usr/bin/conv.exe /usr/bin/dos2unix.exe; then
  rm -f /usr/bin/dos2unix.exe
fi

# /etc/postinstall/dos2unix.sh:
ln -f /usr/bin/dos2unix-linux.exe /usr/bin/dos2unix.exe

# /etc/preremove/dos2unix.sh:
if cmp -s /usr/bin/dos2unix-linux.exe /usr/bin/dos2unix.exe; then
  if test -f /usr/bin/conv.exe; then
    ln -f /usr/bin/conv.exe /usr/bin/dos2unix.exe
  else
    rm -f /usr/bin/dos2unix.exe
  fi
fi


Christian



Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]