From 97a3fdd43aea3382a7a39a3cd6efb336840f41af Mon Sep 17 00:00:00 2001 From: Ruslan Kuprieiev Date: Mon, 19 Jun 2023 02:55:11 +0300 Subject: [PATCH] gha: don't build binary packages The build process is much more stable these days and there is no reason to keep building these packages here. Instead every package has itsown building process (dvc-osxpkg, dvc-exe, dvc-s3-repo) and knows best how to build and sign correctly. pyinstaller hooks need to go into a `__pyinstaller` later on. --- .dvc/.gitignore | 12 -- .dvc/config | 4 - .github/workflows/packages.yaml | 60 ------ scripts/build.py | 88 -------- scripts/fpm/.gitignore | 4 - scripts/fpm/after-install.sh | 2 - scripts/fpm/after-remove.sh | 2 - scripts/fpm/build.py | 98 --------- scripts/fpm/notarize.py | 64 ------ scripts/fpm/sign.py | 55 ----- scripts/innosetup/.gitignore | 6 - scripts/innosetup/addSymLinkPermissions.ps1 | 76 ------- scripts/innosetup/addsymlink.iss | 14 -- scripts/innosetup/build.py | 44 ---- scripts/innosetup/dvc.ico.dvc | 3 - scripts/innosetup/dvc_left.bmp.dvc | 3 - scripts/innosetup/dvc_up.bmp.dvc | 3 - scripts/innosetup/modpath.iss | 215 -------------------- scripts/innosetup/setup.iss | 83 -------- scripts/pyinstaller/entitlements.plist | 11 - scripts/pyinstaller/sign.py | 39 ---- 21 files changed, 886 deletions(-) delete mode 100644 .dvc/.gitignore delete mode 100644 .dvc/config delete mode 100644 scripts/build.py delete mode 100644 scripts/fpm/.gitignore delete mode 100644 scripts/fpm/after-install.sh delete mode 100644 scripts/fpm/after-remove.sh delete mode 100644 scripts/fpm/build.py delete mode 100644 scripts/fpm/notarize.py delete mode 100644 scripts/fpm/sign.py delete mode 100644 scripts/innosetup/.gitignore delete mode 100644 scripts/innosetup/addSymLinkPermissions.ps1 delete mode 100644 scripts/innosetup/addsymlink.iss delete mode 100644 scripts/innosetup/build.py delete mode 100644 scripts/innosetup/dvc.ico.dvc delete mode 100644 scripts/innosetup/dvc_left.bmp.dvc delete mode 100644 scripts/innosetup/dvc_up.bmp.dvc delete mode 100644 scripts/innosetup/modpath.iss delete mode 100644 scripts/innosetup/setup.iss delete mode 100644 scripts/pyinstaller/entitlements.plist delete mode 100644 scripts/pyinstaller/sign.py diff --git a/.dvc/.gitignore b/.dvc/.gitignore deleted file mode 100644 index 53a678bba6..0000000000 --- a/.dvc/.gitignore +++ /dev/null @@ -1,12 +0,0 @@ -/state -/lock -/config.local -/updater -/updater.lock -/state-journal -/state-wal -/cache -/pkg -/repos -/tmp -/experiments diff --git a/.dvc/config b/.dvc/config deleted file mode 100644 index 16f5743a4e..0000000000 --- a/.dvc/config +++ /dev/null @@ -1,4 +0,0 @@ -['remote "dvc"'] -url = https://remote.dvc.org/dvc -[core] -remote = dvc diff --git a/.github/workflows/packages.yaml b/.github/workflows/packages.yaml index c89a3a8192..1448edbc34 100644 --- a/.github/workflows/packages.yaml +++ b/.github/workflows/packages.yaml @@ -11,66 +11,6 @@ permissions: # added using https://github.com/step-security/secure-workflows contents: read jobs: - binary: - permissions: - contents: write # for actions/upload-release-asset to upload release asset - strategy: - matrix: - include: - - {pkg: "deb", os: "ubuntu-20.04", asset: "dvc_${{ github.event.release.tag_name }}_amd64.deb"} - - {pkg: "rpm", os: "ubuntu-20.04", asset: "dvc-${{ github.event.release.tag_name }}-1.x86_64.rpm"} - - {pkg: "osxpkg", os: "macos-11", asset: "dvc-${{ github.event.release.tag_name }}.pkg"} - - {pkg: "exe", os: "windows-2019", asset: "dvc-${{ github.event.release.tag_name }}.exe"} - - name: ${{ matrix.pkg }} - runs-on: ${{ matrix.os }} - steps: - - uses: actions/checkout@v3 - with: - fetch-depth: 0 - - - name: Set up Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - cache: pip - cache-dependency-path: | - pyproject.toml - scripts/build-requirements.txt - - - name: Set up Ruby 2.6 - uses: ruby/setup-ruby@v1 - if: matrix.pkg != 'exe' - with: - ruby-version: '2.6' - - - name: Install fpm - if: matrix.pkg != 'exe' - run: gem install --no-document fpm - - - name: Install deps - run: | - pip install --upgrade pip wheel setuptools - pip install .[all] - pip install -r scripts/build-requirements.txt - - - name: Pull images - run: dvc pull - - - name: Build ${{ matrix.pkg }} - run: python scripts/build.py ${{ matrix.pkg }} - - - name: Publish ${{ matrix.pkg }} - if: github.event_name == 'release' - uses: actions/upload-release-asset@v1.0.2 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ github.event.release.upload_url }} - asset_path: scripts/${{ matrix.pkg == 'exe' && 'innosetup' || 'fpm' }}/${{ matrix.asset }} - asset_name: ${{ matrix.asset }} - asset_content_type: binary/octet-stream - pip: runs-on: ubuntu-20.04 permissions: diff --git a/scripts/build.py b/scripts/build.py deleted file mode 100644 index 9c74b2f479..0000000000 --- a/scripts/build.py +++ /dev/null @@ -1,88 +0,0 @@ -import argparse -import pathlib -import sys -from subprocess import STDOUT, check_call - -path = pathlib.Path(__file__).parent.absolute() -dvc = path.parent / "dvc" -pyinstaller = path / "pyinstaller" -innosetup = path / "innosetup" -fpm = path / "fpm" - -parser = argparse.ArgumentParser() -parser.add_argument("pkg", choices=["deb", "rpm", "osxpkg", "exe"], help="package type") -parser.add_argument("--sign-application", default=False, action="store_true") -parser.add_argument("--application-id") -parser.add_argument("--sign-installer", default=False, action="store_true") -parser.add_argument("--installer-id") -parser.add_argument("--notarize", default=False, action="store_true") -parser.add_argument("--apple-id-username") -parser.add_argument("--apple-id-password") -args = parser.parse_args() - -(dvc / "_build.py").write_text(f'PKG = "{args.pkg}"') - -if not (dvc / "_dvc_version.py").exists(): - raise Exception("no version info found") - -check_call( - ["python", "build.py"], - cwd=pyinstaller, - stderr=STDOUT, -) - -if args.sign_application: - if args.pkg != "osxpkg": - raise NotImplementedError - if not args.application_id: - print("--sign-application requires --application-id") - sys.exit(1) - check_call( - ["python", "sign.py", "--application-id", args.application_id], - cwd=pyinstaller, - stderr=STDOUT, - ) - -if args.pkg == "exe": - check_call( - ["python", "build.py"], - cwd=innosetup, - stderr=STDOUT, - ) -else: - check_call( - ["python", "build.py", args.pkg], - cwd=fpm, - stderr=STDOUT, - ) - -if args.sign_installer: - if args.pkg != "osxpkg": - raise NotImplementedError - if not all([args.installer_id, args.apple_id_username, args.apple_id_password]): - print("--sign-installer requires --installer-id") - sys.exit(1) - check_call( - ["python", "sign.py", "--installer-id", args.installer_id], - cwd=fpm, - stderr=STDOUT, - ) - -if args.notarize: - if args.pkg != "osxpkg": - raise NotImplementedError - if not all([args.apple_id_username, args.apple_id_password]): - print("--notarize requires --apple-id-username and --apple-id-password") - sys.exit(1) - check_call( - [ - "python", - "notarize.py", - "--apple-id-username", - args.apple_id_username, - "--apple-id-password", - args.apple_id_password, - ], - cwd=fpm, - stderr=STDOUT, - ) diff --git a/scripts/fpm/.gitignore b/scripts/fpm/.gitignore deleted file mode 100644 index 80294d1375..0000000000 --- a/scripts/fpm/.gitignore +++ /dev/null @@ -1,4 +0,0 @@ -/build -/*.deb -/*.rpm -/*.pkg diff --git a/scripts/fpm/after-install.sh b/scripts/fpm/after-install.sh deleted file mode 100644 index d80d9750ca..0000000000 --- a/scripts/fpm/after-install.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -ln -sf /usr/local/lib/dvc/dvc /usr/local/bin/dvc diff --git a/scripts/fpm/after-remove.sh b/scripts/fpm/after-remove.sh deleted file mode 100644 index 1a2477a5d1..0000000000 --- a/scripts/fpm/after-remove.sh +++ /dev/null @@ -1,2 +0,0 @@ -#!/bin/sh -rm -rf /usr/local/bin/dvc diff --git a/scripts/fpm/build.py b/scripts/fpm/build.py deleted file mode 100644 index 7b46ad352a..0000000000 --- a/scripts/fpm/build.py +++ /dev/null @@ -1,98 +0,0 @@ -import argparse -import os -import pathlib -import shutil -from subprocess import STDOUT, check_call, check_output - -path = pathlib.Path(__file__).parent.absolute() -dvc = path.parent.parent / "dvc" -pyinstaller = path.parent / "pyinstaller" - -build = path / "build" -install = build / "usr" - -parser = argparse.ArgumentParser() -parser.add_argument("pkg", choices=["deb", "rpm", "osxpkg"], help="package type") -args = parser.parse_args() - -flags = [ - "--description", - '"Data Version Control | Git for Data & Models"', - "-n", - "dvc", - "-s", - "dir", - "-f", - "--license", - '"Apache License 2.0"', -] - -if args.pkg == "osxpkg": - install /= "local" - bash_dir = install / "etc" / "bash_completion.d" - dirs = ["usr"] - flags.extend( - [ - "--osxpkg-identifier-prefix", - "com.iterative", - "--after-install", - path / "after-install.sh", - "--after-remove", - path / "after-remove.sh", - ] - ) -else: - if args.pkg == "rpm": - # https://github.com/jordansissel/fpm/issues/1503 - flags.extend(["--rpm-rpmbuild-define", "_build_id_links none"]) - - bash_dir = build / "etc" / "bash_completion.d" - dirs = ["usr", "etc"] - flags.extend(["--depends", "git >= 1.7.0"]) # needed for gitpython - -try: - shutil.rmtree(build) -except FileNotFoundError: - pass - -lib = install / "lib" -lib.mkdir(parents=True) -shutil.copytree(pyinstaller / "dist" / "dvc", lib / "dvc") - -if args.pkg != "osxpkg": - # NOTE: in osxpkg fpm replaces symlinks with actual file that it - # points to, so we need to use after-install hook. - (install / "bin").mkdir() - os.symlink("../lib/dvc/dvc", install / "bin" / "dvc") - -bash_dir.mkdir(parents=True) -bash_completion = check_output( - [lib / "dvc" / "dvc", "completion", "-s", "bash"], text=True -) -(bash_dir / "dvc").write_text(bash_completion) - -zsh_dir = install / "share" / "zsh" / "site-functions" -zsh_dir.mkdir(parents=True) -zsh_completion = check_output( - [lib / "dvc" / "dvc", "completion", "-s", "zsh"], text=True -) -(zsh_dir / "_dvc").write_text(zsh_completion) - -version = check_output([lib / "dvc" / "dvc", "--version"], text=True).strip() - -check_call( - [ - "fpm", - "--verbose", - "-t", - args.pkg, - *flags, - "-v", - version, - "-C", - build, - *dirs, - ], - cwd=path, - stderr=STDOUT, -) diff --git a/scripts/fpm/notarize.py b/scripts/fpm/notarize.py deleted file mode 100644 index 665e5dcb1b..0000000000 --- a/scripts/fpm/notarize.py +++ /dev/null @@ -1,64 +0,0 @@ -import argparse -import json -import os -import pathlib -import sys -from subprocess import STDOUT, check_call - -if sys.platform != "darwin": - raise NotImplementedError - -parser = argparse.ArgumentParser() -parser.add_argument( - "path", - nargs="?", - help="Path to the osxpkg to notarize. If not specified - try to find one.", -) -parser.add_argument("--apple-id-username", required=True, help="Apple ID username.") -parser.add_argument( - "--apple-id-password", - required=True, - help=( - "Apple ID app-specific password. Note that this is not a regular " - "Apple ID password, so you need to generate one at " - "https://appleid.apple.com/account/manage" - ), -) -args = parser.parse_args() - -path = pathlib.Path(__file__).parent.absolute() - -if args.path: - pkg = pathlib.Path(args.path) -else: - pkgs = list(path.glob("*.pkg")) - if not pkgs: - print("No pkgs found") - sys.exit(1) - - if len(pkgs) > 1: - print("Too many packages") - sys.exit(1) - - (pkg,) = pkgs - - -config = { - "notarize": { - "path": os.fspath(pkg), - "bundle_id": "com.iterative.dvc", - "staple": True, - }, - "apple_id": { - "username": args.apple_id_username, - "password": args.apple_id_password, - }, -} - -(path / "config.json").write_text(json.dumps(config)) - -check_call( - ["gon", "config.json"], - cwd=path, - stderr=STDOUT, -) diff --git a/scripts/fpm/sign.py b/scripts/fpm/sign.py deleted file mode 100644 index 697f9275e3..0000000000 --- a/scripts/fpm/sign.py +++ /dev/null @@ -1,55 +0,0 @@ -import argparse -import os -import pathlib -import sys -from subprocess import STDOUT, check_call - -if sys.platform != "darwin": - raise NotImplementedError - -parser = argparse.ArgumentParser() -parser.add_argument( - "path", - nargs="?", - help="Path to the osxpkg to sign. If not specified - try to find one.", -) -parser.add_argument( - "--installer-id", - required=True, - help="Certificate ID (should be added to the keychain).", -) -args = parser.parse_args() - -path = pathlib.Path(__file__).parent.absolute() - -if args.path: - pkg = pathlib.Path(args.path) -else: - pkgs = list(path.glob("*.pkg")) - if not pkgs: - print("No pkgs found") - sys.exit(1) - - if len(pkgs) > 1: - print("Too many packages") - sys.exit(1) - - (pkg,) = pkgs - -unsigned = pkg.with_suffix(".unsigned") -os.rename(pkg, unsigned) -check_call( - [ - "productsign", - "--sign", - args.installer_id, - os.fspath(unsigned), - os.fspath(pkg), - ], - stderr=STDOUT, -) - -check_call( - ["pkgutil", "--check-signature", os.fspath(pkg)], - stderr=STDOUT, -) diff --git a/scripts/innosetup/.gitignore b/scripts/innosetup/.gitignore deleted file mode 100644 index 2b0954e7d9..0000000000 --- a/scripts/innosetup/.gitignore +++ /dev/null @@ -1,6 +0,0 @@ -/dvc.ico -/dvc_left.bmp -/dvc_up.bmp -/config.ini -/build -/dvc*.exe diff --git a/scripts/innosetup/addSymLinkPermissions.ps1 b/scripts/innosetup/addSymLinkPermissions.ps1 deleted file mode 100644 index b09be93abc..0000000000 --- a/scripts/innosetup/addSymLinkPermissions.ps1 +++ /dev/null @@ -1,76 +0,0 @@ -param ( - [string]$mytype = 'system' -) - -function addSymLinkPermissions($accountToAdd){ - Write-Host "Checking SymLink permissions.." - $sidstr = $null - if ( "$accountToAdd" -eq "Everyone" ) { - $sidstr = "S-1-1-0" - } else { - try { - $ntprincipal = new-object System.Security.Principal.NTAccount "$accountToAdd" - $sid = $ntprincipal.Translate([System.Security.Principal.SecurityIdentifier]) - $sidstr = $sid.Value.ToString() - } catch { - $sidstr = $null - } - } - Write-Host "Account: $($accountToAdd)" -ForegroundColor DarkCyan - if( [string]::IsNullOrEmpty($sidstr) ) { - Write-Host "Account not found!" -ForegroundColor Red - exit -1 - } - Write-Host "Account SID: $($sidstr)" -ForegroundColor DarkCyan - $tmp = [System.IO.Path]::GetTempFileName() - Write-Host "Export current Local Security Policy" -ForegroundColor DarkCyan - secedit.exe /export /cfg "$($tmp)" - $c = Get-Content -Path $tmp - $currentSetting = "" - foreach($s in $c) { - if( $s -like "SECreateSymbolicLinkPrivilege*") { - $x = $s.split("=",[System.StringSplitOptions]::RemoveEmptyEntries) - $currentSetting = $x[1].Trim() - } - } - if( $currentSetting -notlike "*$($sidstr)*" ) { - Write-Host "Need to add permissions to SymLink" -ForegroundColor Yellow - - Write-Host "Modify Setting ""Create SymLink""" -ForegroundColor DarkCyan - - if( [string]::IsNullOrEmpty($currentSetting) ) { - $currentSetting = "*$($sidstr)" - } else { - $currentSetting = "*$($sidstr),$($currentSetting)" - } - Write-Host "$currentSetting" - $outfile = @" -[Unicode] -Unicode=yes -[Version] -signature="`$CHICAGO`$" -Revision=1 -[Privilege Rights] -SECreateSymbolicLinkPrivilege = $($currentSetting) -"@ - $tmp2 = [System.IO.Path]::GetTempFileName() - Write-Host "Import new settings to Local Security Policy" -ForegroundColor DarkCyan - $outfile | Set-Content -Path $tmp2 -Encoding Unicode -Force - Push-Location (Split-Path $tmp2) - try { - secedit.exe /configure /db "secedit.sdb" /cfg "$($tmp2)" /areas USER_RIGHTS - } finally { - Pop-Location - } - } else { - Write-Host "NO ACTIONS REQUIRED! Account already in ""Create SymLink""" -ForegroundColor DarkCyan - Write-Host "Account $accountToAdd already has permissions to SymLink" -ForegroundColor Green - return $true; - } -} - -if ( "$mytype" -eq "user" ) { - addSymLinkPermissions $(Get-WMIObject -class Win32_ComputerSystem | select username).username -} else { - addSymLinkPermissions Everyone -} diff --git a/scripts/innosetup/addsymlink.iss b/scripts/innosetup/addsymlink.iss deleted file mode 100644 index 6f0565e379..0000000000 --- a/scripts/innosetup/addsymlink.iss +++ /dev/null @@ -1,14 +0,0 @@ -procedure AddSymLink(); -var - ErrorCode: Integer; - SRCdir: String; -begin - SRCdir := ExpandConstant('{app}'); - if isUninstaller() = false then begin - if not ShellExec('', 'powershell.exe', '-noninteractive -windowstyle hidden -executionpolicy bypass -File "' + SRCdir + '\addSymLinkPermissions.ps1" -mytype ' + SymLinkType, '', SW_HIDE, ewWaitUntilTerminated, ErrorCode) then begin - SuppressibleMsgBox('Failed to automatically grant SeCreateSymbolicLinkPrivilege. Please download Polsedit(www.southsoftware.com/polsedit.zip). Launch polseditx32.exe or polseeditx64.exe (depending on your Windows version), navigate to "Security Settings" -> "User Rights Assignment", add the account(s) to the list named "Create symbolic links", logoff and login back into your account. More info at https://github.com/git-for-windows/git/wiki/Symbolic-Links.', mbInformation, MB_OK, IDOK); - end else begin - SuppressibleMsgBox('Automatically added SeCreateSymbolicLinkPrivilege. Please logoff and login back into your account in order for the change to take effect.', mbInformation, MB_OK, IDOK); - end; - end; -end; diff --git a/scripts/innosetup/build.py b/scripts/innosetup/build.py deleted file mode 100644 index 223ee840bb..0000000000 --- a/scripts/innosetup/build.py +++ /dev/null @@ -1,44 +0,0 @@ -import argparse -import configparser -import os -import pathlib -import shutil -from subprocess import STDOUT, check_call, check_output - -path = pathlib.Path(__file__).parent.absolute() -config = path / "config.ini" - -dvc = path.parent.parent / "dvc" -pyinstaller = path.parent / "pyinstaller" - -build = path / "build" -install = build / "usr" - -parser = argparse.ArgumentParser() -args = parser.parse_args() - -try: - shutil.rmtree(build) -except FileNotFoundError: - pass - -build.mkdir() -shutil.copytree(pyinstaller / "dist" / "dvc", build / "dvc") -shutil.copy(path / "addSymLinkPermissions.ps1", build) - -version = check_output( - [os.fspath(build / "dvc" / "dvc"), "--version"], text=True -).strip() - -cfg = configparser.ConfigParser() -cfg.add_section("Version") -cfg.set("Version", "version", version) - -with (path / "config.ini").open("w") as fobj: - cfg.write(fobj) - -check_call( - ["iscc", "setup.iss"], - cwd=path, - stderr=STDOUT, -) diff --git a/scripts/innosetup/dvc.ico.dvc b/scripts/innosetup/dvc.ico.dvc deleted file mode 100644 index e8ca30f50a..0000000000 --- a/scripts/innosetup/dvc.ico.dvc +++ /dev/null @@ -1,3 +0,0 @@ -outs: -- md5: 90104d9e83cfb825cf45507e90aadd27 - path: dvc.ico diff --git a/scripts/innosetup/dvc_left.bmp.dvc b/scripts/innosetup/dvc_left.bmp.dvc deleted file mode 100644 index be60334b64..0000000000 --- a/scripts/innosetup/dvc_left.bmp.dvc +++ /dev/null @@ -1,3 +0,0 @@ -outs: -- md5: 9106cda08aa427e73492389a0f17c72d - path: dvc_left.bmp diff --git a/scripts/innosetup/dvc_up.bmp.dvc b/scripts/innosetup/dvc_up.bmp.dvc deleted file mode 100644 index 7fb5ae5519..0000000000 --- a/scripts/innosetup/dvc_up.bmp.dvc +++ /dev/null @@ -1,3 +0,0 @@ -outs: -- md5: 94614d6650e062655f9f77507dc9c1f2 - path: dvc_up.bmp diff --git a/scripts/innosetup/modpath.iss b/scripts/innosetup/modpath.iss deleted file mode 100644 index 2e5f9cabc6..0000000000 --- a/scripts/innosetup/modpath.iss +++ /dev/null @@ -1,215 +0,0 @@ -// ---------------------------------------------------------------------------- -// Script based on: -// -// Inno Setup Ver: 5.4.2 -// Script Version: 1.4.2 -// Author: Jared Breland -// Homepage: http://www.legroom.net/software -// License: GNU Lesser General Public License (LGPL), version 3 -// http://www.gnu.org/licenses/lgpl.html -// -// Script Function: -// Allow modification of environmental path directly from Inno Setup installers -// -// Instructions: -// Copy modpath.iss to the same directory as your setup script -// -// Add this statement to your [Setup] section -// ChangesEnvironment=true -// -// Add this statement to your [Tasks] section -// You can change the Description or Flags -// You can change the Name, but it must match the ModPathName setting below -// Name: modifypath; Description: &Add application directory to your environmental path; Flags: unchecked -// -// Add the following to the end of your [Code] section -// ModPathName defines the name of the task defined above -// ModPathType defines whether the 'user' or 'system' path will be modified; -// this will default to user if anything other than system is set -// setArrayLength must specify the total number of dirs to be added -// Result[0] contains first directory, Result[1] contains second, etc. -// const -// ModPathName = 'modifypath'; -// ModPathType = 'user'; -// -// function ModPathDir(): TArrayOfString; -// begin -// setArrayLength(Result, 1); -// Result[0] := ExpandConstant('{app}'); -// end; -// #include "modpath.iss" -// ---------------------------------------------------------------------------- - -function ModPathDir(): TArrayOfString; -begin - setArrayLength(Result, 1) - Result[0] := ExpandConstant(ModPathPath); -end; - -procedure ModPath(); -var - oldpath: String; - newpath: String; - updatepath: Boolean; - pathArr: TArrayOfString; - aExecFile: String; - aExecArr: TArrayOfString; - i, d: Integer; - pathdir: TArrayOfString; - regroot: Integer; - regpath: String; - -begin - // Get constants from main script and adjust behavior accordingly - // ModPathType MUST be 'system' or 'user'; force 'user' if invalid - if ModPathType = 'system' then begin - regroot := HKEY_LOCAL_MACHINE; - regpath := 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; - end else begin - regroot := HKEY_CURRENT_USER; - regpath := 'Environment'; - end; - - // Get array of new directories and act on each individually - pathdir := ModPathDir(); - for d := 0 to GetArrayLength(pathdir)-1 do begin - updatepath := true; - - // Modify WinNT path - if UsingWinNT() = true then begin - - // Get current path, split into an array - RegQueryStringValue(regroot, regpath, 'Path', oldpath); - oldpath := oldpath + ';'; - i := 0; - - while (Pos(';', oldpath) > 0) do begin - SetArrayLength(pathArr, i+1); - pathArr[i] := Copy(oldpath, 0, Pos(';', oldpath)-1); - oldpath := Copy(oldpath, Pos(';', oldpath)+1, Length(oldpath)); - i := i + 1; - - // Check if current directory matches app dir - if pathdir[d] = pathArr[i-1] then begin - // if uninstalling, remove dir from path - if IsUninstaller() = true then begin - continue; - // if installing, flag that dir already exists in path - end else begin - updatepath := false; - end; - end; - - // Add current directory to new path - if i = 1 then begin - newpath := pathArr[i-1]; - end else begin - newpath := newpath + ';' + pathArr[i-1]; - end; - end; - - // Append app dir to path if not already included - if (IsUninstaller() = false) AND (updatepath = true) then - newpath := newpath + ';' + pathdir[d]; - - // Write new path - RegWriteStringValue(regroot, regpath, 'Path', newpath); - - // Modify Win9x path - end else begin - - // Convert to shortened dirname - pathdir[d] := GetShortName(pathdir[d]); - - // If autoexec.bat exists, check if app dir already exists in path - aExecFile := 'C:\AUTOEXEC.BAT'; - if FileExists(aExecFile) then begin - LoadStringsFromFile(aExecFile, aExecArr); - for i := 0 to GetArrayLength(aExecArr)-1 do begin - if IsUninstaller() = false then begin - // If app dir already exists while installing, skip add - if (Pos(pathdir[d], aExecArr[i]) > 0) then - updatepath := false; - break; - end else begin - // If app dir exists and = what we originally set, then delete at uninstall - if aExecArr[i] = 'SET PATH=%PATH%;' + pathdir[d] then - aExecArr[i] := ''; - end; - end; - end; - - // If app dir not found, or autoexec.bat didn't exist, then (create and) append to current path - if (IsUninstaller() = false) AND (updatepath = true) then begin - SaveStringToFile(aExecFile, #13#10 + 'SET PATH=%PATH%;' + pathdir[d], True); - - // If uninstalling, write the full autoexec out - end else begin - SaveStringsToFile(aExecFile, aExecArr, False); - end; - end; - end; -end; - -// Split a string into an array using passed delimiter -procedure MPExplode(var Dest: TArrayOfString; Text: String; Separator: String); -var - i: Integer; -begin - i := 0; - repeat - SetArrayLength(Dest, i+1); - if Pos(Separator,Text) > 0 then begin - Dest[i] := Copy(Text, 1, Pos(Separator, Text)-1); - Text := Copy(Text, Pos(Separator,Text) + Length(Separator), Length(Text)); - i := i + 1; - end else begin - Dest[i] := Text; - Text := ''; - end; - until Length(Text)=0; -end; - -procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); -var - aSelectedTasks: TArrayOfString; - i: Integer; - taskname: String; - regpath: String; - regstring: String; - appid: String; -begin - // only run during actual uninstall - if CurUninstallStep = usUninstall then begin - // get list of selected tasks saved in registry at install time - appid := '{#emit SetupSetting("AppId")}'; - if appid = '' then appid := '{#emit SetupSetting("AppName")}'; - regpath := ExpandConstant('Software\Microsoft\Windows\CurrentVersion\Uninstall\'+appid+'_is1'); - RegQueryStringValue(HKLM, regpath, 'Inno Setup: Selected Tasks', regstring); - if regstring = '' then RegQueryStringValue(HKCU, regpath, 'Inno Setup: Selected Tasks', regstring); - - // check each task; if matches modpath taskname, trigger patch removal - if regstring <> '' then begin - taskname := ModPathName; - MPExplode(aSelectedTasks, regstring, ','); - if GetArrayLength(aSelectedTasks) > 0 then begin - for i := 0 to GetArrayLength(aSelectedTasks)-1 do begin - if comparetext(aSelectedTasks[i], taskname) = 0 then - ModPath(); - end; - end; - end; - end; -end; - -function NeedRestart(): Boolean; -var - taskname: String; -begin - taskname := ModPathName; - if IsTaskSelected(taskname) and not UsingWinNT() then begin - Result := True; - end else begin - Result := False; - end; -end; diff --git a/scripts/innosetup/setup.iss b/scripts/innosetup/setup.iss deleted file mode 100644 index 3ee23b31bb..0000000000 --- a/scripts/innosetup/setup.iss +++ /dev/null @@ -1,83 +0,0 @@ -#define MyAppName "DVC (Data Version Control)" -#define MyAppVersion ReadIni(SourcePath + "\config.ini", "Version", "version", "unknown") -#define MyAppPublisher "Dmitry Petrov" -#define MyAppURL "https://dvc.org" -#define MyAppDir SourcePath + "\build\dvc" - -[Setup] -AppId={{8258CE8A-110E-4E0D-AE60-FEE00B15F041} -AppName={#MyAppName} -AppVersion={#MyAppVersion} -AppPublisher={#MyAppPublisher} -AppPublisherURL={#MyAppURL} -AppSupportURL={#MyAppURL} -AppUpdatesURL={#MyAppURL} -DefaultDirName={code:GetDefaultDirName} -DefaultGroupName={#MyAppName} -AllowNoIcons=yes -LicenseFile=..\..\LICENSE -OutputBaseFilename=dvc-{#MyAppVersion} -Compression=lzma2/max -SolidCompression=yes -OutputDir=. -ChangesEnvironment=yes -SetupIconFile=dvc.ico -WizardSmallImageFile=dvc_up.bmp -WizardImageFile=dvc_left.bmp -DisableWelcomePage=no - -[Languages] -Name: "english"; MessagesFile: "compiler:Default.isl" - -[Files] -Source: "{#MyAppDir}\*"; DestDir: "{app}"; Flags: ignoreversion recursesubdirs createallsubdirs - -[Tasks] -Name: modifypath; Description: Adds dvc's application directory to environmental path; Flags: checkablealone; -Name: modifypath\system; Description: Adds dvc's application directory to environmental path for all users; -Name: addsymlinkpermissions; Description: Add permission for creating symbolic links; Flags: checkablealone; -Name: addsymlinkpermissions\system; Description: Add permissions for creating symbolic links for all users; - -[Code] -const - ModPathName = 'modifypath'; - ModPathPath = '{app}'; - SymLinkName = 'addsymlinkpermissions'; - -var - ModPathType: String; - SymLinkType: String; - -function GetDefaultDirName(Dummy: string): string; -begin - if IsAdminLoggedOn then begin - Result := ExpandConstant('{pf}\{#MyAppName}'); - end else begin - Result := ExpandConstant('{userpf}\{#MyAppName}'); - end; -end; - -#include "modpath.iss" -#include "addsymlink.iss" - -procedure CurStepChanged(CurStep: TSetupStep); -begin - if CurStep = ssPostInstall then begin - if IsTaskSelected(ModPathName + '\system') then begin - ModPathType := 'system'; - end else begin - ModPathType := 'user'; - end; - - if IsTaskSelected(SymLinkName + '\system') then begin - SymLinkType := 'system'; - end else begin - SymLinkType := 'user'; - end; - - if IsTaskSelected(ModPathName) then - ModPath(); - if IsTaskSelected(SymLinkName) then - AddSymLink(); - end; -end; diff --git a/scripts/pyinstaller/entitlements.plist b/scripts/pyinstaller/entitlements.plist deleted file mode 100644 index 5f4ee2adea..0000000000 --- a/scripts/pyinstaller/entitlements.plist +++ /dev/null @@ -1,11 +0,0 @@ - - - - - - com.apple.security.cs.allow-jit - - com.apple.security.cs.allow-unsigned-executable-memory - - - diff --git a/scripts/pyinstaller/sign.py b/scripts/pyinstaller/sign.py deleted file mode 100644 index d73611086d..0000000000 --- a/scripts/pyinstaller/sign.py +++ /dev/null @@ -1,39 +0,0 @@ -import argparse -import os -import pathlib -import sys -from subprocess import STDOUT, check_call - -if sys.platform != "darwin": - raise NotImplementedError - -parser = argparse.ArgumentParser() -parser.add_argument( - "--application-id", - required=True, - help="Certificate ID (should be added to the keychain).", -) -args = parser.parse_args() - -path = pathlib.Path(__file__).parent.absolute() -dvc = path / "dist" / "dvc" -for root, _, fnames in os.walk(dvc): - for fname in fnames: - fpath = os.path.join(root, fname) - print(f"signing {fpath}") - check_call( - [ - "codesign", - "--force", - "--verbose", - "-s", - args.application_id, - "-o", - "runtime", - "--entitlements", - "entitlements.plist", - fpath, - ], - stderr=STDOUT, - timeout=180, - )