Bug 2384303 - file conflicts when updating eccode-data
Summary: file conflicts when updating eccode-data
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: Fedora
Classification: Fedora
Component: eccodes
Version: rawhide
Hardware: Unspecified
OS: Linux
unspecified
medium
Target Milestone: ---
Assignee: Jos de Kloe
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2025-07-29 19:02 UTC by Jos de Kloe
Modified: 2025-08-19 04:44 UTC (History)
4 users (show)

Fixed In Version: eccodes-2.42.0-3.fc41 eccodes-2.42.0-5.fc42 eccodes-2.42.0-5.fc41
Clone Of:
Environment:
Last Closed: 2025-08-19 04:15:49 UTC
Type: ---
Embargoed:


Attachments (Terms of Use)

Description Jos de Kloe 2025-07-29 19:02:06 UTC
As remarked by Orion Poplawski on the fedora devel mailinglist today (topic: Strange rpm conflicts), upgrading the eccodes-data package from version 2.40.0 to 2.42.0 results in the following error messages:


 sudo dnf upgrade -y eccodes\*
Updating and loading repositories:
Repositories loaded.
Package                                                Arch Version                                                 Repository                   Size
Upgrading:
 eccodes                                               x86_64 2.42.0-2.fc43                                           rawhide-koji                7.8 MiB
   replacing eccodes                                   x86_64 2.40.0-1.fc43                                           rawhide                7.7 MiB
 eccodes-data                                          noarch 2.42.0-2.fc43                                           rawhide-koji               42.0 MiB
   replacing eccodes-data                              noarch 2.40.0-1.fc43                                           rawhide               37.1 MiB
 eccodes-devel                                         x86_64 2.42.0-2.fc43                                           rawhide-koji              212.4 KiB
   replacing eccodes-devel                             x86_64 2.40.0-1.fc43                                           rawhide              212.0 KiB

Transaction Summary:
 Upgrading:          3 packages
 Replacing:          3 packages

Total size of inbound packages is 5 MiB. Need to download 0 B.
After this operation, 5 MiB extra will be used (install 50 MiB, remove 45 MiB).
[1/3] eccodes-0:2.42.0-2.fc43.x86_64                                                    100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[2/3] eccodes-devel-0:2.42.0-2.fc43.x86_64                                                    100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
[3/3] eccodes-data-0:2.42.0-2.fc43.noarch                                                    100% |   0.0   B/s |   0.0   B |  00m00s
>>> Already downloaded
--------------------------------------------------------------------------------------------------------------------------------------------------------------------
[3/3] Total                                                    100% |   0.0   B/s |   0.0   B |  00m00s
Running transaction
Transaction failed: Rpm transaction failed.
Warning: skipped OpenPGP checks for 3 packages from repository: rawhide-koji
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/1 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/110 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/174 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/2 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/20 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/21 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/221 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/222 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/223 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/225 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/226 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/227 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/228 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/229 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/230 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/231 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/232 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/233 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/234 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/235 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/236 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/237 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/31 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/41 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/42 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/64 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/10 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/11 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/12 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/7 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/8 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/9 from install of eccodes-data-2.42.0-2.fc43.noarch conflicts with file from package eccodes-data-2.40.0-1.fc43.noarch



Reproducible: Always

Steps to Reproduce:
upgrade the package
Actual Results:
upgrade fails to complete

Expected Results:
upgrade should just work

Additional Information:
The problem has been identified as an ancient rpm problem where in the upgraded package symbolic links are provided to replace directories in the previous version of the package.

Karolina Surma suggested to solve this using a lua scriptled as documented here:
https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/

Comment 1 Jos de Kloe 2025-07-29 20:12:51 UTC
So I tried to follow this example and added a little lua scriptlet to the spec file. This lua code works fine when I execute it in isolation using the rpmlua tool, i.e. it performs the expected directory renames.

Unfortunately, this lua code seems not executed by the dnf upgrade command when I test it locally on my system, so I must be overlooking something.
Maybe some extra lines are needed to activate it, or maybe it should be in a different point of the spec file?

