Skip to content

git submodules should be updated if not offline#587

Merged
shiftkey merged 1 commit intolinuxfrom
inverted-logic-issue
Aug 30, 2021
Merged

git submodules should be updated if not offline#587
shiftkey merged 1 commit intolinuxfrom
inverted-logic-issue

Conversation

@shiftkey
Copy link
Copy Markdown
Owner

@shiftkey shiftkey commented Aug 29, 2021

This PR fixes an issue spotted downstream in the Arch Linux packaging. From a clean build and package they were not seeing the submodules exist on disk, which meant the app didn't build. alerque/aur#22 is the workaround for that case.

I was able to reproduce this on macOS with a fresh clone:

> git clone https://github.com/shiftkey/desktop desktop-fresh-clone
Cloning into 'desktop-fresh-clone'...
remote: Enumerating objects: 208353, done.
remote: Counting objects: 100% (745/745), done.
remote: Compressing objects: 100% (304/304), done.
remote: Total 208353 (delta 501), reused 589 (delta 438), pack-reused 207608
Receiving objects: 100% (208353/208353), 71.77 MiB | 18.22 MiB/s, done.
Resolving deltas: 100% (166509/166509), done.

> cd desktop-fresh-clone
> yarn
yarn install v1.21.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
[3/5] 🚚  Fetching packages...
[4/5] 🔗  Linking dependencies...
[5/5] 🔨  Building fresh packages...
warning Your current version of Yarn is out of date. The latest version is "1.22.5", while you're on "1.21.1".
$ ts-node -P script/tsconfig.json script/post-install.ts
yarn install v1.21.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Rebuilding all packages...
success Saved lockfile.
✨  Done in 23.54s.
yarn run v1.21.1
$ tsc -P script/tsconfig.json
✨  Done in 20.40s.
✨  Done in 104.66s.

> yarn build:dev
yarn run v1.21.1
$ yarn compile:dev && cross-env NODE_ENV=development ts-node -P script/tsconfig.json script/build.ts
$ cross-env NODE_ENV=development TS_NODE_PROJECT=script/tsconfig.json parallel-webpack --config app/webpack.development.ts
[WEBPACK] Building 5 targets
[WEBPACK] Started building main.js
[WEBPACK] Started building renderer.js
[WEBPACK] Started building crash.js
[WEBPACK] Started building cli.js
[WEBPACK] Started building highlighter.js
...
[WEBPACK] Finished build after 62.458 seconds
Building for development…
Removing old distribution…
Copying dependencies…
  Installing dependencies via yarn…
warning devtron > highlight.js@9.18.5: Support has ended for 9.x series. Upgrade to @latest
  Copying desktop-trampoline…
  Copying ssh-wrapper
  Copying git environment…
  Copying app-path binary…
Packaging emoji…
Error: ENOENT: no such file or directory, stat '/Users/shiftkey/src/test/desktop-fresh-clone/gemoji/images/emoji'
    at Object.statSync (fs.js:1086:3)
    at Object.statSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/graceful-fs/polyfills.js:307:34)
    at statSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/util/stat.js:10:52)
    at getStatsSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/util/stat.js:24:19)
    at Object.checkPathsSync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/util/stat.js:49:33)
    at Object.copySync (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/fs-extra/lib/copy-sync/copy-sync.js:24:38)
    at removeAndCopy (/Users/shiftkey/src/test/desktop-fresh-clone/script/build.ts:233:6)
    at copyEmoji (/Users/shiftkey/src/test/desktop-fresh-clone/script/build.ts:239:3)
    at Object.<anonymous> (/Users/shiftkey/src/test/desktop-fresh-clone/script/build.ts:66:1)
    at Module._compile (internal/modules/cjs/loader.js:1063:30)
    at Module.m._compile (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/ts-node/src/index.ts:439:23)
    at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
    at Object.require.extensions.<computed> [as .ts] (/Users/shiftkey/src/test/desktop-fresh-clone/node_modules/ts-node/src/index.ts:442:12)
    at Module.load (internal/modules/cjs/loader.js:928:32)
    at Function.Module._load (internal/modules/cjs/loader.js:769:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:72:12)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

I think we've just gotten this check wrong as part of the Flatpak work, and we should be running this when the environment variable is not found.

@AdvaithM when you have time, please confirm I've got this right, and that it's not going to affect the Flatpak side of things...

@shiftkey
Copy link
Copy Markdown
Owner Author

And here's the confirmation with this patch that we're correctly initializing the submodules again:

> git checkout inverted-logic-issue
Branch 'inverted-logic-issue' set up to track remote branch 'inverted-logic-issue' from 'origin'.
Switched to a new branch 'inverted-logic-issue'
> yarn
yarn install v1.21.1
[1/5] 🔍  Validating package.json...
[2/5] 🔍  Resolving packages...
success Already up-to-date.
$ ts-node -P script/tsconfig.json script/post-install.ts
yarn install v1.21.1
[1/4] 🔍  Resolving packages...
[2/4] 🚚  Fetching packages...
[3/4] 🔗  Linking dependencies...
[4/4] 🔨  Rebuilding all packages...
success Saved lockfile.
✨  Done in 3.34s.
Submodule 'app/static/common/choosealicense.com' (https://github.com/github/choosealicense.com.git) registered for path 'app/static/common/choosealicense.com'
Submodule 'app/static/common/gitignore' (https://github.com/github/gitignore.git) registered for path 'app/static/common/gitignore'
Submodule 'gemoji' (https://github.com/github/gemoji.git) registered for path 'gemoji'
Cloning into '/Users/shiftkey/src/test/desktop-fresh-clone/app/static/common/choosealicense.com'...
Cloning into '/Users/shiftkey/src/test/desktop-fresh-clone/app/static/common/gitignore'...
Cloning into '/Users/shiftkey/src/test/desktop-fresh-clone/gemoji'...
Submodule path 'app/static/common/choosealicense.com': checked out '42e83d1315b15e63fa8e2337a4d58b5d58dfba08'
Submodule path 'app/static/common/gitignore': checked out 'ec246076319913acee4aaeef8caf86b78e586e7a'
Submodule path 'gemoji': checked out '50865e8895c54037bf06c4c1691aa925d030a59d'
yarn run v1.21.1
$ tsc -P script/tsconfig.json
✨  Done in 5.19s.
✨  Done in 16.59s.

@Lunarequest
Copy link
Copy Markdown

I'll confirm of this works soon

@Lunarequest
Copy link
Copy Markdown

@shiftkey this works when building with flatpaks

@shiftkey shiftkey marked this pull request as ready for review August 30, 2021 11:57
@shiftkey shiftkey merged this pull request into linux Aug 30, 2021
@shiftkey shiftkey deleted the inverted-logic-issue branch August 30, 2021 11:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants