Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions AGENTS.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,12 @@ GitHub Pages (Jekyll) from this repository.
or a name with capitals with `Terminal=true`: all-lowercase names are typically
command line tools; the publish workflow only shows a note that
`check-name.sh --note-text` generates exactly;
an existing entry whose name differs only in capitalization (`Shift` and `shift`) is
compared by the first lines of the two files: the same download location (or a
repository that was renamed) is an error (a second entry for the same application);
the same owner (GitHub user or organization, forge project, domain) is a warning;
another owner is not mentioned (another application with a similar name); when
only a name is checked (discovery) it stays an error;
- `code/check-name.sh` also rejects the word "App" in a name (`Foo-App`, `foo_app`,
`App_Outlet`: a token between `-`, `_`, `.` or blanks; not `WhatsApp`, `Apple`), an
error for files a PR adds and a warning for the 32 old ones, and `code/pick-name.sh`
Expand Down
38 changes: 37 additions & 1 deletion code/check-name.sh
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,43 @@ if [ -z "$DESKTOP" ] ; then
for OTHER in "$DATADIR"/* ; do
OTHER=$(basename "$OTHER")
if [ "$OTHER" != "$NAME" ] && [ "$(echo "$OTHER" | tr 'A-Z' 'a-z')" == "$LOWER" ] ; then
problem "an entry with the same name in different capitalization exists already: data/$OTHER; please change that file instead"
SAME=unknown
# Is the entry that differs only in capitalization the same application? Compare
# where the two entries get the AppImage from (the first line of the files), if
# both files are there (not when a name is only proposed, e.g., by the discovery)
if [ -r "$DATADIR/$NAME" ] && [ -r "$DATADIR/$OTHER" ] ; then
MINE=$(head -n 1 "$DATADIR/$NAME" | tr -d '\r' | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')
THEIRS=$(head -n 1 "$DATADIR/$OTHER" | tr -d '\r' | sed -E 's/^[[:space:]]+//; s/[[:space:]]+$//')
# Repository (or download location) without the channel, host in lower case
loc() { echo "$1" | sed -E 's/#.*//; s/[?].*//; s|^[a-zA-Z]+://||; s|^www[.]||; s|/+$||; s|[.]git$||' | tr 'A-Z' 'a-z' ; }
chan() { case "$1" in *"#"*) echo "${1#*#}" | tr 'A-Z' 'a-z' ;; esac ; }
if [ -z "$MINE" ] || [ -z "$THEIRS" ] ; then
SAME=unknown
elif [ "$(loc "$MINE")" == "$(loc "$THEIRS")" ] && [ "$(chan "$MINE")" == "$(chan "$THEIRS")" ] ; then
SAME=same # the same download location
else
timeout 60 bash "$(dirname "$0")/check-origin.sh" "$THEIRS" "$MINE" >/dev/null 2>&1
case $? in
0) SAME=owner ;; # the same GitHub user or organization, forge project or domain
2) SAME=same ;; # the repository was renamed or moved: the same project
1) SAME=different ;; # another owner: a different application with a similar name
*) SAME=unknown ;;
esac
fi
fi
case "$SAME" in
same) problem "this is the same application as the entry data/$OTHER (the same download location): please change that file instead of adding a second entry whose name differs only in capitalization" ;;
owner) remark "data/$OTHER has the same name in different capitalization and comes from the same owner. If it is the same application, please change that file instead of adding a second entry; if it is another one, this is fine, although file systems that ignore case (macOS, Windows) cannot hold both files in a clone of this repository" ;;
different) ;; # another owner: another application that happens to have a similar name
*)
if [ -r "$DATADIR/$NAME" ] ; then
remark "an entry with the same name in different capitalization exists already: data/$OTHER. If it is the same application, please change that file instead of adding a second entry; if not, this is fine, although file systems that ignore case (macOS, Windows) cannot hold both files in a clone of this repository"
else
# only a name is checked (e.g., one that the discovery proposes): it cannot be told
# whether it is the same application, so do not propose it
problem "an entry with the same name in different capitalization exists already: data/$OTHER; please change that file instead"
fi ;;
esac
break
fi
done
Expand Down