Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 514926 - emerge --sync: clone new repositories
Summary: emerge --sync: clone new repositories
Status: RESOLVED DUPLICATE of bug 485402
Alias: None
Product: Portage Development
Classification: Unclassified
Component: Enhancement/Feature Requests (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Portage team
URL:
Whiteboard:
Keywords: InVCS
Depends on:
Blocks:
 
Reported: 2014-06-24 13:59 UTC by Hristo Venev
Modified: 2016-03-14 04:09 UTC (History)
0 users

See Also:
Package list:
Runtime testing required: ---


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Hristo Venev 2014-06-24 13:59:04 UTC
If a git repository is added in repos.conf that does not exist it will not be cloned.
--- a/pym/_emerge/actions.py
+++ b/pym/_emerge/actions.py
@@ -2165,10 +2165,6 @@
 	dosyncuri = syncuri
 	updatecache_flg = False
 	if repo.sync_type == "git":
-		# Update existing git repository, and ignore the syncuri. We are
-		# going to trust the user and assume that the user is in the branch
-		# that he/she wants updated. We'll let the user manage branches with
-		# git directly.
 		if portage.process.find_binary("git") is None:
 			msg = ["Command not found: git",
 			"Type \"emerge %s\" to enable git support." % portage.const.GIT_PACKAGE_ATOM]
@@ -2176,20 +2172,41 @@
 				writemsg_level("!!! %s\n" % l,
 					level=logging.ERROR, noiselevel=-1)
 			return 1
-		msg = ">>> Starting git pull in %s..." % repo.location
-		emergelog(xterm_titles, msg )
-		writemsg_level(msg + "\n")
-		exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
-			(portage._shell_quote(repo.location),),
-			**portage._native_kwargs(spawn_kwargs))
-		if exitcode != os.EX_OK:
-			msg = "!!! git pull error in %s." % repo.location
+		if os.path.isdir(os.path.join(repo.location+'.git')):
+			# Update existing git repository, and ignore the syncuri. We are
+			# going to trust the user and assume that the user is in the branch
+			# that he/she wants updated. We'll let the user manage branches with
+			# git directly.
+			msg = ">>> Starting git pull in %s..." % repo.location
+			emergelog(xterm_titles, msg )
+			writemsg_level(msg + "\n")
+			exitcode = portage.process.spawn_bash("cd %s ; git pull" % \
+				(portage._shell_quote(repo.location),),
+				**portage._native_kwargs(spawn_kwargs))
+			if exitcode != os.EX_OK:
+				msg = "!!! git pull error in %s." % repo.location
+				emergelog(xterm_titles, msg)
+				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+				return exitcode
+			msg = ">>> Git pull in %s successful" % repo.location
 			emergelog(xterm_titles, msg)
-			writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
-			return exitcode
-		msg = ">>> Git pull in %s successful" % repo.location
-		emergelog(xterm_titles, msg)
-		writemsg_level(msg + "\n")
+			writemsg_level(msg + "\n")
+		else:
+			# Clone repository
+			msg = ">>> Starting git clone in %s..." % repo.location
+			emergelog(xterm_titles, msg )
+			writemsg_level(msg + "\n")
+			exitcode = portage.process.spawn_bash("cd %s ; git clone %s ./" % \
+				(portage._shell_quote(repo.location),portage._shell_quote(repo.sync_uri)),
+				**portage._native_kwargs(spawn_kwargs))
+			if exitcode != os.EX_OK:
+				msg = "!!! git clone error in %s." % repo.location
+				emergelog(xterm_titles, msg)
+				writemsg_level(msg + "\n", level=logging.ERROR, noiselevel=-1)
+				return exitcode
+			msg = ">>> Git clone in %s successful" % repo.location
+			emergelog(xterm_titles, msg)
+			writemsg_level(msg + "\n")
 	elif repo.sync_type == "rsync":
 		for vcs_dir in vcs_dirs:
 			writemsg_level(("!!! %s appears to be under revision " + \


Reproducible: Always
Comment 1 Hristo Venev 2014-06-24 13:59:58 UTC
Typo: s/repo.location+'.git'/repo.location, '.git'/
Comment 2 Brian Dolbec (RETIRED) gentoo-dev 2014-06-24 14:13:00 UTC
Thanks, but the sync system is nearing completion of a complete overhaul.  Your patch for the old spaghetti code is not needed.  The new sync code already handles new repo's.  If you like, please test the plugin-sync branch of the portage git repo.  It also adds a few variables to the repos.conf files.  It also moves total control of sync operations from emerge to emaint, with "emerge --sync" providing auto-sync enabled repos to be synced only.  Syncing of non auto-sync enabled repos must be done from "emaint sync" only.

A new layman-sync plugin module is also being worked on and nearing completion in this years Layman gsoc project.  Then layman overalys can be synced from emerge or emaint as well.
Comment 3 Zac Medico gentoo-dev 2016-03-14 04:09:05 UTC

*** This bug has been marked as a duplicate of bug 485402 ***