Skip to content
This repository was archived by the owner on Feb 1, 2023. It is now read-only.

Commit 31ec400

Browse files
author
Release Manager
committed
Trac #31114: Add one file build/pkgs/*/repology.txt per spkg
We add a files `repology.txt` for each "SPKG" with its name or names on [https://repology.org repology.org]. This can save time when - adding package information for an already supported or new distro - checking for new versions of packages We make `./sage -info packagename` print out the resulting links to repology. Thus they are also formatted as part of the SPKG documentation that goes into the reference manual (#29655). URL: https://trac.sagemath.org/31114 Reported by: slelievre Ticket author(s): Samuel Lelièvre, Matthias Koeppe Reviewer(s): Matthias Koeppe, Dima Pasechnik
2 parents 5ba3c41 + c590a13 commit 31ec400

File tree

276 files changed

+425
-29
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

276 files changed

+425
-29
lines changed

build/bin/sage-print-system-package-command

Lines changed: 55 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,11 @@ shift
55
IF_VERBOSE=:
66
SUDO=
77
PROMPT=
8-
COMMENT="# "
8+
if [ -n "$OUTPUT_RST" ]; then
9+
COMMENT=""
10+
else
11+
COMMENT="# "
12+
fi
913
while :
1014
do
1115
case "$1" in
@@ -51,6 +55,25 @@ system_packages="$*"
5155
options=
5256
env=
5357
shopt -s extglob
58+
59+
function print_shell_command()
60+
{
61+
if [ -n "$OUTPUT_RST" ]; then
62+
echo
63+
echo ".. CODE-BLOCK:: bash"
64+
echo
65+
fi
66+
echo "${PROMPT}$1"
67+
if [ -n "$OUTPUT_RST" ]; then
68+
echo
69+
fi
70+
}
71+
72+
function print_comment()
73+
{
74+
echo "${COMMENT}$1"
75+
}
76+
5477
case $system:$command in
5578
homebrew*:setup-build-env)
5679
$IF_VERBOSE echo "${COMMENT}"
@@ -70,66 +93,79 @@ case $system:$command in
7093
# Verbs handled above are our own inventions. Verbs handled below are apt-get verbs.
7194
#
7295
@(debian*|ubuntu*):update)
73-
echo "${PROMPT}${SUDO}apt-get $command $system_packages"
96+
print_shell_command "${SUDO}apt-get $command $system_packages"
7497
;;
7598
@(debian*|ubuntu*):*)
7699
[ "$NO_INSTALL_RECOMMENDS" = yes ] && options="$options --no-install-recommends"
77100
[ "$YES" = yes ] && options="$options --yes" env="DEBIAN_FRONTEND=noninteractive "
78-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}${env}apt-get $command $options $system_packages"
101+
[ -n "$system_packages" ] && print_shell_command "${SUDO}${env}apt-get $command $options $system_packages"
79102
;;
80103
@(fedora*|redhat*|centos*):install)
81104
[ "$YES" = yes ] && options="$options -y"
82-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}yum install $options $system_packages"
105+
[ -n "$system_packages" ] && print_shell_command "${SUDO}yum install $options $system_packages"
83106
;;
84107
gentoo*:install)
85-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}emerge $system_packages"
108+
[ -n "$system_packages" ] && print_shell_command "${SUDO}emerge $system_packages"
86109
;;
87110
arch*:update)
88-
echo "${PROMPT}${SUDO}pacman -Sy"
111+
print_shell_command "${SUDO}pacman -Sy"
89112
;;
90113
arch*:install)
91114
[ "$YES" = yes ] && options="$options --noconfirm"
92-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}pacman -S $options $system_packages"
115+
[ -n "$system_packages" ] && print_shell_command "${SUDO}pacman -S $options $system_packages"
93116
;;
94117
void*:update)
95-
echo "${PROMPT}${SUDO}xbps-install -Su"
118+
print_shell_command "${SUDO}xbps-install -Su"
96119
;;
97120
void*:install)
98121
[ "$YES" = yes ] && options="$options --yes"
99-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}xbps-install $options $system_packages"
122+
[ -n "$system_packages" ] && print_shell_command "${SUDO}xbps-install $options $system_packages"
100123
;;
101124
opensuse*:install)
102-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}zypper install $system_packages"
125+
[ -n "$system_packages" ] && print_shell_command "${SUDO}zypper install $system_packages"
103126
;;
104127
*conda*:install)
105128
[ "$YES" = yes ] && options="$options --yes"
106-
[ -n "$system_packages" ] && echo "${PROMPT}conda install $system_packages"
129+
[ -n "$system_packages" ] && print_shell_command "conda install $system_packages"
107130
;;
108131
homebrew*:install)
109-
[ -n "$system_packages" ] && echo "${PROMPT}brew install $system_packages"
132+
[ -n "$system_packages" ] && print_shell_command "brew install $system_packages"
110133
;;
111134
slackware*:install)
112-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}slackpkg install $system_packages"
135+
[ -n "$system_packages" ] && print_shell_command "${SUDO}slackpkg install $system_packages"
113136
;;
114137
cygwin*:update)
115-
echo "# first install apt-cyg from https://github.com/transcode-open/apt-cyg"
138+
print_commment "first install apt-cyg from https://github.com/transcode-open/apt-cyg"
116139
;;
117140
cygwin*:install)
118-
[ -n "$system_packages" ] && echo "${PROMPT}apt-cyg install $system_packages"
141+
[ -n "$system_packages" ] && print_shell_command "apt-cyg install $system_packages"
119142
;;
120143
freebsd*:install)
121-
[ -n "$system_packages" ] && echo "${PROMPT}${SUDO}pkg install $system_packages"
144+
[ -n "$system_packages" ] && print_shell_command "${SUDO}pkg install $system_packages"
122145
;;
123146
nix*:install)
124-
[ -n "$system_packages" ] && echo "${PROMPT}nix-env --install $system_packages"
147+
[ -n "$system_packages" ] && print_shell_command "nix-env --install $system_packages"
125148
;;
126149
pip:install)
127-
[ -n "$system_packages" ] && echo "${PROMPT}sage -pip install $system_packages"
150+
[ -n "$system_packages" ] && print_shell_command "sage -pip install $system_packages"
151+
;;
152+
repology:install)
153+
if [ -n "$system_packages" ]; then
154+
links=""
155+
for pkg in $system_packages; do
156+
link="https://repology.org/project/$pkg/versions"
157+
if [ -n "$links" ]; then
158+
links="$links, "
159+
fi
160+
links="$links$link"
161+
done
162+
print_comment "See ${links}"
163+
fi
128164
;;
129165
*:update)
130166
# Nothing needed
131167
;;
132168
*)
133-
echo "# $command the following packages: $system_packages"
169+
print_comment "$command the following packages: $system_packages"
134170
;;
135171
esac

