RPM build fails due to invalid --iteration parameter value from environment variable

See original GitHub issue
  • Version: 22.11.7
  • Electron Version: 10.1.4
  • Electron Type (current, beta, nightly): current
  • Target: Linux RPM

When trying to build on our Azure DevOps Pipeline, the RPM build was failing with the following output:

  • electron-builder  version=22.11.7 os=5.8.0-55-generic
  • loaded configuration  file=package.json ("build" field)
  • rebuilding native dependencies  dependencies=keytar@7.0.0 platform=linux arch=x64
  • install prebuilt binary  name=keytar version=7.0.0 platform=linux arch=x64 napi=
  • packaging       platform=linux arch=x64 electron=10.1.4 appOutDir=dist/linux-unpacked
  • building        target=rpm arch=x64 file=dist/intent-architect-v3-3.0.99-test.0.x86_64.rpm
  ⨯ cannot execute  cause=exit status 1
                    out={:timestamp=>"2021-06-22T18:32:33.650121+0200", :message=>"Package version '3.0.99-test.0' includes dashes, converting to underscores", :level=>:warn}
    {:timestamp=>"2021-06-22T18:32:34.080010+0200", :message=>"Process failed: rpmbuild failed (exit code 1). Full command was:[\"rpmbuild\", \"-bb\", \"--target\", \"x86_64-unknown-linux\", \"--define\", \"buildroot /tmp/package-rpm-build-bd650812f05db682c602b8fef7a4a7c81dfdc1465ed7a5a887279fd95e9f/BUILD\", \"--define\", \"_topdir /tmp/package-rpm-build-bd650812f05db682c602b8fef7a4a7c81dfdc1465ed7a5a887279fd95e9f\", \"--define\", \"_sourcedir /tmp/package-rpm-build-bd650812f05db682c602b8fef7a4a7c81dfdc1465ed7a5a887279fd95e9f\", \"--define\", \"_rpmdir /tmp/package-rpm-build-bd650812f05db682c602b8fef7a4a7c81dfdc1465ed7a5a887279fd95e9f/RPMS\", \"--define\", \"_tmppath /tmp\", \"/tmp/package-rpm-build-bd650812f05db682c602b8fef7a4a7c81dfdc1465ed7a5a887279fd95e9f/SPECS/intent-architect-v3.spec\"]", :level=>:error}
    
                    command=/home/jonathan/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/fpm -s dir --force -t rpm -d gtk3 -d libnotify -d nss -d libXScrnSaver -d libXtst -d xdg-utils -d at-spi2-core -d libuuid --rpm-os linux --rpm-compression xzmt --architecture amd64 --after-install /tmp/t-hicBKq/0-after-install --after-remove /tmp/t-hicBKq/1-after-remove --description 'Intent Architect v3' --version 3.0.99-test.0 --package /home/jonathan/Desktop/Dev/Intent/Intent.IntentArchitect/IntentArchitect.ElectronClient/Intent.IArchitect.Electron/dist/intent-architect-v3-3.0.99-test.0.x86_64.rpm --name intent-architect-v3 --maintainer 'Intent Software <support@intentarchitect.com>' --url https://intentarchitect.com/ --vendor 'Intent Software <support@intentarchitect.com>' --license UNLICENSED --iteration 20210622.6_3.0.99-test.0 '/home/jonathan/Desktop/Dev/Intent/Intent.IntentArchitect/IntentArchitect.ElectronClient/Intent.IArchitect.Electron/dist/linux-unpacked/=/opt/Intent Architect v3' /home/jonathan/Desktop/Dev/Intent/Intent.IntentArchitect/IntentArchitect.ElectronClient/Intent.IArchitect.Electron/build/icons/256x256.png=/usr/share/icons/hicolor/256x256/apps/intent-architect-v3.png '/tmp/t-hicBKq/2-Intent Architect v3.desktop=/usr/share/applications/intent-architect-v3.desktop'
                    workingDir=
Failure: 'npx' exited with code 1

Setting the DEBUG environment variable to electron-builder included the following in its output:

{:timestamp=>"2021-06-22T18:36:58.024005+0200", :message=>"error: line 41: Illegal char '-' (0x2d) in: Release: 20210622.6_3.0.99-test.0", :level=>:info, :file=>"cabin/mixins/pipe.rb", :line=>"47", :method=>"block in pipe"}

It turns out this value is obtained from the BUILD_BUILDNUMBER environment variable and I was then able to reproduce it on my local machine using:

export BUILD_NUMBER=20210622.6_3.0.99-test.0

Searching for the string in the logs I could see it was being passed in using the --iteration parameter.

To workaround the problem I was able to add the following section to the build section in my package.json file:

    "rpm": {
      "fpm": [
        "--iteration=1.0.0"
      ]
    },

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:7

github_iconTop GitHub Comments

2reactions
jordansisselcommented, Jul 13, 2021

@JonathanLydall If it helps, maybe fpm could automatically replace the rejected - character with something rpmbuild accepts, like _ (underscore) ?

(Background: I am the fpm maintainer, so I can help make this change upstream in fpm)

1reaction
jordansisselcommented, Sep 22, 2021

If you want to make a comprehensive solution, perhaps you replace ALL non-whitelisted characters with something like an underscore and display a warning of having done so.

I’ll see what I can do 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

An iteration with a dash causes rpmbuild to fail. · Issue #1833 ...
RPM build fails due to invalid --iteration parameter value from environment variable electron-userland/electron-builder#5976.
Read more >
rpmbuild Command Reference - Ftp - RPM Package Manager
The script starts off by defining a number of environment variables and then leads into the %prep section. In the spec file used...
Read more >
Using Jenkins BUILD NUMBER in RPM spec file
I'm wondering if anyone has tried, or knows how, I could use the Jenkins $BUILD_NUMBER variable to dynamically change the Release number, ...
Read more >
1967190 – cvc4 fails to build in Fedora 35+ - Red Hat Bugzilla
To ignore these errors, you can set the * '$QA_RPATHS' environment variable which is a bitmask allowing the * values below.
Read more >
Common Configuration - electron-builder
npmRebuild = true Boolean - Whether to rebuild native dependencies before starting to package the app. buildNumber String | “undefined” - The build...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found