Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 469888 | Differences between
and this patch

Collapse All | Expand All

(-)/tmp/bintree.py (-4 / +30 lines)
Lines 939-948 Link Here
939
							if not fcmd:
939
							if not fcmd:
940
								raise EnvironmentError("FETCHCOMMAND is unset")
940
								raise EnvironmentError("FETCHCOMMAND is unset")
941
941
942
						fd, tmp_filename = tempfile.mkstemp()
942
						# old method completely breaks timestamp caching
943
						tmp_dirname, tmp_basename = os.path.split(tmp_filename)
943
						# make an archive copy of our file (preserves timestamps)
944
						os.close(fd)
944
						# cd to temp directory
945
945
						# fetch file
946
						# cd to $cwd so wget analyses the unqualified basename
947
						tmp_dirname = tempfile.mkdtemp()
948
						fetch_cwd = os.getcwd()
949
						os.chdir(tmp_dirname)
950
						tmp_basename = os.path.basename(pkgindex_file)
951
						tmp_filename = os.path.join(tmp_dirname, tmp_basename)
952
						f_pkgindex_file = open(pkgindex_file, 'rb')
953
						f_tmpfile = open(tmp_basename, 'wb')
954
						f_tmpfile.write(f_pkgindex_file.read())
955
						f_tmpfile.close()
956
						f_pkgindex_file.close()
957
						os.utime(tmp_basename, (int(local_timestamp), int(local_timestamp)))
958
						tmp_stat_original = os.stat(tmp_filename)
959
						fcmd = fcmd.replace('-O "${DISTDIR}/${FILE}"', '-N')
960
						
946
						fcmd_vars = {
961
						fcmd_vars = {
947
							"DISTDIR": tmp_dirname,
962
							"DISTDIR": tmp_dirname,
948
							"FILE": tmp_basename,
963
							"FILE": tmp_basename,
Lines 957-965 Link Here
957
972
958
						success = portage.getbinpkg.file_get(
973
						success = portage.getbinpkg.file_get(
959
							fcmd=fcmd, fcmd_vars=fcmd_vars)
974
							fcmd=fcmd, fcmd_vars=fcmd_vars)
975
976
						# return from whence we came, cleanups?
977
						os.chdir(fetch_cwd)
978
979
						if tmp_stat_original.st_ctime == os.stat(tmp_filename).st_ctime:
980
							# set to the tmpdir so both are deleted
981
							tmp_filename = tmp_dirname
982
							raise UseCachedCopyOfRemoteIndex()
983
						
960
						if not success:
984
						if not success:
961
							raise EnvironmentError("%s failed" % (setting,))
985
							raise EnvironmentError("%s failed" % (setting,))
962
						f = open(tmp_filename, 'rb')
986
						f = open(tmp_filename, 'rb')
987
						# set to the tmpdir so both are deleted
988
						tmp_filename = tmp_dirname
963
989
964
				f_dec = codecs.iterdecode(f,
990
				f_dec = codecs.iterdecode(f,
965
					_encodings['repo.content'], errors='replace')
991
					_encodings['repo.content'], errors='replace')

Return to bug 469888