#6 Adapt the check before upload to the new format
Merged 3 years ago by arrfab. Opened 3 years ago by pgreco.
pgreco/centos-git-common lookaside_update  into  master

file modified
+3 -10
@@ -79,15 +79,9 @@ 

  checksum=$(sha1sum ${file}|awk '{print $1}')

  

  f_log "Checking if file already uploaded"

- result=$(curl ${lookaside_baseurl}/sources/upload.cgi \

- 	--fail \

- 	-s \

- 	--cert ~/.centos.cert \

- 	--form "name=${pkgname}" \

- 	--form "branch=${branch}" \

- 	--form "sha1sum=${checksum}")

- 

- if [ "$result" = "Available" ] ;then

+ local_size=$(stat -c %s ${file})

+ remote_size=$(curl --silent -i --head ${lookaside_baseurl}/sources/${pkgname}/${branch}/${checksum}|grep "Content-Length"|cut -f 2 -d ':'|tr -d [:blank:]|tr -d '\r')

+ if [ "$local_size" -eq "$remote_size" ] ; then

    f_log "File already uploaded"

    exit 3

  fi
@@ -118,7 +112,6 @@ 

  fi

  

  f_log "Validating that source was correctly uploaded ...."

- local_size=$(stat -c %s ${file})

  remote_size=$(curl --silent -i --head ${lookaside_baseurl}/sources/${pkgname}/${branch}/${checksum}|grep "Content-Length"|cut -f 2 -d ':'|tr -d [:blank:]|tr -d '\r')

  if [ "$local_size" -eq "$remote_size" ] ; then

    f_log "[SUCCESS] Source should be available at ${lookaside_baseurl}/sources/${pkgname}/${branch}/${checksum}"

The check if the file exists remotely started failing after some changes on the server side. This patch adapts the check to the new format (same as the one used to validate after the upload)

LGTM, and I know , based on irc discussion, that it was already tested. Merging. Thanks !

Pull-Request has been merged by arrfab

3 years ago
Metadata