atom-community / atom

:atom: Community build of the hackable text editor
https://atom-community.github.io/
MIT License
736 stars 30 forks source link

script/build: Where is the generated Debian package stored? #396

Open DAC324 opened 2 years ago

DAC324 commented 2 years ago

Hello all,

just ran script/build --create-debian-package as per instructions. The process apparently completed successfully:

$ script/build --create-debian-package
Node:   v16.15.1
Python: v3.10.5
Installing script runner dependencies
Installing script dependencies
Installing apm
apm  2.6.5-atomic.1.0
npm  6.14.14
node 12.18.3 x64
atom unknown
python 3.10.5
git 2.36.1
Installing modules ✓
Wrote Dependencies Fingerprint: /home/gerd/Download/atom/src/atom/node_modules/.dependencies-fingerprint e79b23d9fc2438ff65485fe6428f970e778e8d52
Cleaning /home/gerd/Download/atom/src/atom/out
Copying assets to /home/gerd/Download/atom/src/atom/out/app
Transpiling packages with custom transpiler configurations in /home/gerd/Download/atom/src/atom/out/app
Transpiling Babel paths in /home/gerd/Download/atom/src/atom/out/app
Transpiling CoffeeScript paths in /home/gerd/Download/atom/src/atom/out/app
Transpiling CSON paths in /home/gerd/Download/atom/src/atom/out/app
Transpiling PEG.js paths in /home/gerd/Download/atom/src/atom/out/app
Installing modules ✓
Generating module cache for /home/gerd/Download/atom/src/atom/out/app
Generating pre-built less cache in /home/gerd/Download/atom/src/atom/out/app/less-compile-cache
Generating metadata for /home/gerd/Download/atom/src/atom/out/app/package.json
Generating API docs at /home/gerd/Download/atom/src/atom/docs/output/atom-api.json
Dumping symbols in /home/gerd/Download/atom/src/atom/out/symbols
Running electron-packager on /home/gerd/Download/atom/src/atom/out/app with app name "atom"
Packaging app for platform linux x64 using electron v11.5.0

However, I was not able to find the newly created Debian package. Is there anything to be done in addition?

DeeDeeG commented 2 years ago

The built package would be stored at out/atom-amd64.deb.

I would say pay close attention to the spelling of the --create-debian-package flag, as it's long and easy to mistype, and because non-existent or typo'd flags are silently ignored (!) and the build takes a long time. I don't see anything in that output above about building the debian (.deb) package.

Sample output when creating the debian package ``` Creating Debian package for "/home/user/atom/out/atom-dev-1.63.0-dev-d46f5241a-amd64" Creating Debian package directory structure at "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64" Copying "/home/user/atom/out/atom-dev-1.63.0-dev-d46f5241a-amd64" to "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/usr/share/atom-dev" Copying binaries into "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/usr/bin" Writing control file into "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/DEBIAN" Writing desktop entry file into "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/usr/share/applications" Copying icon into "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/usr/share/pixmaps" Copying license into "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/usr/share/doc/atom-dev" Copying polkit configuration into "/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64/usr/share" Generating .deb file from /tmp/atom-dev-1.63.0-dev-d46f5241a-amd64 dpkg-deb: building package 'atom-dev' in '/tmp/atom-dev-1.63.0-dev-d46f5241a-amd64.deb'. Copying generated package into "/home/user/atom/out/atom-amd64.deb" ```

I made a script to build just the debian package after the rest of the build is already done. Because I've ended up in this exact situation before. (See below). This should be saved as script/some-filename.js so it can import the script/config.js file and the glob module properly.

#! /usr/bin/env node

const glob = require('glob');

const CONFIG = require('./config');
const createDebianPackage = require('./lib/create-debian-package');

const outDir = CONFIG.buildOutputPath;
const appName = CONFIG.appMetadata.name;

console.log(`Searching for completed Atom build using glob pattern: ${outDir}/${appName}-*/`);
const packagedAppPath = glob.sync(`${outDir}/${appName}-*/`)[0];

console.log('Found Atom build at: ' + packagedAppPath);

createDebianPackage(packagedAppPath);

EDIT: Updated with a better script.

DAC324 commented 2 years ago

Indeed, it looks like I made an error while typing/pasting that flag. What appeared strange, though, was that script/build complained about a missing dpkg-deb command in the first instance. After re-installing dpkg, at least that error was gone.

Tried again yesterday, this time with --no-bootstrap amended

script/build --no-bootstrap  --create-debian-package

and then, a Debian package was indeed created:

Generating startup blob with mksnapshot
Moving generated startup blob into "/home/gerd/Download/atom/src/atom/out/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/v8_context_snapshot.bin"
Moving generated startup blob into "/home/gerd/Download/atom/src/atom/out/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/snapshot_blob.bin"
Creating Debian package for "/home/gerd/Download/atom/src/atom/out/atom-dev-1.63.0-dev-b2b1d3e5b-amd64"
Creating Debian package directory structure at "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64"
Copying "/home/gerd/Download/atom/src/atom/out/atom-dev-1.63.0-dev-b2b1d3e5b-amd64" to "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/usr/share/atom-dev"
Copying binaries into "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/usr/bin"
Writing control file into "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/DEBIAN"
Writing desktop entry file into "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/usr/share/applications"
Copying icon into "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/usr/share/pixmaps"
Copying license into "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/usr/share/doc/atom-dev"
Copying polkit configuration into "/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64/usr/share"
Generating .deb file from /tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64
dpkg-deb: Building Package »atom-dev« in »/tmp/atom-dev-1.63.0-dev-b2b1d3e5b-amd64.deb«.
Copying generated package into "/home/gerd/Download/atom/src/atom/out/atom-amd64.deb"
DAC324 commented 2 years ago

Nevertheless, that Debian package built that way, appears to be broken. At first, the entry in the .desktop file appears to be incorrect:

nohup: failed to run '/usr/lib/atom/atom': No such file or directory

After correcting the .desktop file to point to the correct path /usr/share/atom-dev/atom, I only get

$ /usr/share/atom-dev/atom
A JavaScript error occurred in the main process
Uncaught Exception:
Error: Cannot find module '../build/Release/nslog.node'
Require stack:
- /usr/share/atom-dev/resources/app.asar/node_modules/nslog/lib/nslog.js
- /usr/share/atom-dev/resources/app.asar/src/main-process/start.js
- /usr/share/atom-dev/resources/app.asar/src/main-process/main.js
-
    at Module._resolveFilename (internal/modules/cjs/loader.js:972:15)
    at Function.n._resolveFilename (electron/js2c/browser_init.js:249:921)
    at Module._load (internal/modules/cjs/loader.js:848:27)
    at Function.f._load (electron/js2c/asar_bundle.js:5:12633)
    at Module.require (internal/modules/cjs/loader.js:1032:19)
    at require (internal/modules/cjs/helpers.js:72:18)
    at Object.<anonymous> (/usr/share/atom-dev/resources/app.asar/node_modules/nslog/lib/nslog.js:5:11)
    at Object.<anonymous> (/usr/share/atom-dev/resources/app.asar/node_modules/nslog/lib/nslog.js:15:4)
    at Module._compile (internal/modules/cjs/loader.js:1152:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1173:10)