mirror of
https://github.com/cryptoadvance/specter-desktop.git
synced 2026-08-13 12:33:29 +02:00
Macos intel build (#2446)
* remove conflicting dependencies * intel preparation (untested) * make orgName more flexible to test * adjust set-version logic * build-osx package target * fix syntax * fix syntax * fix syntax * append arch for upload * syntax * syntax * fixes * fix * complete feature * fix * set-version now deleting the file instead of complaining if version-mismatch * further improvements * parametrize CI_PROJECT_ROOT_NAMESPACE with --gh-project * more fixes * tinyfix * small fix * fix packaging * fix * fix * documentation and further polishing * polishing * bugfixes and feedback * docs * more polishing * testrun * kick * kick * kick again * kick yet again * kick * kick again * kick * kick yet again * fix * kick * kick again and again * kick again * kick * kick again * kick yet again * remove comments for restriction
This commit is contained in:
parent
7fd2b9158d
commit
92f10e01b0
17 changed files with 898 additions and 314 deletions
|
|
@ -19,7 +19,7 @@ pip3 install build==0.10.0
|
|||
python -m build
|
||||
|
||||
echo " --> Installing pypi package"
|
||||
python .\utils\release-helper.py install_wheel %1%
|
||||
python .\utils\release_helper.py install_wheel %1%
|
||||
|
||||
cd pyinstaller
|
||||
|
||||
|
|
|
|||
|
|
@ -1,6 +1,14 @@
|
|||
|
||||
function orgName() {
|
||||
// This can be changed in order to make download possible from other github orgs
|
||||
return "cryptoadvance"
|
||||
}
|
||||
|
||||
function getDownloadLocation(version, platformname) {
|
||||
return `https://github.com/cryptoadvance/specter-desktop/releases/download/${version}/specterd-${version}-${platformname}.zip`
|
||||
if (platformname != "osx") {
|
||||
return `https://github.com/${orgName()}/specter-desktop/releases/download/${version}/specterd-${version}-${platformname}.zip`
|
||||
}
|
||||
return `https://github.com/${orgName()}/specter-desktop/releases/download/${version}/specterd-${version}-${platformname}_${process.arch}.zip`
|
||||
}
|
||||
|
||||
function appName() {
|
||||
|
|
@ -8,7 +16,8 @@ function appName() {
|
|||
}
|
||||
|
||||
module.exports = {
|
||||
getDownloadLocation: getDownloadLocation,
|
||||
appName: appName
|
||||
getDownloadLocation,
|
||||
appName,
|
||||
orgName
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -146,7 +146,7 @@ app.whenReady().then(() => {
|
|||
if (!appSettings.versionInitialized || appSettings.versionInitialized != versionData.version) {
|
||||
logger.info(`Updating ${appSettingsPath} : ${JSON.stringify(appSettings)}`)
|
||||
appSettings.specterdVersion = versionData.version
|
||||
appSettings.specterdHash = versionData.sha256
|
||||
appSettings.specterdHash = versionData.sha256[process.arch]
|
||||
appSettings.versionInitialized = versionData.version
|
||||
fs.writeFileSync(appSettingsPath, JSON.stringify(appSettings))
|
||||
}
|
||||
|
|
|
|||
|
|
@ -1,25 +1,60 @@
|
|||
const fs = require('fs')
|
||||
const crypto = require('crypto')
|
||||
const version = process.argv[2]
|
||||
const fs = require('fs');
|
||||
const crypto = require('crypto');
|
||||
const versionDataFile = './version-data.json';
|
||||
|
||||
async function setVersion() {
|
||||
let package = require('./package.json')
|
||||
package.version = version
|
||||
fs.writeFileSync('./package.json', JSON.stringify(package, undefined, 2))
|
||||
|
||||
if (process.argv[3]) {
|
||||
let versionData = {
|
||||
version,
|
||||
sha256: (await createHashFromFile(process.argv[3]))
|
||||
}
|
||||
|
||||
fs.writeFileSync('./version-data.json', JSON.stringify(versionData, undefined, 2))
|
||||
}
|
||||
const version = process.argv[2];
|
||||
const file = process.argv[3];
|
||||
const arch = process.argv[4] || process.arch;
|
||||
|
||||
// Set version in package.json
|
||||
let packageJson = require('./package.json');
|
||||
packageJson.version = version;
|
||||
fs.writeFileSync('./package.json', JSON.stringify(packageJson, undefined, 2));
|
||||
|
||||
// Set version in version-data.json
|
||||
if (version && file) {
|
||||
let versionData;
|
||||
try {
|
||||
versionData = require(versionDataFile);
|
||||
|
||||
if (versionData.version != version) {
|
||||
console.log(`Version mismatch. Deleting ${versionDataFile} and creating anew.`);
|
||||
fs.unlinkSync(versionDataFile); // Delete the existing version-data.json file
|
||||
versionData = createNewVersionData(version); // Create new version data object
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
console.log(`No ${versionDataFile} found. Creating anew.`);
|
||||
versionData = createNewVersionData(version);
|
||||
}
|
||||
// Compute SHA256 hash of the provided file
|
||||
versionData.sha256[arch] = await createHashFromFile(file);
|
||||
// Write new version data to file
|
||||
fs.writeFileSync(versionDataFile, JSON.stringify(versionData, undefined, 2));
|
||||
console.log("version-data.js: ")
|
||||
console.log("----------------------------------------------------------")
|
||||
console.log(versionData);
|
||||
console.log("----------------------------------------------------------")
|
||||
} else if (arch || file) {
|
||||
throw new Error("Declare both arch and file or none.");
|
||||
}
|
||||
}
|
||||
|
||||
const createHashFromFile = filePath => new Promise(resolve => {
|
||||
const hash = crypto.createHash('sha256');
|
||||
fs.createReadStream(filePath).on('data', data => hash.update(data)).on('end', () => resolve(hash.digest('hex')));
|
||||
function createNewVersionData(version) {
|
||||
// Return a new version data object
|
||||
return {
|
||||
version,
|
||||
sha256: {}
|
||||
};
|
||||
}
|
||||
|
||||
const createHashFromFile = filePath => new Promise((resolve, reject) => {
|
||||
const hash = crypto.createHash('sha256');
|
||||
fs.createReadStream(filePath)
|
||||
.on('data', data => hash.update(data))
|
||||
.on('end', () => resolve(hash.digest('hex')))
|
||||
.on('error', reject);
|
||||
});
|
||||
|
||||
setVersion()
|
||||
setVersion().catch(console.error);
|
||||
|
|
@ -44,7 +44,7 @@ function getAppSettings() {
|
|||
tor: false,
|
||||
proxyURL: "socks5://127.0.0.1:9050",
|
||||
specterdVersion: (versionData && versionData.version !== undefined) ? versionData.version : 'unknown',
|
||||
specterdHash: (versionData && versionData.sha256 !== undefined) ? versionData.sha256 : 'unknown',
|
||||
specterdHash: (versionData && versionData.sha256 !== undefined) ? versionData.sha256[process.arch] : 'unknown',
|
||||
specterdCLIArgs: "",
|
||||
versionInitialized: false
|
||||
}
|
||||
|
|
|
|||
|
|
@ -3,7 +3,7 @@ const fs = require('fs')
|
|||
const { app, Menu } = require('electron')
|
||||
const extract = require('extract-zip')
|
||||
const { getDownloadLocation } = require('../downloadloc.js')
|
||||
const { appName, appSettings, platformName, appNameLower, versionData, versionDataPath } = require('./config.js')
|
||||
const { appName, appSettings, platformName, appNameLower, versionDataPath } = require('./config.js')
|
||||
const { isMac, getFileHash } = require('./helpers.js')
|
||||
const { logger } = require('./logging.js')
|
||||
const ProgressBar = require('electron-progressbar')
|
||||
|
|
|
|||
|
|
@ -2,5 +2,3 @@ pyinstaller==5.2
|
|||
pefile==2022.5.30
|
||||
macholib
|
||||
pywin32-ctypes
|
||||
babel==2.12.1
|
||||
pytz==2022.1
|
||||
|
|
|
|||
|
|
@ -10,10 +10,6 @@ altgraph==0.17 \
|
|||
# via
|
||||
# macholib
|
||||
# pyinstaller
|
||||
babel==2.12.1 \
|
||||
--hash=sha256:b4246fb7677d3b98f501a39d43396d3cafdc8eadb045f4a31be01863f655c610 \
|
||||
--hash=sha256:cc2d99999cd01d44420ae725a21c9e3711b3aadc7976d6147f622d8581963455
|
||||
# via -r requirements.in
|
||||
future==0.18.2 \
|
||||
--hash=sha256:b1bead90b70cf6ec3f0710ae53a525360fa360d306a86583adc6bf83a4db537d
|
||||
# via pefile
|
||||
|
|
@ -43,10 +39,6 @@ pyinstaller-hooks-contrib==2022.8 \
|
|||
--hash=sha256:c4210fc50282c9c6a918e485e0bfae9405592390508e3be9fde19acc2213da56 \
|
||||
--hash=sha256:e46f099934dd4577fb1ddcf37a99fa04027c92f8f5291c8802f326345988d001
|
||||
# via pyinstaller
|
||||
pytz==2022.1 \
|
||||
--hash=sha256:1e760e2fe6a8163bc0b3d9a19c4f84342afa0a2affebfaa84b01b978a02ecaa7 \
|
||||
--hash=sha256:e68985985296d9a66a881eb3193b0906246245294a881e7c8afe623866ac6a5c
|
||||
# via -r requirements.in
|
||||
pywin32-ctypes==0.2.0 \
|
||||
--hash=sha256:24ffc3b341d457d48e8922352130cf2644024a4ff09762a2261fd34c36ee5942 \
|
||||
--hash=sha256:9dc2d991b3479cc2df15930958b674a48a227d5361d413827a4cfd0b5876fc98
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue