This commit is contained in:
Ludwig Nussel 2023-03-02 13:43:35 +01:00
parent bc02fc7b38
commit a3ff31cd06
3 changed files with 16 additions and 8 deletions

View File

@ -28,5 +28,5 @@ BASE_BRANCH="main"
# optional: fixed date or a filename prefixed with @ to get a stable date for testing # optional: fixed date or a filename prefixed with @ to get a stable date for testing
DATE="@token" DATE="@token"
# optional: an OBS project with a list of packages # optional: an OBS project with a list of packages
RING0API="https://api.opensuse.org/public/source/openSUSE:Factory:Rings:0-Bootstrap" OBSPKGLIST="https://api.opensuse.org/public/source/openSUSE:Factory:Rings:0-Bootstrap"
``` ```

1
pusher
View File

@ -108,6 +108,7 @@ log_info "to push: ${!pq[*]}"
log_info "remote: ${!rq[*]}" log_info "remote: ${!rq[*]}"
if [ -n "$show_status" ]; then if [ -n "$show_status" ]; then
echo "# local remote pr package"
if [ "${#modules[@]}" -eq 0 ]; then if [ "${#modules[@]}" -eq 0 ]; then
for m in "${!pq[@]}" "${!rq[@]}" "${!pr[@]}"; do for m in "${!pq[@]}" "${!rq[@]}" "${!pr[@]}"; do
modules["$m"]=1 modules["$m"]=1

View File

@ -8,7 +8,7 @@ BASE_BRANCH="main"
PACKAGE_BASE_URL= PACKAGE_BASE_URL=
PACKAGE_RELATIVE_URL="../../rpm" PACKAGE_RELATIVE_URL="../../rpm"
# https://api.opensuse.org/public/source/openSUSE:Factory:Rings:0-Bootstrap # https://api.opensuse.org/public/source/openSUSE:Factory:Rings:0-Bootstrap
RING0API= OBSPKGLIST=
DATE="$(date "+%s %z")" DATE="$(date "+%s %z")"
keep["dummy-release"]=1 keep["dummy-release"]=1
@ -22,7 +22,7 @@ cfg_file=
# constant needed to aid quoting # constant needed to aid quoting
nl=$'\n' nl=$'\n'
declare -A ring0 declare -A obs
declare -A new declare -A new
declare -A drop declare -A drop
declare -A revs declare -A revs
@ -135,14 +135,14 @@ while read -r m t cid p; do
revs["$p"]="$cid" revs["$p"]="$cid"
done < <(git cat-file -p "$REMOTE/$BASE_BRANCH^{tree}") done < <(git cat-file -p "$REMOTE/$BASE_BRANCH^{tree}")
if [ -n "$RING0API" ]; then if [ -n "$OBSPKGLIST" ]; then
while read -r p; do while read -r p; do
ring0["$p"]=1 obs["$p"]=1
[ -n "${revs[$p]}" ] || new["$p"]=1 [ -n "${revs[$p]}" ] || new["$p"]=1
done < <(curl -s -f "$RING0API"|sed -ne 's/.*entry name="\([^":]*\).*\/>/\1/p'|sort -u | grep -v AGGR) done < <(curl -s -f "$OBSPKGLIST"|sed -ne 's/.*entry name="\([^":]*\).*\/>/\1/p'|sort -u | grep -v AGGR)
for m in "${!revs[@]}"; do for m in "${!revs[@]}"; do
[ -n "${ring0[$m]}" -o -n "${keep[$m]}" ] || drop["$m"]=1 [ -n "${obs[$m]}" -o -n "${keep[$m]}" ] || drop["$m"]=1
done done
fi fi
@ -212,6 +212,7 @@ for m in "${modules[@]}"; do
gitmodules_rev="$nh" gitmodules_rev="$nh"
fi fi
treetext="$newtreetext" treetext="$newtreetext"
# fall through
else else
newtree=$(echo "$newtreetext" | git mktree) newtree=$(echo "$newtreetext" | git mktree)
msg="Update $m" msg="Update $m"
@ -220,8 +221,11 @@ for m in "${modules[@]}"; do
newcid="$(git commit-tree -p "$REMOTE/$BASE_BRANCH" -m "$msg" "$newtree")" newcid="$(git commit-tree -p "$REMOTE/$BASE_BRANCH" -m "$msg" "$newtree")"
commits["$m"]="$newcid" commits["$m"]="$newcid"
cat "$tmpfile2" > "$tmpfile" cat "$tmpfile2" > "$tmpfile"
continue
fi fi
elif [ -n "${pq[refs/pq/$m]}" ]; then # fall through
fi
if [ -n "${pq[refs/pq/$m]}" ]; then
log_info "remove pq for $m" log_info "remove pq for $m"
git update-ref -d "refs/pq/$m" git update-ref -d "refs/pq/$m"
fi fi
@ -231,6 +235,9 @@ if [ "$single" = 1 ]; then
newtree="$(echo "$treetext" | git mktree)" newtree="$(echo "$treetext" | git mktree)"
newcid="$(git commit-tree -p "$REMOTE/$BASE_BRANCH" -m "Update all" "$newtree")" newcid="$(git commit-tree -p "$REMOTE/$BASE_BRANCH" -m "Update all" "$newtree")"
commits["all"]="$newcid" commits["all"]="$newcid"
elif [ -n "${pq[refs/pq/all]}" ]; then
log_info "remove pq for single commit"
git update-ref -d "refs/pq/all"
fi fi
for m in "${!commits[@]}"; do for m in "${!commits[@]}"; do