Skip to content

Commit

Permalink
ci(dist): change generated source archive to use version
Browse files Browse the repository at this point in the history
The current srpm generation in the build system creates an upstream
tarball named as "NAME-COMMIT.tar.gz" containing a single directory
named in the same way (i.e. "NAME-COMMIT"); while this works fine in
newer versions of RPM, older versions such as the one in EL 8 require
that the source tarball has a single directory named "NAME-VERSION".

Hence, change both things to be more in line with what is generally done
in RPM packaging:
- change the name of the generated upstream tarball to contain the
  version and not the commit (which is later added as part of the RPM
  Release)
- set the "archivename" RPM variable to the format wanted; this variable
  is used by the forgemeta RPM macros, used internally by the Go (S)RPM
  macros

This requires setting "Version" earlier, i.e. before using the %gometa
macro.

Signed-off-by: Pino Toscano <[email protected]>
  • Loading branch information
ptoscano authored and subpop committed Nov 13, 2023
1 parent 4fe18d5 commit 97694cc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
4 changes: 2 additions & 2 deletions dist/srpm/meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ tarball = custom_target('tarball',
'--gzip',
'--absolute-names',
'--file', '@OUTPUT@',
'--transform', 's+@0@+@1@-@2@+'.format(meson.project_source_root(), meson.project_name(), commit),
'--transform', 's+@0@+@1@-@2@+'.format(meson.project_source_root(), meson.project_name(), meson.project_version()),
'--exclude', build_root_basename,
'--exclude', '.git',
'--exclude', '.vscode',
'--exclude', '.github',
'--exclude', '.copr',
meson.project_source_root()
],
output: '@0@-@[email protected]'.format(meson.project_name(), commit)
output: '@0@-@[email protected]'.format(meson.project_name(), meson.project_version())
)

specfile = configure_file(
Expand Down
5 changes: 4 additions & 1 deletion dist/srpm/yggdrasil.spec.in
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,14 @@

%bcond_without check

# must be before %%gometa
Version: @VERSION@

# https://github.com/redhatinsights/yggdrasil
%global goipath github.com/redhatinsights/yggdrasil
%global commit @COMMIT@
%global shortcommit %(c=%{commit}; echo ${c:0:7})
%global archivename yggdrasil-%{version}

%if 0%{?fedora}
%gometa -f
Expand Down Expand Up @@ -41,7 +45,6 @@ exchanging data with its worker processes through a D-Bus message broker.}
%global godocs CONTRIBUTING.md README.md

Name: yggdrasil
Version: @VERSION@
Release: 0%{?dist}
Summary: Remote data transmission and processing client

Expand Down

0 comments on commit 97694cc

Please sign in to comment.