Friday, January 01, 2021

Creating package debug... Fatal error: can't parse comment is too long

Hi,

I often generate my own distfiles from git checkout when I debug code
from OpenBSD ports tree. Some of the ports have already debug packages
defined. Sample debug package looks as follows:

# pkg_info -I debug-sane-backends
debug-sane-backends-1.0.31p1 debug info for sane-backends-1.0.31p1
debug-sane-backends-1.0.31p1-snmp debug info for sane-backends-1.0.31p1-snmp

As you can see package version ends up inside the COMMENT. When I
generate my debugging distfiles, they are usually generated from
git repos as most projects are currently hosted on GitHub and that's
git. Here is example distfile:

sane-backends-1.0.31.0.20201130.120702.git.e3e397556.tar.gz

and I generate it something a long the lines of:

git archive --format=tar --prefix="$prefix.0.$date.git.$sha/" $hash | gzip -9nf

I find that naming convention useful to me. However with that long
versioning it goes over the limit of 60 characters in COMMENT, per code
in OpenBSD/PkgCreate.pm, function add_description().

Looking at current code in bsd.port.mk:

1201 . if ${DEBUG_PACKAGES:M${_S}}
1202 _DBG_PKG_ARGS${_S} := ${PKG_ARGS${_S}}
1203 _DBG_PKG_ARGS${_S} += -P${FULLPKGPATH${_S}}:${FULLPKGNAME${_S}}:${FULLPKGNAME${_S}}
1204 _DBG_PKG_ARGS${_S} += -DCOMMENT="debug info for ${FULLPKGNAME${_S}}"
1205 _DBG_PKG_ARGS${_S} += -d"-debug info for ${FULLPKGNAME${_S}}"
1206 # XXX revisit that fullpkgpath later ?
1207 _DBG_PKG_ARGS${_S} += -DFULLPKGPATH=debug/${FULLPKGPATH${_S}}
1208 _DBG_PKG_ARGS${_S} += -f ${_WRKDEBUG}/${PLIST${_S}:T}
1209 _EXCLUDE_DEBUG_PLISTS += ${_WRKDEBUG}/${PLIST${_S}:T}
1210 _pkg${_S} += ${_DBG_PKGFILE${_S}}
1211 _pkg_cookie${_S} += ${_DBG_PACKAGE_COOKIE${_S}}
1212 . endif

We see that version information is also inside description of the
package:

# pkg_info debug-sane-backends-- | grep -A1 -E '^(Comment|Description)'
Comment:
debug info for sane-backends-1.0.31p1
Description:
debug info for sane-backends-1.0.31p1

So my proposition is to just drop the version part from the comment:

Index: bsd.port.mk
===================================================================
RCS file: /cvs/ports/infrastructure/mk/bsd.port.mk,v
retrieving revision 1.1542
diff -u -p -u -r1.1542 bsd.port.mk
--- bsd.port.mk 26 Jun 2020 11:51:16 -0000 1.1542
+++ bsd.port.mk 1 Jan 2021 19:48:31 -0000
@@ -1201,7 +1201,7 @@ _pkg_cookie${_S} = ${_PACKAGE_COOKIE${_S
. if ${DEBUG_PACKAGES:M${_S}}
_DBG_PKG_ARGS${_S} := ${PKG_ARGS${_S}}
_DBG_PKG_ARGS${_S} += -P${FULLPKGPATH${_S}}:${FULLPKGNAME${_S}}:${FULLPKGNAME${_S}}
-_DBG_PKG_ARGS${_S} += -DCOMMENT="debug info for ${FULLPKGNAME${_S}}"
+_DBG_PKG_ARGS${_S} += -DCOMMENT="debug info for ${PKGSTEM${_S}}"
_DBG_PKG_ARGS${_S} += -d"-debug info for ${FULLPKGNAME${_S}}"
# XXX revisit that fullpkgpath later ?
_DBG_PKG_ARGS${_S} += -DFULLPKGPATH=debug/${FULLPKGPATH${_S}}

However I think that would require to bump all debug packages across the
entire OpenBSD ports tree, right? Anyway, I would love to see above diff
committed. Comments?

--
Regards,
Mikolaj

No comments:

Post a Comment