Skip to content

Commit a966514

Browse files
oklopferook37
andauthored
allow split packages to be built (#27)
I'm sure other problems will arise while getting this together but this should at least work at base --------- Co-authored-by: ook37 <oren+12345@taumoda.com>
1 parent 534e961 commit a966514

File tree

6 files changed

+109
-49
lines changed

6 files changed

+109
-49
lines changed

.github/workflows/pkg-ananicy-cpp.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,39 @@ jobs:
3434
m_dist="${{ matrix.distro }}"
3535
m_arch="${{ matrix.architecture }}"
3636
../scripts/packer.sh "${m_name}" "${m_dist}" "${m_arch}"
37-
debfile=(*${m_arch}.deb)
38-
echo "DEBNAME=${debfile}" >> $GITHUB_ENV
37+
debfiles=(*.deb)
38+
if [ ${#debfiles[@]} -gt 1 ]; then
39+
echo "DEBNAME=${m_name}:${m_arch}@${m_dist}" >> $GITHUB_ENV
40+
echo "DEBPATH=out" >> $GITHUB_ENV
41+
else
42+
echo "DEBNAME=${debfiles[0]}@${m_dist}" >> $GITHUB_ENV
43+
echo "DEBPATH=out/${debfiles[0]}" >> $GITHUB_ENV
44+
fi
3945
- name: Upload .deb files
4046
uses: actions/upload-artifact@v4
4147
with:
42-
name: ${{ env.DEBNAME }}@${{ matrix.distro }}
43-
path: out/${{ env.DEBNAME }}
48+
name: ${{ env.DEBNAME }}
49+
path: ${{ env.DEBPATH }}
4450
- name: Upload to server
4551
run: |
4652
LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}"
4753
LOCAL_PORT=8080
4854
REMOTE_PORT=${{ secrets.APTLY_PORT }}
4955
REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages"
5056
ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}"
51-
rm_str="$(./scripts/checker.sh overflow ananicy-cpp ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
52-
if [ -n "${rm_str}" ]; then
53-
echo "Removing ${rm_str}..."
54-
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
57+
children=($(curl -fsSL https://pacstall.dev/api/packages/ananicy-cpp | jq -r '.baseChildren[]'))
58+
if [ ${#children[@]} -le 1 ]; then
59+
children=("ananicy-cpp")
5560
fi
56-
curl -X POST -F file=@out/${{ env.DEBNAME }} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq
61+
for i in "${children[@]}"; do
62+
unset rm_str
63+
rm_str="$(./scripts/checker.sh overflow ${i} ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
64+
if [ -n "${rm_str}" ]; then
65+
echo "Removing ${rm_str}..."
66+
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
67+
fi
68+
done
69+
for i in out/*.deb; do curl -X POST -F file=@${i} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq; done
5770
curl -s -X POST -H 'Content-Type: application/json' \
5871
"http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/file/${{ matrix.distro }}?forceReplace=1" | jq
5972
curl -X PUT -H 'Content-Type: application/json' --data '{"Signing": {"Skip": false, "GpgKey": "${{ secrets.GPG_KEY }}"}, "MultiDist": true, "ForceOverwrite": true}' "http://localhost:${LOCAL_PORT}/api/publish/pacstall/pacstall" | jq

.github/workflows/pkg-emacs.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,39 @@ jobs:
3434
m_dist="${{ matrix.distro }}"
3535
m_arch="${{ matrix.architecture }}"
3636
../scripts/packer.sh "${m_name}" "${m_dist}" "${m_arch}"
37-
debfile=(*${m_arch}.deb)
38-
echo "DEBNAME=${debfile}" >> $GITHUB_ENV
37+
debfiles=(*.deb)
38+
if [ ${#debfiles[@]} -gt 1 ]; then
39+
echo "DEBNAME=${m_name}:${m_arch}@${m_dist}" >> $GITHUB_ENV
40+
echo "DEBPATH=out" >> $GITHUB_ENV
41+
else
42+
echo "DEBNAME=${debfiles[0]}@${m_dist}" >> $GITHUB_ENV
43+
echo "DEBPATH=out/${debfiles[0]}" >> $GITHUB_ENV
44+
fi
3945
- name: Upload .deb files
4046
uses: actions/upload-artifact@v4
4147
with:
42-
name: ${{ env.DEBNAME }}@${{ matrix.distro }}
43-
path: out/${{ env.DEBNAME }}
48+
name: ${{ env.DEBNAME }}
49+
path: ${{ env.DEBPATH }}
4450
- name: Upload to server
4551
run: |
4652
LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}"
4753
LOCAL_PORT=8080
4854
REMOTE_PORT=${{ secrets.APTLY_PORT }}
4955
REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages"
5056
ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}"
51-
rm_str="$(./scripts/checker.sh overflow emacs ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
52-
if [ -n "${rm_str}" ]; then
53-
echo "Removing ${rm_str}..."
54-
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
57+
children=($(curl -fsSL https://pacstall.dev/api/packages/emacs | jq -r '.baseChildren[]'))
58+
if [ ${#children[@]} -le 1 ]; then
59+
children=("emacs")
5560
fi
56-
curl -X POST -F file=@out/${{ env.DEBNAME }} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq
61+
for i in "${children[@]}"; do
62+
unset rm_str
63+
rm_str="$(./scripts/checker.sh overflow ${i} ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
64+
if [ -n "${rm_str}" ]; then
65+
echo "Removing ${rm_str}..."
66+
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
67+
fi
68+
done
69+
for i in out/*.deb; do curl -X POST -F file=@${i} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq; done
5770
curl -s -X POST -H 'Content-Type: application/json' \
5871
"http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/file/${{ matrix.distro }}?forceReplace=1" | jq
5972
curl -X PUT -H 'Content-Type: application/json' --data '{"Signing": {"Skip": false, "GpgKey": "${{ secrets.GPG_KEY }}"}, "MultiDist": true, "ForceOverwrite": true}' "http://localhost:${LOCAL_PORT}/api/publish/pacstall/pacstall" | jq

.github/workflows/pkg-nushell-bin.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -34,26 +34,39 @@ jobs:
3434
m_dist="${{ matrix.distro }}"
3535
m_arch="${{ matrix.architecture }}"
3636
../scripts/packer.sh "${m_name}" "${m_dist}" "${m_arch}"
37-
debfile=(*${m_arch}.deb)
38-
echo "DEBNAME=${debfile}" >> $GITHUB_ENV
37+
debfiles=(*.deb)
38+
if [ ${#debfiles[@]} -gt 1 ]; then
39+
echo "DEBNAME=${m_name}:${m_arch}@${m_dist}" >> $GITHUB_ENV
40+
echo "DEBPATH=out" >> $GITHUB_ENV
41+
else
42+
echo "DEBNAME=${debfiles[0]}@${m_dist}" >> $GITHUB_ENV
43+
echo "DEBPATH=out/${debfiles[0]}" >> $GITHUB_ENV
44+
fi
3945
- name: Upload .deb files
4046
uses: actions/upload-artifact@v4
4147
with:
42-
name: ${{ env.DEBNAME }}@${{ matrix.distro }}
43-
path: out/${{ env.DEBNAME }}
48+
name: ${{ env.DEBNAME }}
49+
path: ${{ env.DEBPATH }}
4450
- name: Upload to server
4551
run: |
4652
LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}"
4753
LOCAL_PORT=8080
4854
REMOTE_PORT=${{ secrets.APTLY_PORT }}
4955
REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages"
5056
ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}"
51-
rm_str="$(./scripts/checker.sh overflow nushell-bin ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
52-
if [ -n "${rm_str}" ]; then
53-
echo "Removing ${rm_str}..."
54-
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
57+
children=($(curl -fsSL https://pacstall.dev/api/packages/nushell-bin | jq -r '.baseChildren[]'))
58+
if [ ${#children[@]} -le 1 ]; then
59+
children=("nushell-bin")
5560
fi
56-
curl -X POST -F file=@out/${{ env.DEBNAME }} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq
61+
for i in "${children[@]}"; do
62+
unset rm_str
63+
rm_str="$(./scripts/checker.sh overflow ${i} ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
64+
if [ -n "${rm_str}" ]; then
65+
echo "Removing ${rm_str}..."
66+
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
67+
fi
68+
done
69+
for i in out/*.deb; do curl -X POST -F file=@${i} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq; done
5770
curl -s -X POST -H 'Content-Type: application/json' \
5871
"http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/file/${{ matrix.distro }}?forceReplace=1" | jq
5972
curl -X PUT -H 'Content-Type: application/json' --data '{"Signing": {"Skip": false, "GpgKey": "${{ secrets.GPG_KEY }}"}, "MultiDist": true, "ForceOverwrite": true}' "http://localhost:${LOCAL_PORT}/api/publish/pacstall/pacstall" | jq

.github/workflows/pkg-pacstall.yml

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -31,26 +31,39 @@ jobs:
3131
m_dist="${{ matrix.distro }}"
3232
m_arch="${{ matrix.architecture }}"
3333
../scripts/packer.sh "${m_name}" "${m_dist}" "${m_arch}"
34-
debfile=(*${m_arch}.deb)
35-
echo "DEBNAME=${debfile}" >> $GITHUB_ENV
34+
debfiles=(*.deb)
35+
if [ ${#debfiles[@]} -gt 1 ]; then
36+
echo "DEBNAME=${m_name}:${m_arch}@${m_dist}" >> $GITHUB_ENV
37+
echo "DEBPATH=out" >> $GITHUB_ENV
38+
else
39+
echo "DEBNAME=${debfiles[0]}@${m_dist}" >> $GITHUB_ENV
40+
echo "DEBPATH=out/${debfiles[0]}" >> $GITHUB_ENV
41+
fi
3642
- name: Upload .deb files
3743
uses: actions/upload-artifact@v4
3844
with:
39-
name: ${{ env.DEBNAME }}@${{ matrix.distro }}
40-
path: out/${{ env.DEBNAME }}
45+
name: ${{ env.DEBNAME }}
46+
path: ${{ env.DEBPATH }}
4147
- name: Upload to server
4248
run: |
4349
LOCATION="${{ secrets.SSH_USER }}@${{ secrets.SSH_IP }}"
4450
LOCAL_PORT=8080
4551
REMOTE_PORT=${{ secrets.APTLY_PORT }}
4652
REPO_URL="http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/packages"
4753
ssh -i ~/.ssh/id_ed25519 -fN -L ${LOCAL_PORT}:localhost:${REMOTE_PORT} "${LOCATION}"
48-
rm_str="$(./scripts/checker.sh overflow pacstall ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
49-
if [ -n "${rm_str}" ]; then
50-
echo "Removing ${rm_str}..."
51-
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
54+
children=($(curl -fsSL https://pacstall.dev/api/packages/pacstall | jq -r '.baseChildren[]'))
55+
if [ ${#children[@]} -le 1 ]; then
56+
children=("pacstall")
5257
fi
53-
curl -X POST -F file=@out/${{ env.DEBNAME }} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq
58+
for i in "${children[@]}"; do
59+
unset rm_str
60+
rm_str="$(./scripts/checker.sh overflow ${i} ${{ matrix.distro }} ${{ matrix.architecture }} 5 ${REPO_URL})"
61+
if [ -n "${rm_str}" ]; then
62+
echo "Removing ${rm_str}..."
63+
curl -X DELETE -H 'Content-Type: application/json' --data "{\"PackageRefs\": [${rm_str}]}" "${REPO_URL}" | jq
64+
fi
65+
done
66+
for i in out/*.deb; do curl -X POST -F file=@${i} "http://localhost:${LOCAL_PORT}/api/files/${{ matrix.distro }}" | jq; done
5467
curl -s -X POST -H 'Content-Type: application/json' \
5568
"http://localhost:${LOCAL_PORT}/api/repos/ppr-${{ matrix.distro }}/file/${{ matrix.distro }}?forceReplace=1" | jq
5669
curl -X PUT -H 'Content-Type: application/json' --data '{"Signing": {"Skip": false, "GpgKey": "${{ secrets.GPG_KEY }}"}, "MultiDist": true, "ForceOverwrite": true}' "http://localhost:${LOCAL_PORT}/api/publish/pacstall/pacstall" | jq

manager.py

Lines changed: 20 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -152,10 +152,10 @@ def gen_workflow(package_name, package_data):
152152
{
153153
"name": "Set up SSH key",
154154
"run": LiteralString(
155-
f"mkdir -p ~/.ssh\n"
156-
f"echo \"${{{{ secrets.SSH_KEY }}}}\" > ~/.ssh/id_ed25519\n"
157-
f"chmod 600 ~/.ssh/id_ed25519\n"
158-
f"ssh-keyscan -H \"${{{{ secrets.SSH_IP }}}}\" >> ~/.ssh/known_hosts"
155+
"mkdir -p ~/.ssh\n"
156+
"echo \"${{ secrets.SSH_KEY }}\" > ~/.ssh/id_ed25519\n"
157+
"chmod 600 ~/.ssh/id_ed25519\n"
158+
"ssh-keyscan -H \"${{ secrets.SSH_IP }}\" >> ~/.ssh/known_hosts"
159159
)
160160
},
161161
{
@@ -166,16 +166,22 @@ def gen_workflow(package_name, package_data):
166166
f"m_dist=\"${{{{ matrix.distro }}}}\"\n"
167167
f"m_arch=\"${{{{ matrix.architecture }}}}\"\n"
168168
f"../scripts/packer.sh \"${{m_name}}\" \"${{m_dist}}\" \"${{m_arch}}\"\n"
169-
"debfile=(*${m_arch}.deb)\n"
170-
"echo \"DEBNAME=${debfile}\" >> $GITHUB_ENV"
169+
f"debfiles=(*.deb)\n"
170+
f"if [ ${{#debfiles[@]}} -gt 1 ]; then\n"
171+
f" echo \"DEBNAME=${{m_name}}:${{m_arch}}@${{m_dist}}\" >> $GITHUB_ENV\n"
172+
f" echo \"DEBPATH=out\" >> $GITHUB_ENV\n"
173+
f"else\n"
174+
f" echo \"DEBNAME=${{debfiles[0]}}@${{m_dist}}\" >> $GITHUB_ENV\n"
175+
f" echo \"DEBPATH=out/${{debfiles[0]}}\" >> $GITHUB_ENV\n"
176+
f"fi"
171177
)
172178
},
173179
{
174180
"name": "Upload .deb files",
175181
"uses": "actions/upload-artifact@v4",
176182
"with": {
177-
"name": "${{ env.DEBNAME }}@${{ matrix.distro }}",
178-
"path": "out/${{ env.DEBNAME }}"
183+
"name": "${{ env.DEBNAME }}",
184+
"path": "${{ env.DEBPATH }}"
179185
}
180186
},
181187
{
@@ -186,10 +192,12 @@ def gen_workflow(package_name, package_data):
186192
f"REMOTE_PORT=${{{{ secrets.APTLY_PORT }}}}\n"
187193
f"REPO_URL=\"http://localhost:${{LOCAL_PORT}}/api/repos/ppr-${{{{ matrix.distro }}}}/packages\"\n"
188194
f"ssh -i ~/.ssh/id_ed25519 -fN -L ${{LOCAL_PORT}}:localhost:${{REMOTE_PORT}} \"${{LOCATION}}\"\n"
189-
f"rm_str=\"$(./scripts/checker.sh overflow {package_name} ${{{{ matrix.distro }}}} ${{{{ matrix.architecture }}}} {overflow} ${{REPO_URL}})\"\n"
190-
f"if [ -n \"${{rm_str}}\" ]; then\n echo \"Removing ${{rm_str}}...\"\n"
191-
f" curl -X DELETE -H 'Content-Type: application/json' --data \"{{\\\"PackageRefs\\\": [${{rm_str}}]}}\" \"${{REPO_URL}}\" | jq\nfi\n"
192-
f"curl -X POST -F file=@out/${{{{ env.DEBNAME }}}} \"http://localhost:${{LOCAL_PORT}}/api/files/${{{{ matrix.distro }}}}\" | jq\n"
195+
f"children=($(curl -fsSL https://pacstall.dev/api/packages/{package_name} | jq -r '.baseChildren[]'))\n"
196+
f"if [ ${{#children[@]}} -le 1 ]; then\n children=(\"{package_name}\")\nfi\nfor i in \"${{children[@]}}\"; do\n"
197+
f" unset rm_str\n rm_str=\"$(./scripts/checker.sh overflow ${{i}} ${{{{ matrix.distro }}}} ${{{{ matrix.architecture }}}} {overflow} ${{REPO_URL}})\"\n"
198+
f" if [ -n \"${{rm_str}}\" ]; then\n echo \"Removing ${{rm_str}}...\"\n"
199+
f" curl -X DELETE -H 'Content-Type: application/json' --data \"{{\\\"PackageRefs\\\": [${{rm_str}}]}}\" \"${{REPO_URL}}\" | jq\n fi\ndone\n"
200+
f"for i in out/*.deb; do curl -X POST -F file=@${{i}} \"http://localhost:${{LOCAL_PORT}}/api/files/${{{{ matrix.distro }}}}\" | jq; done\n"
193201
f"curl -s -X POST -H 'Content-Type: application/json' \\\n"
194202
f" \"http://localhost:${{LOCAL_PORT}}/api/repos/ppr-${{{{ matrix.distro }}}}/file/${{{{ matrix.distro }}}}?forceReplace=1\" | jq\n"
195203
f"curl -X PUT -H 'Content-Type: application/json' --data '{{\"Signing\": {{\"Skip\": false, \"GpgKey\": \"${{{{ secrets.GPG_KEY }}}}\"}}, \"MultiDist\": true, \"ForceOverwrite\": true}}' \"http://localhost:${{LOCAL_PORT}}/api/publish/pacstall/pacstall\" | jq\n"

scripts/packer.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ packer() {
9696
docker run --net=host --privileged "ghcr.io/pacstall/${dist}${target}" bash -c "mkdir -p out && cd out && pacstall -PBINs ${pkg}" \
9797
&& container="$(docker ps -lq)" \
9898
&& docker cp "${container}":/home/pacstall/out/. . \
99-
&& echo -e "[${BCyan}${NC}] ${BOLD}PACK${NC}: deb for ${BPurple}${pkg}${NC}/${BLUE}${dist/-/:}${NC}/${CYAN}${a}${NC} built at ${BGreen}${PWD}${NC}" \
99+
&& echo -e "[${BCyan}${NC}] ${BOLD}PACK${NC}: deb(s) for ${BPurple}${pkg}${NC}/${BLUE}${dist/-/:}${NC}/${CYAN}${a}${NC} built at ${BGreen}${PWD}${NC}" \
100100
&& docker rm "${container}" &> /dev/null
101101
done
102102
}

0 commit comments

Comments
 (0)