I am just analyzing the getdelta.sh script, because I want it to cooperate with http-replicator, which is kind of tricky due to the distfiles not being in /user/portage/distfiles, but in the defined http-replicator-cache-dir.
I think there is something wrong with this part of the script for handling xdelta files from kde.org:
Code: Select all
FILEEXT=$(rev <<< $GOTFILE | cut -c 1-11 | rev)
if [ $FILEEXT = ".tar.xdelta" ]
then
# we haven't received a dtu-file, but an xdelta instead
# this means the deltup-server redirected us to ftp.kde.org
# to get the official delta-file from there
output "${GREEN}This is an xdelta from ftp.kde.org...\n"
output "${GREEN}Applying...\n"
bunzip2 ${DISTDIR}/${best_candidate}
xdelta patch $GOTFILE
if ${REMOVE_OLD}
then
remove "$(rev <<< ${best_candidate} | cut -c 5- | rev)"
else
bzip2 $(rev <<< ${best_candidate} | cut -c 5- | rev)
fi
bzip2 $(rev <<< $NEW_FILE | cut -c 5- | rev)
rm -f $GOTFILE
mv -f ${NEW_FILE} ${DISTDIR}
output "${GREEN}Succesfully done\n"
fi
The problem is, that bunzip is not extracting and replacing the desired archive to the present working dir, but the dir the archive is in. At this point we are still in $tmp_dwn_dest (= "${DISTDIR}/.getdelta-`date +%N`-tmp"), but the script is unzipping $best_candidate in $DISTDIR, so the next line with "xdelta patch" can not proceed because the unzipped $best_candidate is not there. Then if the old file should not get removed, it is trying to zip the the extracted $best_candidate again, which is not in tmp_dwn_dest.
If I am right, this is how that part of the getdelta.sh script should look like:
Code: Select all
FILEEXT=$(rev <<< $GOTFILE | cut -c 1-11 | rev)
if [ $FILEEXT = ".tar.xdelta" ]
then
# we haven't received a dtu-file, but an xdelta instead
# this means the deltup-server redirected us to ftp.kde.org
# to get the official delta-file from there
output "${GREEN}This is an xdelta from ftp.kde.org...\n"
output "${GREEN}Applying...\n"
cp ${DISTDIR}/${best_candidate} .
bunzip2 ${best_candidate}
xdelta patch $GOTFILE
if ${REMOVE_OLD}
then
remove "${best_candidate}"
fi
bzip2 $(rev <<< $NEW_FILE | cut -c 5- | rev)
mv -f ${NEW_FILE} ${DISTDIR}
output "${GREEN}Succesfully done\n"
fi
Any comments?