mirror of
https://github.com/t2linux/fedora.git
synced 2026-04-30 13:51:42 -07:00
Build packages in temp dir and cleanup on exit
This commit is contained in:
@@ -55,14 +55,14 @@ jobs:
|
||||
uses: actions/upload-artifact@v3
|
||||
with:
|
||||
name: packages
|
||||
path: _output/*.rpm
|
||||
path: builddir/packages/*.rpm
|
||||
|
||||
- name: "Release"
|
||||
if: startsWith(github.ref, 'refs/tags/v')
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
files: |
|
||||
_output/*.rpm
|
||||
builddir/packages/*.rpm
|
||||
|
||||
deploy:
|
||||
needs: ["build"]
|
||||
|
||||
@@ -20,7 +20,7 @@ jobs:
|
||||
with:
|
||||
latest: true
|
||||
fileName: "*"
|
||||
out-file-path: "_output"
|
||||
out-file-path: "builddir/packages"
|
||||
|
||||
- name: "Build DNF Repo"
|
||||
run: |
|
||||
@@ -38,5 +38,5 @@ jobs:
|
||||
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
||||
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
||||
with:
|
||||
publish-dir: _output/dnf-repo
|
||||
publish-dir: builddir/dnf-repo
|
||||
production-deploy: ${{ startsWith(github.ref, 'refs/tags/v') }}
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
_output/
|
||||
builddir/
|
||||
|
||||
+25
-8
@@ -1,18 +1,35 @@
|
||||
#!/usr/bin/bash
|
||||
set -e
|
||||
|
||||
packages=( "t2linux-config" "t2linux-repo" "t2linux-audio" "kernel")
|
||||
packages=( "t2linux-config" "t2linux-repo" "t2linux-audio" "kernel" )
|
||||
|
||||
mkdir -p /repo/builddir
|
||||
builddir=$(mktemp -d -p "/repo/builddir"); export builddir
|
||||
function cleanup {
|
||||
rm -rf "$builddir"
|
||||
}
|
||||
trap cleanup EXIT
|
||||
|
||||
mkdir -p /repo/_output
|
||||
for current_package in "${packages[@]}"; do
|
||||
|
||||
[[ -d "/repo/$current_package" ]] || exit 10
|
||||
|
||||
export package_builddir="$builddir/$current_package"
|
||||
mkdir -p "$package_builddir"
|
||||
|
||||
cp -fr "/repo/$current_package"/* "$package_builddir"
|
||||
if [ "$current_package" == "kernel" ]; then
|
||||
/repo/kernel/kernel.sh
|
||||
fi
|
||||
cd /repo/"$current_package" || echo "ERROR: Package $current_package not found"
|
||||
spectool -g "$current_package".spec
|
||||
mock --buildsrpm --spec "$current_package".spec --sources . --resultdir /repo/_output
|
||||
|
||||
export specfile="$package_builddir/$current_package.spec"
|
||||
[[ -f "$specfile" ]] || exit 11
|
||||
|
||||
spectool -g -C "$package_builddir" "$specfile"
|
||||
mock --buildsrpm --spec "$specfile" --sources "$package_builddir" --resultdir "$builddir"
|
||||
done
|
||||
|
||||
mock --rebuild --chain /repo/_output/*.src.rpm --localrepo /repo/_output/mock_repo
|
||||
cp -f /repo/_output/mock_repo/results/*/*/*.rpm /repo/_output
|
||||
rm -rf /repo/_output/*.log
|
||||
mock --rebuild --chain "$builddir"/*.src.rpm --localrepo "$builddir"
|
||||
mkdir -p /repo/builddir/packages
|
||||
cp -f "$builddir"/results/*/*/*.rpm /repo/builddir/packages/
|
||||
cleanup
|
||||
|
||||
+4
-2
@@ -1,4 +1,5 @@
|
||||
#!/usr/bin/bash
|
||||
set -e
|
||||
|
||||
SIGNING_KEY_UID=$( \
|
||||
echo "$SIGNING_KEY" \
|
||||
@@ -11,7 +12,8 @@ echo "$SIGNING_KEY" | gpg --import
|
||||
unset SIGNING_KEY
|
||||
|
||||
# shellcheck disable=SC2164
|
||||
mkdir -p /repo/_output/dnf-repo && cd /repo/_output/dnf-repo
|
||||
cp ../*.rpm . && rm ./*.src.rpm
|
||||
mkdir -p /repo/builddir/dnf-repo && cd /repo/builddir/dnf-repo
|
||||
cp /repo/builddir/packages/*.rpm .
|
||||
rm ./*.src.rpm
|
||||
rpm --addsign ./*.rpm
|
||||
createrepo .
|
||||
|
||||
+14
-10
@@ -1,20 +1,24 @@
|
||||
#!/usr/bin/bash
|
||||
FEDORA_KERNEL_VERSION=6.5.6-200.fc38
|
||||
cd /repo/kernel
|
||||
koji download-build --quiet --arch=src "kernel-${FEDORA_KERNEL_VERSION}"
|
||||
rpmdev-extract -q "kernel-${FEDORA_KERNEL_VERSION}".src.rpm
|
||||
mv -n "kernel-${FEDORA_KERNEL_VERSION}".src/* .
|
||||
set -e
|
||||
|
||||
KERNEL_VERSION=6.5.6-200.fc38
|
||||
|
||||
cd "$package_builddir"
|
||||
koji download-build --quiet --arch=src "kernel-$KERNEL_VERSION"
|
||||
rpmdev-extract -q -C "$package_builddir" "kernel-$KERNEL_VERSION.src.rpm"
|
||||
mv -n "kernel-$KERNEL_VERSION.src"/* .
|
||||
rm -r "kernel-$KERNEL_VERSION.src.rpm" "kernel-$KERNEL_VERSION.src"
|
||||
|
||||
# Fedora devs are against merging kernel-local for all architectures when keys are not properly specified, so we have to patch it in.
|
||||
sed -i "s@for i in %{all_arch_configs}@for i in *.config@g" kernel.spec
|
||||
sed -i "s@for i in %{all_arch_configs}@for i in *.config@g" "$package_builddir/kernel.spec"
|
||||
|
||||
# Set buildid to .t2
|
||||
sed -i 's/# define buildid .local/%define buildid .t2/g' kernel.spec
|
||||
sed -i 's/# define buildid .local/%define buildid .t2/g' "$package_builddir/kernel.spec"
|
||||
|
||||
# Disable debug kernels
|
||||
sed -i "/%define with_debug /c %define with_debug 0" kernel.spec
|
||||
sed -i "/%define with_debug /c %define with_debug 0" "$package_builddir/kernel.spec"
|
||||
|
||||
cat linux-t2-patches/extra_config > kernel-local
|
||||
cat linux-t2-patches/*.patch > linux-kernel-test.patch
|
||||
cat "$package_builddir/linux-t2-patches/extra_config" > "$package_builddir/kernel-local"
|
||||
cat "$package_builddir/linux-t2-patches"/*.patch > "$package_builddir/linux-kernel-test.patch"
|
||||
|
||||
cd ..
|
||||
|
||||
Reference in New Issue
Block a user