build/bin/sage-spkg-info

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -38,9 +38,25 @@ echo "Equivalent System Packages"
3838
echo "--------------------------"
3939
echo
4040
PKG_DISTROS="$PKG_SCRIPTS"/distros
41+
systems=""
42+
have_repology=no
4143
for system_package_file in "$PKG_DISTROS"/*.txt; do
44+
system=$(basename "$system_package_file" .txt)
4245
if [ -f "$system_package_file" ]; then
43-
system=$(basename "$system_package_file" .txt)
46+
case "$system" in
47+
repology)
48+
have_repology=yes
49+
;;
50+
*)
51+
systems="$systems $system"
52+
;;
53+
esac
54+
fi
55+
done
56+
if [ $have_repology = yes ]; then
57+
systems="$systems repology"
58+
fi
59+
for system in $systems; do
4460
system_packages="$(echo $(sed 's/#.*//;' $system_package_file))"
4561
case $system in
4662
debian)
@@ -51,20 +67,13 @@ for system_package_file in "$PKG_DISTROS"/*.txt; do
5167
# Generic
5268
echo "Fedora/Redhat/CentOS:"
5369
;;
70+
repology)
71+
;;
5472
*)
5573
echo "$system:"
5674
;;
5775
esac
58-
if [ -n "$OUTPUT_RST" ]; then
59-
echo
60-
echo ".. CODE-BLOCK:: bash"
61-
echo
62-
fi
6376
sage-print-system-package-command $system --prompt=' $ ' --sudo install $system_packages
64-
if [ -n "$OUTPUT_RST" ]; then
65-
echo
66-
fi
67-
fi
6877
done
6978
if [ -z "$system" ]; then
7079
echo "(none known)"
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
4ti2
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
alabaster
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
arb-fp
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python:attrs
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python:babel
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python:backcall
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
barvinok
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
python:beautifulsoup4

0 commit comments

Comments
 (0)