I tried it here and got the same error, but changing the DLAGENT in makepkg.conf to wget instead of curl solved it.
If you only want to get the source, use `makepkg -o` then you won't have to go around deleting everything. Also, there is no need to follow makepkg with pacman, just use `makepkg -ei`. And if a package has already been built, you don't need to delete it, just use `makepkg -efi`. And when we parse out those uneeded steps from your instructions, we are left with what the