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
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
|
#!/bin/bash
set -u
# 20260714 bkw: Populate the boneyard.
# local paths
OUTDIR=~/boneyard
STATEDIR=~/boneyard-state
TREE=$STATEDIR/slackbuilds
OUTFILE=$OUTDIR/index.html
# git stuff
CLONEURL=git://git.slackbuilds.org/slackbuilds.git
# this is the first commit of the 15.0 series:
START_COMMIT=15.0-20220311.1
SLACKVER="$( echo $START_COMMIT | cut -d- -f1 )"
# sshfs URL for web server
SSHFS_REMOTE=sluk:/home/urchlay/public_html/html/boneyard/
# local sshfs mountpoint
SSHFS_MNTPNT=/home/urchlay/boneyard-remote
# during script development/testing, set this to make
# test runs faster (but very incomplete of course):
#DEBUG_LIMIT="-n 10"
# for production, set this:
DEBUG_LIMIT=""
# global variables:
catprg="" # e.g. "system/someapp"
categ="" # e.g. "system"
prg="" # e.g. "someapp"
tarball=""
gitlog=""
rm_log=""
last_log=""
tarcommit=""
descfile=""
desc=""
logfile=""
# sets global variables. sorry, purists.
get_log_lines() {
catprg="$@"
prg="$( basename $catprg )"
categ="$( dirname $catprg )"
tarball=$OUTDIR/$prg.tar.gz
logfile=$STATEDIR/$categ-$prg.log
if [ ! -e "$logfile" ]; then
git log -n2 --date=format:%Y-%m-%d --pretty=format:"%h%x09%ad%x09%s" -- "$catprg/$prg.SlackBuild" > $logfile
fi
gitlog="$( cat $logfile )"
rm_log="$( echo "$gitlog" | head -n 1 )"
last_log="$( echo "$gitlog" | tail -n 1 )"
tarcommit="$( echo $last_log | cut -d' ' -f1 )"
descfile=$STATEDIR/$categ-$prg.desc
echo " $catprg last commit before removal: $tarcommit"
}
mktarball() {
if [ -e "$tarball" -a -e "$descfile" ]; then
echo " - tarball and .desc already exist"
desc="$( cat $descfile )"
else
new_tarballs+="$tarball "
git checkout $tarcommit
( cd $categ ; tar cvfz $tarball $prg )
desc="$( grep "^$prg: " $catprg/slack-desc | head -n 1 | cut -d: -f2 )"
echo "$desc" > "$descfile"
git checkout master
fi
}
p() {
echo "<p />" >> $OUTFILE.new
}
br() {
echo "<br />" >> $OUTFILE.new
}
htmlprint() {
echo "$@" | sed -e 's,<,%lt,g' -e 's,>,>,g' >> $OUTFILE.new
}
print_report_line() {
local tarfile="$( basename $tarball )"
size="$( stat -c '%s' $tarball )"
if [ "$size" -ge 1024 ]; then
size="$(( size / 1024 ))K"
fi
echo "<a href=\"$tarfile\">$catprg</a> $size" >> $OUTFILE.new
br
htmlprint "$desc" ; br
htmlprint "$rm_log" ; br
htmlprint "$last_log" ; br
p
}
get_all_removed() {
git log $DEBUG_LIMIT --pretty=oneline --grep="Removed" $START_COMMIT.. | \
cut -d' ' -f2 | cut -d: -f1 | sort
}
# main()
mkdir -p $OUTDIR $STATEDIR
if [ -d "$TREE" ]; then
cd $TREE
git checkout master
git pull
else
rm -rf $TREE
git clone $CLONEURL $TREE
cd $TREE
fi
removed=$( get_all_removed )
total=$( echo $removed | wc -w )
skipped=0
cat <<EOF >$OUTFILE.new
<html><head><title>SlackBuilds.org Removed Builds</title></head>
<!-- start of run: $( date ) -->
<body>
These are all the builds that have been removed from SlackBuilds.org
since the $SLACKVER repository was started (git tag $START_COMMIT).
<p />
Note that this is purely a personal project of B. Watson
<a href="mailto:urchlay@slackware.uk"><urchlay@slackware.uk></a>.
It is NOT part of the SlackBuilds.org project or website.
<p />
To search for a build, use your browser's "Search within page" feature
(commonly control-F or F3).
<p />
Some of these builds were removed because they were broken or
nonfunctional (e.g. a client for a service that no longer exists). Others
were removed because they no longer had a maintainer, and got outdated.
If you find anything here that's useful, you can submit it to
SBo under your own name, after fixing any problems with it and/or
version-updating it.
<p />
EOF
count=0
for i in $removed; do
: $(( count ++ ))
echo $count/$total: $i
get_log_lines $i
if [ -d "$catprg" ]; then
# If the dir exists, the build got re-added, skip it
: $(( skipped ++ ))
echo " -> skipped because $catprg exists"
continue
fi
mktarball
print_report_line
done
cat <<EOF >>$OUTFILE.new
<p />
Boneyard populated $( date ) with $(( total - skipped )) builds.
</body></html>
EOF
mv $OUTFILE.new $OUTFILE
if [ ! -e $SSHFS_MNTPNT/.sshfs.mounted ]; then
mkdir -p $SSHFS_MNTPNT
sshfs $SSHFS_REMOTE $SSHFS_MNTPNT
touch $SSHFS_MNTPNT/.sshfs.mounted
fi
# unconditionally copy the index.html
echo
echo "copying index.html"
cp $OUTDIR/index.html $SSHFS_MNTPNT
if [ "$new_tarballs" = "" ]; then
echo "no newly created tarballs to copy"
exit 0
fi
echo "copying $( echo $new_tarballs | wc -w ) new tarballs"
cd $OUTDIR
cp -v $new_tarballs $SSHFS_MNTPNT
|