[Tarantool-patches] [PATCH v1 2/3] Enable script for saving packages in S3 for modules
Alexander V. Tikhonov
avtikhon at tarantool.org
Mon Mar 30 08:38:05 MSK 2020
From: "Alexander.V Tikhonov" <avtikhon at tarantool.org>
Found that modules may have only binaries packages w/o sources
packages. Script changed to be able to work with only binaries
either sources packages.
Follow-up #3380
---
tools/update_repo.sh | 51 +++++++++++++++++++++++++++-----------------
1 file changed, 32 insertions(+), 19 deletions(-)
diff --git a/tools/update_repo.sh b/tools/update_repo.sh
index ddc44d118..975a76c00 100755
--- a/tools/update_repo.sh
+++ b/tools/update_repo.sh
@@ -306,20 +306,24 @@ function pack_deb {
# debian has special directory 'pool' for packages
debdir=pool
- # get packages from pointed location
- if ! ls $repo/*.deb $repo/*.dsc $repo/*.tar.*z >/dev/null ; then
- echo "ERROR: files $repo/*.deb $repo/*.dsc $repo/*.tar.*z not found"
- usage
- exit 1
- fi
-
# set the subpath with binaries based on literal character of the product name
proddir=$(echo $product | head -c 1)
# copy single distribution with binaries packages
repopath=$ws/pool/${option_dist}/$component/$proddir/$product
$mk_dir ${repopath}
- cp $repo/*.deb $repo/*.dsc $repo/*.tar.*z $repopath/.
+ file_found=0
+ for file in $repo/*.deb $repo/*.dsc $repo/*.tar.*z ; do
+ [ -f $file ] || continue
+ file_found=1
+ cp $file $repopath/.
+ done
+ # check that any files found
+ if [ "$file_found" == "0" ]; then
+ echo "ERROR: files $repo/*.deb $repo/*.dsc $repo/*.tar.*z not found"
+ usage
+ exit 1
+ fi
pushd $ws
# create the configuration file for 'reprepro' tool
@@ -395,28 +399,36 @@ EOF
continue || echo "Updating dists"
# finalize the Packages file
- for packages in dists/$loop_dist/$component/binary-*/Packages ; do
- mv $packages.saved $packages
- done
+ if [ -f $packages.saved ]; then
+ for packages in dists/$loop_dist/$component/binary-*/Packages ; do
+ mv $packages.saved $packages
+ done
+ fi
# finalize the Sources file
- sources=dists/$loop_dist/$component/source/Sources
- mv $sources.saved $sources
+ if [ -f $sources.saved ]; then
+ sources=dists/$loop_dist/$component/source/Sources
+ mv $sources.saved $sources
+ fi
# 2(binaries). update Packages file archives
for packpath in dists/$loop_dist/$component/binary-* ; do
pushd $packpath
- sed "s#Filename: $debdir/$component/#Filename: $debdir/$loop_dist/$component/#g" -i Packages
- bzip2 -c Packages >Packages.bz2
- gzip -c Packages >Packages.gz
+ if [ -f Packages ]; then
+ sed "s#Filename: $debdir/$component/#Filename: $debdir/$loop_dist/$component/#g" -i Packages
+ bzip2 -c Packages >Packages.bz2
+ gzip -c Packages >Packages.gz
+ fi
popd
done
# 2(sources). update Sources file archives
pushd dists/$loop_dist/$component/source
- sed "s#Directory: $debdir/$component/#Directory: $debdir/$loop_dist/$component/#g" -i Sources
- bzip2 -c Sources >Sources.bz2
- gzip -c Sources >Sources.gz
+ if [ -f Sources ]; then
+ sed "s#Directory: $debdir/$component/#Directory: $debdir/$loop_dist/$component/#g" -i Sources
+ bzip2 -c Sources >Sources.bz2
+ gzip -c Sources >Sources.gz
+ fi
popd
# 3. update checksums entries of the Packages* files in *Release files
@@ -435,6 +447,7 @@ EOF
# 'sha1' - at the 2nd and 'sha256' at the 3rd
pushd dists/$loop_dist
for file in $(grep " $component/" Release | awk '{print $3}' | sort -u) ; do
+ [ -f $file ] || continue
sz=$(stat -c "%s" $file)
md5=$(md5sum $file | awk '{print $1}')
sha1=$(sha1sum $file | awk '{print $1}')
--
2.17.1
More information about the Tarantool-patches
mailing list