atom: use system Git instead of prebuilt bundle

One of Atom's dependencies, dugite, downloads a full copy of prebuilt
Git into its node_modules directory, what is totally redundant.
Modify its "source code" to use system Git instead and remove post-install
download target.

To patch Atom package the same approach is used as in commit 4a94ed99271d
("atom: fix Fuzzy finder (git-utils)").
This reduces the total size of Atom xbps package by ~30 Mb.

Signed-off-by: Alexander Lobakin <bloodyreaper@yandex.ru>
This commit is contained in:
Alexander Lobakin 2019-12-19 18:20:08 +03:00 committed by Juan RP
parent c24c7a428a
commit 68b24d3049
2 changed files with 62 additions and 8 deletions

View file

@ -0,0 +1,51 @@
diff -Naurp0 a/package.json b/package.json
--- a/package.json 2019-12-13 22:07:42.000000000 +0300
+++ b/package.json 2019-12-19 17:00:25.029132872 +0300
@@ -52,0 +53 @@
+ "dugite": "file:packages/dugite",
diff -Naurp0 a/package-lock.json b/package-lock.json
--- a/package-lock.json 2019-12-13 22:07:42.000000000 +0300
+++ b/package-lock.json 2019-12-19 16:44:18.175132282 +0300
@@ -2530,3 +2530 @@
- "version": "1.87.5",
- "resolved": "https://registry.npmjs.org/dugite/-/dugite-1.87.5.tgz",
- "integrity": "sha512-Rfl1pJ7SaIk8kW9knOGFvVl/aRWAL7RnESs/0GMUCay/yOtVejkrDGlK8JciN5dluJbIg/4bMp0KeK3HGuQqEQ==",
+ "version": "file:packages/dugite",
@@ -3212 +3210 @@
- "dugite": "1.87.5",
+ "dugite": "file:packages/dugite",
@@ -6992 +6990 @@
- "dugite": "^1.86.0",
+ "dugite": "file:packages/dugite",
diff -Naurp0 a/packages/dugite/build/lib/git-environment.js b/packages/dugite/build/lib/git-environment.js
--- a/packages/dugite/build/lib/git-environment.js 1985-10-26 11:15:00.000000000 +0300
+++ b/packages/dugite/build/lib/git-environment.js 2019-12-19 15:13:56.919818081 +0300
@@ -4,12 +3,0 @@ const path = require("path");
-function resolveEmbeddedGitDir() {
- if (process.platform === 'darwin' ||
- process.platform === 'linux' ||
- process.platform === 'android' ||
- process.platform === 'win32') {
- const s = path.sep;
- return path
- .resolve(__dirname, '..', '..', 'git')
- .replace(/[\\\/]app.asar[\\\/]/, `${s}app.asar.unpacked${s}`);
- }
- throw new Error('Git not supported on platform: ' + process.platform);
-}
@@ -27 +15 @@ function resolveGitDir() {
- return resolveEmbeddedGitDir();
+ return '/usr';
@@ -108,7 +95,0 @@ function setupEnvironment(environmentVar
- if (!env.GIT_SSL_CAINFO && !env.LOCAL_GIT_DIRECTORY) {
- // use the SSL certificate bundle included in the distribution only
- // when using embedded Git and not providing your own bundle
- const distDir = resolveEmbeddedGitDir();
- const sslCABundle = `${distDir}/ssl/cacert.pem`;
- env.GIT_SSL_CAINFO = sslCABundle;
- }
diff -Naurp0 a/packages/dugite/package.json b/packages/dugite/package.json
--- a/packages/dugite/package.json 1985-10-26 11:15:00.000000000 +0300
+++ b/packages/dugite/package.json 2019-12-19 15:19:07.645889964 +0300
@@ -16 +15,0 @@
- "postinstall": "node ./script/download-git.js",

View file

@ -1,31 +1,39 @@
# Template file for 'atom'
_dugite_ver=1.87.6
_git_utils_ver=5.6.2
pkgname=atom
version=1.41.0
revision=2
revision=3
archs="x86_64"
hostmakedepends="git pkg-config python-devel nodejs-lts-10 nodejs-lts-10-devel curl gtk+3
libXtst libXScrnSaver nss python alsa-lib"
makedepends="python-devel GConf-devel libgnome-keyring-devel gtk+3-devel
libX11-devel libxkbfile-devel libsecret-devel"
depends="git"
short_desc="Chrome-based text editor from Github"
maintainer="Wilson Birney <wpb@360scada.com>"
license="MIT"
homepage="https://atom.io"
distfiles="
https://github.com/atom/atom/archive/v${version}.tar.gz
https://registry.npmjs.org/dugite/-/dugite-${_dugite_ver}.tgz
https://registry.npmjs.org/git-utils/-/git-utils-${_git_utils_ver}.tgz"
checksum="
4a440909462c461cbec9b82b5f97bd21719a34f0ab59f2d859df85a40246c949
61cd7b32932788c70420cb64042d7056715c5e5c20f4df022e77cee034519c09
b430ee53a09317df5b6677e5625950baefe840258f2e9d55cf4fc448c9d8576e"
skip_extraction="git-utils-${_git_utils_ver}.tgz"
skip_extraction="
dugite-${_dugite_ver}.tgz
git-utils-${_git_utils_ver}.tgz"
shlib_provides="libGLESv2.so"
patch_args="-Np1"
nocross=yes
nostrip=yes
post_extract() {
mkdir -p packages/git-utils
mkdir -p packages/dugite packages/git-utils
tar xzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/dugite-${_dugite_ver}.tgz \
--strip-components=1 -C packages/dugite
tar xzf ${XBPS_SRCDISTDIR}/${pkgname}-${version}/git-utils-${_git_utils_ver}.tgz \
--strip-components=1 -C packages/git-utils
}
@ -43,8 +51,3 @@ do_install() {
mv $DESTDIR/usr/libexec/applications $DESTDIR/usr/share
vlicense LICENSE.md
}
post_install() {
# Very hackish, git-imap-send is linked to openssl's libssl/libcrypto. Removing it allows it to package
rm $DESTDIR/usr/libexec/atom/resources/app.asar.unpacked/node_modules/dugite/git/libexec/git-core/git-imap-send
}