Bug 243287 - "make -C /usr/src/release OSRELEASE=something release" gives errors on stable/12 amd64
Summary: "make -C /usr/src/release OSRELEASE=something release" gives errors on stable...
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: bin (show other bugs)
Version: 12.0-STABLE
Hardware: Any Any
: --- Affects Only Me
Assignee: freebsd-bugs mailing list
URL:
Keywords: needs-qa
Depends on:
Blocks:
 
Reported: 2020-01-12 08:24 UTC by Trond.Endrestol
Modified: 2020-01-20 15:38 UTC (History)
1 user (show)

See Also:
koobs: maintainer-feedback? (re)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trond.Endrestol 2020-01-12 08:24:03 UTC
Setting a value for OSRELEASE when making a release on stable/12 amd64 gives errors:

make -C /usr/src/release -D NO_INSTALLEXTRAKERNELS NODOC=1 NOPORTS=1 NOSRC=1 OSRELEASE=FSI-`uname -s`-`uname -r`-`uname -p` release

make: "/usr/src/release/Makefile.ec2" line 32: Malformed conditional (${BRANCH} == "CURRENT" || ${BRANCH} == "STABLE" || ${BRANCH} == "PRERELEASE")
make: "/usr/src/release/Makefile.azure" line 19: Malformed conditional (${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE")
make: "/usr/src/release/Makefile.gce" line 26: Malformed conditional (${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE")
make: "/usr/src/release/Makefile.vagrant" line 31: Malformed conditional (${BRANCH} == "STABLE" || ${BRANCH} == "CURRENT" || ${BRANCH} == "PRERELEASE")
make: Fatal errors encountered -- cannot continue
make: stopped in /usr/src/release

Source tree is at r356645.

Omitting OSRELEASE works as intended.

If the variable OSRELEASE now serves a different role, then release(7) should reflect this, and maybe a new variable should be created to serve the original purpose of OSRELEASE when making a release.
Comment 1 Glen Barber freebsd_committer 2020-01-13 16:31:04 UTC
The problem is by defining OSRELEASE, the TYPE, BRANCH, and REVISION variables do not get set.

I have added logic to ensure the variables do get set if they are not otherwise defined.  Thank you for the report.
Comment 2 commit-hook freebsd_committer 2020-01-13 16:31:50 UTC
A commit references this bug:

Author: gjb
Date: Mon Jan 13 16:31:01 UTC 2020
New revision: 356685
URL: https://svnweb.freebsd.org/changeset/base/356685

Log:
  Ensure the TYPE, BRANCH, and REVISION variables are set in
  cloudware targets when OSRELEASE is overridden.

  Submitted by:	Trond Endrestol
  PR:		243287
  MFC after:	3 days
  Sponsored by:	Rubicon Communications, LLC (netgate.com)

Changes:
  head/release/Makefile.vm
Comment 3 commit-hook freebsd_committer 2020-01-16 01:14:33 UTC
A commit references this bug:

Author: gjb
Date: Thu Jan 16 01:13:33 UTC 2020
New revision: 356770
URL: https://svnweb.freebsd.org/changeset/base/356770

Log:
  MFC r356685, r356686:
   r356685:
    Ensure the TYPE, BRANCH, and REVISION variables are set in
    cloudware targets when OSRELEASE is overridden. [1]

   r356686:
    Fix a typo.

  PR:		243287 [1]
  Sponsored by:	Rubicon Communications, LLC (netgate.com)

Changes:
_U  stable/11/
  stable/11/release/Makefile
  stable/11/release/Makefile.vm
_U  stable/12/
  stable/12/release/Makefile
  stable/12/release/Makefile.vm
Comment 4 Trond.Endrestol 2020-01-16 10:36:21 UTC
Still, something is not right.

First, I ran:

# make -C /usr/src/release -D NO_INSTALLEXTRAKERNELS NODOC=1 NOPORTS=1 NOSRC=1 disc1.iso memstick.img

Next, I ran:

# make -C /usr/src/release -D NO_INSTALLEXTRAKERNELS NODOC=1 NOPORTS=1 NOSRC=1 OSRELEASE=`hostname`-`uname -s`-`uname -r`-`uname -p` disc1.iso memstick.img

The latter command gave this output:

Building /usr/obj/usr/src/amd64.amd64/release/disc1.iso
200+0 records in
200+0 records out
819200 bytes transferred in 0.004640 secs (176549289 bytes/sec)
newfs_msdos: cannot get number of sectors per track: Operation not supported
newfs_msdos: cannot get number of heads: Operation not supported
/dev/md0: 1557 sectors in 1557 FAT12 clusters (512 bytes/cluster)
BytesPerSec=512 SecPerClust=1 ResSectors=1 FATs=2 RootDirEnts=512 Sectors=1600 Media=0xf8 FATsecs=5 SecPerTrack=63 Heads=1 HiddenSecs=0
1+0 records in
1+0 records out
32768 bytes transferred in 0.000188 secs (173858602 bytes/sec)
`memstick.img' is up to date.

I was expecting filenames such as

enterprise.ximalas.info-FreeBSD-12.1-STABLE-amd64disc1.iso
and
enterprise.ximalas.info-FreeBSD-12.1-STABLE-amd64memstick.img

or preferably

enterprise.ximalas.info-FreeBSD-12.1-STABLE-amd64-disc1.iso
and
enterprise.ximalas.info-FreeBSD-12.1-STABLE-amd64-memstick.img

Or is OSRELEASE only relevant when doing "make -C /usr/src/release ... install"?

Maybe changing release(7) is in order. It states near the end:

     OSRELEASE        Optional base name for generated media images (e.g.,
                      FreeBSD-9.0-RC2-amd64).  Defaults to the output of
                      `uname -s`-`uname -r`-`uname -p` within the chroot.

As far as I can tell, the last statement is false unless it relates to release.sh, in which case it should be moved nearer to the description of release.sh.

My source tree is pretty much up-to-date:

# svn info /usr/src
Path: /usr/src
Working Copy Root Path: /usr/src
URL: svn://svn.ximalas.info/freebsd/base/stable/12
Relative URL: ^/stable/12
Repository Root: svn://svn.ximalas.info/freebsd/base
Repository UUID: ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
Revision: 356777
Node Kind: directory
Schedule: normal
Last Changed Author: dim
Last Changed Rev: 356777
Last Changed Date: 2020-01-16 08:02:09 +0100 (Thu, 16 Jan 2020)
Comment 5 Glen Barber freebsd_committer 2020-01-16 15:00:46 UTC
OSRELEASE is only relevant with the install target.

    323 install:        release-install vm-install
    324
    325 release-install:
    326 .if defined(DESTDIR) && !empty(DESTDIR)
    327         mkdir -p ${DESTDIR}
    328 .endif

    330 .for I in ${IMAGES}
    331         cp -p ${I} ${DESTDIR}/${OSRELEASE}-${I}
Comment 6 commit-hook freebsd_committer 2020-01-16 15:08:26 UTC
A commit references this bug:

Author: gjb
Date: Thu Jan 16 15:07:52 UTC 2020
New revision: 356792
URL: https://svnweb.freebsd.org/changeset/base/356792

Log:
  Update release(7) to note OSRELEASE is only relevant when the
  'install' target is invoked.

  While here, bump the sample output version name, and explicitly
  add the 'obj' target to avoid polluting the src checkout.

  Submitted by:	Trond Endrestol
  PR:		243287 (related)
  MFC after:	3 days
  Sponsored by:	Rubicon Communications, LLC (netgate.com)

Changes:
  head/share/man/man7/release.7
Comment 7 Glen Barber freebsd_committer 2020-01-16 15:09:25 UTC
(In reply to Glen Barber from comment #5)

I have updated the release(7) manual page to reflect such.
Comment 8 commit-hook freebsd_committer 2020-01-20 15:38:24 UTC
A commit references this bug:

Author: gjb
Date: Mon Jan 20 15:38:05 UTC 2020
New revision: 356917
URL: https://svnweb.freebsd.org/changeset/base/356917

Log:
  MFC r356792:
   Update release(7) to note OSRELEASE is only relevant when the
   'install' target is invoked.

   While here, bump the sample output version name, and explicitly
   add the 'obj' target to avoid polluting the src checkout.

  PR:		243287 (related)
  Sponsored by:	Rubicon Communications, LLC (netgate.com)

Changes:
_U  stable/11/
  stable/11/share/man/man7/release.7
_U  stable/12/
  stable/12/share/man/man7/release.7