Browse Source

Implement OBS Upload workflow

tags/90.0.4430.93-1
James Buren 1 month ago
parent
commit
e75e62a556
5 changed files with 233 additions and 7 deletions
  1. +180
    -0
      .github/workflows/obs-upload.sh
  2. +28
    -0
      .github/workflows/obs-upload.yml
  3. BIN
      NotoSansTibetan-Regular.ttf
  4. +0
    -1
      sources
  5. +25
    -6
      ungoogled-chromium.spec

+ 180
- 0
.github/workflows/obs-upload.sh View File

@ -0,0 +1,180 @@
#!/bin/sh
set -e
RELEASES='rhel:7 rhel:8 fedora:32 fedora:33'
for i in git curl xmlstarlet rpmspec
do
if test -z "$(which "$i" || true)"
then
echo "The $i binary could not be found. Aborting."
exit 1
fi
done
BASE="$(git rev-parse --show-toplevel 2> /dev/null)"
SPECFILE="${BASE}/ungoogled-chromium.spec"
SOURCES="${BASE}/sources"
if test -z "${BASE}"
then
echo "BASE directory could not be determined. Aborting."
exit 1
fi
if test ! -f "${SPECFILE}"
then
echo "${SPECFILE} must exist and be a regular file. Aborting."
exit 1
fi
for i in OBS_API_USERNAME OBS_API_PASSWORD
do
if test -z "$(eval echo \$${i})"
then
echo "$i is not in the environment. Aborting."
exit 1
fi
done
PROJECT="${OBS_API_PROJECT:-home:${OBS_API_USERNAME}}"
curl()
{
for i in `seq 1 5`
do
{
command curl -sS -K - "${@}" << EOF
user="${OBS_API_USERNAME}:${OBS_API_PASSWORD}"
EOF
} && return 0 || sleep 30s
done
return 1
}
get_type()
{
local TAG
local TYPE
TAG="$(git describe --tags --exact-match 2> /dev/null || true)"
if test -z "${TAG}"
then
TYPE='development'
else
TYPE='production'
fi
echo "${TYPE}"
}
generate_obs()
{
local ROOT="${1}"
local i
local release
local version
local url
local filename
local verifier
local checksum
local revision
sed -r '1c%global obs 1' "${SPECFILE}" > "${ROOT}/ungoogled-chromium.spec"
SPECFILE="${ROOT}/ungoogled-chromium.spec"
for i in ${RELEASES}
do
release="${i%:*}"
version="${i#*:}"
rpmspec -E "%global ${release} ${version}" -P "${SPECFILE}" | sed -n -r '/^(Source|Patch)[0-9]+:/s/(Source|Patch)[0-9]+:\s*(\S+)\s*/\2/p' >> "${ROOT}/files"
done
printf '<services>\n' > "${ROOT}/_service"
sort -u < "${ROOT}/files" | while read i
do
if echo "${i}" | grep -q -E '^https?://'
then
url="${i}"
filename="${url##*/}"
verifier="$(grep "(${filename})" "${SOURCES}" | cut -d ' ' -f 1 | tr 'A-Z' 'a-z')"
checksum="$(grep "(${filename})" "${SOURCES}" | cut -d = -f 2 | sed 's;^ *\| *$;;g')"
printf '%s<service name="download_url">\n' ' ' >> "${ROOT}/_service"
printf '%s<param name="url">%s</param>\n' ' ' "${url}" >> "${ROOT}/_service"
printf '%s</service>\n' ' ' >> "${ROOT}/_service"
printf '%s<service name="verify_file">\n' ' ' >> "${ROOT}/_service"
printf '%s<param name="file">%s</param>\n' ' ' "_service:download_url:${filename}" >> "${ROOT}/_service"
printf '%s<param name="verifier">%s</param>\n' ' ' "${verifier}" >> "${ROOT}/_service"
printf '%s<param name="checksum">%s</param>\n' ' ' "${checksum}" >> "${ROOT}/_service"
printf '%s</service>\n' ' ' >> "${ROOT}/_service"
elif ! echo "${i}" | grep -q -E '^depot_tools-[^.]+[.]tar[.]xz$'
then
cp "${BASE}/${i}" "${ROOT}"
fi
done
revision="$(sed -n -r '/^%global *depot_tools_revision */s;%global *depot_tools_revision * ([^ ]+) *;\1;p' "${SPECFILE}")"
cat >> "${ROOT}/_service" << EOF
<service name="tar_scm">
<param name="scm">git</param>
<param name="url">https://chromium.googlesource.com/chromium/tools/depot_tools.git</param>
<param name="version">${revision}</param>
<param name="revision">${revision}</param>
</service>
<service name="recompress">
<param name="compression">xz</param>
<param name="file">*.tar</param>
</service>
EOF
printf '</services>\n' >> "${ROOT}/_service"
rm -f "${ROOT}/files"
}
upload_obs()
{
local ROOT="${1}"
local TYPE="${2}"
local REPOSITORY
local PACKAGE="ungoogled-chromium-fedora"
local FILE
local FILENAME
case "${TYPE}" in
production)
REPOSITORY="${PROJECT}"
;;
development)
REPOSITORY="${PROJECT}:testing"
;;
esac
curl "https://api.opensuse.org/source/${REPOSITORY}/${PACKAGE}" -F 'cmd=deleteuploadrev'
curl "https://api.opensuse.org/source/${REPOSITORY}/${PACKAGE}" > "${ROOT}/directory.xml"
xmlstarlet sel -t -v '//entry/@name' < "${ROOT}/directory.xml" | while read FILENAME
do
curl "https://api.opensuse.org/source/${REPOSITORY}/${PACKAGE}/${FILENAME}?rev=upload" -X DELETE
done
rm -f "${ROOT}/directory.xml"
for FILE in "${ROOT}"/*
do
FILENAME="${FILE##*/}"
curl "https://api.opensuse.org/source/${REPOSITORY}/${PACKAGE}/${FILENAME}?rev=upload" -T "${FILE}"
done
curl "https://api.opensuse.org/source/${REPOSITORY}/${PACKAGE}" -F 'cmd=commit'
}
TMP="$(mktemp -d)"
TYPE="$(get_type)"
trap 'rm -rf "${TMP}"' EXIT INT
generate_obs "${TMP}"
upload_obs "${TMP}" "${TYPE}"

