From f73742b6a4b4dcef1fb63f43c96b9cf961f4ee68 Mon Sep 17 00:00:00 2001 From: ed Date: Fri, 17 Oct 2025 21:59:37 +0000 Subject: [PATCH] release-automation --- scripts/docker/make.sh | 2 +- scripts/genhelp.sh | 44 +++++++++++++++++++++++++++++++++++ scripts/help2html.py | 10 ++++++-- scripts/help2txt.sh | 2 +- scripts/rls.sh | 53 +++++++++++++++++++++++++++++++----------- 5 files changed, 94 insertions(+), 17 deletions(-) create mode 100755 scripts/genhelp.sh diff --git a/scripts/docker/make.sh b/scripts/docker/make.sh index a6ff45e9..2c752cdf 100755 --- a/scripts/docker/make.sh +++ b/scripts/docker/make.sh @@ -48,7 +48,7 @@ done filt= [ $clean ] && filt='//{print$$3}' -[ $hclean ] && filt='/localhost\/copyparty-|^.*localhost\/alpine-/{print$3}' +[ $hclean ] && filt='/localhost\/(copyparty|alpine)-/{print$3}' [ $purge ] && filt='NR>1{print$3}' [ $filt ] && { [ $purge ] && { diff --git a/scripts/genhelp.sh b/scripts/genhelp.sh new file mode 100755 index 00000000..0ecb6603 --- /dev/null +++ b/scripts/genhelp.sh @@ -0,0 +1,44 @@ +#!/bin/bash +set -e + +[ -e make-sfx.sh ] || cd scripts +[ -e make-sfx.sh ] && [ -e deps-docker ] || { + echo cd into the scripts folder first + exit 1 +} + +cd ../dist + +kwds='-bind -accounts -auth -auth-ord -flags -handlers -hooks -idp -urlform -exp -ls -dbd -chmod -pwhash -zm' + +html() { + for a in '' $kwds; do + echo "html$a" >&2 + COLUMNS=140 ./copyparty-sfx.py --ansi --help$a 2>/dev/null + printf '\n\n\n%0139d\n\n' + done | aha -b --no-xml | sed -r ' + s/color:black/color:#222/g; + s/color:dimgray\b/color:#606060/g; + s/color:red\b/color:#c75b79/g; + s/color:lime\b/color:#b8e346/g; + s/color:yellow\b/color:#ffa402/g; + s/color:#3333[Ff]{2}\b/color:#02a2ff/g; + s/color:fuchsia\b/color:#f65be3/g; + s/color:aqua\b/color:#3da698/g; + s/color:white\b/color:#fff/g; + s/style="filter:[^;]+/style="/g; + ' | + HLPTXT=CAT python3 ../scripts/help2html.py +} + +txt() { + (for a in '' $kwds; do + echo "txt$a" >&2 + COLUMNS=9001 ./copyparty-sfx.py --help$a 2>/dev/null + printf '\n\n\n%0255d\n\n\n' + done;printf '\n\n\n') | + HLPTXT=CAT ../scripts/help2txt.sh +} + +html +txt diff --git a/scripts/help2html.py b/scripts/help2html.py index 4803632b..f39332ed 100755 --- a/scripts/help2html.py +++ b/scripts/help2html.py @@ -1,5 +1,6 @@ #!/usr/bin/env python3 +import os import re import socket import subprocess as sp @@ -21,6 +22,9 @@ def readclip(): "xclip -selection CLIPBOARD -o", "pbpaste", ] + if os.getenv("HLPTXT") == "CAT": + cmds = ["cat"] + for cmd in cmds: try: return sp.check_output(cmd.split()).decode("utf-8") @@ -44,7 +48,7 @@ def cnv(src): while True: ln = next(src) - if ""): ln = "
" + ln
             yield ln
@@ -53,12 +57,14 @@ def cnv(src):
     for ln in src:
         ln = ln.rstrip()
         t = ln
-        if re.search(r"^]+>copyparty v[0-9]", ln):
+        if re.search(r"^<(font|span)[^>]+>copyparty v[0-9]", ln):
             in_sfx = 3
         if in_sfx:
             in_sfx -= 1
             if not skip_sfx:
                 yield ln
+            elif not in_sfx:
+                yield ""
             continue
         if '">uuid:' in ln:
             ln = re.sub(r">uuid:[0-9a-f-]{36}<", ">autogenerated<", ln)
diff --git a/scripts/help2txt.sh b/scripts/help2txt.sh
index a046bda3..ec10b29d 100755
--- a/scripts/help2txt.sh
+++ b/scripts/help2txt.sh
@@ -1,7 +1,7 @@
 #!/bin/bash
 set -e
 
-( xsel -ob | sed -r '
+( ( HLPTXT=CAT && cat || xsel -ob ) | sed -r '
 s`/home/ed/`~/`;
 s/uuid:[0-9a-f-]{36}/autogenerated/;
 s/(-salt SALT.*default: )[0-9a-zA-Z/+]{24}\)/\124-character-autogenerated)/;
diff --git a/scripts/rls.sh b/scripts/rls.sh
index d18f12f2..594753b2 100755
--- a/scripts/rls.sh
+++ b/scripts/rls.sh
@@ -1,9 +1,13 @@
 #!/bin/bash
 set -e
 
-# if specified, keep the following sfx flags last: gz gzz fast
-
-parallel=1
+# usage: ./scripts/rls.sh 1.9.11 gzz 50  # create full release
+# usage: ./scripts/rls.sh sfx gzz 10     # just create sfx.py + en.py + helptext
+#
+# if specified, keep the following sfx-args last:  gz gzz xz nopk udep fast
+#
+# WARNING: when creating full release, will DELETE all of ../dist/,
+#   and all docker-images matching 'localhost/(copyparty|alpine)-'
 
 [ -e make-sfx.sh ] || cd scripts
 [ -e make-sfx.sh ] && [ -e deps-docker ] || {
@@ -11,26 +15,24 @@ parallel=1
     exit 1
 }
 
-v=$1
+v=$1; shift
+[ "$v" = sfx ] &&
+    rls= || rls=1
 
-[ "$v" = sfx ] || {
+[ $rls ] && {
     printf '%s\n' "$v" | grep -qE '^[0-9\.]+$' || exit 1
     grep -E "(${v//./, })" ../copyparty/__version__.py || exit 1
 
-    git push all
+    ./make-sfx.sh nopk gz
+    ../dist/copyparty-sfx.py --version >/dev/null
+
     git tag v$v
-    git push all --tags
-
     rm -rf ../dist
-
     ./make-pypi-release.sh u
-    (cd .. && python3 ./setup.py clean2)
-
     ./make-tgz-release.sh $v
 }
 
-rm -f ../dist/copyparty-sfx*
-shift
+rm -rf /tmp/pe-copyparty* ../sfx ../dist/copyparty-sfx*
 ./make-sfx.sh "$@"
 ../dist/copyparty-sfx.py --version >/dev/null
 mv ../dist/copyparty-{sfx,int}.py
@@ -38,6 +40,9 @@ mv ../dist/copyparty-{sfx,int}.py
 while [ "$1" ]; do
     case "$1" in
         gz*) break;;
+        xz) break;;
+        nopk) break;;
+        udep) break;;
         fast) break;;
     esac
     shift
@@ -49,4 +54,26 @@ done
 mv ../dist/copyparty-{sfx,en}.py
 mv ../dist/copyparty-{int,sfx}.py
 
+./genhelp.sh
+
+[ $rls ] || exit  # ----------------------------------------------------
+
+./prep.sh
+git add ../contrib/package/arch/PKGBUILD ../contrib/package/makedeb-mpr/PKGBUILD ../contrib/package/nix/copyparty/pin.json
+git commit -m "update pkgs to $v"
+git log | head
+
+( cd docker
+    #./make.sh purge
+    ./make.sh hclean
+    ./make.sh hclean
+    ./make.sh hclean pull img push
+)
+
+git push
+git push --all
+git push --tags
+git push all
+git push all --all
+git push all --tags
 # git tag -d v$v; git push --delete origin v$v