Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
View | Details | Raw Unified | Return to bug 142579
Collapse All | Expand All

(-)gentoo2/usr/bin/emerge (-4 / +4 lines)
Lines 1303-1309 Link Here
1303
		return 1
1303
		return 1
1304
1304
1305
	def select_files(self,myfiles):
1305
	def select_files(self,myfiles):
1306
		"given a list of .tbz2s, .ebuilds and deps, create the appropriate depgraph and return a favorite list"
1306
		"given a list of packages, .ebuilds and deps, create the appropriate depgraph and return a favorite list"
1307
		myfavorites=[]
1307
		myfavorites=[]
1308
		myroot = self.target_root
1308
		myroot = self.target_root
1309
		portdb = self.trees[myroot]["porttree"].dbapi
1309
		portdb = self.trees[myroot]["porttree"].dbapi
Lines 1316-1322 Link Here
1316
				if x in matches or not portdb.cpv_exists(x)]
1316
				if x in matches or not portdb.cpv_exists(x)]
1317
		for x in myfiles:
1317
		for x in myfiles:
1318
			ext = os.path.splitext(x)[1]
1318
			ext = os.path.splitext(x)[1]
1319
			if ext==".tbz2":
1319
			if (ext==".tbz2" or ext==".tgz"):
1320
				if not os.path.exists(x):
1320
				if not os.path.exists(x):
1321
					if os.path.exists(
1321
					if os.path.exists(
1322
						os.path.join(pkgsettings["PKGDIR"], "All", x)):
1322
						os.path.join(pkgsettings["PKGDIR"], "All", x)):
Lines 1326-1332 Link Here
1326
						x = os.path.join(pkgsettings["PKGDIR"], x)
1326
						x = os.path.join(pkgsettings["PKGDIR"], x)
1327
					else:
1327
					else:
1328
						print "\n\n!!! Binary package '"+str(x)+"' does not exist."
1328
						print "\n\n!!! Binary package '"+str(x)+"' does not exist."
1329
						print "!!! Please ensure the tbz2 exists as specified.\n"
1329
						print "!!! Please ensure the package exists as specified.\n"
1330
						sys.exit(1)
1330
						sys.exit(1)
1331
				mytbz2=xpak.tbz2(x)
1331
				mytbz2=xpak.tbz2(x)
1332
				mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0]
1332
				mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0]
Lines 5252-5258 Link Here
5252
5252
5253
	for x in myfiles:
5253
	for x in myfiles:
5254
		ext = os.path.splitext(x)[1]
5254
		ext = os.path.splitext(x)[1]
5255
		if (ext == ".ebuild" or ext == ".tbz2") and os.path.exists(os.path.abspath(x)):
5255
		if (ext == ".ebuild" or ext == ".tbz2" or ext == ".tgz") and os.path.exists(os.path.abspath(x)):
5256
			print "emerging by path implies --oneshot... adding --oneshot to options."
5256
			print "emerging by path implies --oneshot... adding --oneshot to options."
5257
			print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")
5257
			print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")
5258
			break
5258
			break
(-)gentoo2/usr/lib/portage/bin/emerge (-4 / +4 lines)
Lines 1303-1309 Link Here
1303
		return 1
1303
		return 1
1304
1304
1305
	def select_files(self,myfiles):
1305
	def select_files(self,myfiles):
1306
		"given a list of .tbz2s, .ebuilds and deps, create the appropriate depgraph and return a favorite list"
1306
		"given a list of packages, .ebuilds and deps, create the appropriate depgraph and return a favorite list"
1307
		myfavorites=[]
1307
		myfavorites=[]
1308
		myroot = self.target_root
1308
		myroot = self.target_root
1309
		portdb = self.trees[myroot]["porttree"].dbapi
1309
		portdb = self.trees[myroot]["porttree"].dbapi
Lines 1316-1322 Link Here
1316
				if x in matches or not portdb.cpv_exists(x)]
1316
				if x in matches or not portdb.cpv_exists(x)]
1317
		for x in myfiles:
1317
		for x in myfiles:
1318
			ext = os.path.splitext(x)[1]
1318
			ext = os.path.splitext(x)[1]
1319
			if ext==".tbz2":
1319
			if (ext==".tbz2" or ext==".tgz"):
1320
				if not os.path.exists(x):
1320
				if not os.path.exists(x):
1321
					if os.path.exists(
1321
					if os.path.exists(
1322
						os.path.join(pkgsettings["PKGDIR"], "All", x)):
1322
						os.path.join(pkgsettings["PKGDIR"], "All", x)):