The latest attempt of the spec file that I used for local testing is thus one:
---------------------------------------------
%if 0%{?el8}
%undefine __cmake_in_source_build
%endif

Name:           eccodes
Version:        2.42.0
Release:        2%{?dist}
Summary:        WMO data format decoding and encoding

# force the shared libraries to have these so versions
%global so_version       0.1
%global so_version_f90   0.1

# note that the test_data package provided on the ECMWF version
# is unversioned, so use the download date to discriminate
# between different versions.
%global datapack_date    20250202

# latest fedora-38/rawhide grib_api version is 1.27.0-18
# but this version number is to be updated as soon as we know
# what the final release of grib_api by upstream will be.
# latest upstream grib_api release is 1.28.0 (05-Dec-2018)
# as was written on https://confluence.ecmwf.int/display/GRIB/Home
# (Note that this page is no longer available, 17-Oct-2020)
%global final_grib_api_version 1.28.1-1%{?dist}

%ifarch i686 ppc64 armv7hl
  %global obsolete_grib_api 0
%else
  %global obsolete_grib_api 1
%endif

# license remarks:
# Most of eccodes is licensed ASL 2.0 (which is identical to the SPDX
# identifier Apache-2.0) but a special case must be noted.
# These 2 files:
#     src/grib_yacc.c
#     src/grib_yacc.h
# contain a special exception clause that allows them to be
# relicensed if they are included in a larger project

License:        Apache-2.0

URL:            https://confluence.ecmwf.int/display/ECC/ecCodes+Home
Source0:        https://confluence.ecmwf.int/download/attachments/45757960/eccodes-%{version}-Source.tar.gz

# note: this data package is unversioned upstream but still it is updated
# now and then so rename the datapack using the download date
# to make it versioned in fedora
Source1:        https://get.ecmwf.int/repository/test-data/eccodes/eccodes_test_data.tar.gz#/eccodes_test_data_%{datapack_date}.tar.gz

# a custom script to create man pages
Source2:        eccodes_create_man_pages.sh

# Add soversion to the shared libraries, since upstream refuses to do so
# https://jira.ecmwf.int/browse/SUP-1809
Patch1:         eccodes-soversion.patch

# note that the requests to make the other issues public are filed here:
# https://jira.ecmwf.int/browse/SUP-2073
# (and again, unfortunately this issue is not public)

BuildRequires:  cmake3 >= 3.18
BuildRequires:  gcc-c++
BuildRequires:  gcc-gfortran
BuildRequires:  /usr/bin/git
BuildRequires:  jasper-devel
BuildRequires:  openjpeg2-devel >= 2.5.2
BuildRequires:  libpng-devel
BuildRequires:  netcdf-devel
BuildRequires:  libaec-devel

# For tests
BuildRequires:  perl(Getopt::Long)
BuildRequires:  perl(Test::More)
BuildRequires:  perl(File::Compare)

# For creation of man pages
BuildRequires:  help2man

# The data is needed by the library and all tools provided in the main package.
# The other way around, the data package could be installed without
# installing the base package. It will probably be pretty useless,
# unless a user wishes to read and study all these grib and bufr
# file format definitions.
Requires: %{name}-data = %{version}-%{release}

# NOTE: upstream writes:
# """
# For GRIB encoding and decoding, the GRIB-API functionality is provided
# fully in ecCodes with only minor interface and behaviour changes.
# Interfaces for C, Fortran 90 and Python are all maintained as in GRIB-API.
# However, the GRIB-API Fortran 77 interface is no longer available.
# """
# Therefore, since the library name and pkg-config file content changes
# and fortran77 support was removed, this replacement package cannot be
# considered compatible enough and no Provides can be defined.
#
# Furthermore, upstream writes:
# "Please note that GRIB-API support is being discontinued at the end of 2018."
# So the old grib_api will need to be obsoleted.

