Files
dramforever 90bd2ffbb4 scripts/update-package: Push .changes file to track commit
Push a .changes file to track the commit and directory used, which
should end up showing up in the RPM changelog.

Signed-off-by: Vivian Wang <wangruikang@iscas.ac.cn>
2026-05-21 11:03:33 +08:00

63 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# set -x
export REPO=openruyi
export OSC="$DRYRUN osc"
export BEFORE_COMMIT=$1
export AFTER_COMMIT=$2
export DATE="$(LC_ALL=en_US.UTF-8 date --utc '+%a %b %_d %T %Z %Y')"
for P in $(git diff --no-renames --max-depth=1 --name-only $BEFORE_COMMIT..$AFTER_COMMIT --diff-filter=AM -- SPECS/)
do
PKG=$(basename $P)
echo "do Add/Modify type change $P $PKG"
$OSC api -X PUT /source/$REPO/$PKG/_meta -d "<?xml version=\"1.0\" encoding=\"UTF-8\"?>
<package name=\"$PKG\" project=\"$REPO\">
<title/>
<description/>
</package>
"
$OSC api -X PUT /source/$REPO/$PKG/$PKG.changes -d \
"----------------------------------------
$DATE - openRuyi <update-package-v1@noreply.openruyi.cn>
Automatic update from Git repository
See changes at https://github.com/openRuyi-Project/openRuyi/commits/$AFTER_COMMIT/$P
[metadata]
version=1
commit=$AFTER_COMMIT
subdir=$P
"
$OSC api -X PUT /source/$REPO/$PKG/_service -d \
"<services>
<service name=\"obs_scm\" mode=\"trylocal\">
<param name=\"scm\">git</param>
<param name=\"url\">https://github.com/openRuyi-project/openruyi/</param>
<param name=\"revision\">$AFTER_COMMIT</param>
<param name=\"exclude\">*</param>
<param name=\"extract\">$P/*</param>
</service>
<service name=\"download_assets\" mode=\"trylocal\"></service>
</services>
"
done
for P in $(git diff --no-renames --max-depth=1 --name-only $BEFORE_COMMIT..$AFTER_COMMIT --diff-filter=D -- SPECS/)
do
PKG=$(basename $P)
echo "do Delete type change $P $PKG"
echo "<package name=\"$PKG\" project=\"$REPO\">
<title/>
<description/>
<build>
<disable/>
</build>
<publish>
<disable/>
</publish>
<useforbuild>
<disable/>
</useforbuild>
</package>" | $OSC meta pkg $REPO $PKG -F -
done