2
0
Adam Majer 2024-07-31 13:20:43 +00:00 committed by Git OBS Bridge
parent 25eebd35ab
commit bf51c2c14e
2 changed files with 58 additions and 2 deletions

View File

@ -22,8 +22,6 @@ Release: 0
Summary: Cockpit user interface for virtual machines Summary: Cockpit user interface for virtual machines
License: LGPL-2.1-or-later AND MIT License: LGPL-2.1-or-later AND MIT
URL: https://github.com/cockpit-project/cockpit-machines URL: https://github.com/cockpit-project/cockpit-machines
# source_validator insists that if obscpio has no version then
# tarball must neither
Source: https://github.com/cockpit-project/cockpit-machines/archive/refs/tags/%{version}.tar.gz#/cockpit-machines-%{version}.tar.gz Source: https://github.com/cockpit-project/cockpit-machines/archive/refs/tags/%{version}.tar.gz#/cockpit-machines-%{version}.tar.gz
Source10: package-lock.json Source10: package-lock.json
Source11: node_modules.spec.inc Source11: node_modules.spec.inc

58
update_version.sh Normal file
View File

@ -0,0 +1,58 @@
#!/usr/bin/bash
set -e
curVersion=$(grep Version: cockpit-machines.spec | sed -e 's,^\(\s*Version:\s*\)\(.*\)\s*$,\2,')
if [[ ! "$curVersion" =~ ^[0-9]+$ ]]; then
echo "Error: curVersion is not a valid integer"
exit 1
fi
###
### Fetch latest soruces
###
GWD="-C cockpit-machines"
# fetch latest cockpit-machines
if [ ! -d cockpit-machines ]; then
git clone https://github.com/cockpit-project/cockpit-machines cockpit-machines
else
git $GWD checkout main
git $GWD fetch
fi
newVersion=$(git $GWD tag | grep '^[0-9.]\+$' | sort -rn | head -1)
echo "Current version: $curVersion"
echo " New version: $newVersion"
if [[ ! "$newVersion" =~ ^[0-9]+$ ]]; then
echo "Error: newVersion cannot be determined"
exit 1
fi
if [ "$curVersion" -ge "$newVersion" ]; then
echo "Nothing to do."
exit 0
fi
###
### UPDATE
###
# # initialize all submodules
git $GWD checkout --quiet $newVersion
git $GWD submodule update --init --depth 1
diff cockpit-machines/node_modules/.package.json cockpit-machines/package.json
cp cockpit-machines/node_modules/.package-lock.json package-lock.json
# update node_modules
curl -Lo cockpit-machines-$newVersion.tar.gz https://github.com/cockpit-project/cockpit-machines/archive/refs/tags/$newVersion.tar.gz
# Updating version in spec file
sed -i -e "s,^\(\s*Version:\s*\)\(.*\)\s*$,\1${newVersion}," cockpit-machines.spec
# update modules
osc service mr