当前位置: 首页 > 知识库问答 >
问题:

linux上的电子构建无法定期创建rpm包

羿易安
2023-03-14

使用Electron和ElectronNet,我有一个azure devops管道设置,它将使用要构建的*-最新映像在linux、windows和osx上构建应用程序。在linux上,它被配置为同时输出rpmdeb包,但是rpm包会定期使用此输出生成失败。当这种情况发生时,通常会发生一段时间,然后在没有任何干预的情况下停止发生。我甚至在第二天重新运行了失败的作业,构建在rpm和deb构建中都完全成功。deb构建从未失败过。

真的在寻找任何关于如何让它一直成功或出了什么问题的想法。我的搜索引擎没有找到任何有用的东西。



 Package Electron App for Platform linux...
    • electron-builder  version=22.8.1 os=5.4.0-1026-azure
    • artifacts will be published if draft release exists  reason=CI detected
    • loaded configuration  file=/home/vsts/work/1/s/src/Prefix.App/obj/desktop/-encodedCommand/bin/electron-builder.json
    • description is missed in the package.json  appPackageFile=/home/vsts/work/1/s/src/Prefix.App/obj/desktop/-encodedCommand/package.json
    • packaging       platform=linux arch=x64 electron=9.2.0 appOutDir=/home/vsts/work/1/s/dist/linux-unpacked
    • downloading     url=https://github.com/electron/electron/releases/download/v9.2.0/electron-v9.2.0-linux-x64.zip size=73 MB parts=4
    • downloaded      url=https://github.com/electron/electron/releases/download/v9.2.0/electron-v9.2.0-linux-x64.zip duration=1.841s
    • building        target=deb arch=x64 file=/home/vsts/work/1/s/dist/stackify-prefix.deb
    • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
    • downloading     url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86_64/fpm-1.9.3-2.3.1-linux-x86_64.7z size=5.0 MB parts=1
    • downloaded      url=https://github.com/electron-userland/electron-builder-binaries/releases/download/fpm-1.9.3-2.3.1-linux-x86_64/fpm-1.9.3-2.3.1-linux-x86_64.7z duration=798ms
    • building        target=rpm arch=x64 file=/home/vsts/work/1/s/dist/stackify-prefix.rpm
    • application Linux category is set to default "Utility"  reason=linux.category is not set and cannot map from macOS docs=https://www.electron.build/configuration/linux
    ⨯ cannot execute  cause=exit status 1
                      out={:timestamp=>"2020-10-08T17:32:40.544179+0000", :message=>"Process failed: rpmbuild failed (exit code 1). Full command was:[\"rpmbuild\", \"-bb\", \"--target\", \"x86_64-unknown-linux\", \"--define\", \"buildroot /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616/BUILD\", \"--define\", \"_topdir /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616\", \"--define\", \"_sourcedir /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616\", \"--define\", \"_rpmdir /tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616/RPMS\", \"--define\", \"_tmppath /tmp\", \"/tmp/package-rpm-build-72bf79147c0f3c704c50ec33b5227ad320ace97152807fea175c575ab616/SPECS/Prefix.spec\"]", :level=>:error}
                      command=/home/vsts/.cache/electron-builder/fpm/fpm-1.9.3-2.3.1-linux-x86_64/fpm -s dir --force -t rpm -d libXScrnSaver --rpm-os linux --rpm-compression xzmt --architecture amd64 --name prefix --after-install /tmp/t-KD6Fyh/2-after-install --after-remove /tmp/t-KD6Fyh/3-after-remove --description '' --version 1.0.0 --package /home/vsts/work/1/s/dist/stackify-prefix.rpm --maintainer Stackify --url 'https://github.com/ElectronNET/Electron.NET#readme' --vendor Stackify --license MIT --iteration 0.8.25-rc.1+72 --name=Prefix --after-install=../../../../../build/linux/postinst --after-remove=../../../../../build/linux/postrm /home/vsts/work/1/s/dist/linux-unpacked/=/opt/Prefix /home/vsts/work/1/s/build/assets/Prefix_256.png=/usr/share/icons/hicolor/0x0/apps/Prefix.png /tmp/t-KD6Fyh/5-Prefix.desktop=/usr/share/applications/Prefix.desktop
                      workingDir=
 ... done

共有1个答案

冯开诚
2023-03-14

这是因为还使用了GitVersion版本,并且electron builder使用--iteration参数将FullSemVer变量传递给fpm命令。当正在构建的分支具有语义上合适的标记时(例如:1.2.3),FullSemVer看起来像1.2.3.0。但是,如果分支没有这样的标记,它看起来像1.2.3-beta.1,rpm构建由于非法字符而失败。

为了解决这个问题,我将迭代参数硬编码到electron.manifest.json

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

然后在电子构建之前添加一个任务,以便在构建之前更新值。

- pwsh: |
   $variable = '--iteration=' + $env:GITVERSION_MAJORMINORPATCH
   (Get-Content -Path .\path\to\electron.manifest.json -Raw) -replace '--iteration=1.0.0', $variable | Set-Content -Path .\path\to\electron.manifest.json
 类似资料:
  • 所以我在这个问题上挣扎了很长一段时间。我想在Netbeans中创建一个新的JavaFX项目,但是我没有从列表中选择JavaFX的选项。因为我有最新的java版本,JavaFX应该包含在SDK中,对吗?我还查找了是否有位于目录我也这么做。那么为什么我不能创建一个常规的JavaFX项目呢?我是不是错过了什么? 提前谢谢你!

  • 我设法创建了一个. exe安装程序的窗口使用电子建设者,我创建2package.json指出的文档: https://github.com/electron-userland/electron-builder. mymainpackage.json的build部分是 一切工作正常,我有和.exe安装程序,但没有办法有一个.msi安装程序,把内容在程序文件目录。 相反,我最终在C:\用户\用户之家\

  • 问题内容: 很长时间以来,我一直在从事与离子相关的项目。 最近,我更新了android studio及其软件包,由于以下问题,我现在无法在android上进行构建: com.android.build.api.transform.TransformException:java.util.zip.ZipException:重复条目:com / google / android / gms / iid

  • 我有一个具有多个pom层的微服务项目。我使用“org.codehaus.mojo: rpm-maven-plugin: 2.1.1”插件为每个服务生成rpm。我需要将其设置为生成一个rpm,并将所有这些rpm作为所需的依赖项。 在父pom中,我添加了设置为无源,但需要两个rpm包。当我向父级添加相同的设置时,它失败了,我不明白我缺少了什么。 例如:项目组--ProjectCommon--Proje

  • 我已经建立了一个简单的应用程序使用电子和它的作品罚款当你启动与。在我尝试部署我的应用程序后,我得到以下错误。 警告:--asar不接受任何参数,它只有子属性(请参阅--help)使用electron v4.1.3为平台win32 ia32打包应用程序警告:找到“electron”,但不是作为devDependency,修剪rcedit.exe失败,退出代码为1。保留标题不是0或图像类型不是“a”的