blob: 80cce410b103e3937b8847d0bdf3007ad3b34e77 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
|
#!/bin/sh
# Abbreviate according to
# https://en.opensuse.org/openSUSE:Packaging_Patches_guidelines#Current_set_of_abbreviations
set -eu
if [ $# -le 1 ] ; then
STR="$(cat)"
else
STR="$1"
fi
# Conditional branching with exit status ... I am not sure what do I need it for.
# So for example
#
# $ echo "foo.bar" | sed 's/bar.*$//; t; q42' ; echo $?
# foo.
# 0
#
# whereas
#
# $ echo "foo.bar" | sed 's/baz.*$//; t; q42' ; echo $?
# foo.bar
# 42
STR="$(echo "$STR" | sed -E -e 's@https?://github.com/(.*)/issues/([0-9]+)@gh#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://github.com/(.*)/pull/([0-9]+)@gh#\1!\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://github.com/(.*)/discussions/([0-9]+)@gh#\1!\2@')"
# TODO STR=STR:gsub("https?://github.com/(.*)/commit/(%w+)", function (r, i)
# return "gh#" .. r .. "@" .. i:sub(1, 12)
# end)
STR="$(echo "$STR" | sed -E -e 's!https?://github.com/(.*)/commit/([a-zA-Z0-9]+)!gh#\1#\2!')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.com/(.*)/issues/([0-9]+)@gl#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.com/(.*)/pull/([0-9]+)@gl#\1!\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.com/(.*)/-/issues/([0-9]+)@gl#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.com/(.*)/-/pull/([0-9]+)@gl#\1!\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.com/(.*)/-/merge-requests/([0-9]+)@gl#\1!\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sourceforge.net/support/tracker.php\?aid=([0-9]+)@sh#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sf.net/support/tracker.php\?aid=([0-9]+)@sh#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sourceforge.net/p/(.*)/patches/([0-9]+)/@shp#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sourceforge.net/p/(.*)/bugs/([0-9]+)/@shb#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sourceforge.net/p/(.*)/tickets/([0-9]+)/@sht#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sf.net/support/p/(.*)/patches/([0-9]+)/@shp#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sf.net/support/p/(.*)/bugs/([0-9]+)/@shb#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://sf.net/support/p/(.*)/tickets/([0-9]+)/@sht#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bitbucket.org/(.*)/issues/([0-9]+)/@bt#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://build.suse.de/request/show/([0-9]+)@ssr#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://build.opensuse.org/request/show/([0-9]+)@sr#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.opensuse.org/show_bug.cgi\?id=([0-9]+)@boo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.opensuse.org/([0-9]+)@boo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.suse.com/show_bug.cgi\?id=([0-9]+)@bsc#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.suse.com/([0-9]+)@bsc#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.redhat.com/show_bug.cgi\?id=([0-9]+)@rh#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.redhat.com/([0-9]+)@rh#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.mozilla.org/show_bug.cgi\?id=([0-9]+)@bmo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugzilla.mozilla.org/([0-9]+)@bmo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.documentfoundation.org/show_bug.cgi\?id=([0-9]+)@tdf#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.documentfoundation.org/([0-9]+)@tdf#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://jira.suse.com/browse/([a-zA-Z]+)@jsc#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.python.org/issue([0-9]+)@bpo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.launchpad.net/.+/\+bug/([0-9]+)@lp#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://www.python.org/dev/peps/pep-([0-9]+)/?@pep#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://svn.boost.org/trac/boost/([0-9]+)@boost#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://rt.cpan.org/Public/([0-9]+)@RT#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.debian.org/([0-9]+)@deb#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.freedesktop.org/([0-9]+)@fdo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.freedesktop.org/([a-zA-Z]+)/issues/([0-9]+)@glfo#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gcc.gnu.org/bugzilla/([0-9]+)@gcc#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://gitlab.gnome.org/([a-zA-Z]+)/issues/([0-9]+)@glgo#\1#\2@')"
STR="$(echo "$STR" | sed -E -e 's@https?://bugs.kde.org/([0-9]+)@kde#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://api.github.com/repos/openSUSE/open-build-service/issues/([0-9]+)@obs#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://api.github.com/repos/openSUSE/obs-build/issues/([0-9]+)@build#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://api.github.com/repos/openSUSE/osc/issues/([0-9]+)@osc#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://progress.opensuse.org/issues/([0-9]+)@poo#\1@')"
STR="$(echo "$STR" | sed -E -e 's@https?://developerbugs.linux-foundation.org/([0-9]+)@lf#\1@')"
echo "$STR"
|