summaryrefslogtreecommitdiff
blob: f0f616aaf7efc1c834ac078ced24863343dd5994 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
<?

// 	$verbose = true;
// 	$qa = true;	

// 	$debug = true;

	require_once 'header.php';
	require_once 'class.portage.tree.php';
	require_once 'class.portage.category.php';
	require_once 'class.portage.package.php';
	require_once 'class.portage.ebuild.php';
	
	// Find all the ebuilds that are missing ebuild arch
	$sql = "SELECT * FROM missing_metadata;";
	$arr = $db->getAssoc($sql);
	
	if($verbose)
		shell::msg(number_format(count($arr))." ebuilds to check");
	
	foreach($arr as $ebuild_id => $row) {
		extract($row);
		
		$obj_ebuild = new PortageEbuild("$category/$pf");
		
		if($debug)
			shell::msg("[$category/".$obj_ebuild->pn."]");
			
		$arr_metadata = $obj_ebuild->metadata();
		
		if(count($arr_metadata)) {
		
			foreach($arr_metadata as $keyword => $value) {
				
				if(!empty($value)) {
					$arr_insert = array(
						'ebuild' => $ebuild_id,
						'keyword' => $keyword,
						'value' => $value,
					);
					
					$db->autoExecute('ebuild_metadata', $arr_insert, MDB2_AUTOQUERY_INSERT);
				}
			}
		} else {
			if($verbose || $qa)
				shell::msg("[QA] No metadata: $category/".$obj_ebuild->pf);
		}
		
	}
	
	// Set the new package descriptions
 	$sql = "UPDATE package SET description = (SELECT description FROM view_package_description vpd WHERE vpd.package = package.id);";
 	$db->query($sql);
	
?>