def main(): """Run main.""" try: os.mkdir(TMP_DIR) except OSError: pass opts, args = acid.process_args() if args: # Copy names = list(args) else: names = None import time start_time = time.time() checked_repositories = [] skipped_repositories = [] interesting_repositories = [] try: while True: if opts.timeout > 0 and time.time() - start_time > opts.timeout: break if args: if not names: break else: while not names: # Continually populate if user did not specify a repository # explicitly. names = [ p for p in latest_repositories() if p not in checked_repositories and p not in skipped_repositories ] if not names: import time time.sleep(1) repository_name = names.pop(0) print(repository_name) user_tmp_dir = os.path.join( TMP_DIR, os.path.basename(os.path.split(repository_name)[0])) try: os.mkdir(user_tmp_dir) except OSError: pass repository_tmp_dir = os.path.join( user_tmp_dir, os.path.basename(repository_name)) try: os.mkdir(repository_tmp_dir) except OSError: print('Skipping already checked repository') skipped_repositories.append(repository_name) continue try: download_repository(repository_name, output_directory=repository_tmp_dir) except subprocess.CalledProcessError: print('ERROR: git clone failed') continue if acid.check(opts, [repository_tmp_dir]): checked_repositories.append(repository_name) if interesting( os.path.join(repository_tmp_dir, os.path.basename(repository_name))): interesting_repositories.append(repository_name) else: return 1 except KeyboardInterrupt: pass if checked_repositories: print('\nTested repositories:') for name in checked_repositories: print(' ' + name + (' *' if name in interesting_repositories else ''))
def main(): """Run main.""" try: os.mkdir(TMP_DIR) except OSError: pass args = acid.process_args() if args.paths: names = [complete(a) for a in args.paths] else: names = None checked_repositories = [] skipped_repositories = [] interesting_repositories = [] while True: if args.paths: if not names: break else: while not names: # Continually populate if user did not specify a repository # explicitly. names = [p for p in latest_repositories() if p not in checked_repositories and p not in skipped_repositories] if not names: import time time.sleep(1) repository_name = names.pop(0) print(repository_name) user_tmp_dir = os.path.join( TMP_DIR, os.path.basename(os.path.split(repository_name)[0])) try: os.mkdir(user_tmp_dir) except OSError: pass repository_tmp_dir = os.path.join( user_tmp_dir, os.path.basename(repository_name)) try: os.mkdir(repository_tmp_dir) except OSError: print('Skipping already checked repository') skipped_repositories.append(repository_name) continue try: download_repository(repository_name, output_directory=repository_tmp_dir) except subprocess.CalledProcessError: print('ERROR: git clone failed') continue if acid.check([repository_tmp_dir], args): checked_repositories.append(repository_name) if interesting( os.path.join(repository_tmp_dir, os.path.basename(repository_name))): interesting_repositories.append(repository_name) else: return 1 if checked_repositories: print('\nTested repositories:') for name in checked_repositories: print(' ' + name + (' *' if name in interesting_repositories else ''))
def main(): """Run main.""" try: os.mkdir(TMP_DIR) except OSError: pass opts, args = acid.process_args() if args: # Copy names = list(args) else: names = None checked_packages = [] skipped_packages = [] last_hours = 1 with acid.timeout(opts.timeout): while True: if args: if not names: break else: while not names: # Continually populate if user did not specify a package # explicitly. names = [p for p in latest_packages(last_hours) if p not in checked_packages and p not in skipped_packages] if not names: last_hours *= 2 package_name = names.pop(0) print(package_name) package_tmp_dir = os.path.join(TMP_DIR, package_name) try: os.mkdir(package_tmp_dir) except OSError: print('Skipping already checked package') skipped_packages.append(package_name) continue try: download_package( package_name, output_directory=package_tmp_dir) except subprocess.CalledProcessError: print('ERROR: yolk fetch failed') continue for download_name in os.listdir(package_tmp_dir): try: if not extract_package( os.path.join(package_tmp_dir, download_name), output_directory=package_tmp_dir): print('ERROR: Could not extract package') continue except UnicodeDecodeError: print('ERROR: Could not extract package') continue if acid.check(opts, [package_tmp_dir]): checked_packages.append(package_name) else: return 1 if checked_packages: print('\nTested packages:\n ' + '\n '.join(checked_packages))
def main(): """Run main.""" try: os.mkdir(TMP_DIR) except OSError: pass args = acid.process_args() if args.paths: # Copy names = list(args.paths) else: names = None checked_packages = [] skipped_packages = [] last_hours = 1 while True: if args.paths: if not names: break else: while not names: # Continually populate if user did not specify a package # explicitly. names = [ p for p in latest_packages(last_hours) if p not in checked_packages and p not in skipped_packages ] if not names: last_hours *= 2 package_name = names.pop(0) print(package_name, file=sys.stderr) package_tmp_dir = os.path.join(TMP_DIR, package_name) try: os.mkdir(package_tmp_dir) except OSError: print('Skipping already checked package', file=sys.stderr) skipped_packages.append(package_name) continue try: download_package(package_name, output_directory=package_tmp_dir) except subprocess.CalledProcessError: print('yolk fetch failed', file=sys.stderr) continue for download_name in os.listdir(package_tmp_dir): try: if not extract_package(os.path.join(package_tmp_dir, download_name), output_directory=package_tmp_dir): print('Could not extract package', file=sys.stderr) continue except UnicodeDecodeError: print('Could not extract package', file=sys.stderr) continue if acid.check([package_tmp_dir], args): checked_packages.append(package_name) else: return 1 if checked_packages: print('\nTested packages:\n ' + '\n '.join(checked_packages), file=sys.stderr)