Skip to content

Commit e3fabf3

Browse files
committed
Merge pull request moby#16831 from jfrazelle/release-updates
Release updates
2 parents c3f42b2 + 96559aa commit e3fabf3

File tree

2 files changed

+76
-0
lines changed

2 files changed

+76
-0
lines changed

hack/make/generate-index-listing

Lines changed: 74 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,74 @@
1+
#!/bin/bash
2+
set -e
3+
4+
# This script generates index files for the directory structure
5+
# of the apt and yum repos
6+
7+
: ${DOCKER_RELEASE_DIR:=$DEST}
8+
APTDIR=$DOCKER_RELEASE_DIR/apt
9+
YUMDIR=$DOCKER_RELEASE_DIR/yum
10+
11+
if [ ! -d $APTDIR ] && [ ! -d $YUMDIR ]; then
12+
echo >&2 'release-rpm or release-deb must be run before generate-index-listing'
13+
exit 1
14+
fi
15+
16+
create_index() {
17+
local directory=$1
18+
local original=$2
19+
local cleaned=${directory#$original}
20+
21+
# the index file to create
22+
local index_file="${directory}/index"
23+
24+
# cd into dir & touch the index file
25+
cd $directory
26+
touch $index_file
27+
28+
# print the html header
29+
cat <<-EOF > "$index_file"
30+
<!DOCTYPE html>
31+
<html>
32+
<head><title>Index of ${cleaned}/</title></head>
33+
<body bgcolor="white">
34+
<h1>Index of ${cleaned}/</h1><hr>
35+
<pre><a href="../">../</a>
36+
EOF
37+
38+
# start of content output
39+
(
40+
# change IFS locally within subshell so the for loop saves line correctly to L var
41+
IFS=$'\n';
42+
43+
# pretty sweet, will mimick the normal apache output
44+
for L in $(find -L . -mount -depth -maxdepth 1 -type f ! -name 'index' -printf "<a href=\"%f\">%-44f@_@%Td-%Tb-%TY %Tk:%TM @%f@\n"|sort|sed 's,\([\ ]\+\)@_@,</a>\1,g');
45+
do
46+
# file
47+
F=$(sed -e 's,^.*@\([^@]\+\)@.*$,\1,g'<<<"$L");
48+
49+
# file with file size
50+
F=$(du -bh $F | cut -f1);
51+
52+
# output with correct format
53+
sed -e 's,\ @.*$, '"$F"',g'<<<"$L";
54+
done;
55+
) >> $index_file;
56+
57+
# now output a list of all directories in this dir (maxdepth 1) other than '.' outputting in a sorted manner exactly like apache
58+
find -L . -mount -depth -maxdepth 1 -type d ! -name '.' -printf "<a href=\"%f\">%-43f@_@%Td-%Tb-%TY %Tk:%TM -\n"|sort -d|sed 's,\([\ ]\+\)@_@,/</a>\1,g' >> $index_file
59+
60+
# print the footer html
61+
echo "</pre><hr></body></html>" >> $index_file
62+
63+
}
64+
65+
get_dirs() {
66+
local directory=$1
67+
68+
for d in `find ${directory} -type d`; do
69+
create_index $d $directory
70+
done
71+
}
72+
73+
get_dirs $APTDIR
74+
get_dirs $YUMDIR

hack/make/release-deb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,8 @@ for dir in contrib/builder/deb/*/; do
104104
-name *~${codename#*-}*.deb > "$APTDIR/dists/$codename/$component/filelist"
105105
done
106106

107+
# clean the databases
108+
apt-ftparchive clean "$APTDIR/conf/apt-ftparchive.conf"
107109

108110
# run the apt-ftparchive commands so we can have pinning
109111
apt-ftparchive generate "$APTDIR/conf/apt-ftparchive.conf"

0 commit comments

Comments
 (0)