%if 0%{obsolete_grib_api}
# as stated in the note above, setting provides seems not correct here
# Provides:       grib_api = %%{final_grib_api_version}
Obsoletes:      grib_api < %{final_grib_api_version}
%endif

# as explained in bugzilla #1562066
ExcludeArch: i686

%description
ecCodes is a package developed by ECMWF which provides an application
programming interface and a set of tools for decoding and encoding messages
in the following formats:

 *  WMO FM-92 GRIB edition 1 and edition 2
 *  WMO FM-94 BUFR edition 3 and edition 4 
 *  WMO GTS abbreviated header (only decoding).

A useful set of command line tools provide quick access to the messages. C,
and Fortran 90 interfaces provide access to the main ecCodes functionality.

ecCodes is an evolution of GRIB-API.  It is designed to provide the user with
a simple set of functions to access data from several formats with a key/value
approach.

For GRIB encoding and decoding, the GRIB-API functionality is provided fully
in ecCodes with only minor interface and behaviour changes. Interfaces for C,
and Fortran 90 are all maintained as in GRIB-API.  However, the
GRIB-API Fortran 77 interface is no longer available.

In addition, a new set of functions with the prefix "codes_" is provided to
operate on all the supported message formats. These functions have the same
interface and behaviour as the "grib_" functions. 

A selection of GRIB-API tools has been included in ecCodes (ecCodes GRIB
tools), while new tools are available for the BUFR (ecCodes BUFR tools) and
GTS formats. The new tools have been developed to be as similar as possible
to the existing GRIB-API tools maintaining, where possible, the same options
and behaviour. A significant difference compared with GRIB-API tools is that
bufr_dump produces output in JSON format suitable for many web based
applications.

#######################################################
%package devel
Summary:    Contains ecCodes development files
Requires:   %{name}%{?_isa} = %{version}-%{release}
Requires:   gcc-gfortran%{?_isa}
Requires:   jasper-devel%{?_isa}

%if 0%{obsolete_grib_api}
# Provides:   grib_api-devel = %%{final_grib_api_version}
Obsoletes:  grib_api-devel < %{final_grib_api_version}
%endif

%description devel
Header files and libraries for ecCodes.

#####################################################
%package data
Summary:    Data needed by the eccodes library and tools
BuildArch:  noarch

%description data
This package provides all tables and definitions needed
to encode and decode grib and bufr files, and includes
both the official WMO tables and a number of often used
local definitions by ECMWF and other meteorological centers.

#####################################################
# include a LUA scriptlet as suggested on:
# https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/
# to assist in replacing a directory by a symlink

%pretrans -p <lua>

-- This should solve a problem where directories were replaced
-- by symbolic links when upgrading eccodes from 2.41.0 to 2.42.0

problematic_dirs = {
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/1",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/110",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/174",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/2",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/20",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/21",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/221",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/222",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/223",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/225",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/226",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/227",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/228",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/229",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/230",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/231",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/232",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/233",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/234",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/235",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/236",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/237",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/31",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/41",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/42",
    "/usr/share/eccodes/definitions/bufr/tables/0/local/8/78/64",
    "/usr/share/eccodes/definitions/bufr/tables/0/wmo/10",
    "/usr/share/eccodes/definitions/bufr/tables/0/wmo/11",
    "/usr/share/eccodes/definitions/bufr/tables/0/wmo/12",
    "/usr/share/eccodes/definitions/bufr/tables/0/wmo/7",
    "/usr/share/eccodes/definitions/bufr/tables/0/wmo/8",
    "/usr/share/eccodes/definitions/bufr/tables/0/wmo/9"}

for index, path in ipairs(problematic_dirs) do
  print("handling path:" .. index .. ":" .. path)
  st = posix.stat(path)
  if st and st.type == "directory" then
    status = os.rename(path, path .. ".rpmmoved")
    if not status then
      suffix = 0
      while not status do
        suffix = suffix + 1
        status = os.rename(path .. ".rpmmoved", path .. ".rpmmoved." .. suffix)
      end
      os.rename(path, path .. ".rpmmoved")
    end
  end