Lines 1326-1332 Link Here
1326
						x = os.path.join(pkgsettings["PKGDIR"], x)
1326
						x = os.path.join(pkgsettings["PKGDIR"], x)
1327
					else:
1327
					else:
1328
						print "\n\n!!! Binary package '"+str(x)+"' does not exist."
1328
						print "\n\n!!! Binary package '"+str(x)+"' does not exist."
1329
						print "!!! Please ensure the tbz2 exists as specified.\n"
1329
						print "!!! Please ensure the package exists as specified.\n"
1330
						sys.exit(1)
1330
						sys.exit(1)
1331
				mytbz2=xpak.tbz2(x)
1331
				mytbz2=xpak.tbz2(x)
1332
				mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0]
1332
				mykey=mytbz2.getelements("CATEGORY")[0]+"/"+os.path.splitext(os.path.basename(x))[0]
Lines 5252-5258 Link Here
5252
5252
5253
	for x in myfiles:
5253
	for x in myfiles:
5254
		ext = os.path.splitext(x)[1]
5254
		ext = os.path.splitext(x)[1]
5255
		if (ext == ".ebuild" or ext == ".tbz2") and os.path.exists(os.path.abspath(x)):
5255
		if (ext == ".ebuild" or ext == ".tbz2" or ext == ".tgz") and os.path.exists(os.path.abspath(x)):
5256
			print "emerging by path implies --oneshot... adding --oneshot to options."
5256
			print "emerging by path implies --oneshot... adding --oneshot to options."
5257
			print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")
5257
			print colorize("BAD", "\n*** emerging by path is broken and may not always work!!!\n")
5258
			break
5258
			break
(-)gentoo2/usr/lib/portage/bin/misc-functions.sh (-7 / +15 lines)
Lines 501-525 Link Here
501
dyn_package() {
501
dyn_package() {
502
	cd "${PORTAGE_BUILDDIR}/image"
502
	cd "${PORTAGE_BUILDDIR}/image"
503
	install_mask "${PORTAGE_BUILDDIR}/image" ${PKG_INSTALL_MASK}
503
	install_mask "${PORTAGE_BUILDDIR}/image" ${PKG_INSTALL_MASK}
504
	local pkg_dest="${PKGDIR}/All/${PF}.tbz2"
504
  if [[ "${PORTAGE_COMPRESS}" == "gzip" ]]
505
	local pkg_tmp="${PKGDIR}/All/${PF}.tbz2.$$"
505
  then
506
    local compressor="gzip"
507
	  local extn="tgz"
508
	else
509
	  local compressor="bzip2"
510
	  local extn="tbz2"
511
	fi
512
	local pkg_dest="${PKGDIR}/All/${PF}.${extn}"
513
	local pkg_tmp="${PKGDIR}/All/${PF}.${extn}.$$"
506
	local tar_options=""
514
	local tar_options=""
507
	[ "${PORTAGE_QUIET}" == "1" ] ||  tar_options="${tar_options} -v"
515
	[ "${PORTAGE_QUIET}" == "1" ] ||  tar_options="${tar_options} -v"
508
	# Sandbox is disabled in case the user wants to use a symlink
516
	# Sandbox is disabled in case the user wants to use a symlink
509
	# for $PKGDIR and/or $PKGDIR/All.
517
	# for $PKGDIR and/or $PKGDIR/All.
510
	export SANDBOX_ON="0"
518
	export SANDBOX_ON="0"
511
	tar ${tar_options} -cf - . | bzip2 -f > "${pkg_tmp}" || \
519
	tar ${tar_options} -cf - . | $compressor -f > "${pkg_tmp}" || \
512
		die "Failed to create tarball"
520
		die "Failed to create tarball"
513
	cd ..
521
	cd ..
514
	export PYTHONPATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
522
	export PYTHONPATH=${PORTAGE_PYM_PATH:-/usr/lib/portage/pym}
515
	python -c "import xpak; t=xpak.tbz2('${pkg_tmp}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')"
523
	python -c "import xpak; t=xpak.tbz2('${pkg_tmp}'); t.recompose('${PORTAGE_BUILDDIR}/build-info')"
516
	if [ $? -ne 0 ]; then
524
	if [ $? -ne 0 ]; then
517
		rm -f "${pkg_tmp}"
525
		rm -f "${pkg_tmp}"
518
		die "Failed to append metadata to the tbz2 file"
526
		die "Failed to append metadata to the package file"
519
	fi
527
	fi
520
	mv -f "${pkg_tmp}" "${pkg_dest}" || die "Failed to move tbz2 to ${pkg_dest}"
528
	mv -f "${pkg_tmp}" "${pkg_dest}" || die "Failed to move package to ${pkg_dest}"
521
	ln -sf "../All/${PF}.tbz2" "${PKGDIR}/${CATEGORY}/${PF}.tbz2" || die "Failed to create symlink in ${PKGDIR}/${CATEGORY}"
529
	ln -sf "../All/${PF}.$extn" "${PKGDIR}/${CATEGORY}/${PF}.$extn" || die "Failed to create symlink in ${PKGDIR}/${CATEGORY}"
522
	vecho ">>> Done."
530
	echo ">>> Done."
523
	cd "${PORTAGE_BUILDDIR}"
531
	cd "${PORTAGE_BUILDDIR}"
524
	touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}"
532
	touch .packaged || die "Failed to 'touch .packaged' in ${PORTAGE_BUILDDIR}"
525
}
533
}
(-)gentoo2/usr/lib/portage/pym/emergehelp.py (-3 / +3 lines)
Lines 160-166 Link Here
160
		print "              be displayed as USE=\"-bar dar -foo\""