+ 28
- 0
.github/workflows/obs-upload.yml View File

@ -0,0 +1,28 @@
name: OBS Upload
on:
push:
release:
types:
- published
jobs:
obs-upload:
runs-on: ubuntu-latest
steps:
- uses: styfle/[email protected]
with:
access_token: ${{ github.token }}
- uses: actions/[email protected]
- name: Convert from shallow repository to full repository
run: git fetch --unshallow
- name: Initialize ungoogled-chromium submodule
run: git submodule update --init --recursive
- name: Install extra packages
run: sudo apt install -y xmlstarlet rpm
- name: Run OBS Upload Script
env:
OBS_API_USERNAME: ${{ secrets.OBS_API_USERNAME }}
OBS_API_PASSWORD: ${{ secrets.OBS_API_PASSWORD }}
OBS_API_PROJECT: ${{ secrets.OBS_API_PROJECT }}
run: .github/workflows/obs-upload.sh

BIN
NotoSansTibetan-Regular.ttf View File


+ 0
- 1
sources View File

@ -19,6 +19,5 @@ SHA256 (NotoSansSymbols2-Regular.ttf) = 5004b78d8f657a575a6aa25a8cd51932e82afed1
SHA256 (NotoSansTibetan-Regular.ttf) = 5a45f430812ef981952553ef6dd6fa04c7849e97880cdfecc7bf572a58efed93
SHA256 (node-v10.15.3-linux-x64.tar.gz) = 6c35b85a7cd4188ab7578354277b2b2ca43eacc864a2a16b3669753ec2369d52
SHA256 (xcb-proto-1.14.tar.xz) = 186a3ceb26f9b4a015f5a44dcc814c93033a5fc39684f36f1ecc79834416a605
SHA256 (depot_tools.git-master.tar.gz) = dfae74fd6b3d982583fee8acfeec64d8994865dd3550f642be4b1d0d4998dd5d
SHA256 (chromium-89.0.4389.114.tar.xz) = f2f0abe9697a220a8545df74d832c6c8d85a4fb11845e7e398752d746e72ed00
SHA256 (ungoogled-chromium-89.0.4389.114-1.tar.gz) = 38bc4f73356caaa23d7f6b9d2961f9241f8e0fb212f3ab11bf88dca1db5ca3ee

