Tarantool development patches archive
 help / color / mirror / Atom feed
From: "Alexander V. Tikhonov" <avtikhon@tarantool.org>
To: Oleg Piskunov <o.piskunov@tarantool.org>,
	Sergey Bronnikov <sergeyb@tarantool.org>,
	Alexander Turenko <alexander.turenko@tarantool.org>
Cc: tarantool-patches@dev.tarantool.org
Subject: [Tarantool-patches] [PATCH v1 2/3] Enable script for saving packages in S3 for modules
Date: Mon, 30 Mar 2020 08:38:05 +0300	[thread overview]
Message-ID: <a17b8dc105f22bf9ef6f14e2f1fef90b9b46a28e.1585546307.git.avtikhon@tarantool.org> (raw)
In-Reply-To: <cover.1585546306.git.avtikhon@tarantool.org>
In-Reply-To: <cover.1585546306.git.avtikhon@tarantool.org>

From: "Alexander.V Tikhonov" <avtikhon@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

  parent reply	other threads:[~2020-03-30  5:38 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-03-30  5:38 [Tarantool-patches] [PATCH v1 0/3] extend packages pushing to S3 script Alexander V. Tikhonov
2020-03-30  5:38 ` [Tarantool-patches] [PATCH v1 1/3] Add metafiles cleanup routines at S3 pack script Alexander V. Tikhonov
2020-03-30  5:38 ` Alexander V. Tikhonov [this message]
2020-03-30  5:38 ` [Tarantool-patches] [PATCH v1 3/3] Add help instruction on 'product' option Alexander V. Tikhonov
2020-03-30 14:40 ` [Tarantool-patches] [PATCH v1 0/3] extend packages pushing to S3 script Sergey Bronnikov
2020-04-11  5:04   ` Oleg Piskunov
2020-04-15 13:51 ` Kirill Yukhin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a17b8dc105f22bf9ef6f14e2f1fef90b9b46a28e.1585546307.git.avtikhon@tarantool.org \
    --to=avtikhon@tarantool.org \
    --cc=alexander.turenko@tarantool.org \
    --cc=o.piskunov@tarantool.org \
    --cc=sergeyb@tarantool.org \
    --cc=tarantool-patches@dev.tarantool.org \
    --subject='Re: [Tarantool-patches] [PATCH v1 2/3] Enable script for saving packages in S3 for modules' \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox