Skip to content

Commit 75ff0a5

Browse files
authored
feat: use source cache versioning (#83)
1 parent 138a606 commit 75ff0a5

File tree

2 files changed

+5
-32
lines changed

2 files changed

+5
-32
lines changed

copr_script.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,10 @@
1212
# distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
1313
# See the License for the specific language governing permissions and limitations under the License.
1414

15-
wget https://versionhistory.googleapis.com/v1/chrome/platforms/linux/channels/stable/versions/all/releases?filter=endtime=none -O chromium-version.json
16-
grep \"version\" chromium-version.json | grep -oh "[0-9]*\.[0-9]*\.[0-9]*\.[0-9]*" > chromium-version.txt
15+
set -ueo pipefail
1716

1817
# Preset variables
19-
readonly LIST_SOURCES=(
18+
declare -r LIST_SOURCES=(
2019
"https://easylist.to/easylist/easylist.txt"
2120
"https://easylist.to/easylist/easyprivacy.txt"
2221
"https://secure.fanboy.co.nz/fanboy-annoyance.txt"
@@ -46,17 +45,18 @@ readonly LIST_SOURCES=(
4645
"https://raw.githubusercontent.com/lassekongo83/Frellwits-filter-lists/master/Frellwits-Swedish-Filter.txt"
4746
"https://raw.githubusercontent.com/AdguardTeam/FiltersRegistry/master/filters/filter_7_Japanese/filter.txt"
4847
)
49-
readonly NAME="trivalent-subresource-filter"
48+
declare -r NAME="trivalent-subresource-filter"
5049

5150
# Clone the repo with the spec file and chromium source downloader
5251
cp "$NAME/$NAME.spec" ./
5352
cp "$NAME/use-cwd-for-gclient-path.patch" ./
5453
cp "$NAME/install_filter.sh" ./
5554
cp /usr/src/chromium/chromium-*-clean.tar.xz ./
55+
cp /usr/src/chromium/chromium-version.txt ./
5656
rm -rf "./$NAME"
5757

5858
# Get the filters that will be added
59-
counter=1
59+
declare -i counter=1
6060
for url in "${LIST_SOURCES[@]}"; do
6161
wget "$url" -O "filter-$counter.txt"
6262
counter=$((counter+1))

trivalent-subresource-filter.spec

Lines changed: 0 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -12,36 +12,9 @@ BuildArch: noarch
1212
License: Apache-2.0
1313
Summary: Subresource filter for %{chromium_name}
1414
%{lua:
15-
function splitVersionTag(vtag)
16-
local vtag_array = {}
17-
local index = 1
18-
for version_block in string.gmatch(vtag, "%d+") do
19-
vtag_array[index] = tonumber(version_block)
20-
index = index + 1
21-
end
22-
return vtag_array
23-
end
24-
2515
local f = io.open(macros['_sourcedir']..'/chromium-version.txt', 'r')
2616
local version_tag = f:read "*all"
2717

28-
-- This IS NOT the version of the browser
29-
-- It is only used if it is greater than the automated version detection
30-
-- The point is to update to an arbitrary greater release tag, like early stable or beta tags
31-
local off_version_tag = "144.0.7559.31"
32-
33-
local vt = splitVersionTag(version_tag)
34-
local ovt = splitVersionTag(off_version_tag)
35-
36-
for i = 1, # vt do
37-
if vt[i] > ovt[i] then
38-
break
39-
elseif ovt[i] > vt[i] then
40-
version_tag = off_version_tag
41-
break
42-
end
43-
end
44-
4518
-- This will dynamically set the version based on chromium's latest stable release channel
4619
print("Version: "..version_tag.."\n")
4720

0 commit comments

Comments
 (0)