Skip to content

Commit 162e6d3

Browse files
authored
Add multiarch repos for RPM and DEB (#415)
1 parent ff62de4 commit 162e6d3

File tree

2 files changed

+58
-34
lines changed

2 files changed

+58
-34
lines changed

scripts/createAll

+24-2
Original file line numberDiff line numberDiff line change
@@ -12,24 +12,46 @@ repo="/repositories"
1212

1313
test -n "$version" || exit 1
1414

15+
echo "USE_ARM=$USE_ARM"
16+
1517
#centos
1618
#fedora
1719
#suse
1820
mkdir -p $repo/Community/RPM/x86_64
1921
mkdir -p $repo/Enterprise/RPM/x86_64
22+
if [[ "$USE_ARM" = "On" ]]
23+
then
24+
mkdir -p $repo/Community/RPM/aarch64
25+
mkdir -p $repo/Enterprise/RPM/aarch64
26+
fi
27+
28+
arch_list="x86_64"
29+
[[ "$USE_ARM" = "On" ]] && arch_list="$arch_list:aarch64"
30+
31+
echo "User archs are $arch_list"
2032

2133
ensure_oskar "$version" "$incoming" "$repo" \
2234
"Linux" "RPM" \
23-
"x86_64" "rpm"
35+
"$arch_list" "rpm"
2436

2537
#debian
2638
#ubuntu
2739
mkdir -p $repo/Community/Debian/amd64
2840
mkdir -p $repo/Enterprise/Debian/amd64
41+
if [[ "$USE_ARM" = "On" ]]
42+
then
43+
mkdir -p $repo/Community/Debian/arm64
44+
mkdir -p $repo/Enterprise/Debian/arm64
45+
fi
46+
47+
arch_list="amd64"
48+
[[ "$USE_ARM" = "On" ]] && arch_list="$arch_list:arm64"
49+
50+
echo "User archs are $arch_list"
2951

3052
ensure_oskar "$version" "$incoming" "$repo" \
3153
"Linux" "Debian" \
32-
"amd64" "deb"
54+
"$arch_list" "deb"
3355

3456
chown -R $UID.$GID $repo
3557

scripts/createRepo

+34-32
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ usage(){
2626

2727
provided(){
2828
echo -n "createRepo <version:'$1'> <in_path'$2'> <repo_path'$3'>"
29-
echo " <in_name'$4'> <repo_name'$5'> <arch'$5'> <package_type'$7'>"
29+
echo " <in_name'$4'> <repo_name'$5'> <arch'$6'> <package_type'$7'>"
3030
}
3131

3232
#provided "$@"
@@ -66,7 +66,7 @@ create_repo(){
6666
#set -x
6767
provided "$@"
6868
local version="$1" # X.Y.Z[-(H | (alpha | beta | milestone | rc).R)]
69-
local major_minor=$(expr "$version" : '\([0-9].[0-9]\)') # X.Y
69+
local major_minor=$(expr "$version" : '\([0-9].[0-9]*\)') # X.Y
7070
local version_fs="${major_minor/./}" # XY[-(alpha | beta | milestone | rc).R]
7171
[[ "${version%%-*}" = "${version}" ]] || [[ "${version##*-}" =~ ^[1-9]+$ ]] || version_fs="${version_fs}-${version##*-}"
7272
local in_path="$2" # /mnt/data/fileserver
@@ -94,10 +94,10 @@ create_repo(){
9494
"$repo_path/$repo_community/$repo_name" \
9595
"$url_community"
9696
echo "enterprise #################################"
97-
create_repo_edition "$version" "$major_minor" "$arch" "$package_type"\
98-
"$in_path/$in_enterprise/$in_name" \
99-
"$repo_path/$repo_enterprise/$repo_name" \
100-
"$url_enterprise"
97+
create_repo_edition "$version" "$major_minor" "$arch" "$package_type"\
98+
"$in_path/$in_enterprise/$in_name" \
99+
"$repo_path/$repo_enterprise/$repo_name" \
100+
"$url_enterprise"
101101
}
102102

103103
create_repo_edition(){
@@ -135,21 +135,22 @@ create_repo_deb(){
135135
local url="$7"
136136

137137
# sign files
138-
cd "$in" || { echo "can not enter source dir"; exit 1; }
139-
for file in "$in"/*"$major_minor"*.deb; do
140-
fbase="${file%.deb}"
141-
noext="${fbase##*/}"
142-
[[ -f "$file" ]] || ferr "create_repo_deb - file: $file - does not exist"
143-
[[ -d "$repo" ]] || ferr "create_repo_deb - reop: $repo - does not exist"
144-
if cmp -s "$file" "$repo/amd64/${noext}.deb"; then
145-
echo "file already exists '$file'"
146-
else
147-
cp "$file" "$repo/amd64/${noext}.deb" \
148-
|| { echo "could not move $file" to "$repo"; exit 1; }
149-
"$script_dir"/debSign "$repo/amd64/${noext}.deb" || ferr "failed to sign $repo/amd64/${noext}.deb"
150-
fi
138+
for arch in "${arch_array[@]}"; do
139+
cd "$in" || { echo "can not enter source dir"; exit 1; }
140+
for file in "$in"/*"$major_minor"*${arch}*.deb; do
141+
fbase="${file%.deb}"
142+
noext="${fbase##*/}"
143+
[[ -f "$file" ]] || ferr "create_repo_deb - file: $file - does not exist"
144+
[[ -d "$repo" ]] || ferr "create_repo_deb - reop: $repo - does not exist"
145+
if cmp -s "$file" "$repo/${arch}/${noext}.deb"; then
146+
echo "file already exists '$file'"
147+
else
148+
cp "$file" "$repo/${arch}/${noext}.deb" \
149+
|| { echo "could not move $file" to "$repo"; exit 1; }
150+
"$script_dir"/debSign "$repo/${arch}/${noext}.deb" || ferr "failed to sign $repo/${arch}/${noext}.deb"
151+
fi
152+
done
151153
done
152-
153154
cd "$repo" || { echo "can not enter repo"; exit 1; }
154155
echo
155156
echo "now building reop"
@@ -192,19 +193,20 @@ create_repo_rpm(){
192193
local url="$7"
193194

194195
# sign files
195-
cd "$in" || { echo "can not enter source dir"; exit 1; }
196-
for file in "$in"/*"$major_minor"*.rpm; do
197-
fbase="${file%.rpm}"
198-
noext="${fbase##*/}"
199-
if cmp -s "$file" "$repo/x86_64/${noext}.rpm"; then
200-
echo "file already exists '$file'"
201-
else
202-
"$script_dir"/rpmSign.exp "$file" || ferr "failed to sign $file"
203-
cp "$file" "$repo/x86_64/${noext}.rpm" \
204-
|| { echo "could not move $file" to "$repo"; exit 1; }
205-
fi
196+
for arch in "${arch_array[@]}"; do
197+
cd "$in" || { echo "can not enter source dir"; exit 1; }
198+
for file in "$in"/*"$major_minor"*${arch}*.rpm; do
199+
fbase="${file%.rpm}"
200+
noext="${fbase##*/}"
201+
if cmp -s "$file" "$repo/${arch}/${noext}.rpm"; then
202+
echo "file already exists '$file'"
203+
else
204+
"$script_dir"/rpmSign.exp "$file" || ferr "failed to sign $file"
205+
cp "$file" "$repo/${arch}/${noext}.rpm" \
206+
|| { echo "could not move $file" to "$repo"; exit 1; }
207+
fi
208+
done
206209
done
207-
208210
cd "$repo" || { echo "can not enter repo"; exit 1; }
209211
echo
210212
echo "now building reop"

0 commit comments

Comments
 (0)