end

--#####################################################

%package doc
Summary:    Documentation and example code
BuildArch:  noarch

# a sub package grib_api-doc did not exist
# so no obsoletes needed here

%description doc
This package contains the html documentation for ecCodes
and a fair number of example programs and scripts to use it
in C, and Fortran 90.

#####################################################
%prep
%autosetup -n %{name}-%{version}-Source -p1

# unpack the test data below build
mkdir -p %{_vpath_builddir}
pushd %{_vpath_builddir}
tar xf %SOURCE1
popd

%build

#-- The following features are disabled by default and not switched on:
#
# * MEMFS , Memory based access to definitions/samples
# * MEMORY_MANAGEMENT , enable memory management
# * ALIGN_MEMORY , enable memory alignment
# * GRIB_TIMER , enable timer
# * ECCODES_THREADS , enable POSIX threads
#
#-- The following features are disabled by default and switched on:
# * PNG , support for PNG decoding/encoding
# * ECCODES_OMP_THREADS , enable OMP threads
# * EXTRA_TESTS , enable extended regression testing
#
#-- The following features are set to AUTO by default and
#   explicitely switched on to ensure they don't vanish unnoticed
#   in case of dependency problems during the build:
# * ENABLE_JPG
# ^ ENABLE_FORTRAN
# * ENABLE_NETCDF
#   NetCDF is only needed to create the grib_to_netcdf convert tool
#
#-- Also add an explicit option to not use rpath
#
# Note: -DINSTALL_LIB_DIR=%%{_lib} is needed because otherwise
#        the library so files get installed in /usr/lib in stead
#        of /usr/lib64 on x86_64.

# added -DCMAKE_Fortran_FLAGS="-fPIC"
# because the koji build crashes with the error that it needs this setting
# when I try to build for armv7hl (other archs do not complain ......)
# I have no idea what causes this difference in behaviour.

%cmake3 -DINSTALL_LIB_DIR=%{_lib} \
        -DENABLE_ECCODES_OMP_THREADS=ON \
        -DENABLE_EXTRA_TESTS=ON \
        -DENABLE_JPG=ON \
        -DENABLE_PNG=ON \
        -DENABLE_FORTRAN=ON \
        -DENABLE_NETCDF=ON \
        -DCMAKE_SKIP_INSTALL_RPATH=TRUE \
        -DECCODES_SOVERSION=%{so_version} \
        -DECCODES_SOVERSION_F90=%{so_version_f90} \
        -DCMAKE_Fortran_FLAGS="-fPIC"

# note the final '..' is no longer needed to the cmake3 call.
# this is now hidden in the %%cmake3 macro

%cmake_build

# copy some include files to the build dir
# that are otherwise not found when creating the debugsource sub-package
cp fortran/eccodes_constants.h %{_vpath_builddir}/fortran/
cp fortran/grib_api_constants.h %{_vpath_builddir}/fortran/

