On 2024-07-26, at 16:24:52 -0400, Nicholas D Steeves wrote:
> Jeremy Sowden <aza...@debian.org> writes:
> > This error:
> >>  debian/rules clean
> >> dh clean --with elpa
> >>    dh_auto_clean
> >>    make -j8 clean
> >> make[1]: Entering directory '/<<PKGBUILDDIR>>'
> >> End of file during parsing
> >> rm -f *.elc .latest-* autoloads.el scala-mode- Error: end-of-file nil   
> >> mapbacktrace(#f(compiled-function (evald func args flags) #<bytecode 
> >> 0x943b01ebae87e2>))   debug-early-backtrace()   debug-early(error 
> >> (end-of-file))   read(#<buffer scala-mode-pkg.el>)   (nth 2 (read 
> >> (find-file "./scala-mode-pkg.el")))   (format "%s\n" (nth 2 (read 
> >> (find-file "./scala-mode-pkg.el"))))   (princ (format "%s\n" (nth 2 (read 
> >> (find-file "./scala-mode-pkg.el")))))   command-line-1(("-L" "." "--eval" 
> >> "(princ (format \"%s\\n\" (nth 2 (read (find-file 
> >> \"./scala-mode-pkg.el\")))))"))   command-line()   normal-top-level().tar
> >> /bin/sh: 1: Syntax error: "(" unexpected
> >> make[1]: *** [Makefile:55: clean] Error 2
> >
> > occurs because the Makefile does this (trimmed):
> >
> >   VERSION                 := $(shell ${ELISP_COMMAND} $(ELISP_OPTIONS) 
> > --eval '(princ (format "%s\n" (nth 2 (read (find-file "$(PKG_FILE)")))))')
> >   MODE_NAME_VERSION       = $(MODE_NAME)-$(VERSION)
> >
> >   clean:
> >           $(RM) *.elc .latest-* autoloads.el $(MODE_NAME_VERSION).tar
> >
> > It tries to use Emacs to get the version from the scala-mode-pkg.el
> > file, but that doesn't exist, so the output from the `$(shell)` command
> > is a stack-trace, not a version number.
> >
> > Make prefers variable definitions given as arguments at the command line
> > to those defined in the Makefile, so if `VERSION=X.Y.Z` is passed to
> > `make clean`:
> >
> >   override_dh_autoclean:
> >           dh_auto_clean -- VERSION=X.Y.Z
> >
> > Emacs isn't called, and the error goes away.

Actually, it turns out that emacs _is_ called:

  dh clean --with elpa
     debian/rules override_dh_auto_clean
  make[1]: Entering directory '/build/scala-mode-el-1.1.0+git20240113.4c6d636'
  dh_auto_clean -- VERSION=1.1.0
          make -j16 clean VERSION=1.1.0
  make[2]: Entering directory '/build/scala-mode-el-1.1.0+git20240113.4c6d636'
  End of file during parsing
  ^^^^^^^^^^^^^^^^^^^^^^^^^^

but the stack-trace doesn't get assigned to the variable, and the build
continues successfully:

  rm -f *.elc .latest-* autoloads.el scala-mode-1.1.0.tar
  [ ! -d scala-mode-1.1.0 ] || rm -f scala-mode-1.1.0/*
  [ ! -d scala-mode-1.1.0 ] || rmdir scala-mode-1.1.0
  make[2]: Leaving directory '/build/scala-mode-el-1.1.0+git20240113.4c6d636'
  make[1]: Leaving directory '/build/scala-mode-el-1.1.0+git20240113.4c6d636'

> Thank you, yes, this is one of the right ways to solve this issue, and I
> hope it's evident to everyone following this thread why this is the
> case.  :)
>
> Please use Xiyue Deng (manphiz)'s work on SUBSTVARS for "VERSION=X.Y.Z",
> and feel free to apply any fixups; I seem to remember that there's
> something like a fragile regex.

This?

  BASE_UPSTREAM_VERSION=$(shell echo ${DEB_VERSION_UPSTREAM} | sed 
"s/\+git.*//")

I replaced it with:

  BASE_UPSTREAM_VERSION = $(word 1,$(subst +git, ,$(DEB_VERSION_UPSTREAM)))

> > I will push this change and review the rest of this (lengthy :))
> > report.
>
> Rather than reading this mentoring thread--long form for educational
> value--it's probably faster to review d/changelog, diff
> debian/20111005-2.1, and check for consistency.
>
> P.S. did you forget to push?

Indeed.  Now done.

J.

Attachment: signature.asc
Description: PGP signature

Reply via email to