160
		print "              be displayed as USE=\"-bar dar -foo\""
161
		print
161
		print
162
		print "       "+green("--ask")+" ("+green("-a")+" short option)"
162
		print "       "+green("--ask")+" ("+green("-a")+" short option)"
163
		print "              before performing the merge, display what ebuilds and tbz2s will"
163
		print "              before performing the merge, display what ebuilds and packages will"
164
		print "              be installed, in the same format as when using --pretend; then"
164
		print "              be installed, in the same format as when using --pretend; then"
165
		print "              ask whether to continue with the merge or abort. Using --ask is"
165
		print "              ask whether to continue with the merge or abort. Using --ask is"
166
		print "              more efficient than using --pretend and then executing the same"
166
		print "              more efficient than using --pretend and then executing the same"
Lines 175-181 Link Here
175
		print "              Tell emerge to build binary packages for all ebuilds processed"
175
		print "              Tell emerge to build binary packages for all ebuilds processed"
176
		print "              (in addition to actually merging the packages.  Useful for"
176
		print "              (in addition to actually merging the packages.  Useful for"
177
		print "              maintainers or if you administrate multiple Gentoo Linux"
177
		print "              maintainers or if you administrate multiple Gentoo Linux"
178
		print "              systems (build once, emerge tbz2s everywhere) as well as disaster"
178
		print "              systems (build once, emerge packages everywhere) as well as disaster"
179
		print "              recovery."
179
		print "              recovery."
180
		print
180
		print
181
		print "       "+green("--buildpkgonly")+" ("+green("-B")+" short option)"
181
		print "       "+green("--buildpkgonly")+" ("+green("-B")+" short option)"
Lines 278-284 Link Here
278
		print
278
		print
279
		print "       "+green("--pretend")+" ("+green("-p")+" short option)"
279
		print "       "+green("--pretend")+" ("+green("-p")+" short option)"
280
		print "              Instead of actually performing the merge, simply display what"
280
		print "              Instead of actually performing the merge, simply display what"
281
		print "              ebuilds and tbz2s *would* have been installed if --pretend"
281
		print "              ebuilds and packages *would* have been installed if --pretend"
282
		print "              weren't used.  Using --pretend is strongly recommended before"
282
		print "              weren't used.  Using --pretend is strongly recommended before"
283
		print "              installing an unfamiliar package.  In the printout, N = new,"
283
		print "              installing an unfamiliar package.  In the printout, N = new,"
284
		print "              U = updating, R = replacing, F = fetch  restricted, B = blocked"
284
		print "              U = updating, R = replacing, F = fetch  restricted, B = blocked"
(-)gentoo2/usr/lib/portage/pym/getbinpkg.py (-2 / +4 lines)
Lines 446-452 Link Here
446
		metadata[baseurl]["data"]={}
446
		metadata[baseurl]["data"]={}
447
447
448
	filelist = dir_get_list(baseurl, conn)
448
	filelist = dir_get_list(baseurl, conn)
449
	tbz2list = match_in_array(filelist, suffix=".tbz2")
449
	binlist1 = match_in_array(filelist, suffix=".tbz2")
450
	binlist2 = match_in_array(filelist, suffix=".tgz")
451
	tbz2list = binlist1 + binlist2
450
	metalist = match_in_array(filelist, prefix="metadata.idx")
452
	metalist = match_in_array(filelist, prefix="metadata.idx")
451
	del filelist
453
	del filelist
452
	
454
	