%install
%cmake_install
mkdir -p %{buildroot}%{_fmoddir}
mv %{buildroot}%{_includedir}/*.mod %{buildroot}%{_fmoddir}/

# remove a script that does not belong in the doc section
# and triggers an rpmlint error
rm %{buildroot}%{_datadir}/%{name}/definitions/installDefinitions.sh
# by the way, is there a way in the files section to include a directory
# but exclude a given file in it? I could not find such a trick.

# copy the html documentation to the install directory
mkdir -p %{buildroot}%{_datadir}/doc/%{name}/
cp -r html %{buildroot}%{_datadir}/doc/%{name}/

# copy the example scripts/programs to the install directory
# but dont copy the shell scripts and Makefiles, since these
# are part of the cmake test setup and not usefull as example.
# Use %%{_datadir}/doc/%%{name}/ rather than %%{_datadir}/%%{name}/
# otherwise the rpmbuild will create a lot off unnecessary
# pyc and pyo files.

mkdir -p %{buildroot}%{_datadir}/doc/%{name}/examples/C
cp examples/C/*.c %{buildroot}%{_datadir}/doc/%{name}/examples/C
mkdir -p %{buildroot}%{_datadir}/doc/%{name}/examples/F90
cp examples/F90/*.f90 %{buildroot}%{_datadir}/doc/%{name}/examples/F90

# create man pages for the tools that support the --help option
# since upstream does not provide them.
# Source2 points to the script eccodes_create_man_pages.sh
# used to generate the man pages.
LD_LIBRARY_PATH=%{buildroot}/%{_libdir} \
%{SOURCE2} %{_vpath_builddir}/bin \
           %{_vpath_builddir}/man

# copy the created man pages to the install directory
mkdir -p %{buildroot}%{_datadir}/man/man1
cp %{_vpath_builddir}/man/*.1 %{buildroot}%{_datadir}/man/man1

# Fix permissions
chmod 644 AUTHORS LICENSE

# also not needed for x86_64
# maybe they fixed it for all archs?
#%%ifarch i686 armv7hl
#  # pass (nothing to do)
#%%else
#  # it seems pkgconfig files end up in lib in stead of lib64 now
#  # so move them to the right place
#  mv %%{buildroot}/%%{_usr}/lib/pkgconfig/ \
#     %%{buildroot}/%%{_libdir}/pkgconfig/
#%%endif

# It seems the cmake options
# -DCMAKE_SKIP_RPATH=TRUE
# -DCMAKE_SKIP_INSTALL_RPATH=TRUE
# have no effect on the generated *.pc files.
# These still contain an rpath reference, so patch them and remove 
# the rpath using sed
sed -i 's|^libs=.*$|libs=-L${libdir} -leccodes|g' %{buildroot}/%{_libdir}/pkgconfig/eccodes.pc
sed -i 's|^libs=.*$|libs=-L${libdir} -leccodes_f90 -leccodes|g' %{buildroot}/%{_libdir}/pkgconfig/eccodes_f90.pc

%ldconfig_scriptlets

%check
cd  %{_vpath_builddir}

# notes:
# * the LD_LIBRARY_PATH setting is required to let the tests
#   run inside the build dir, otherwise they are broken due to
#   the removal of rpath
# * the LIBRARY_PATH setting is needed te let the
#   'eccodes_t_bufr_dump_(de|en)code_C' tests run.
#   These tests compile on the fly generated C code, and
#   without this setting the loader does not find the libraries.
# * this is a 'non-standard' use of ctest3 so it does currently not
#   work with the %%ctest macro.

LD_LIBRARY_PATH=%{buildroot}/%{_libdir} \
LIBRARY_PATH=%{buildroot}/%{_libdir} \
ctest3 -V %{?_smp_mflags}

%files
%license LICENSE
%doc ChangeLog AUTHORS NEWS NOTICE
%{_bindir}/*
%{_libdir}/*.so.*
%{_mandir}/man1/*.1*

%files devel
%{_includedir}/*
%{_fmoddir}/%{name}.mod
%{_fmoddir}/grib_api.mod
%{_libdir}/pkgconfig/%{name}.pc
%{_libdir}/pkgconfig/%{name}_f90.pc
%{_libdir}/*.so
%dir %{_libdir}/cmake/%{name}
%{_libdir}/cmake/%{name}/*

%files data
%dir %{_datadir}/%{name}
%{_datadir}/%{name}/definitions/
%{_datadir}/%{name}/samples/
%{_datadir}/%{name}/ifs_samples/

%files doc
%doc %{_datadir}/doc/%{name}/

%changelog
...removed ...

---------------------------------------------

Comment 2 Jos de Kloe 2025-07-30 08:55:44 UTC
It has become clear now that this lua scriptlet can not work as a solution. So I will change the package and revert the change, replacing the symbolic links with a copy of the symlinked directory.

Comment 3 Fedora Update System 2025-07-30 12:07:03 UTC
FEDORA-2025-d89daf91f6 (eccodes-2.42.0-3.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-d89daf91f6

Comment 4 Fedora Update System 2025-07-30 12:07:28 UTC
FEDORA-2025-3180cc7afb (eccodes-2.42.0-3.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-3180cc7afb

Comment 5 TomasJuhasz 2025-07-30 13:45:42 UTC
Hi,

since I recently also came across this issue with file conflicts and %pretrans script, I wanted to verify if the problem that you have encountered with the scriplet not executing during dnf upgrade was the same I that had faced.

I tried adding the -n argument to the start of the scriplet - like this: %pretrans -n eccodes-data -p <lua>.

With this change I made a scratch build based on commit: 7a579d5a5ed84d316a64a4ee922be865c636d899 (update to new upstream version 2.42.0) 
- https://koji.fedoraproject.org/koji/taskinfo?taskID=135488785 (v2.42) and tried to update to it from this build: https://koji.fedoraproject.org/koji/buildinfo?buildID=2683475 (v2.40), the scriplet was successfully invoked and upgrade completed correctly.

My guess is that in cases where one specfile builds multiple rpms without the specification of the -n argument dnf doesn't know for which to invoke the scriplet.

I know this is no longer an issue, just wanted to share for future reference.

Comment 6 Eugene Mah 2025-07-31 00:48:30 UTC
Still getting a bunch of conflicts on my system with ecccodes-2.42.0-1

Transaction failed: Rpm transaction failed.
Warning: skipped OpenPGP checks for 4 packages from repository: @commandline
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/1 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/110 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/174 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/2 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/20 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/21 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/221 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/222 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/223 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/225 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/226 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/227 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/228 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/229 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/230 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/231 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/232 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/233 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/234 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/235 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/236 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/237 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/31 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/41 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/42 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/64 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/10 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/11 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/12 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/7 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/8 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch
  - file /usr/share/eccodes/definitions/bufr/tables/0/wmo/9 from install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from package eccodes-data-2.42.0-1.fc42.noarch

Comment 7 Fedora Update System 2025-07-31 01:27:05 UTC
FEDORA-2025-d89daf91f6 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-d89daf91f6`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-d89daf91f6

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 8 Fedora Update System 2025-07-31 01:32:46 UTC
FEDORA-2025-3180cc7afb has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-3180cc7afb`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-3180cc7afb

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 9 Jos de Kloe 2025-07-31 08:43:02 UTC
I am sorry to hear that my fix does not solve the upgrade problem when starting from version 2.42.1
The fix was intended to fix the upgrade issue when starting from version 2.40.1

Unfortunately I am not able to work on this for the coming days, so the only advice that I can give is to use the workaround of first uninstalling eccodes and then installing the new version again.

Comment 10 Fedora Update System 2025-08-08 01:12:05 UTC
FEDORA-2025-d89daf91f6 (eccodes-2.42.0-3.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 11 Jos de Kloe 2025-08-11 13:32:58 UTC
(In reply to Eugene Mah from comment #6)
> Still getting a bunch of conflicts on my system with ecccodes-2.42.0-1
> 
> Transaction failed: Rpm transaction failed.
> Warning: skipped OpenPGP checks for 4 packages from repository: @commandline
>   - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/1 from
> install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from
> package eccodes-data-2.42.0-1.fc42.noarch
....


Thanks to Tomas Juhasz I found a solution to get the Lua script to work, and this should solve the conflicts that you reported.
I will publish revision 5 in a moment that contains this fix.

Comment 12 Fedora Update System 2025-08-11 13:34:16 UTC
FEDORA-2025-04baa9d319 (eccodes-2.42.0-5.fc41) has been submitted as an update to Fedora 41.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-04baa9d319

Comment 13 Fedora Update System 2025-08-11 13:34:45 UTC
FEDORA-2025-b0284b5bbd (eccodes-2.42.0-5.fc42) has been submitted as an update to Fedora 42.
https://bodhi.fedoraproject.org/updates/FEDORA-2025-b0284b5bbd

Comment 14 Eugene Mah 2025-08-11 16:31:45 UTC
(In reply to Jos de Kloe from comment #11)
> (In reply to Eugene Mah from comment #6)
> > Still getting a bunch of conflicts on my system with ecccodes-2.42.0-1
> > 
> > Transaction failed: Rpm transaction failed.
> > Warning: skipped OpenPGP checks for 4 packages from repository: @commandline
> >   - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/1 from
> > install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from
> > package eccodes-data-2.42.0-1.fc42.noarch
> ....
> 
> 
> Thanks to Tomas Juhasz I found a solution to get the Lua script to work, and
> this should solve the conflicts that you reported.
> I will publish revision 5 in a moment that contains this fix.

No problems with upgrading this time so looks like it's working.  There were some .rpmmoved files that got left behind though.  Any reason to keep them around?

Comment 15 Fedora Update System 2025-08-12 02:06:48 UTC
FEDORA-2025-04baa9d319 has been pushed to the Fedora 41 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-04baa9d319`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-04baa9d319

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 16 Fedora Update System 2025-08-12 02:54:15 UTC
FEDORA-2025-b0284b5bbd has been pushed to the Fedora 42 testing repository.
Soon you'll be able to install the update with the following command:
`sudo dnf upgrade --enablerepo=updates-testing --refresh --advisory=FEDORA-2025-b0284b5bbd`
You can provide feedback for this update here: https://bodhi.fedoraproject.org/updates/FEDORA-2025-b0284b5bbd

See also https://fedoraproject.org/wiki/QA:Updates_Testing for more information on how to test updates.

Comment 17 Jos de Kloe 2025-08-12 07:10:56 UTC
(In reply to Eugene Mah from comment #14)
> (In reply to Jos de Kloe from comment #11)
> > (In reply to Eugene Mah from comment #6)
> > > Still getting a bunch of conflicts on my system with ecccodes-2.42.0-1
> > > 
> > > Transaction failed: Rpm transaction failed.
> > > Warning: skipped OpenPGP checks for 4 packages from repository: @commandline
> > >   - file /usr/share/eccodes/definitions/bufr/tables/0/local/8/78/1 from
> > > install of eccodes-data-2.42.0-3.fc42.noarch conflicts with file from
> > > package eccodes-data-2.42.0-1.fc42.noarch
> > ....
> > 
> > 
> > Thanks to Tomas Juhasz I found a solution to get the Lua script to work, and
> > this should solve the conflicts that you reported.
> > I will publish revision 5 in a moment that contains this fix.
> 
> No problems with upgrading this time so looks like it's working.  There were
> some .rpmmoved files that got left behind though.  Any reason to keep them
> around?

Thanks for your feedback.
The .rpmmoved folders are generated by the lua script to ensure any end-user modifications are preserved (although I do not think it is likely that end-users would do such modifications). This is how it is suggested in the documentation as given on this page: https://docs.fedoraproject.org/en-US/packaging-guidelines/Directory_Replacement/
The %ghost definitions should make sure that the .rpmmoved folders are deleted if the eccodes-data package is deleted. If that is not the case than this was not intentional. (but note that there was a typo in the %ghost definitions for version eccodes-data-2.42.0-4 that may explain this. For version eccodes-data-2.42.0-5 this should be repaired).

Comment 18 Fedora Update System 2025-08-19 04:15:49 UTC
FEDORA-2025-b0284b5bbd (eccodes-2.42.0-5.fc42) has been pushed to the Fedora 42 stable repository.
If problem still persists, please make note of it in this bug report.

Comment 19 Fedora Update System 2025-08-19 04:44:58 UTC
FEDORA-2025-04baa9d319 (eccodes-2.42.0-5.fc41) has been pushed to the Fedora 41 stable repository.
If problem still persists, please make note of it in this bug report.


Note You need to log in before you can comment on or make changes to this bug.