Skip to content

Commit e0a56c7

Browse files
committed
chore: refactor
1 parent 6e11cbc commit e0a56c7

File tree

3 files changed

+75
-60
lines changed

3 files changed

+75
-60
lines changed

.github/workflows/package_electron.yml

Lines changed: 1 addition & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -48,24 +48,9 @@ jobs:
4848
with:
4949
fetch-depth: 1000
5050
path: ${{ github.workspace }}
51-
- name: Clone tur
52-
uses: actions/checkout@v3
53-
with:
54-
repository: termux-user-repository/tur
55-
fetch-depth: 1
56-
path: ${{ github.workspace }}/tur-repo
57-
- name: Clone termux-packages
58-
uses: actions/checkout@v3
59-
with:
60-
repository: termux/termux-packages
61-
fetch-depth: 1
62-
path: ${{ github.workspace }}/main-repo
6351
- name: Merge repos
6452
run: |
65-
cp -rn ./main-repo/* ./
66-
rm -rf ./main-repo
67-
cp -rn ./tur-repo/* ./
68-
rm -rf ./tur-repo
53+
./setup-tur-electron-builder.sh
6954
- name: Gather build summary
7055
run: |
7156
if [ "${{ github.event_name }}" != "workflow_dispatch" ]; then

.gitignore

Lines changed: 11 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,11 @@
1-
# These files are from termux/termux-packages
2-
/termux-packages/
3-
/disabled-packages/
4-
/ndk-patches/
5-
/packages/
6-
/root-packages/
7-
/scripts/
8-
/x11-packages/
9-
/CODEOWNERS
10-
/CONTRIBUTING.md
11-
/build-all.sh
12-
/build-package.sh
13-
/build-package.sh.orig
14-
/clean.sh
15-
16-
# Vim
17-
[._]*.s[a-w][a-z]
18-
[._]s[a-w][a-z]
19-
*.un~
20-
Session.vim
21-
.netrwhist
22-
*~
23-
24-
# Vagrant
25-
scripts/*.log
26-
scripts/.vagrant/
27-
28-
# Built *.deb files.
29-
/debs/
30-
/output/
31-
32-
# Built electron *.zip files
33-
/output-electron/
34-
35-
# Preinstalled build tools.
36-
/build-tools/
37-
38-
# Predownloaded packages sources.
39-
/packages/*/cache
40-
/root-packages/*/cache
41-
/x11-packages/*/cache
42-
43-
# VSCode
44-
.vscode
1+
# Ignore everything except these files
2+
*
3+
!.github
4+
!.github/**
5+
!.gitattributes
6+
!.gitignore
7+
!README.md
8+
!repo.json
9+
!setup-tur-electron-builder.sh
10+
!tur-electron
11+
!tur-electron/**

setup-tur-electron-builder.sh

Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
#!/bin/bash
2+
# setup-tur-electron-builder.sh - script to setup an electron building environment
3+
4+
set -e -u -o pipefail
5+
6+
# Enter the working directory
7+
basedir=$(realpath $(dirname $0))
8+
cd $basedir
9+
10+
# Checkout the master branch of termux/termux-packages
11+
if [ -d "./termux-packages" ] && [ -d "./termux-packages/.git" ]; then
12+
echo "Pulling termux-packages..."
13+
pushd ./termux-packages
14+
git reset --hard origin/master
15+
git pull --rebase
16+
popd
17+
else
18+
rm -rf ./termux-packages
19+
git clone https://github.com/termux/termux-packages.git --depth=1
20+
fi
21+
22+
# Checkout the master branch of termux-user-repository/tur
23+
if [ -d "./tur-repo" ] && [ -d "./tur-repo/.git" ]; then
24+
echo "Pulling termux-packages..."
25+
pushd ./termux-packages
26+
git reset --hard origin/master
27+
git pull --rebase
28+
popd
29+
else
30+
rm -rf ./tur-repo
31+
git clone https://github.com/termux-user-repository/tur.git tur-repo --depth=1
32+
fi
33+
34+
# Push changes
35+
git stash -u
36+
37+
# Delete other files
38+
shopt -s extglob
39+
rm -rf !(termux-packages|tur-repo)
40+
shopt -u extglob
41+
42+
# Reset to current branch
43+
git reset --hard
44+
45+
# Merge files
46+
cp -rn ./termux-packages/* ./
47+
cp -rn ./tur-repo/* ./
48+
49+
# Pop changes
50+
git stash pop
51+
52+
# Apply script patches
53+
shopt -s nullglob
54+
_patch=
55+
for _patch in ./common-files/building-system-patches/*.patch; do
56+
echo "Applying patch: $_patch"
57+
patch --silent -p1 < $_patch
58+
done
59+
unset _patch
60+
shopt -u nullglob
61+
62+
# Remove files
63+
rm -f build-package.sh.orig

0 commit comments

Comments
 (0)