+ 25
- 6
ungoogled-chromium.spec View File

@ -1,3 +1,5 @@
%global obs 0
%define _lto_cflags %{nil}
%global numjobs 14
@ -163,8 +165,8 @@ BuildRequires: libicu-devel >= 5.4
%global majorversion 89
%global revision 1
# Depot tool revision
%global depot_tool_revision 428143ee24c5f084c8dfb38cd17f07b4f7ba9bf7
# Depot tools revision
%global depot_tools_revision 428143ee24c5f084c8dfb38cd17f07b4f7ba9bf7
%if %{freeworld}
Name: ungoogled-chromium%{nsuffix}
@ -309,13 +311,13 @@ Patch700: chromium-missing-std-vector.patch
# For Chromium Fedora use chromium-latest.py --stable --ffmpegclean --ffmpegarm
# If you want to include the ffmpeg arm sources append the --ffmpegarm switch
# https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%%{version}.tar.xz
%if %{freeworld}
%if %{freeworld} || %{obs}
Source0: https://commondatastorage.googleapis.com/chromium-browser-official/chromium-%{version}.tar.xz
%else
Source0: chromium-%{version}-clean.tar.xz
%endif
# https://chromium.googlesource.com/chromium/tools/depot_tools.git/+archive/7e7a454f9afdddacf63e10be48f0eab603be654e.tar.gz
Source2: https://chromium.googlesource.com/chromium/tools/depot_tools.git/+archive/%{depot_tool_revision}.tar.gz
# Packaged by OBS from https://chromium.googlesource.com/chromium/tools/depot_tools.git
Source2: depot_tools-%{depot_tools_revision}.tar.xz
Source3: %{name}.sh
Source4: %{chromium_browser_channel}.desktop
# Also, only used if you want to reproduce the clean tarball.
@ -644,11 +646,28 @@ Requires: minizip%{_isa}
############################################PREP###########################################################
%prep
%setup -q -T -n ungoogled-chromium-%{ungoogled_chromium_revision} -b 300
%setup -q -T -c -n depot_tools -a 2
%setup -q -T -n depot_tools-%{depot_tools_revision} -b 2
%setup -q -n chromium-%{version}
%global ungoogled_chromium_root %{_builddir}/ungoogled-chromium-%{ungoogled_chromium_revision}
ln -s depot_tools-%{depot_tools_revision} ../depot_tools
%if %{obs}
(
cd ..
for i in chromium-%{version}.tar.xz chromium-latest.py clean_ffmpeg.sh get_free_ffmpeg_source_files.py
do
j=../SOURCES/$i
chmod +x $j
ln -s $j $i
done
printf 'md5 %s\n' "$(md5sum chromium-%{version}.tar.xz)" > chromium-%{version}.tar.xz.hashes
./chromium-latest.py --version %{version} --ffmpegclean --ffmpegarm --prep
rm -f *.tar.xz* *.sh *.py
)
%endif
### Chromium Fedora Patches ###
%patch1 -p1 -b .etc
%patch2 -p1 -b .gnsystem


Loading…
Cancel
Save