Lines 509-515 Link Here
509
				sys.stderr.write("!!! Failed to write binary metadata to disk!\n")
511
				sys.stderr.write("!!! Failed to write binary metadata to disk!\n")
510
				sys.stderr.write("!!! "+str(e)+"\n")
512
				sys.stderr.write("!!! "+str(e)+"\n")
511
			break
513
			break
512
	# We may have metadata... now we run through the tbz2 list and check.
514
	# We may have metadata... now we run through the package list and check.
513
	sys.stderr.write(yellow("cache miss: 'x'")+" --- "+green("cache hit: 'o'")+"\n")
515
	sys.stderr.write(yellow("cache miss: 'x'")+" --- "+green("cache hit: 'o'")+"\n")
514
	binpkg_filenames = set()
516
	binpkg_filenames = set()
515
	for x in tbz2list:
517
	for x in tbz2list:
(-)gentoo2/usr/lib/portage/pym/portage.py (-31 / +115 lines)
Lines 4906-4912 Link Here
4906
			cache_me = True
4906
			cache_me = True
4907
		mysplit = mycpv.split("/")
4907
		mysplit = mycpv.split("/")
4908
		mylist  = []
4908
		mylist  = []
4909
		tbz2name = mysplit[1]+".tbz2"
4909
		global settings
4910
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
4911
		if mysettings["PORTAGE_COMPRESS"] == "gzip":
4912
			tbz2name = mysplit[1]+".tgz"
4913
		else:
4914
			tbz2name = mysplit[1]+".tbz2"
4910
		if self.bintree and not self.bintree.isremote(mycpv):
4915
		if self.bintree and not self.bintree.isremote(mycpv):
4911
			tbz2 = xpak.tbz2(self.bintree.getname(mycpv))
4916
			tbz2 = xpak.tbz2(self.bintree.getname(mycpv))
4912
			getitem = tbz2.getfile
4917
			getitem = tbz2.getfile
Lines 4919-4925 Link Here
4919
		for x in mykeys:
4924
		for x in mykeys:
4920
			myval = getitem(x)
4925
			myval = getitem(x)
4921
			# myval is None if the key doesn't exist
4926
			# myval is None if the key doesn't exist
4922
			# or the tbz2 is corrupt.
4927
			# or the package is corrupt.
4923
			if myval:
4928
			if myval:
4924
				mydata[x] = " ".join(myval.split())
4929
				mydata[x] = " ".join(myval.split())
4925
		if "EAPI" in mykeys:
4930
		if "EAPI" in mykeys:
Lines 6356-6362 Link Here
6356
		the ${PKGDIR}/${CATEGORY} directory if empty.  The file will not be
6361
		the ${PKGDIR}/${CATEGORY} directory if empty.  The file will not be
6357
		removed if os.path.islink() returns False."""
6362
		removed if os.path.islink() returns False."""
6358
		mycat, mypkg = catsplit(cpv)
6363
		mycat, mypkg = catsplit(cpv)
6359
		mylink = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2")
6364
		global settings
6365
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6366
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6367
			extn=".tgz"
6368
		else:
6369
			extn=".tbz2"  
6370
		mylink = os.path.join(self.pkgdir, mycat, mypkg + extn)
6360
		if os.path.islink(mylink):
6371
		if os.path.islink(mylink):
6361
			"""Only remove it if it's really a link so that this method never
6372
			"""Only remove it if it's really a link so that this method never
6362
			removes a real package that was placed here to avoid a collision."""
6373
			removes a real package that was placed here to avoid a collision."""
Lines 6373-6380 Link Here
6373
		"""Create a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink (and
6384
		"""Create a ${PKGDIR}/${CATEGORY}/${PF}.tbz2 symlink (and
6374
		${PKGDIR}/${CATEGORY} directory, if necessary).  Any file that may
6385
		${PKGDIR}/${CATEGORY} directory, if necessary).  Any file that may
6375
		exist in the location of the symlink will first be removed."""
6386
		exist in the location of the symlink will first be removed."""
6387
		global settings
6388
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6389
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6390
			extn=".tgz"
6391
		else:
6392
			extn=".tbz2"
6376
		mycat, mypkg = catsplit(cpv)
6393
		mycat, mypkg = catsplit(cpv)
6377
		full_path = os.path.join(self.pkgdir, mycat, mypkg + ".tbz2")
6394
		full_path = os.path.join(self.pkgdir, mycat, mypkg + extn)
6378
		try:
6395
		try:
6379
			os.makedirs(os.path.dirname(full_path))
6396
			os.makedirs(os.path.dirname(full_path))
6380
		except OSError, e:
6397
		except OSError, e:
Lines 6387-6393 Link Here
6387
			if e.errno != errno.ENOENT:
6404
			if e.errno != errno.ENOENT:
6388
				raise
6405
				raise
6389
			del e
6406
			del e
6390
		os.symlink(os.path.join("..", "All", mypkg + ".tbz2"), full_path)
6407
		os.symlink(os.path.join("..", "All", mypkg + extn), full_path)
6391
6408
6392
	def move_slot_ent(self, mylist):
6409
	def move_slot_ent(self, mylist):
6393
		if not self.populated:
6410
		if not self.populated:
Lines 6458-6464 Link Here
6458
			# Try to avoid the population routine when possible, so that
6475
			# Try to avoid the population routine when possible, so that
6459
			# FEATURES=buildpkg doesn't always force population.
6476
			# FEATURES=buildpkg doesn't always force population.
6460
			mycat, mypkg = catsplit(cpv)
6477
			mycat, mypkg = catsplit(cpv)
6461
			myfile = mypkg + ".tbz2"
6478
			global settings
6479
			mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6480
			if mysettings["PORTAGE_COMPRESS"] == "gzip":
6481
				extn=".tgz"
6482
			else:
6483
				extn=".tbz2"
6484
			myfile = mypkg + extn
6462
			full_path = os.path.join(self.pkgdir, "All", myfile)
6485
			full_path = os.path.join(self.pkgdir, "All", myfile)
6463
			if not os.path.exists(full_path):
6486
			if not os.path.exists(full_path):
6464
				return
6487
				return
Lines 6471-6477 Link Here
6471
		"""Move a colliding package if it exists.  Code below this point only
6494
		"""Move a colliding package if it exists.  Code below this point only
6472
		executes in rare cases."""
6495
		executes in rare cases."""
6473
		mycat, mypkg = catsplit(cpv)
6496
		mycat, mypkg = catsplit(cpv)
6474
		myfile = mypkg + ".tbz2"
6497
		myfile = mypkg + extn
6475
		mypath = os.path.join("All", myfile)
6498
		mypath = os.path.join("All", myfile)
6476
		dest_path = os.path.join(self.pkgdir, mypath)
6499
		dest_path = os.path.join(self.pkgdir, mypath)
6477
		if os.path.exists(dest_path):
6500
		if os.path.exists(dest_path):
Lines 6487-6494 Link Here
6487
	def _move_to_all(self, cpv):
6510
	def _move_to_all(self, cpv):
6488
		"""If the file exists, move it.  Whether or not it exists, update state
6511
		"""If the file exists, move it.  Whether or not it exists, update state
6489
		for future getname() calls."""
6512
		for future getname() calls."""
6513
		global settings
6514
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6515
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6516
			extn=".tgz"
6517
		else:
6518
			extn=".tbz2"
6490
		mycat , mypkg = catsplit(cpv)
6519
		mycat , mypkg = catsplit(cpv)
6491
		myfile = mypkg + ".tbz2"
6520
		myfile = mypkg + extn
6492
		src_path = os.path.join(self.pkgdir, mycat, myfile)
6521
		src_path = os.path.join(self.pkgdir, mycat, myfile)
6493
		try:
6522
		try:
6494
			mystat = os.lstat(src_path)
6523
			mystat = os.lstat(src_path)
Lines 6508-6516 Link Here
6508
	def _move_from_all(self, cpv):
6537
	def _move_from_all(self, cpv):
6509
		"""Move a package from ${PKGDIR}/All/${PF}.tbz2 to
6538
		"""Move a package from ${PKGDIR}/All/${PF}.tbz2 to
6510
		${PKGDIR}/${CATEGORY}/${PF}.tbz2 and update state from getname calls."""
6539
		${PKGDIR}/${CATEGORY}/${PF}.tbz2 and update state from getname calls."""
6540
		global settings
6541
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6542
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6543
			extn=".tgz"
6544
		else:
6545
			extn=".tbz2"
6511
		self._remove_symlink(cpv)
6546
		self._remove_symlink(cpv)
6512
		mycat , mypkg = catsplit(cpv)
6547
		mycat , mypkg = catsplit(cpv)
6513
		myfile = mypkg + ".tbz2"
6548
		myfile = mypkg + extn
6514
		mypath = os.path.join(mycat, myfile)
6549
		mypath = os.path.join(mycat, myfile)
6515
		dest_path = os.path.join(self.pkgdir, mypath)
6550
		dest_path = os.path.join(self.pkgdir, mypath)
6516
		try:
6551
		try:
Lines 6540-6546 Link Here
6540
			dirs.insert(0, "All")
6575
			dirs.insert(0, "All")
6541
			for mydir in dirs:
6576
			for mydir in dirs:
6542
				for myfile in listdir(os.path.join(self.pkgdir, mydir)):
6577
				for myfile in listdir(os.path.join(self.pkgdir, mydir)):
6543
					if not myfile.endswith(".tbz2"):
6578
					if not (myfile.endswith(".tbz2") or myfile.endswith(".tgz")):
6544
						continue
6579
						continue
6545
					mypath = os.path.join(mydir, myfile)
6580
					mypath = os.path.join(mydir, myfile)
6546
					full_path = os.path.join(self.pkgdir, mypath)
6581
					full_path = os.path.join(self.pkgdir, mypath)
Lines 6550-6556 Link Here
6550
					# For invalid packages, mycat could be None.
6585
					# For invalid packages, mycat could be None.
6551
					mycat = mytbz2.getfile("CATEGORY")
6586
					mycat = mytbz2.getfile("CATEGORY")
6552
					mypf = mytbz2.getfile("PF")
6587
					mypf = mytbz2.getfile("PF")
6553
					mypkg = myfile[:-5]
6588
					if myfile.endswith(".tgz"):
6589
						mypkg = myfile[:-4]
6590
					else:	
6591
						mypkg = myfile[:-5]
6554
					if not mycat or not mypf:
6592
					if not mycat or not mypf:
6555
						#old-style or corrupt package
6593
						#old-style or corrupt package
