krobertson / deb-s3

Easily create and manage an APT repository on S3 -- NO LONGER MAINTAINED
MIT License
482 stars 148 forks source link

setting fail-if-exists flag caused index corruption if the uploaded file exists #113

Closed yongwen closed 7 years ago

yongwen commented 7 years ago

The following upload command with the --fail-if-exists and the same filename will upload some of the Packages file to s3, then exit because of the file exists. Since some of the Packages file got uploaded but not the Release file. It causes the repository index corruption:

deb-s3 upload \ --fail-if-exists --preserve-versions \ --bucket ABC \ --codename precise \ --component main \ --arch all \ --sign ABC \ graphicsmagick_1.3.26~ABC_all.deb

Output: 00:09:11 >> Retrieving existing manifests 00:09:11 >> Examining package file graphicsmagick_1.3.26~ABC_all.deb 00:09:18 !! Uploading manifest failed because: file https://s3.amazonaws.com/ABC/apt/pool/g/gr/graphicsmagick_1.3.26~ABC_all.deb already exists with different contents 00:09:18 >> Uploading packages and new manifests to S3 00:09:18 -- Transferring dists/precise/main/binary-amd64/Packages 00:09:18 -- Transferring dists/precise/main/binary-amd64/Packages.gz 00:09:18 -- Transferring dists/precise/main/binary-i386/Packages 00:09:18 -- Transferring dists/precise/main/binary-i386/Packages.gz 00:09:18 -- Transferring pool/g/gr/graphicsmagick_1.3.26~ABC_all.deb

Seems like one solution is to upload the graphicsmagick_1.3.26~ABC_all.deb first and if it exists and exit without uploading other Packages files.

yongwen commented 7 years ago

a possible workaround/fix: https://github.com/gengmao/deb-s3/pull/1