Bug 271998 - [NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice versa text file format converter
Summary: [NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice versa text file for...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Nuno Teixeira
URL: https://waterlan.home.xs4all.nl/dos2u...
Keywords:
Depends on:
Blocks:
 
Reported: 2023-06-14 20:28 UTC by Dimitry Andric
Modified: 2023-06-28 17:45 UTC (History)
1 user (show)

See Also:


Attachments
[NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice versa text file format converter (6.57 KB, patch)
2023-06-14 20:28 UTC, Dimitry Andric
no flags Details | Diff
[NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice versa text file format converter (6.98 KB, patch)
2023-06-26 12:36 UTC, Dimitry Andric
no flags Details | Diff
fixed pkg-plist v0 (4.27 KB, patch)
2023-06-26 13:28 UTC, Nuno Teixeira
no flags Details | Diff
[NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice versa text file format converter (8.52 KB, patch)
2023-06-26 14:57 UTC, Dimitry Andric
no flags Details | Diff
sugestion with docs/strip fixed (7.30 KB, patch)
2023-06-27 07:18 UTC, Nuno Teixeira
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Dimitry Andric freebsd_committer freebsd_triage 2023-06-14 20:28:14 UTC
This is a port for Erwin Waterlander's dos2unix, which is shipped in
most Linux distributions, and has many more features than the similar
converters/dosunix and converters/unix2dos ports. It is also much more
maintained, as those other ports have not had significant updates in
years.

The port has an NLS option to toggle the building and installing of
multi-lingual messages, man pages, and other documentation.

Note that this port's "dos2unix" and "unix2dos" binaries conflict with
those of the converters/unix2dos port, but I see no good reason to have
both installed at the same time.
Comment 1 Dimitry Andric freebsd_committer freebsd_triage 2023-06-14 20:28:36 UTC
Created attachment 242779 [details]
[NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice  versa text file format converter
Comment 2 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 09:58:40 UTC
Can I commit this? What is the procedure? :)
Comment 3 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-26 10:44:22 UTC
Hello Dimitry,

Sugestions:

- Use DISTVERSION instead of PORTVERSION
  ( https://docs.freebsd.org/en/books/porters-handbook/book/#makefile-versions )

- Define LICENSE_FILE if included in distfile

- NLS: NLS is controlling share/locale wich is correct but it's doing same for share/docs and share/man what I think it's not too correct.

What about adding a DOCS option to control share/docs and share/man native language and mix %%DOCS%%%%NLS%% for all translated mans and docs?

e.g.:
---
%%DOCS%%%%NLS%%man/<LANG>/man1/portname.1.gz
%%DOCS%%man/man1/portname.1.gz

%%DOCS%%share/doc/portname/manual.htm
%%DOCS%%%%NLS%%share/doc/portname/<LANG>/manual.htm

%%NLS%%share/locale/<LANG>/LC_MESSAGES/portname.mo
---
Comment 4 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 10:49:00 UTC
(In reply to Nuno Teixeira from comment #3)
It's upstream's choice to put the translated documentation and manpages under NLS, so it would be more effort to remove those files from the stage dir. I will take a look at that, are there other examples in the ports tree on how to do that? Or can packaging ignore certain files in the stage dir, if necessary?
Comment 5 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 10:49:04 UTC
(In reply to Nuno Teixeira from comment #3)
It's upstream's choice to put the translated documentation and manpages under NLS, so it would be more effort to remove those files from the stage dir. I will take a look at that, are there other examples in the ports tree on how to do that? Or can packaging ignore certain files in the stage dir, if necessary?
Comment 6 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 10:49:53 UTC
Sorry, Bugzilla tricked me with its stupid "mid-air collision" dialogs, I have accidentally changed the state of some fields but I have no idea which ones.
Comment 7 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-26 10:56:12 UTC
(In reply to Dimitry Andric from comment #5)
>it's upstream's choice to put the translated documentation and manpages under >NLS, so it would be more effort to remove those files from the stage dir. I >will take a look at that, are there other examples in the ports tree on how to >do that? Or can packaging ignore certain files in the stage dir, if necessary?

translated docs and mans continue to be under control of NLS. We just adding DOCS to control what docs to be installed with NLS on/off.

This not interfere with stage, it just tells what to be installed.
Comment 8 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 12:36:32 UTC
Created attachment 243010 [details]
[NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice  versa text file format converter

Updated patch for comments:
* Used DISTVERSION
* Added LICENSE_FILE
* Added DOCS knob
Comment 9 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-26 13:28:21 UTC
Created attachment 243012 [details]
fixed pkg-plist v0

It seems that program create symlinks related to mac:

---
% ls -l stage/usr/local/share/man/man1/
total 14
-rw-r--r--  1 nobody  wheel  10700 Jun 26 13:19 dos2unix.1.gz
lrwxr-xr-x  1 nobody  wheel     13 Jun 26 13:19 mac2unix.1.gz -> dos2unix.1.gz
lrwxr-xr-x  1 nobody  wheel     13 Jun 26 13:19 unix2dos.1.gz -> dos2unix.1.gz
lrwxr-xr-x  1 nobody  wheel     13 Jun 26 13:19 unix2mac.1.gz -> dos2unix.1.gz

% ls -l stage/usr/local/bin/
total 130
-rwxr-xr-x  1 nobody  wheel  63280 Jun 26 13:19 dos2unix
lrwxr-xr-x  1 nobody  wheel      8 Jun 26 13:19 mac2unix -> dos2unix
-rwxr-xr-x  1 nobody  wheel  63960 Jun 26 13:19 unix2dos
lrwxr-xr-x  1 nobody  wheel      8 Jun 26 13:19 unix2mac -> unix2dos
---

And Q/A misses that:
---
===> Checking for items in STAGEDIR missing from pkg-plist
Error: Orphaned: bin/mac2unix
Error: Orphaned: bin/unix2mac
Error: Orphaned: share/man/de/man1/mac2unix.1.gz
Error: Orphaned: share/man/de/man1/unix2mac.1.gz
Error: Orphaned: share/man/es/man1/mac2unix.1.gz
Error: Orphaned: share/man/es/man1/unix2mac.1.gz
Error: Orphaned: share/man/fr/man1/mac2unix.1.gz
Error: Orphaned: share/man/fr/man1/unix2mac.1.gz
Error: Orphaned: share/man/ko/man1/mac2unix.1.gz
Error: Orphaned: share/man/ko/man1/unix2mac.1.gz
Error: Orphaned: share/man/man1/mac2unix.1.gz
Error: Orphaned: share/man/man1/unix2mac.1.gz
Error: Orphaned: share/man/nl/man1/mac2unix.1.gz
Error: Orphaned: share/man/nl/man1/unix2mac.1.gz
Error: Orphaned: share/man/pl/man1/mac2unix.1.gz
Error: Orphaned: share/man/pl/man1/unix2mac.1.gz
Error: Orphaned: share/man/pt_BR/man1/mac2unix.1.gz
Error: Orphaned: share/man/pt_BR/man1/unix2mac.1.gz
Error: Orphaned: share/man/ro/man1/mac2unix.1.gz
Error: Orphaned: share/man/ro/man1/unix2mac.1.gz
Error: Orphaned: share/man/sr/man1/mac2unix.1.gz
Error: Orphaned: share/man/sr/man1/unix2mac.1.gz
Error: Orphaned: share/man/sv/man1/mac2unix.1.gz
Error: Orphaned: share/man/sv/man1/unix2mac.1.gz
Error: Orphaned: share/man/uk/man1/mac2unix.1.gz
Error: Orphaned: share/man/uk/man1/unix2mac.1.gz
Error: Orphaned: share/man/zh_CN/man1/mac2unix.1.gz
Error: Orphaned: share/man/zh_CN/man1/unix2mac.1.gz
---

Any config tweak to disable those symlinks?
Comment 10 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 13:32:11 UTC
(In reply to Nuno Teixeira from comment #9)
Oh that's a good one, I think the mac2unix and unix2mac links should be included in the package, as they're shortcuts for those conversions.

What are you running to get the "===> Checking for items in STAGEDIR missing from pkg-plist" messages? I tried portlint but it finds everything OK.
Comment 11 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-26 13:55:13 UTC
(In reply to Dimitry Andric from comment #10)

I'm running inside poudriere jail in interactive mode (testport).

My personal opinion is to find a way to remove 'mac2unix' and 'unix2mac' references and for that we can use a soft way as build configure or a hard way of removing those links with ${RM}.

I can take a look at it tomorrow.

Also I remember tewaking a configure some time ago to fix:

- %%DOCSDIR%%-7.5.0/es/dos2unix.htm
+ %%DOCSDIR%%/es/dos2unix.htm

So we can have a more beutifull pkg-plist :)

( DOCSDIR gets expanded to PREFIX/share/doc/PORTNAME )

And remember that we will need a conflict in both ports:

Name    : unix2dos-1.3
Comment : Convert ASCII newlines between CR/LF and LF
Repo    : FreeBSD
Filename: usr/local/bin/unix2dos
(...)
Filename: usr/local/bin/dos2unix
Comment 12 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-26 14:13:48 UTC
(In reply to Dimitry Andric from comment #10)
(...)

> Oh that's a good one, I think the mac2unix and unix2mac links should be 
> included in the package, as they're shortcuts for those conversions.

Sorry didn't read that at first.
*If* those symlinks are to be included in pkg then ignore my previous message.

Just confirm that symlinks are to be included so I can recreate pkg-plist and carry on.
Comment 13 Dimitry Andric freebsd_committer freebsd_triage 2023-06-26 14:57:29 UTC
Created attachment 243014 [details]
[NEW PORT] converters/dos2unix: DOS/Mac to Unix and vice  versa text file format converter

Changes:
* add mac2unix and unix2mac symlinks (for binaries and man pages)
* added CONFLICTS_INSTALL
* defined DOCSDIR and used it in pkg-plist
Comment 14 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-26 19:48:33 UTC
(In reply to Dimitry Andric from comment #13)

All good with pkg-plist.

- DOCSDIR: ${WRKSRC}/Makefile defines it as 'docsubdir = $(PACKAGE)-$(DOS2UNIX_VERSION)' and it can simply be configured to just 'docsubdir = $(PACKAGE)' but its fine eather way.

- STRIP: ${WRKSRC}/Makefile mention stripping binaries but they don't being stripped:

====> Running Q/A tests (stage-qa)
Warning: 'bin/dos2unix' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}
Warning: 'bin/unix2dos' is not stripped consider trying INSTALL_TARGET=install-strip or using ${STRIP_CMD}

- CONFLICTS_INSTALL usually don't need comments.
Comment 15 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-27 07:18:43 UTC
Created attachment 243031 [details]
sugestion with docs/strip fixed

- Use MAKE_ARGS to set docs dir correctly. DOCSDIR should not have a version in PORTNAME
- Strip binaries

Ready do commit
Comment 16 Dimitry Andric freebsd_committer freebsd_triage 2023-06-27 07:30:27 UTC
(In reply to Nuno Teixeira from comment #15)
And how does it get added to converters/Makefile? Is that a separate step?
Comment 17 Nuno Teixeira freebsd_committer freebsd_triage 2023-06-27 08:29:05 UTC
(In reply to Dimitry Andric from comment #16)

You should commit converters/Makefile toguether with converters/dos2unix port.
A second commit should add CONFLICTS_INSTALL to converters/unix2dos (don't know if a bump PORTREVISION is needed here, but if unsure just bump it)
Comment 18 commit-hook freebsd_committer freebsd_triage 2023-06-28 17:43:53 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=0a41062b5b5a90548e1a8b529448dd8a389c6203

commit 0a41062b5b5a90548e1a8b529448dd8a389c6203
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-06-28 17:34:53 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-06-28 17:39:39 +0000

    converters/dos2unix: Add new port

    This is a port for Erwin Waterlander's dos2unix, which is shipped in
    most Linux distributions, and has many more features than the similar
    converters/dosunix and converters/unix2dos ports. It is also much more
    maintained, as those other ports have not had significant updates in
    years.

    The port has DOCS and NLS options, to toggle the building and/or
    installing of documentation, multi-lingual messages and man pages.

    Note that this port's "dos2unix" and "unix2dos" binaries conflict with
    those of the converters/unix2dos port, but I see no good reason to have
    both installed at the same time.

    PR:             271998
    Reviewed by:    eduardo
    MFH:            2023Q2

 converters/Makefile                 |   1 +
 converters/dos2unix/Makefile (new)  |  31 ++++++++++
 converters/dos2unix/distinfo (new)  |   3 +
 converters/dos2unix/pkg-descr (new) |  18 ++++++
 converters/dos2unix/pkg-plist (new) | 112 ++++++++++++++++++++++++++++++++++++
 5 files changed, 165 insertions(+)
Comment 19 commit-hook freebsd_committer freebsd_triage 2023-06-28 17:43:54 UTC
A commit in branch main references this bug:

URL: https://cgit.FreeBSD.org/ports/commit/?id=fdc58defc52fcafb84e22fc729fe2466cdb68339

commit fdc58defc52fcafb84e22fc729fe2466cdb68339
Author:     Dimitry Andric <dim@FreeBSD.org>
AuthorDate: 2023-06-28 17:42:16 +0000
Commit:     Dimitry Andric <dim@FreeBSD.org>
CommitDate: 2023-06-28 17:42:18 +0000

    converters/unix2dos: mark install conflict with converters/dos2unix

    PR:             271998
    Reviewed by:    eduardo
    MFH:            2023Q2

 converters/unix2dos/Makefile | 3 +++
 1 file changed, 3 insertions(+)
Comment 20 Dimitry Andric freebsd_committer freebsd_triage 2023-06-28 17:45:24 UTC
Thanks Nuno!