6556
						writemsg("!!! Invalid binary package: '%s'\n" % full_path,
6594
						writemsg("!!! Invalid binary package: '%s'\n" % full_path,
Lines 6607-6613 Link Here
6607
					del self.remotepkgs[mypkg]
6645
					del self.remotepkgs[mypkg]
6608
					continue
6646
					continue
6609
				mycat=self.remotepkgs[mypkg]["CATEGORY"].strip()
6647
				mycat=self.remotepkgs[mypkg]["CATEGORY"].strip()
6610
				fullpkg=mycat+"/"+mypkg[:-5]
6648
				if mypkg.endswith(".tgz"):
6649
					fullpkg = mycat+"/"+mypkg[:-4]
6650
				else:
6651
					fullpkg=mycat+"/"+mypkg[:-5]
6611
				if mycat not in categories:
6652
				if mycat not in categories:
6612
					writemsg(("!!! Remote binary package has an " + \
6653
					writemsg(("!!! Remote binary package has an " + \
6613
						"unrecognized category: '%s'\n") % fullpkg,
6654
						"unrecognized category: '%s'\n") % fullpkg,
Lines 6668-6703 Link Here
6668
		mypath = self._pkg_paths.get(mycpv, None)
6709
		mypath = self._pkg_paths.get(mycpv, None)
6669
		if mypath:
6710
		if mypath:
6670
			return os.path.join(self.pkgdir, mypath)
6711
			return os.path.join(self.pkgdir, mypath)
6712
		global settings
6713
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6714
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6715
			extn=".tgz"
6716
		else:
6717
			extn=".tbz2"
6671
		mycat, mypkg = catsplit(mycpv)
6718
		mycat, mypkg = catsplit(mycpv)
6672
		mypath = os.path.join("All", mypkg + ".tbz2")
6719
		mypath = os.path.join("All", mypkg + extn)
6673
		if mypath in self._pkg_paths.values():
6720
		if mypath in self._pkg_paths.values():
6674
			mypath = os.path.join(mycat, mypkg + ".tbz2")
6721
			mypath = os.path.join(mycat, mypkg + extn)
6675
		self._pkg_paths[mycpv] = mypath # cache for future lookups
6722
		self._pkg_paths[mycpv] = mypath # cache for future lookups
6676
		return os.path.join(self.pkgdir, mypath)
6723
		return os.path.join(self.pkgdir, mypath)
6677
6724
6678
	def isremote(self,pkgname):
6725
	def isremote(self,pkgname):
6679
		"Returns true if the package is kept remotely."
6726
		"Returns true if the package is kept remotely."
6727
		global settings
6728
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6729
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6730
			extn=".tgz"
6731
		else:
6732
			extn=".tbz2"
6680
		mysplit=pkgname.split("/")
6733
		mysplit=pkgname.split("/")
6681
		remote = (not os.path.exists(self.getname(pkgname))) and self.remotepkgs.has_key(mysplit[1]+".tbz2")
6734
		remote = (not os.path.exists(self.getname(pkgname))) and self.remotepkgs.has_key(mysplit[1]+extn)
6682
		return remote
6735
		return remote
6683
6736
6684
	def get_use(self,pkgname):
6737
	def get_use(self,pkgname):
6738
		global settings
6739
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6740
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6741
			extn=".tgz"
6742
		else:
6743
			extn=".tbz2"
6685
		mysplit=pkgname.split("/")
6744
		mysplit=pkgname.split("/")
6686
		if self.isremote(pkgname):
6745
		if self.isremote(pkgname):
6687
			return self.remotepkgs[mysplit[1]+".tbz2"]["USE"][:].split()
6746
			return self.remotepkgs[mysplit[1]+extn]["USE"][:].split()
6688
		tbz2=xpak.tbz2(self.getname(pkgname))
6747
		tbz2=xpak.tbz2(self.getname(pkgname))
6689
		return tbz2.getfile("USE").split()
6748
		return tbz2.getfile("USE").split()
6690
6749
6691
	def gettbz2(self,pkgname):
6750
	def gettbz2(self,pkgname):
6692
		"fetches the package from a remote site, if necessary."
6751
		"fetches the package from a remote site, if necessary."
6752
		global settings
6753
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
6754
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
6755
			extn=".tgz"
6756
		else:
6757
			extn=".tbz2"
6693
		print "Fetching '"+str(pkgname)+"'"
6758
		print "Fetching '"+str(pkgname)+"'"
6694
		mysplit  = pkgname.split("/")
6759
		mysplit  = pkgname.split("/")
6695
		tbz2name = mysplit[1]+".tbz2"
6760
		tbz2name = mysplit[1]+extn
6696
		if not self.isremote(pkgname):
6761
		if not self.isremote(pkgname):
6697
			if (tbz2name not in self.invalids):
6762
			if (tbz2name not in self.invalids):
6698
				return
6763
				return
6699
			else:
6764
			else:
6700
				writemsg("Resuming download of this tbz2, but it is possible that it is corrupt.\n",
6765
				writemsg("Resuming download of this binary, but it is possible that it is corrupt.\n",
6701
					noiselevel=-1)
6766
					noiselevel=-1)
6702
		mydest = self.pkgdir+"/All/"
6767
		mydest = self.pkgdir+"/All/"
6703
		try:
6768
		try:
Lines 7904-7910 Link Here
7904
		return self.portdb.cp_list(self.cp, mytree=self.mytree)
7969
		return self.portdb.cp_list(self.cp, mytree=self.mytree)
7905
7970
7906
def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes=None):
7971
def pkgmerge(mytbz2, myroot, mysettings, mydbapi=None, vartree=None, prev_mtimes=None):
7907
	"""will merge a .tbz2 file, returning a list of runtime dependencies
7972
	"""will merge a binary file, returning a list of runtime dependencies
7908
		that must be satisfied, or None if there was a merge error.	This
7973
		that must be satisfied, or None if there was a merge error.	This
7909
		code assumes the package exists."""
7974
		code assumes the package exists."""
7910
	global db
7975
	global db
Lines 7912-7919 Link Here
7912
		mydbapi = db[myroot]["bintree"].dbapi
7977
		mydbapi = db[myroot]["bintree"].dbapi
7913
	if vartree is None:
7978
	if vartree is None:
7914
		vartree = db[myroot]["vartree"]
7979
		vartree = db[myroot]["vartree"]
7915
	if mytbz2[-5:]!=".tbz2":
7980
		global settings
7916
		print "!!! Not a .tbz2 file"
7981
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
7982
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
7983
			extn=".tgz"
7984
		else:
7985
			extn=".tbz2"
7986
		if mytbz2[-5:]!=extn:
7987
			print "!!! Not a package file"
7917
		return 1
7988
		return 1
7918
7989
7919
	tbz2_lock = None
7990
	tbz2_lock = None
Lines 7923-7930 Link Here
7923
		""" Don't lock the tbz2 file because the filesytem could be readonly or
7994
		""" Don't lock the tbz2 file because the filesytem could be readonly or
7924
		shared by a cluster."""
7995
		shared by a cluster."""
7925
		#tbz2_lock = portage_locks.lockfile(mytbz2, wantnewlockfile=1)
7996
		#tbz2_lock = portage_locks.lockfile(mytbz2, wantnewlockfile=1)
7926
7997
		if os.path.basename(mytbz2).endswith(".tgz"):
7927
		mypkg = os.path.basename(mytbz2)[:-5]
7998
			mypkg = os.path.basename(mytbz2)[:-4]
7999
		else:
8000
			mypkg = os.path.basename(mytbz2)[:-5]
7928
		xptbz2 = xpak.tbz2(mytbz2)
8001
		xptbz2 = xpak.tbz2(mytbz2)
7929
		mycat = xptbz2.getfile("CATEGORY")
8002
		mycat = xptbz2.getfile("CATEGORY")
7930
		if not mycat:
8003
		if not mycat:
Lines 7939-7946 Link Here
7939
		catdir = os.path.dirname(builddir)
8012
		catdir = os.path.dirname(builddir)
7940
		pkgloc = os.path.join(builddir, "image")
8013
		pkgloc = os.path.join(builddir, "image")
7941
		infloc = os.path.join(builddir, "build-info")
8014
		infloc = os.path.join(builddir, "build-info")
7942
		myebuild = os.path.join(
8015
7943
			infloc, os.path.basename(mytbz2)[:-4] + "ebuild")
8016
		if os.path.basename(mytbz2).endswith(".tgz"):
8017
			myebuild = os.path.join(
8018
				infloc, os.path.basename(mytbz2)[:-3] + "ebuild")
8019
		else:
8020
			myebuild = os.path.join(
8021
				infloc, os.path.basename(mytbz2)[:-4] + "ebuild")
7944
		portage_util.ensure_dirs(os.path.dirname(catdir),
8022
		portage_util.ensure_dirs(os.path.dirname(catdir),
7945
			uid=portage_uid, gid=portage_gid, mode=070, mask=0)
8023
			uid=portage_uid, gid=portage_gid, mode=070, mask=0)
7946
		catdir_lock = portage_locks.lockdir(catdir)
8024
		catdir_lock = portage_locks.lockdir(catdir)
Lines 7978-7986 Link Here
7978
			return retval
8056
			return retval
7979
8057
7980
		writemsg_stdout(">>> Extracting %s\n" % mypkg)
8058
		writemsg_stdout(">>> Extracting %s\n" % mypkg)
7981
		retval = portage_exec.spawn_bash(
8059
		global settings
7982
			"bzip2 -dqc -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc),
8060
		mysettings = config(config_incrementals=portage_const.INCREMENTALS)
7983
			env=mysettings.environ())
8061
		if mysettings["PORTAGE_COMPRESS"]== "gzip":
8062
			retval = portage_exec.spawn_bash(
8063
				"gzip -cdq -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc),
8064
				env=mysettings.environ())
8065
		else:
8066
			retval = portage_exec.spawn_bash(
8067
				"bzip2 -dqc -- '%s' | tar -xp -C '%s' -f -" % (mytbz2, pkgloc),
8068
				env=mysettings.environ())
7984
		if retval != os.EX_OK:
8069
		if retval != os.EX_OK:
7985
			writemsg("!!! Error Extracting '%s'\n" % mytbz2, noiselevel=-1)
8070
			writemsg("!!! Error Extracting '%s'\n" % mytbz2, noiselevel=-1)
7986
			return retval
8071
			return retval
Lines 8163-8169 Link Here
8163
		if do_upgrade_packagesmessage and \
8248
		if do_upgrade_packagesmessage and \
8164
			listdir(os.path.join(mysettings["PKGDIR"], "All"), EmptyOnError=1):
8249
			listdir(os.path.join(mysettings["PKGDIR"], "All"), EmptyOnError=1):
8165
			writemsg_stdout(" ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the")
8250
			writemsg_stdout(" ** Skipping packages. Run 'fixpackages' or set it in FEATURES to fix the")
8166
			writemsg_stdout("\n    tbz2's in the packages directory. "+bold("Note: This can take a very long time."))
8251
			writemsg_stdout("\n    binaries in the packages directory. "+bold("Note: This can take a very long time."))
8167
			writemsg_stdout("\n")
8252
			writemsg_stdout("\n")
8168
	if myupd:
8253
	if myupd:
8169
		return myupd
8254
		return myupd
Lines 8229-8236 Link Here
8229
			portdbapi.portdbapi_instances.remove(portdb)
8314
			portdbapi.portdbapi_instances.remove(portdb)
8230
			del trees[myroot]["porttree"], myroot, portdb
8315
			del trees[myroot]["porttree"], myroot, portdb
8231
8316
8232
	settings = config(config_root=config_root, target_root=target_root,
8317
	settings = config(config_root=config_root, target_root=target_root, config_incrementals=portage_const.INCREMENTALS)
8233
		config_incrementals=portage_const.INCREMENTALS)
8234
	settings.lock()
8318
	settings.lock()
8235
	settings.validate()
8319
	settings.validate()
8236
8320

Return to bug 142579