Github messages for voidlinux
 help / color / mirror / Atom feed
From: noraj <noraj@users.noreply.github.com>
To: ml@inbox.vuxu.org
Subject: Re: New package: haiti-1.3.0
Date: Sun, 03 Jul 2022 20:11:32 +0200	[thread overview]
Message-ID: <20220703181132.pismhX4TBwzjJPyMeDPBaYzphFg4fWISgr638UoxsVU@z> (raw)
In-Reply-To: <gh-mailinglist-notifications-41a7ca26-5023-4802-975b-f1789d68868e-void-packages-37804@inbox.vuxu.org>

[-- Attachment #1: Type: text/plain, Size: 5053 bytes --]

New comment by noraj on void-packages repository

https://github.com/void-linux/void-packages/pull/37804#issuecomment-1173146895

Comment:
https://github.com/void-linux/void-packages/runs/7163511132?check_suite_focus=true

> Error: 533152dd: subject does not follow CONTRIBUTING.md guildelines

The cause is not very detailed by I guess it's the commit description that is wrong.

By the way I was trying to change the package name to the tool name and thought this would have been enough:

```shell
# Template file for 'haiti'
pkgname=haiti
_gemname=haiti-hash
version=1.3.0
revision=1
build_style=gem
depends="ruby-docopt ruby-paint"
short_desc="Hash type identifier (CLI & lib)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://noraj.github.io/haiti/"
changelog="https://github.com/noraj/haiti/blob/master/docs/CHANGELOG.md"
distfiles="https://rubygems.org/downloads/${_gemname}-${version}.gem>${pkgname}-${version}.gem"
checksum=d2a2808cc1626bc5bb24c34a211645c2b3749af6f7d595a9a2d65d1be0d72a9f

post_install() {
	vlicense LICENSE.txt
}
```

But I have a hard time doing that since https://github.com/void-linux/void-packages/blob/master/common/build-style/gem.sh assume that `${pkgname}` or `${pkgname#ruby-}` = gem file name =  the gem name, and https://github.com/void-linux/void-packages/blob/master/common/build-style/gemspec.sh assumes `${pkgname}` or `${pkgname#ruby-}` = gem file name = the gem name = gemspec file name.

But since I have `pkgname = haiti`, gemname = haiti-hash, and gamespec = haiti. I can easily rename `haiti-hash-1.3.0.gem` to `haiti-1.3.0.gem` but `/host/sources/by_sha256` will still use `<sha256>_haiti-hash-1.3.0.gem`. But some variables in the helper such as `_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${pkgname#ruby-}-${version}` are using pkgname. If feels like there should be a `gemname` variable available that would be equal by default to `${pkgname#ruby-}` but that could be overwritten to overcome those issues.

So in order to manage that I have to re-define the whole `do_install()` just to make `_INSTDIR` and the last `sed` use `${_gemname}` instead of `${pkgname#ruby-}`.

```shell
# Template file for 'haiti'
pkgname=haiti
_gemname=haiti-hash
version=1.3.0
revision=1
build_style=gem
depends="ruby-docopt ruby-paint"
short_desc="Hash type identifier (CLI & lib)"
maintainer="Orphaned <orphan@voidlinux.org>"
license="MIT"
homepage="https://noraj.github.io/haiti/"
changelog="https://github.com/noraj/haiti/blob/master/docs/CHANGELOG.md"
distfiles="https://rubygems.org/downloads/${_gemname}-${version}.gem>${pkgname}-${version}.gem"
checksum=d2a2808cc1626bc5bb24c34a211645c2b3749af6f7d595a9a2d65d1be0d72a9f

do_install() {
	: ${gem_cmd:=gem}

	local _GEMDIR _INSTDIR
	
	_GEMDIR=$($gem_cmd env gemdir)
	_INSTDIR=${DESTDIR}/${_GEMDIR}/gems/${_gemname}-${version}

	$gem_cmd install \
		--local \
		--install-dir ${DESTDIR}/${_GEMDIR} \
		--bindir ${DESTDIR}/usr/bin \
		--ignore-dependencies \
		--no-document \
		--verbose \
		${XBPS_SRCDISTDIR}/${pkgname}-${version}/${pkgname#ruby-}-${version}.gem

	# Remove cache
	rm -rf ${DESTDIR}/${_GEMDIR}/cache

	# Remove ext directory. they are only source code and configuration
	# The actual extensions are guarded in an arch path
	rm -rf ${_INSTDIR}/ext

	# Remove installed tests and benchmarks
	rm -rf ${_INSTDIR}/{test,tests,autotest,benchmark,benchmarks,script,examples,demo}

	# Remove files shipped on the root of the gem, most of the time they are useless
	find ${_INSTDIR} -maxdepth 1 -type f -delete

	# Remove unnecessary files
	find ${DESTDIR}/${_GEMDIR}/extensions \( -name mkmf.log -o -name gem_make.out \) -delete

	# Place manpages in usr/share/man/man[0-9]
	if [ -d ${_INSTDIR}/man ]; then
		find ${_INSTDIR}/man -type f -name '*.[0-8n]' | while read -r m; do
			vman ${m}
		done
	fi

	rm -rf "${_INSTDIR}/man"

	# Place executables in /usr/bin
	if [ -d "${_INSTDIR}/bin" ]; then
		for f in "${_INSTDIR}"/bin/*; do
			vbin "${f}"
		done
	fi

	rm -rf ${_INSTDIR}/bin

	# Place conf files in their places
	if [ -d ${_INSTDIR}/etc ]; then
		find ${_INSTDIR}/etc -type f | while read -r c; do
			vmkdir ${c%/*}/
			mv ${c} "${DESTDIR}/${c##*${_INSTDIR}/etc/}/"
		done
	fi

	rm -rf ${_INSTDIR}/etc

	# Ignore the ~> operator, replace it with >=
	sed 's|~>|>=|g' \
		-i ${DESTDIR}/${_GEMDIR}/specifications/${_gemname}-${version}.gemspec
}

post_install() {
	vlicense LICENSE.txt
}
```

Bit this seems hardly maintainable.

So the 3 options are : 

- Add a optional `gemname` variable in templates
- Use `do_install()` override but it's hard to maintain since each template using this method would have to be changed when `common/build-style/gem.sh` changes
- Keep `ruby-<gem-name>` for pkgname which is less end-user friendly (`goatcounter` is `goatcounter` not `go-goatcounter` or `you-get` pkgname is `you-get` and not `python-you-get`)

I wonder if there is an easy alternative I'm missing.

  parent reply	other threads:[~2022-07-03 18:11 UTC|newest]

Thread overview: 15+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-07-02 17:30 [PR PATCH] add haiti and its dependencies noraj
2022-07-03  9:53 ` New package: haiti-1.3.0 sgn
2022-07-03 15:48 ` noraj
2022-07-03 18:11 ` noraj [this message]
2022-07-03 18:19 ` [PR PATCH] [Updated] " noraj
2022-07-03 22:55 ` sgn
2022-07-03 22:55 ` [PR PATCH] [Closed]: " sgn
2022-07-04 11:01 ` noraj
2022-07-05  2:52 ` sgn
2022-07-05  2:53 ` sgn
2022-07-05  2:53 ` sgn
2022-07-05  2:57 ` sgn
2022-07-05  7:51 ` noraj
2022-07-05 10:13 ` sgn
2022-07-05 10:27 ` noraj

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20220703181132.pismhX4TBwzjJPyMeDPBaYzphFg4fWISgr638UoxsVU@z \
    --to=noraj@users.noreply.github.com \
    --cc=ml@inbox.vuxu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).