Commits

Michał Górny committed 666826e

Support setting update timeout.

  • Participants
  • Parent commits 59ed1dd

Comments (0)

Files changed (3)

smartliverebuild/cli.py

 		help='Do not switch UID to portage when FEATURES=userpriv is set.')
 	opt.add_option('-t', '--type', action='append', type='vcslist', dest='type',
 		help='Limit rebuild to packages using specific VCS (eclass name). If used multiple times, all specified VCS-es will be used.')
+	opt.add_option('-T', '--timeout', type='int', dest='timeout',
+		help='Update timeout (0 to disable)')
 	opt.add_option('-U', '--unprivileged-user', action='store_true', dest='unprivileged_user',
 		help='Allow running as an unprivileged user.')
 

smartliverebuild/config.py

 			'quickpkg': 'False',
 			'remote_only': 'False',
 			'setuid': str(pm_conf.userpriv_enabled),
+			'timeout': 0,
 			'type': '',
 			'unprivileged_user': 'False'
 		}

smartliverebuild/vcs/__init__.py

 			# let's hope we don't get much output
 			ret = self.subprocess.poll()
 			if ret is None:
+				if self._opts.timeout \
+						and time.time() - self.starttime > float(self._opts.timeout):
+							raise Exception('timeout occured')
 				return None
 
 		(sod, sed) = self.subprocess.communicate()