mirror of
				https://gitlab.archlinux.org/pacman/pacman.git
				synced 2025-11-04 01:14:41 +01:00 
			
		
		
		
	Compare commits
	
		
			1235 Commits
		
	
	
		
	
	| Author | SHA1 | Date | |
|---|---|---|---|
| 
						 | 
					1bf7672343 | ||
| 
						 | 
					9702703633 | ||
| 
						 | 
					0b36d87817 | ||
| 
						 | 
					f8c73464c9 | ||
| 
						 | 
					48a6adee3e | ||
| 
						 | 
					cfa1e8b5e2 | ||
| 
						 | 
					3a88fcb191 | ||
| 
						 | 
					2a7bdd3e3a | ||
| 
						 | 
					b39a62f575 | ||
| 
						 | 
					cad8fe2fbf | ||
| 
						 | 
					0dbb945387 | ||
| 
						 | 
					519685e4b1 | ||
| 
						 | 
					4fc7c1d41e | ||
| 
						 | 
					5e81518ecb | ||
| 
						 | 
					7e081d2adf | ||
| 
						 | 
					1a5f308d52 | ||
| 
						 | 
					2d8a751943 | ||
| 
						 | 
					13fb2430e8 | ||
| 
						 | 
					0827aff85e | ||
| 
						 | 
					316b031b7c | ||
| 
						 | 
					757e85b21d | ||
| 
						 | 
					41cbea29b4 | ||
| 
						 | 
					0adb36346c | ||
| 
						 | 
					acef70c103 | ||
| 
						 | 
					8b4be66a30 | ||
| 
						 | 
					9a8c7154b1 | ||
| 
						 | 
					4fe9adf418 | ||
| 
						 | 
					0d6e82d374 | ||
| 
						 | 
					d750c854bc | ||
| 
						 | 
					72263e22bd | ||
| 
						 | 
					a92a36070a | ||
| 
						 | 
					5cf6f614eb | ||
| 
						 | 
					793202344b | ||
| 
						 | 
					e6dbe82c0c | ||
| 
						 | 
					05a3641c76 | ||
| 
						 | 
					ab1e92860b | ||
| 
						 | 
					b37a6063d0 | ||
| 
						 | 
					f78914cc6e | ||
| 
						 | 
					de8c5e78bb | ||
| 
						 | 
					737596f038 | ||
| 
						 | 
					870d4c8fdd | ||
| 
						 | 
					c37a06fe1d | ||
| 
						 | 
					9eb3695a3f | ||
| 
						 | 
					3a66b93be0 | ||
| 
						 | 
					930d501947 | ||
| 
						 | 
					716d776936 | ||
| 
						 | 
					be4c491ceb | ||
| 
						 | 
					ca128f2eff | ||
| 
						 | 
					3b2e09740c | ||
| 
						 | 
					eeb228c32e | ||
| 
						 | 
					64e3a462c6 | ||
| 
						 | 
					ab6d8614d5 | ||
| 
						 | 
					6341e5ce23 | ||
| 
						 | 
					652438772e | ||
| 
						 | 
					1e7a191136 | ||
| 
						 | 
					076b6184de | ||
| 
						 | 
					860e4c4943 | ||
| 
						 | 
					9aec7c3c72 | ||
| 
						 | 
					03272ad571 | ||
| 
						 | 
					40937b381a | ||
| 
						 | 
					af6125fbcc | ||
| 
						 | 
					0d356c27c1 | ||
| 
						 | 
					1741bdaf81 | ||
| 
						 | 
					828f305023 | ||
| 
						 | 
					5698d7b66d | ||
| 
						 | 
					f173f6d0da | ||
| 
						 | 
					2b4c996b86 | ||
| 
						 | 
					542c3cf812 | ||
| 
						 | 
					2c94118dc1 | ||
| 
						 | 
					fa8b99189e | ||
| 
						 | 
					77986af9b7 | ||
| 
						 | 
					c3402ab44e | ||
| 
						 | 
					4d1e27957d | ||
| 
						 | 
					254a8e2e05 | ||
| 
						 | 
					6018063ef6 | ||
| 
						 | 
					ab7393c53e | ||
| 
						 | 
					91b72cc386 | ||
| 
						 | 
					bcaf1b84ff | ||
| 
						 | 
					27f64e3789 | ||
| 
						 | 
					9ca88575e6 | ||
| 
						 | 
					9e52a36794 | ||
| 
						 | 
					f054351e52 | ||
| 
						 | 
					9c8d7a8093 | ||
| 
						 | 
					c54621d819 | ||
| 
						 | 
					d8717a6a96 | ||
| 
						 | 
					0565cebfc3 | ||
| 
						 | 
					3e619ccffe | ||
| 
						 | 
					1b288bae1f | ||
| 
						 | 
					b6bb8cb7dc | ||
| 
						 | 
					d884a791b9 | ||
| 
						 | 
					a5dd5d4141 | ||
| 
						 | 
					5c1853124d | ||
| 
						 | 
					55092d0fa7 | ||
| 
						 | 
					e4e0add629 | ||
| 
						 | 
					03ce7cc4eb | ||
| 
						 | 
					b3a1f89611 | ||
| 
						 | 
					df0a8f7406 | ||
| 
						 | 
					c968e625e8 | ||
| 
						 | 
					0e260f9335 | ||
| 
						 | 
					2dd8b88d5c | ||
| 
						 | 
					d8591dd341 | ||
| 
						 | 
					a100cd6bca | ||
| 
						 | 
					640c2462bb | ||
| 
						 | 
					a278356f75 | ||
| 
						 | 
					a7dbe4635b | ||
| 
						 | 
					9058d7fe9a | ||
| 
						 | 
					d911438352 | ||
| 
						 | 
					19dabcc19a | ||
| 
						 | 
					b2e088e42c | ||
| 
						 | 
					d9eda13fc6 | ||
| 
						 | 
					170bb80a1f | ||
| 
						 | 
					fa745fb467 | ||
| 
						 | 
					0bbf9ddf9d | ||
| 
						 | 
					e8462a4f88 | ||
| 
						 | 
					653d2dc86d | ||
| 
						 | 
					4d80d87f90 | ||
| 
						 | 
					2bda849bf9 | ||
| 
						 | 
					59b6fdeee1 | ||
| 
						 | 
					24ab8717d4 | ||
| 
						 | 
					3a9a510ca8 | ||
| 
						 | 
					8bf972824a | ||
| 
						 | 
					eba623b443 | ||
| 
						 | 
					59bb21fce3 | ||
| 
						 | 
					d0981d4c5b | ||
| 
						 | 
					3d4e95e526 | ||
| 
						 | 
					135f4397c2 | ||
| 
						 | 
					8bec63bf92 | ||
| 
						 | 
					259d521e37 | ||
| 
						 | 
					1825bd6716 | ||
| 
						 | 
					2fb8081d05 | ||
| 
						 | 
					c50ce453dc | ||
| 
						 | 
					ad0517d371 | ||
| 
						 | 
					44f3a15798 | ||
| 
						 | 
					ab2be5794d | ||
| 
						 | 
					67ce123457 | ||
| 
						 | 
					e4f13e62cf | ||
| 
						 | 
					62bfba53db | ||
| 
						 | 
					2ddbc6964b | ||
| 
						 | 
					4dae3fde17 | ||
| 
						 | 
					39319c1860 | ||
| 
						 | 
					64b7edd2fe | ||
| 
						 | 
					064e7280cb | ||
| 
						 | 
					b4a197a615 | ||
| 
						 | 
					2b1b7b7075 | ||
| 
						 | 
					fa8419a0b5 | ||
| 
						 | 
					bcc9c417ae | ||
| 
						 | 
					c44c649a52 | ||
| 
						 | 
					9ab44178f4 | ||
| 
						 | 
					1c8b3f2562 | ||
| 
						 | 
					d170c4580c | ||
| 
						 | 
					b14ff66038 | ||
| 
						 | 
					d4193d43cf | ||
| 
						 | 
					9c604af0a0 | ||
| 
						 | 
					3c433abb54 | ||
| 
						 | 
					d30878763c | ||
| 
						 | 
					5f38128686 | ||
| 
						 | 
					5a1bf3d803 | ||
| 
						 | 
					63087c31b5 | ||
| 
						 | 
					a2b776f6c9 | ||
| 
						 | 
					1bc79cb9a5 | ||
| 
						 | 
					f4e2009e9b | ||
| 
						 | 
					bf468c0956 | ||
| 
						 | 
					12f74fd895 | ||
| 
						 | 
					bf23f85d4a | ||
| 
						 | 
					c6b04c0465 | ||
| 
						 | 
					c0a5884b18 | ||
| 
						 | 
					4f2fea240d | ||
| 
						 | 
					3c013f68ac | ||
| 
						 | 
					fae33a1faf | ||
| 
						 | 
					6a4c6a02de | ||
| 
						 | 
					6d1dcf7937 | ||
| 
						 | 
					16b91f798f | ||
| 
						 | 
					f9de3b22ad | ||
| 
						 | 
					a8670304c9 | ||
| 
						 | 
					098e114f58 | ||
| 
						 | 
					1550938ce1 | ||
| 
						 | 
					9c763a0d1b | ||
| 
						 | 
					13ec13c85e | ||
| 
						 | 
					04d211effa | ||
| 
						 | 
					86f5c74694 | ||
| 
						 | 
					1af766987f | ||
| 
						 | 
					d9908fc1f2 | ||
| 
						 | 
					a138db3c07 | ||
| 
						 | 
					a202959a19 | ||
| 
						 | 
					5678298f7d | ||
| 
						 | 
					c635f185ba | ||
| 
						 | 
					64bd242863 | ||
| 
						 | 
					008fe7b24f | ||
| 
						 | 
					9ad7cda9d8 | ||
| 
						 | 
					8b0d59b83a | ||
| 
						 | 
					37a89e2fac | ||
| 
						 | 
					eaa82b4d07 | ||
| 
						 | 
					42e7020281 | ||
| 
						 | 
					0994893b0e | ||
| 
						 | 
					aa44824788 | ||
| 
						 | 
					6444ccbaf0 | ||
| 
						 | 
					585bd89803 | ||
| 
						 | 
					01a6502169 | ||
| 
						 | 
					9c3bf2988f | ||
| 
						 | 
					b6753eeb7e | ||
| 
						 | 
					8a19c4a782 | ||
| 
						 | 
					67602c4cf7 | ||
| 
						 | 
					d8367162e8 | ||
| 
						 | 
					d0a5766e24 | ||
| 
						 | 
					36eb35cacd | ||
| 
						 | 
					2c4511bdbe | ||
| 
						 | 
					1a2d5bee3b | ||
| 
						 | 
					3a4623b10a | ||
| 
						 | 
					5dfa3c8f6a | ||
| 
						 | 
					9a4d616220 | ||
| 
						 | 
					c40ee73bc4 | ||
| 
						 | 
					fc756c3c70 | ||
| 
						 | 
					36f456ccae | ||
| 
						 | 
					97459e9eb7 | ||
| 
						 | 
					46324d9b26 | ||
| 
						 | 
					e83e868a77 | ||
| 
						 | 
					c3b954e7b9 | ||
| 
						 | 
					e3e9cc14a5 | ||
| 
						 | 
					5dd764eb47 | ||
| 
						 | 
					46101bea1c | ||
| 
						 | 
					d3dc200263 | ||
| 
						 | 
					7114ca6208 | ||
| 
						 | 
					263e65dbb3 | ||
| 
						 | 
					0b30edacd4 | ||
| 
						 | 
					90f1dd1657 | ||
| 
						 | 
					9ce2c9b187 | ||
| 
						 | 
					cef0d726b4 | ||
| 
						 | 
					e7fc560866 | ||
| 
						 | 
					37b73fe4fb | ||
| 
						 | 
					0dbc55a357 | ||
| 
						 | 
					5fbb361261 | ||
| 
						 | 
					a79c0038ae | ||
| 
						 | 
					fa06951d90 | ||
| 
						 | 
					a55adb81d0 | ||
| 
						 | 
					a79be86f57 | ||
| 
						 | 
					e8c35bea2b | ||
| 
						 | 
					4c4ce473d6 | ||
| 
						 | 
					577701250d | ||
| 
						 | 
					603f087cd7 | ||
| 
						 | 
					1f8f0bd9ac | ||
| 
						 | 
					dfc78129be | ||
| 
						 | 
					aca153bfa6 | ||
| 
						 | 
					8c55c0096c | ||
| 
						 | 
					ad27aa30fb | ||
| 
						 | 
					e2b4e220bc | ||
| 
						 | 
					0c99eabd50 | ||
| 
						 | 
					2e76c184aa | ||
| 
						 | 
					d590a45795 | ||
| 
						 | 
					3190b87b65 | ||
| 
						 | 
					87ee9693bd | ||
| 
						 | 
					05e1b8de1a | ||
| 
						 | 
					0d2ba870c9 | ||
| 
						 | 
					ae56a32273 | ||
| 
						 | 
					5fcc054421 | ||
| 
						 | 
					130c0d5496 | ||
| 
						 | 
					8f4a67bda9 | ||
| 
						 | 
					c7da5a6ef2 | ||
| 
						 | 
					3a00bc31f2 | ||
| 
						 | 
					5c549b0e1d | ||
| 
						 | 
					52ec8dfffe | ||
| 
						 | 
					7568928e71 | ||
| 
						 | 
					45b6a3074a | ||
| 
						 | 
					6a5156eedc | ||
| 
						 | 
					85171807c1 | ||
| 
						 | 
					34f3f1e7a6 | ||
| 
						 | 
					07d1e0441b | ||
| 
						 | 
					900a22b90c | ||
| 
						 | 
					38e229e4db | ||
| 
						 | 
					fac4831a09 | ||
| 
						 | 
					d560a9aecd | ||
| 
						 | 
					1dbfef7b1c | ||
| 
						 | 
					e28c5803bb | ||
| 
						 | 
					1e2b398406 | ||
| 
						 | 
					406c9b66b4 | ||
| 
						 | 
					6c15cc4d22 | ||
| 
						 | 
					6d8e3d2a91 | ||
| 
						 | 
					1ec7fa89ad | ||
| 
						 | 
					69aee3e391 | ||
| 
						 | 
					58140dba74 | ||
| 
						 | 
					56de155296 | ||
| 
						 | 
					5b839c58ee | ||
| 
						 | 
					56ae960376 | ||
| 
						 | 
					be1ffedaf6 | ||
| 
						 | 
					c981f5ad76 | ||
| 
						 | 
					af83a58574 | ||
| 
						 | 
					5fcd60e264 | ||
| 
						 | 
					681509fd44 | ||
| 
						 | 
					1291c04961 | ||
| 
						 | 
					80d97fcf75 | ||
| 
						 | 
					0f0b192d8a | ||
| 
						 | 
					6ac2ee21b3 | ||
| 
						 | 
					7a9d8b7001 | ||
| 
						 | 
					839417e8c6 | ||
| 
						 | 
					f018317f48 | ||
| 
						 | 
					4f114f3817 | ||
| 
						 | 
					892a1076c0 | ||
| 
						 | 
					87082e3f44 | ||
| 
						 | 
					7bebe4deff | ||
| 
						 | 
					02a0bf550a | ||
| 
						 | 
					3729ef7a9a | ||
| 
						 | 
					b012da645e | ||
| 
						 | 
					6c96ad36e0 | ||
| 
						 | 
					5b9bc6024c | ||
| 
						 | 
					2694d17ad9 | ||
| 
						 | 
					0088a7ab1c | ||
| 
						 | 
					7e7c64f513 | ||
| 
						 | 
					7d1ea0b814 | ||
| 
						 | 
					502e0d1db0 | ||
| 
						 | 
					a194fb434e | ||
| 
						 | 
					ee960048b2 | ||
| 
						 | 
					3ed57be450 | ||
| 
						 | 
					4960be7764 | ||
| 
						 | 
					5901038610 | ||
| 
						 | 
					2ee1706a72 | ||
| 
						 | 
					4cad2423a3 | ||
| 
						 | 
					baf1ff64e6 | ||
| 
						 | 
					02731189f1 | ||
| 
						 | 
					1a94c00e36 | ||
| 
						 | 
					f363cf7857 | ||
| 
						 | 
					af5d69d59d | ||
| 
						 | 
					3da06c3519 | ||
| 
						 | 
					59112e186b | ||
| 
						 | 
					76a7d2293c | ||
| 
						 | 
					8ff03868a3 | ||
| 
						 | 
					1a29744d0d | ||
| 
						 | 
					d4f499f563 | ||
| 
						 | 
					df5dc0c9de | ||
| 
						 | 
					f38de43eb6 | ||
| 
						 | 
					9375715ae4 | ||
| 
						 | 
					e2ca25623b | ||
| 
						 | 
					cd4a3d03a0 | ||
| 
						 | 
					5c136d85db | ||
| 
						 | 
					c034a3322b | ||
| 
						 | 
					a724235b61 | ||
| 
						 | 
					1d6583a58d | ||
| 
						 | 
					ce1f453b74 | ||
| 
						 | 
					2ee7a8d89a | ||
| 
						 | 
					f63854fa96 | ||
| 
						 | 
					83c7dc80cb | ||
| 
						 | 
					fd936c9e73 | ||
| 
						 | 
					169287e494 | ||
| 
						 | 
					7624101e18 | ||
| 
						 | 
					a1a8d067e0 | ||
| 
						 | 
					7cf5e1aebf | ||
| 
						 | 
					c72ca3d539 | ||
| 
						 | 
					3cb1669e07 | ||
| 
						 | 
					0fa695d0e3 | ||
| 
						 | 
					50a2db4834 | ||
| 
						 | 
					fb72eede20 | ||
| 
						 | 
					c1bb41a037 | ||
| 
						 | 
					252183b409 | ||
| 
						 | 
					fea9abc8db | ||
| 
						 | 
					e910d45ac0 | ||
| 
						 | 
					9604570add | ||
| 
						 | 
					6ea97963b3 | ||
| 
						 | 
					5343ec7661 | ||
| 
						 | 
					43a09d1663 | ||
| 
						 | 
					b65c7afc17 | ||
| 
						 | 
					c781a85387 | ||
| 
						 | 
					a5a9080219 | ||
| 
						 | 
					18d00097a2 | ||
| 
						 | 
					599520e489 | ||
| 
						 | 
					4291500c82 | ||
| 
						 | 
					47ea63ff3b | ||
| 
						 | 
					765e29b67c | ||
| 
						 | 
					ad65462a05 | ||
| 
						 | 
					9ff29545e5 | ||
| 
						 | 
					8d9890d3f4 | ||
| 
						 | 
					ab50864a75 | ||
| 
						 | 
					9813107c33 | ||
| 
						 | 
					00c0329531 | ||
| 
						 | 
					88f348f2b1 | ||
| 
						 | 
					875c017e4d | ||
| 
						 | 
					2a0d188d6b | ||
| 
						 | 
					fa72c2cdc2 | ||
| 
						 | 
					4742f5929d | ||
| 
						 | 
					8ca96447dd | ||
| 
						 | 
					6aee32102f | ||
| 
						 | 
					774c7eb24d | ||
| 
						 | 
					a671fa497c | ||
| 
						 | 
					eadf389607 | ||
| 
						 | 
					8454daa7fe | ||
| 
						 | 
					686fae6d74 | ||
| 
						 | 
					d721bae443 | ||
| 
						 | 
					760bea5432 | ||
| 
						 | 
					8d3bd4ec13 | ||
| 
						 | 
					132ec4c3b9 | ||
| 
						 | 
					3802cab563 | ||
| 
						 | 
					f98541400b | ||
| 
						 | 
					2015f0d1d9 | ||
| 
						 | 
					137ea39fa1 | ||
| 
						 | 
					9cdfd18739 | ||
| 
						 | 
					71f9de64c6 | ||
| 
						 | 
					8ee084dbb3 | ||
| 
						 | 
					d069d9714a | ||
| 
						 | 
					a8e2578feb | ||
| 
						 | 
					b8a7277061 | ||
| 
						 | 
					8089081ef9 | ||
| 
						 | 
					c74495a3b2 | ||
| 
						 | 
					4d2317dafb | ||
| 
						 | 
					220a3ce2b8 | ||
| 
						 | 
					8d11aa3cdf | ||
| 
						 | 
					85508b478e | ||
| 
						 | 
					7fb8a299c2 | ||
| 
						 | 
					7b6f7bbe09 | ||
| 
						 | 
					16623a7ea5 | ||
| 
						 | 
					4838d250e5 | ||
| 
						 | 
					bb5e6c3b76 | ||
| 
						 | 
					8a373096f5 | ||
| 
						 | 
					088649534e | ||
| 
						 | 
					dfa4dcb16d | ||
| 
						 | 
					34bbe4cf7b | ||
| 
						 | 
					5312e683fc | ||
| 
						 | 
					8ad893732d | ||
| 
						 | 
					b42d0852f3 | ||
| 
						 | 
					e0607f6ae2 | ||
| 
						 | 
					e03fa67445 | ||
| 
						 | 
					23f128ad5e | ||
| 
						 | 
					663c74150a | ||
| 
						 | 
					ef1fb0ef81 | ||
| 
						 | 
					c26e5b81e5 | ||
| 
						 | 
					947dfda515 | ||
| 
						 | 
					9e22e75fa1 | ||
| 
						 | 
					bf0e8e6b43 | ||
| 
						 | 
					8fa02036c3 | ||
| 
						 | 
					726712aa08 | ||
| 
						 | 
					978b197120 | ||
| 
						 | 
					0d877ec429 | ||
| 
						 | 
					08b0b6de96 | ||
| 
						 | 
					556c56d4d5 | ||
| 
						 | 
					6eac7258cd | ||
| 
						 | 
					0fd6d354a6 | ||
| 
						 | 
					d5b0f0c26f | ||
| 
						 | 
					906dc0ce24 | ||
| 
						 | 
					697377aae3 | ||
| 
						 | 
					d8621b981e | ||
| 
						 | 
					dcc1b22cb3 | ||
| 
						 | 
					1142a32c7f | ||
| 
						 | 
					960b64553d | ||
| 
						 | 
					6fdc589fc6 | ||
| 
						 | 
					5b6526a2ad | ||
| 
						 | 
					b46bdeea14 | ||
| 
						 | 
					3c67127018 | ||
| 
						 | 
					0c5dbdbfec | ||
| 
						 | 
					4c5bf09eec | ||
| 
						 | 
					456ebe8f8e | ||
| 
						 | 
					9809102237 | ||
| 
						 | 
					e28aff4d87 | ||
| 
						 | 
					aa8a674b6b | ||
| 
						 | 
					19d373c9b9 | ||
| 
						 | 
					4b3df10d5d | ||
| 
						 | 
					2c72c8b822 | ||
| 
						 | 
					2627b423ff | ||
| 
						 | 
					70e6875ad9 | ||
| 
						 | 
					5d4a3f101c | ||
| 
						 | 
					5301d3fe8f | ||
| 
						 | 
					29d4dcf767 | ||
| 
						 | 
					501242a35b | ||
| 
						 | 
					0ee1beca12 | ||
| 
						 | 
					c99ebca83e | ||
| 
						 | 
					002acb4674 | ||
| 
						 | 
					cbb7e180c7 | ||
| 
						 | 
					a5759cb0d7 | ||
| 
						 | 
					b76409609c | ||
| 
						 | 
					4ceb1c5bf9 | ||
| 
						 | 
					60ebee7a6e | ||
| 
						 | 
					7000bf9198 | ||
| 
						 | 
					e8e872c8f9 | ||
| 
						 | 
					16718a216e | ||
| 
						 | 
					568a89d580 | ||
| 
						 | 
					c261210ccf | ||
| 
						 | 
					46a1ac6429 | ||
| 
						 | 
					e8deba3b87 | ||
| 
						 | 
					0adb74b293 | ||
| 
						 | 
					dd3fe853b3 | ||
| 
						 | 
					19e61a9e07 | ||
| 
						 | 
					be503c6eac | ||
| 
						 | 
					6946d7d1b7 | ||
| 
						 | 
					af747ef34a | ||
| 
						 | 
					edbe6c2bdc | ||
| 
						 | 
					75fe6ef104 | ||
| 
						 | 
					486643083c | ||
| 
						 | 
					1586b23080 | ||
| 
						 | 
					ec50ec8a15 | ||
| 
						 | 
					5780350751 | ||
| 
						 | 
					ae97082e98 | ||
| 
						 | 
					48f4efd9a1 | ||
| 
						 | 
					ccd3a3eb9f | ||
| 
						 | 
					1ee2032b7f | ||
| 
						 | 
					2d0e2bf255 | ||
| 
						 | 
					b8c9385b8b | ||
| 
						 | 
					877578762c | ||
| 
						 | 
					8566034866 | ||
| 
						 | 
					deac973188 | ||
| 
						 | 
					445aa3b52c | ||
| 
						 | 
					bbab90836b | ||
| 
						 | 
					3c41030964 | ||
| 
						 | 
					fd9ff672b0 | ||
| 
						 | 
					acf95f6b3b | ||
| 
						 | 
					137a4086de | ||
| 
						 | 
					488ca24265 | ||
| 
						 | 
					5782b8356c | ||
| 
						 | 
					e49abc9860 | ||
| 
						 | 
					b0dac754d2 | ||
| 
						 | 
					289fdf0d1d | ||
| 
						 | 
					f6c55b3c3f | ||
| 
						 | 
					1ada16f017 | ||
| 
						 | 
					2d7a41539b | ||
| 
						 | 
					94204d1089 | ||
| 
						 | 
					ff487212a2 | ||
| 
						 | 
					2e5e496eb0 | ||
| 
						 | 
					a187fa4562 | ||
| 
						 | 
					4b0bc2cf97 | ||
| 
						 | 
					aa9aa343cb | ||
| 
						 | 
					2bed2090fb | ||
| 
						 | 
					53d9633449 | ||
| 
						 | 
					0f302df5ed | ||
| 
						 | 
					3d4529335c | ||
| 
						 | 
					1a17249159 | ||
| 
						 | 
					366adc3bb0 | ||
| 
						 | 
					23e3c48526 | ||
| 
						 | 
					15b6cecdd5 | ||
| 
						 | 
					8ab106eb9b | ||
| 
						 | 
					61dd7e03be | ||
| 
						 | 
					dbbe76b83d | ||
| 
						 | 
					9302593cfb | ||
| 
						 | 
					c9a7b7e0bf | ||
| 
						 | 
					d38c098787 | ||
| 
						 | 
					83b734a103 | ||
| 
						 | 
					d5536d3eb3 | ||
| 
						 | 
					d568a4335b | ||
| 
						 | 
					99c7b1b088 | ||
| 
						 | 
					9a9e0203de | ||
| 
						 | 
					1545a04253 | ||
| 
						 | 
					e4af5e3c97 | ||
| 
						 | 
					ae7067440c | ||
| 
						 | 
					f9423cfa5d | ||
| 
						 | 
					1040ad4e71 | ||
| 
						 | 
					b0ae59724e | ||
| 
						 | 
					d4e5de4bf6 | ||
| 
						 | 
					54067c390f | ||
| 
						 | 
					4dbac804a3 | ||
| 
						 | 
					4e6848dbea | ||
| 
						 | 
					e374e6829c | ||
| 
						 | 
					721b785e73 | ||
| 
						 | 
					edeafcc988 | ||
| 
						 | 
					bf3aec8c32 | ||
| 
						 | 
					b520c6312f | ||
| 
						 | 
					2408d46c1b | ||
| 
						 | 
					eb5da52c0e | ||
| 
						 | 
					b630f455d2 | ||
| 
						 | 
					cb0f2bd038 | ||
| 
						 | 
					30c9dbcdeb | ||
| 
						 | 
					6aef45ee1a | ||
| 
						 | 
					81d233b793 | ||
| 
						 | 
					d2cb52de12 | ||
| 
						 | 
					f3fc9af2b7 | ||
| 
						 | 
					e7e0c13762 | ||
| 
						 | 
					b543c055b9 | ||
| 
						 | 
					b8f2d713e0 | ||
| 
						 | 
					eb21e9eb93 | ||
| 
						 | 
					f34e48a988 | ||
| 
						 | 
					f9cb4f3b9c | ||
| 
						 | 
					22a5128985 | ||
| 
						 | 
					0aded7487f | ||
| 
						 | 
					156d41a186 | ||
| 
						 | 
					ba532bda6b | ||
| 
						 | 
					ff8de12151 | ||
| 
						 | 
					965539adbf | ||
| 
						 | 
					bb94729c09 | ||
| 
						 | 
					8f92fe47a7 | ||
| 
						 | 
					578ceb29fa | ||
| 
						 | 
					9f1c5f0251 | ||
| 
						 | 
					d9b5cb238d | ||
| 
						 | 
					fc5be14dac | ||
| 
						 | 
					2108d95526 | ||
| 
						 | 
					008bd33e38 | ||
| 
						 | 
					92b8c09000 | ||
| 
						 | 
					7879a5b3e5 | ||
| 
						 | 
					068f8cec42 | ||
| 
						 | 
					e0f889e2ea | ||
| 
						 | 
					5baec6d5e9 | ||
| 
						 | 
					97fb8ada30 | ||
| 
						 | 
					0927206fc4 | ||
| 
						 | 
					adc6ca1f2c | ||
| 
						 | 
					00da25a5ea | ||
| 
						 | 
					bfe9b56e1f | ||
| 
						 | 
					68602f4931 | ||
| 
						 | 
					dff6982c83 | ||
| 
						 | 
					660bd1caa1 | ||
| 
						 | 
					3c46420367 | ||
| 
						 | 
					cf3d5e4830 | ||
| 
						 | 
					b5b2f0b1bf | ||
| 
						 | 
					27e3125c8d | ||
| 
						 | 
					ba869597fb | ||
| 
						 | 
					0c9f4329f8 | ||
| 
						 | 
					43413894d4 | ||
| 
						 | 
					c3161925c2 | ||
| 
						 | 
					295a3491ad | ||
| 
						 | 
					33466000d6 | ||
| 
						 | 
					c8574baa7c | ||
| 
						 | 
					7885931c96 | ||
| 
						 | 
					9917930ae1 | ||
| 
						 | 
					bd2e95b00b | ||
| 
						 | 
					2e48101999 | ||
| 
						 | 
					325be32acd | ||
| 
						 | 
					bbac318d7a | ||
| 
						 | 
					54c630f6ec | ||
| 
						 | 
					10fc538c70 | ||
| 
						 | 
					841e531c51 | ||
| 
						 | 
					3b22183a4d | ||
| 
						 | 
					8391716b8a | ||
| 
						 | 
					aa12a773b8 | ||
| 
						 | 
					50de87e0e6 | ||
| 
						 | 
					5167160c0c | ||
| 
						 | 
					ba0d225d93 | ||
| 
						 | 
					926280cfc7 | ||
| 
						 | 
					a82a5cf3f7 | ||
| 
						 | 
					4ba0561fe7 | ||
| 
						 | 
					f917a4a55a | ||
| 
						 | 
					63660afbc7 | ||
| 
						 | 
					3b20561748 | ||
| 
						 | 
					ea96b56722 | ||
| 
						 | 
					e7d8e2b5ac | ||
| 
						 | 
					4ccafc484d | ||
| 
						 | 
					09cfe2a4c0 | ||
| 
						 | 
					9eb07a81fa | ||
| 
						 | 
					7ed0d60a0d | ||
| 
						 | 
					95121cc4f1 | ||
| 
						 | 
					2aa85c3bfd | ||
| 
						 | 
					92febc847c | ||
| 
						 | 
					c6263da168 | ||
| 
						 | 
					21281e9b69 | ||
| 
						 | 
					018fa2b48c | ||
| 
						 | 
					a31426d3ea | ||
| 
						 | 
					0108884952 | ||
| 
						 | 
					d5f703729f | ||
| 
						 | 
					bd2473797e | ||
| 
						 | 
					6201f6e5ac | ||
| 
						 | 
					4dd9ccbc78 | ||
| 
						 | 
					17ad845c41 | ||
| 
						 | 
					287f7a575e | ||
| 
						 | 
					dfacd8473e | ||
| 
						 | 
					107eabdfb3 | ||
| 
						 | 
					207ba1e05f | ||
| 
						 | 
					ca5af32b99 | ||
| 
						 | 
					f617b6acd4 | ||
| 
						 | 
					77ca6e4062 | ||
| 
						 | 
					e8d757b6ba | ||
| 
						 | 
					fb9db2df5d | ||
| 
						 | 
					83d5512bf1 | ||
| 
						 | 
					9e5e86aa14 | ||
| 
						 | 
					95da285f56 | ||
| 
						 | 
					8da9be0955 | ||
| 
						 | 
					4060c5c77f | ||
| 
						 | 
					0acd794226 | ||
| 
						 | 
					62d5a71fba | ||
| 
						 | 
					aa4c61f999 | ||
| 
						 | 
					e8a3e3d81a | ||
| 
						 | 
					194dea2de1 | ||
| 
						 | 
					fafcbdeb8c | ||
| 
						 | 
					89b9e9d1dc | ||
| 
						 | 
					80e6d8a6fe | ||
| 
						 | 
					ca5a2771ae | ||
| 
						 | 
					39fe2d0e39 | ||
| 
						 | 
					f1e010a5a7 | ||
| 
						 | 
					29c0d8233b | ||
| 
						 | 
					4c4890dd1c | ||
| 
						 | 
					2759858e8c | ||
| 
						 | 
					acc639adf2 | ||
| 
						 | 
					6356567ae0 | ||
| 
						 | 
					7c0ff7f4b7 | ||
| 
						 | 
					763fb3d9e7 | ||
| 
						 | 
					804688ab6a | ||
| 
						 | 
					2f0ca00e55 | ||
| 
						 | 
					60d958c78b | ||
| 
						 | 
					be4198b34e | ||
| 
						 | 
					32413213cb | ||
| 
						 | 
					d5e93e895b | ||
| 
						 | 
					25b492aab6 | ||
| 
						 | 
					5221440b6b | ||
| 
						 | 
					286dc83451 | ||
| 
						 | 
					1f1e53c208 | ||
| 
						 | 
					9f527d2de4 | ||
| 
						 | 
					fda599df37 | ||
| 
						 | 
					21faf1682e | ||
| 
						 | 
					2114ef1874 | ||
| 
						 | 
					9cf1b2c004 | ||
| 
						 | 
					88eedef6c6 | ||
| 
						 | 
					52d2ff648d | ||
| 
						 | 
					123ecb8e07 | ||
| 
						 | 
					c6dd581ec5 | ||
| 
						 | 
					27506aba8f | ||
| 
						 | 
					46459da39b | ||
| 
						 | 
					895780bd9a | ||
| 
						 | 
					87e55a4ee7 | ||
| 
						 | 
					cd5e4b89f4 | ||
| 
						 | 
					e892234207 | ||
| 
						 | 
					f4796c905c | ||
| 
						 | 
					eac09e1d9f | ||
| 
						 | 
					c0d9d26070 | ||
| 
						 | 
					32ebd7ad5d | ||
| 
						 | 
					bf06efaa78 | ||
| 
						 | 
					eb7cc246c6 | ||
| 
						 | 
					c9ca363431 | ||
| 
						 | 
					863cfb5808 | ||
| 
						 | 
					d2d00e4543 | ||
| 
						 | 
					c07593c64c | ||
| 
						 | 
					a1c50a08c9 | ||
| 
						 | 
					325e20dea1 | ||
| 
						 | 
					23850c7c99 | ||
| 
						 | 
					c8448bb466 | ||
| 
						 | 
					ec679e09b2 | ||
| 
						 | 
					a7c1b7a914 | ||
| 
						 | 
					91a56a7072 | ||
| 
						 | 
					d107aced37 | ||
| 
						 | 
					565c931e2c | ||
| 
						 | 
					bc6ada0877 | ||
| 
						 | 
					54db3745d6 | ||
| 
						 | 
					14dc3389fd | ||
| 
						 | 
					c9e9c1ccfd | ||
| 
						 | 
					3af0268fdb | ||
| 
						 | 
					df36fe2e79 | ||
| 
						 | 
					768b65e934 | ||
| 
						 | 
					16259d728e | ||
| 
						 | 
					0cd174efd5 | ||
| 
						 | 
					a4b23417f9 | ||
| 
						 | 
					c54af84180 | ||
| 
						 | 
					ed4032a908 | ||
| 
						 | 
					41c8263ba2 | ||
| 
						 | 
					bb878217cd | ||
| 
						 | 
					04bc3a24eb | ||
| 
						 | 
					c23ff87893 | ||
| 
						 | 
					ef0577e3d5 | ||
| 
						 | 
					3446453c72 | ||
| 
						 | 
					193b2b33f8 | ||
| 
						 | 
					db402d6029 | ||
| 
						 | 
					eda65967ec | ||
| 
						 | 
					96e9cf35f1 | ||
| 
						 | 
					5d11605958 | ||
| 
						 | 
					5d618438c4 | ||
| 
						 | 
					a7298c36fd | ||
| 
						 | 
					d9aa7025ea | ||
| 
						 | 
					8c00dd7341 | ||
| 
						 | 
					4c1f41a7c1 | ||
| 
						 | 
					0d24994934 | ||
| 
						 | 
					6949012590 | ||
| 
						 | 
					db2562113b | ||
| 
						 | 
					be3ce88bb2 | ||
| 
						 | 
					f66ae5334e | ||
| 
						 | 
					f6b3c9d803 | ||
| 
						 | 
					ecf0e37fc5 | ||
| 
						 | 
					6029a77ac0 | ||
| 
						 | 
					bd746568f6 | ||
| 
						 | 
					03aa44a3ec | ||
| 
						 | 
					f77933ea1e | ||
| 
						 | 
					9594f513a4 | ||
| 
						 | 
					37aeb43644 | ||
| 
						 | 
					de442b6867 | ||
| 
						 | 
					167a598265 | ||
| 
						 | 
					bd744d067d | ||
| 
						 | 
					8cd41ec62b | ||
| 
						 | 
					4114e25df1 | ||
| 
						 | 
					1e0b2f6629 | ||
| 
						 | 
					566dc23357 | ||
| 
						 | 
					75c80caebc | ||
| 
						 | 
					82208c0239 | ||
| 
						 | 
					9d4d81783d | ||
| 
						 | 
					d649dc669d | ||
| 
						 | 
					91876c21f1 | ||
| 
						 | 
					44bcb73327 | ||
| 
						 | 
					d6785a5726 | ||
| 
						 | 
					d8f395fb56 | ||
| 
						 | 
					11dff8a50e | ||
| 
						 | 
					9d96bed9d6 | ||
| 
						 | 
					a0cfed7df2 | ||
| 
						 | 
					627ede8779 | ||
| 
						 | 
					c1d6cec2e2 | ||
| 
						 | 
					42c859e4cc | ||
| 
						 | 
					01beca5df7 | ||
| 
						 | 
					7ddc967d7c | ||
| 
						 | 
					6dd593c293 | ||
| 
						 | 
					19c3179b7e | ||
| 
						 | 
					62c11e450a | ||
| 
						 | 
					3f0303dc92 | ||
| 
						 | 
					926d998a75 | ||
| 
						 | 
					faf0246437 | ||
| 
						 | 
					5002227296 | ||
| 
						 | 
					1e3c088c2e | ||
| 
						 | 
					ca8319aec9 | ||
| 
						 | 
					7ee01c8666 | ||
| 
						 | 
					aec4241af2 | ||
| 
						 | 
					e123e04741 | ||
| 
						 | 
					04e8048725 | ||
| 
						 | 
					4e263f24c6 | ||
| 
						 | 
					13c9745302 | ||
| 
						 | 
					b275e5184e | ||
| 
						 | 
					dc339faf6a | ||
| 
						 | 
					50296576d0 | ||
| 
						 | 
					60c1f2857b | ||
| 
						 | 
					699937e94d | ||
| 
						 | 
					cb9489119e | ||
| 
						 | 
					235562a85e | ||
| 
						 | 
					963f7fe02f | ||
| 
						 | 
					51353edc61 | ||
| 
						 | 
					a3d7230e4d | ||
| 
						 | 
					b52ed49d75 | ||
| 
						 | 
					31b9862600 | ||
| 
						 | 
					24e0bd215c | ||
| 
						 | 
					c792262b13 | ||
| 
						 | 
					9c066dff43 | ||
| 
						 | 
					85c055da73 | ||
| 
						 | 
					e1f6fe652d | ||
| 
						 | 
					eab8cf6241 | ||
| 
						 | 
					f0c351b3fa | ||
| 
						 | 
					d02efd2f20 | ||
| 
						 | 
					1660ed3cf9 | ||
| 
						 | 
					7e9ad22ac2 | ||
| 
						 | 
					d3f5ab0e70 | ||
| 
						 | 
					793b9c3b42 | ||
| 
						 | 
					e4773b1b82 | ||
| 
						 | 
					8bf2c753f5 | ||
| 
						 | 
					d9cf14ff1d | ||
| 
						 | 
					ee207d7c7b | ||
| 
						 | 
					95e1a1ef82 | ||
| 
						 | 
					38b6de937c | ||
| 
						 | 
					8122fae51a | ||
| 
						 | 
					b00269d9c8 | ||
| 
						 | 
					879e4665c4 | ||
| 
						 | 
					3e19cd366a | ||
| 
						 | 
					ab07dfdeb9 | ||
| 
						 | 
					37634d22e5 | ||
| 
						 | 
					db14815f46 | ||
| 
						 | 
					99a5017f55 | ||
| 
						 | 
					17ed9eb734 | ||
| 
						 | 
					2b556d89de | ||
| 
						 | 
					cbd6c300b5 | ||
| 
						 | 
					8d5d7f6761 | ||
| 
						 | 
					8a02abcf19 | ||
| 
						 | 
					b694d84554 | ||
| 
						 | 
					1431d244f7 | ||
| 
						 | 
					574e45df28 | ||
| 
						 | 
					7c75564af9 | ||
| 
						 | 
					2025279eb6 | ||
| 
						 | 
					d981f93f18 | ||
| 
						 | 
					4ccf49d3e7 | ||
| 
						 | 
					0bf4ae726d | ||
| 
						 | 
					03b9bf08ac | ||
| 
						 | 
					7f1360b440 | ||
| 
						 | 
					f4992960ad | ||
| 
						 | 
					0c43198ee0 | ||
| 
						 | 
					22e478d203 | ||
| 
						 | 
					85c80542a5 | ||
| 
						 | 
					32413ad44b | ||
| 
						 | 
					dce82f9d19 | ||
| 
						 | 
					7e87614665 | ||
| 
						 | 
					fbb0945bfb | ||
| 
						 | 
					9506409c3f | ||
| 
						 | 
					71da296d01 | ||
| 
						 | 
					c3835c157a | ||
| 
						 | 
					bbeced26f6 | ||
| 
						 | 
					e8de265f80 | ||
| 
						 | 
					0e2db97a42 | ||
| 
						 | 
					79548e0d78 | ||
| 
						 | 
					73717f89df | ||
| 
						 | 
					6650c43fca | ||
| 
						 | 
					0c5e80c3b4 | ||
| 
						 | 
					80eca94c8e | ||
| 
						 | 
					0e18cefe38 | ||
| 
						 | 
					300dd62e0a | ||
| 
						 | 
					7305768d54 | ||
| 
						 | 
					e0a7682607 | ||
| 
						 | 
					e05fd5e060 | ||
| 
						 | 
					357b9a24a9 | ||
| 
						 | 
					07647d3d43 | ||
| 
						 | 
					fa0c1e1419 | ||
| 
						 | 
					8dbb80cfe9 | ||
| 
						 | 
					f1fadecfb3 | ||
| 
						 | 
					d06d993d56 | ||
| 
						 | 
					7b41952bfc | ||
| 
						 | 
					537a335cc7 | ||
| 
						 | 
					9ff6dc93af | ||
| 
						 | 
					d920e7053c | ||
| 
						 | 
					b9f98ae97c | ||
| 
						 | 
					4d65332ccd | ||
| 
						 | 
					235ce32563 | ||
| 
						 | 
					2401468f51 | ||
| 
						 | 
					ec01a22f7d | ||
| 
						 | 
					d39d3b3a09 | ||
| 
						 | 
					d174cc8943 | ||
| 
						 | 
					34ae6ce4e5 | ||
| 
						 | 
					7a5e41925f | ||
| 
						 | 
					b929e74f2e | ||
| 
						 | 
					060d06d2f7 | ||
| 
						 | 
					00fbdabc55 | ||
| 
						 | 
					80d3709e65 | ||
| 
						 | 
					dd694f433b | ||
| 
						 | 
					5293d57840 | ||
| 
						 | 
					6103183253 | ||
| 
						 | 
					d8b09e6656 | ||
| 
						 | 
					ee72c016ab | ||
| 
						 | 
					d8f0c3e5b9 | ||
| 
						 | 
					b26432dbdb | ||
| 
						 | 
					b0dc547fcb | ||
| 
						 | 
					fb8437b588 | ||
| 
						 | 
					fcf0cefd1a | ||
| 
						 | 
					3ebb7b94d9 | ||
| 
						 | 
					912ea363de | ||
| 
						 | 
					d8ee8d0c99 | ||
| 
						 | 
					61ba5c961e | ||
| 
						 | 
					ce3fbcb18d | ||
| 
						 | 
					2041586829 | ||
| 
						 | 
					87b0818246 | ||
| 
						 | 
					ffdc2c5396 | ||
| 
						 | 
					f3a280bc67 | ||
| 
						 | 
					2e9602716c | ||
| 
						 | 
					2330a64589 | ||
| 
						 | 
					1afddd74a9 | ||
| 
						 | 
					e6ff630763 | ||
| 
						 | 
					0475b2501a | ||
| 
						 | 
					0b0fe51a2c | ||
| 
						 | 
					620d2d9d58 | ||
| 
						 | 
					b2488eb356 | ||
| 
						 | 
					e5c714f501 | ||
| 
						 | 
					cfde337b7b | ||
| 
						 | 
					cfaff6e0c1 | ||
| 
						 | 
					894773eb5b | ||
| 
						 | 
					e2fe052576 | ||
| 
						 | 
					fe961e6590 | ||
| 
						 | 
					08cddb4b4b | ||
| 
						 | 
					bf79c02440 | ||
| 
						 | 
					9bfd6ff275 | ||
| 
						 | 
					bd3d1a17c2 | ||
| 
						 | 
					01cc55a1f4 | ||
| 
						 | 
					cd793c5ab7 | ||
| 
						 | 
					28dbd5551e | ||
| 
						 | 
					b6f6a165c4 | ||
| 
						 | 
					5acfa65ffb | ||
| 
						 | 
					8e60adc916 | ||
| 
						 | 
					11fb1d30f4 | ||
| 
						 | 
					42f4a5081e | ||
| 
						 | 
					f27fad9b89 | ||
| 
						 | 
					a7da2a47c3 | ||
| 
						 | 
					0deeb9991c | ||
| 
						 | 
					b9601b1e59 | ||
| 
						 | 
					953808a9ee | ||
| 
						 | 
					4763341ea1 | ||
| 
						 | 
					1601532a53 | ||
| 
						 | 
					8014dc648f | ||
| 
						 | 
					b449878fea | ||
| 
						 | 
					236f1795e9 | ||
| 
						 | 
					47a4741a3c | ||
| 
						 | 
					e4f6edf237 | ||
| 
						 | 
					1e07af1b0a | ||
| 
						 | 
					fe19a0c58d | ||
| 
						 | 
					15f4144e12 | ||
| 
						 | 
					135d862eb6 | ||
| 
						 | 
					6fb2035dd0 | ||
| 
						 | 
					c71efe6d62 | ||
| 
						 | 
					f5299d1752 | ||
| 
						 | 
					6268e66efa | ||
| 
						 | 
					ccabeafb3d | ||
| 
						 | 
					3dc87ec59a | ||
| 
						 | 
					edce7555a6 | ||
| 
						 | 
					aa4d3298fb | ||
| 
						 | 
					c2edd31eae | ||
| 
						 | 
					fac9ac6c40 | ||
| 
						 | 
					4d68092e2f | ||
| 
						 | 
					6be08f76f6 | ||
| 
						 | 
					819b4cd54e | ||
| 
						 | 
					77da9dc974 | ||
| 
						 | 
					cb8eae24c9 | ||
| 
						 | 
					d895cae16c | ||
| 
						 | 
					aabb7c3cdd | ||
| 
						 | 
					7ae25ac67f | ||
| 
						 | 
					333373f90e | ||
| 
						 | 
					5be7b6a1b2 | ||
| 
						 | 
					d4def1c193 | ||
| 
						 | 
					19b3ee6d39 | ||
| 
						 | 
					deaed047fd | ||
| 
						 | 
					6fa7e8aff5 | ||
| 
						 | 
					cd2370754a | ||
| 
						 | 
					83e14aeebd | ||
| 
						 | 
					e6464f0cb6 | ||
| 
						 | 
					4e9d88aa05 | ||
| 
						 | 
					e65a752475 | ||
| 
						 | 
					ffe7f6d161 | ||
| 
						 | 
					8a434aeb46 | ||
| 
						 | 
					62c76cf825 | ||
| 
						 | 
					b01c2aefd9 | ||
| 
						 | 
					bce495e56f | ||
| 
						 | 
					1d3b17e251 | ||
| 
						 | 
					5097b162fc | ||
| 
						 | 
					00b6694068 | ||
| 
						 | 
					3f34e0936a | ||
| 
						 | 
					480a9ff82f | ||
| 
						 | 
					ffa4c6fc8f | ||
| 
						 | 
					6c917e433e | ||
| 
						 | 
					30740d9d2f | ||
| 
						 | 
					086bbc5b62 | ||
| 
						 | 
					8bec8a3f6a | ||
| 
						 | 
					bad86247f7 | ||
| 
						 | 
					e25afaf673 | ||
| 
						 | 
					e205003635 | ||
| 
						 | 
					3bb3b1555a | ||
| 
						 | 
					77268f352f | ||
| 
						 | 
					7fa35f32d8 | ||
| 
						 | 
					19445e42e6 | ||
| 
						 | 
					6f468c2465 | ||
| 
						 | 
					6a656c7429 | ||
| 
						 | 
					452ee39de1 | ||
| 
						 | 
					f7f8964c23 | ||
| 
						 | 
					50e9543908 | ||
| 
						 | 
					2f8be5f8db | ||
| 
						 | 
					714609639f | ||
| 
						 | 
					9652c27710 | ||
| 
						 | 
					31fcdec619 | ||
| 
						 | 
					e8ec7e54e5 | ||
| 
						 | 
					841c60f2b3 | ||
| 
						 | 
					76a05e94c1 | ||
| 
						 | 
					916c7085d8 | ||
| 
						 | 
					b847d1d8e7 | ||
| 
						 | 
					9749fb033c | ||
| 
						 | 
					ae2c9bba5a | ||
| 
						 | 
					af2c0a1537 | ||
| 
						 | 
					20127e732c | ||
| 
						 | 
					759c48cd34 | ||
| 
						 | 
					1340ed7925 | ||
| 
						 | 
					a15fd48016 | ||
| 
						 | 
					7bfaa358ea | ||
| 
						 | 
					1645dfd3d1 | ||
| 
						 | 
					230bd5c2fd | ||
| 
						 | 
					b7b3f9c5e7 | ||
| 
						 | 
					d78f45ae0c | ||
| 
						 | 
					ea6aeef8ba | ||
| 
						 | 
					0da98ec6ba | ||
| 
						 | 
					5273e38fb2 | ||
| 
						 | 
					da8cd388c4 | ||
| 
						 | 
					57090d8cba | ||
| 
						 | 
					af284d5fdb | ||
| 
						 | 
					88df07717d | ||
| 
						 | 
					14cc790c59 | ||
| 
						 | 
					0c180cb7cc | ||
| 
						 | 
					fe824f87b9 | ||
| 
						 | 
					5c5b28833c | ||
| 
						 | 
					d5acf7a44a | ||
| 
						 | 
					c3493360af | ||
| 
						 | 
					08191b13f2 | ||
| 
						 | 
					1c5b94e6bb | ||
| 
						 | 
					b82a0d83ce | ||
| 
						 | 
					6405ecb259 | ||
| 
						 | 
					7e767b7e90 | ||
| 
						 | 
					8f5dbd5614 | ||
| 
						 | 
					a8285350cc | ||
| 
						 | 
					c2134fde2b | ||
| 
						 | 
					2194eddf30 | ||
| 
						 | 
					23923200c3 | ||
| 
						 | 
					d4ba5bdda6 | ||
| 
						 | 
					d63313efe1 | ||
| 
						 | 
					49de11b340 | ||
| 
						 | 
					2d9e7dc2bc | ||
| 
						 | 
					70b2c5f5ef | ||
| 
						 | 
					c7f159c1c9 | ||
| 
						 | 
					968486ecc0 | ||
| 
						 | 
					e049bb8bd6 | ||
| 
						 | 
					e7ad883ebe | ||
| 
						 | 
					c69d71d55b | ||
| 
						 | 
					fb0f880f0a | ||
| 
						 | 
					dcfc247a2c | ||
| 
						 | 
					3e903d34cc | ||
| 
						 | 
					217aaaf3ea | ||
| 
						 | 
					ed511b141f | ||
| 
						 | 
					e5f23e0ebb | ||
| 
						 | 
					d79872b4c7 | ||
| 
						 | 
					e9c7c3b90d | ||
| 
						 | 
					95b0a868f2 | ||
| 
						 | 
					071ba05534 | ||
| 
						 | 
					4d24da8cda | ||
| 
						 | 
					372e26118f | ||
| 
						 | 
					807f014d77 | ||
| 
						 | 
					2c11e5da1d | ||
| 
						 | 
					55ca38b4cd | ||
| 
						 | 
					64e4f627c1 | ||
| 
						 | 
					3b804cb654 | ||
| 
						 | 
					122e16106f | ||
| 
						 | 
					0fc9545546 | ||
| 
						 | 
					5477f2597b | ||
| 
						 | 
					dfcf918763 | ||
| 
						 | 
					8ab44c7986 | ||
| 
						 | 
					1bb0085dfe | ||
| 
						 | 
					31a55df3d9 | ||
| 
						 | 
					c9ab8a7f6c | ||
| 
						 | 
					0308df07d3 | ||
| 
						 | 
					141d7f234f | ||
| 
						 | 
					043f250d0e | ||
| 
						 | 
					2f7e92ad04 | ||
| 
						 | 
					d5ff21c221 | ||
| 
						 | 
					adfab9c899 | ||
| 
						 | 
					37242ceb30 | ||
| 
						 | 
					80ee9994f0 | ||
| 
						 | 
					3a6bb2735b | ||
| 
						 | 
					d43f54e5c4 | ||
| 
						 | 
					8eb8995aa7 | ||
| 
						 | 
					d1ac6ffc13 | ||
| 
						 | 
					2379eb1fa6 | ||
| 
						 | 
					028490ddcf | ||
| 
						 | 
					5ef0c3caa5 | ||
| 
						 | 
					8561ad2256 | ||
| 
						 | 
					ec15e859a4 | ||
| 
						 | 
					3b3152fc50 | ||
| 
						 | 
					3f99cfba1b | ||
| 
						 | 
					9388808964 | ||
| 
						 | 
					de570d1a65 | ||
| 
						 | 
					2091f7ab16 | ||
| 
						 | 
					cfbc4fe809 | ||
| 
						 | 
					61e806b96a | ||
| 
						 | 
					c0ee713704 | ||
| 
						 | 
					106d0fc541 | ||
| 
						 | 
					5f80d7afbd | ||
| 
						 | 
					8a72761743 | ||
| 
						 | 
					a86015f73f | ||
| 
						 | 
					4245c6b222 | ||
| 
						 | 
					b370f0ca42 | ||
| 
						 | 
					aade18cf3b | ||
| 
						 | 
					9020bcee37 | ||
| 
						 | 
					9e50e5314c | ||
| 
						 | 
					3a2a752e1e | ||
| 
						 | 
					ce7456b4cc | ||
| 
						 | 
					d8c2ab0e6f | ||
| 
						 | 
					15b667ef36 | ||
| 
						 | 
					3d3c7ebb0d | ||
| 
						 | 
					9085aa4322 | ||
| 
						 | 
					247b9af02b | ||
| 
						 | 
					c02b16c4cc | ||
| 
						 | 
					4d4f46ba2a | ||
| 
						 | 
					bf1c8e3a3c | ||
| 
						 | 
					3d2c8e1fd0 | ||
| 
						 | 
					ab84249a58 | ||
| 
						 | 
					26da037fd5 | ||
| 
						 | 
					8287312c29 | ||
| 
						 | 
					36f702ba82 | ||
| 
						 | 
					74c8943682 | ||
| 
						 | 
					12e00af531 | ||
| 
						 | 
					403c175dbc | ||
| 
						 | 
					228221003d | ||
| 
						 | 
					9263cc5874 | ||
| 
						 | 
					1152052b3e | ||
| 
						 | 
					429b956fb2 | ||
| 
						 | 
					d3726bbd26 | ||
| 
						 | 
					2e2c614f0e | ||
| 
						 | 
					48861f509a | ||
| 
						 | 
					d7bd40045c | ||
| 
						 | 
					e81faa9d6d | ||
| 
						 | 
					640324f1d4 | ||
| 
						 | 
					8e533b0363 | ||
| 
						 | 
					4ad6939980 | ||
| 
						 | 
					0f22bef8c3 | ||
| 
						 | 
					2d9dad5e14 | ||
| 
						 | 
					a79661225a | ||
| 
						 | 
					15eea825e6 | ||
| 
						 | 
					b1b9ca01f0 | ||
| 
						 | 
					05e954d2cd | ||
| 
						 | 
					bcde027091 | ||
| 
						 | 
					c4d8da4727 | ||
| 
						 | 
					6e3ea82f9b | ||
| 
						 | 
					58832b0d7c | ||
| 
						 | 
					66f3b93331 | ||
| 
						 | 
					29498b6a2a | ||
| 
						 | 
					a774e4d5e2 | ||
| 
						 | 
					9108bfe080 | ||
| 
						 | 
					bcbb6a56a1 | ||
| 
						 | 
					ec24d814ab | ||
| 
						 | 
					28cb22e3c2 | ||
| 
						 | 
					1438377401 | ||
| 
						 | 
					96a4d1ca04 | ||
| 
						 | 
					df9d19ba73 | ||
| 
						 | 
					24abcddc57 | ||
| 
						 | 
					ef6b6fe065 | ||
| 
						 | 
					5cc099a8ab | ||
| 
						 | 
					897e2b121a | ||
| 
						 | 
					eb19d41d5f | ||
| 
						 | 
					7b8f8753b1 | ||
| 
						 | 
					dcb3b9f85f | ||
| 
						 | 
					96ac9c5299 | ||
| 
						 | 
					b36b87656e | ||
| 
						 | 
					de7ccedbe7 | ||
| 
						 | 
					2436351d6e | ||
| 
						 | 
					dfcea1456d | ||
| 
						 | 
					ec831e05f5 | ||
| 
						 | 
					00513823dc | ||
| 
						 | 
					d7d4f47d63 | ||
| 
						 | 
					93f9052557 | ||
| 
						 | 
					af1c986383 | ||
| 
						 | 
					71328479f3 | ||
| 
						 | 
					b7f8f5d26a | ||
| 
						 | 
					58782b1c55 | ||
| 
						 | 
					37e85c0031 | ||
| 
						 | 
					ab3d8478c2 | ||
| 
						 | 
					9574bfd6c8 | ||
| 
						 | 
					cbbd3781c2 | ||
| 
						 | 
					47762ab687 | ||
| 
						 | 
					b1e495b88d | ||
| 
						 | 
					bc3e73fc8f | ||
| 
						 | 
					c91d948486 | ||
| 
						 | 
					0b3d04719d | ||
| 
						 | 
					aa7e42db11 | ||
| 
						 | 
					5cfa4ec47e | ||
| 
						 | 
					0c41663c7b | ||
| 
						 | 
					9ca423b981 | ||
| 
						 | 
					5df5d2c411 | ||
| 
						 | 
					477fd794a0 | ||
| 
						 | 
					a36d4b2831 | ||
| 
						 | 
					cbc25c22fc | ||
| 
						 | 
					ce3125196d | ||
| 
						 | 
					7ea58d09f6 | ||
| 
						 | 
					4fadcbfab2 | ||
| 
						 | 
					dc08eca368 | ||
| 
						 | 
					9555ec714a | ||
| 
						 | 
					e5dd8c2ac5 | ||
| 
						 | 
					5bcc058d42 | ||
| 
						 | 
					a975523fb9 | ||
| 
						 | 
					dece66ac18 | ||
| 
						 | 
					3b4e74cb3b | ||
| 
						 | 
					28dd29dedb | ||
| 
						 | 
					296e630edd | ||
| 
						 | 
					84ac55b052 | ||
| 
						 | 
					0f988beff8 | ||
| 
						 | 
					c5716d0e72 | ||
| 
						 | 
					9de33488bf | ||
| 
						 | 
					b8c8447971 | ||
| 
						 | 
					ee3b70c4a9 | ||
| 
						 | 
					9f9cf95692 | ||
| 
						 | 
					e19091b2bf | ||
| 
						 | 
					87acfef166 | ||
| 
						 | 
					fa601c41ed | 
							
								
								
									
										20
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										20
									
								
								.editorconfig
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,20 @@
 | 
			
		||||
# EditorConfig configuration for pacman
 | 
			
		||||
# http://EditorConfig.org
 | 
			
		||||
 | 
			
		||||
# Top-most EditorConfig file
 | 
			
		||||
root = true
 | 
			
		||||
 | 
			
		||||
# Unix-style newlines without trailing whitespaces, but with a newline
 | 
			
		||||
# ending every file, utf-8 charset, set indent to tabs
 | 
			
		||||
[*]
 | 
			
		||||
end_of_line = lf
 | 
			
		||||
insert_final_newline = true
 | 
			
		||||
trim_trailing_whitespace = true
 | 
			
		||||
charset = utf-8
 | 
			
		||||
indent_style = tab
 | 
			
		||||
 | 
			
		||||
[{NEWS,HACKING}]
 | 
			
		||||
indent_style = space
 | 
			
		||||
 | 
			
		||||
[*.py]
 | 
			
		||||
indent_style = space
 | 
			
		||||
							
								
								
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										3
									
								
								.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,5 +1,6 @@
 | 
			
		||||
*~
 | 
			
		||||
*.o
 | 
			
		||||
ABOUT-NLS
 | 
			
		||||
aclocal.m4
 | 
			
		||||
autom4te.cache
 | 
			
		||||
config.h
 | 
			
		||||
@@ -9,9 +10,11 @@ config.status
 | 
			
		||||
config.status.lineno
 | 
			
		||||
configure
 | 
			
		||||
configure.lineno
 | 
			
		||||
cov-int
 | 
			
		||||
cscope.in.out
 | 
			
		||||
cscope.out
 | 
			
		||||
cscope.po.out
 | 
			
		||||
intl
 | 
			
		||||
libtool
 | 
			
		||||
Makefile
 | 
			
		||||
Makefile.in
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										29
									
								
								HACKING
									
									
									
									
									
								
							
							
						
						
									
										29
									
								
								HACKING
									
									
									
									
									
								
							@@ -6,16 +6,13 @@ concerns when hacking on pacman. If you are interested in contributing, please
 | 
			
		||||
read link:submitting-patches.html[submitting-patches] and
 | 
			
		||||
link:translation-help.html[translation-help] as well.
 | 
			
		||||
 | 
			
		||||
Coding style
 | 
			
		||||
Coding Style
 | 
			
		||||
------------
 | 
			
		||||
 | 
			
		||||
1.  All code should be indented with tabs. (Ignore the use of only spaces in
 | 
			
		||||
    this file) By default, source files contain the following VIM modeline:
 | 
			
		||||
+
 | 
			
		||||
[source,C]
 | 
			
		||||
-------------------------------------------
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
-------------------------------------------
 | 
			
		||||
    this file.) A tab size of two spaces is used when calculating line widths,
 | 
			
		||||
    which should be a maximum of 80 characters. An EditorConfig file is used
 | 
			
		||||
    to set this project-wide default.
 | 
			
		||||
 | 
			
		||||
2.  When opening new blocks such as 'while', 'if', or 'for', leave the opening
 | 
			
		||||
    brace on the same line as the beginning of the codeblock. The closing brace
 | 
			
		||||
@@ -73,15 +70,7 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
 | 
			
		||||
       NOT
 | 
			
		||||
    return(0);
 | 
			
		||||
 | 
			
		||||
6.  The sizeof() operator should accept a type, not a value. (TODO: in certain
 | 
			
		||||
    cases, it may be better- should this be a set guideline? Read "The Practice
 | 
			
		||||
    of Programming")
 | 
			
		||||
 | 
			
		||||
    sizeof(alpm_list_t);
 | 
			
		||||
       NOT
 | 
			
		||||
    sizeof(*mylist);
 | 
			
		||||
 | 
			
		||||
7.  When using strcmp() (or any function that returns 0 on success) in a
 | 
			
		||||
6.  When using strcmp() (or any function that returns 0 on success) in a
 | 
			
		||||
    conditional statement, use != 0 or == 0 and not the negation (!) operator.
 | 
			
		||||
    It reads much cleaner for humans (using a negative to check for success is
 | 
			
		||||
    confusing) and the compiler will treat it correctly anyway.
 | 
			
		||||
@@ -90,7 +79,7 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
 | 
			
		||||
       NOT
 | 
			
		||||
    if(!strcmp(a, b))
 | 
			
		||||
 | 
			
		||||
8.  Use spaces around almost all arithmetic, comparison and assignment
 | 
			
		||||
7.  Use spaces around almost all arithmetic, comparison and assignment
 | 
			
		||||
    operators and after all ',;:' separators.
 | 
			
		||||
 | 
			
		||||
	foobar[2 * size + 1] = function(a, 6);
 | 
			
		||||
@@ -101,7 +90,7 @@ alpm_list_t *alpm_list_add(alpm_list_t *list, void *data)
 | 
			
		||||
	   NOT
 | 
			
		||||
	for(a=0;a<n&&n>0;a++,n--) {}
 | 
			
		||||
 | 
			
		||||
9.  Declare all variables at the start of the block.
 | 
			
		||||
8.  Declare all variables at the start of the block.
 | 
			
		||||
[source,C]
 | 
			
		||||
-------------------------------------------
 | 
			
		||||
int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
 | 
			
		||||
@@ -200,7 +189,3 @@ For example, to run valgrind:
 | 
			
		||||
 | 
			
		||||
    ./src/pacman/pacman
 | 
			
		||||
    valgrind --leak-check=full -- src/pacman/.libs/lt-pacman -Syu
 | 
			
		||||
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										221
									
								
								INSTALL
									
									
									
									
									
								
							
							
						
						
									
										221
									
								
								INSTALL
									
									
									
									
									
								
							@@ -1,28 +1,25 @@
 | 
			
		||||
Installation Instructions
 | 
			
		||||
*************************
 | 
			
		||||
 | 
			
		||||
Copyright (C) 1994, 1995, 1996, 1999, 2000, 2001, 2002, 2004, 2005,
 | 
			
		||||
2006 Free Software Foundation, Inc.
 | 
			
		||||
Copyright (C) 1994-1996, 1999-2002, 2004-2013 Free Software Foundation,
 | 
			
		||||
Inc.
 | 
			
		||||
 | 
			
		||||
This file is free documentation; the Free Software Foundation gives
 | 
			
		||||
unlimited permission to copy, distribute and modify it.
 | 
			
		||||
   Copying and distribution of this file, with or without modification,
 | 
			
		||||
are permitted in any medium without royalty provided the copyright
 | 
			
		||||
notice and this notice are preserved.  This file is offered as-is,
 | 
			
		||||
without warranty of any kind.
 | 
			
		||||
 | 
			
		||||
Basic Installation
 | 
			
		||||
==================
 | 
			
		||||
 | 
			
		||||
You will need to build and install two libraries before you can
 | 
			
		||||
properly build pacman.
 | 
			
		||||
 | 
			
		||||
libarchive
 | 
			
		||||
http://code.google.com/p/libarchive/
 | 
			
		||||
 | 
			
		||||
libcurl
 | 
			
		||||
http://curl.haxx.se/libcurl/
 | 
			
		||||
 | 
			
		||||
Briefly, the shell commands `./configure; make; make install' should
 | 
			
		||||
   Briefly, the shell commands `./configure; make; make install' should
 | 
			
		||||
configure, build, and install this package.  The following
 | 
			
		||||
instructions are generic. Run `./configure --help` for specific
 | 
			
		||||
options.
 | 
			
		||||
more-detailed instructions are generic; see the `README' file for
 | 
			
		||||
instructions specific to this package.  Some packages provide this
 | 
			
		||||
`INSTALL' file but do not implement all of the features documented
 | 
			
		||||
below.  The lack of an optional feature in a given package is not
 | 
			
		||||
necessarily a bug.  More recommendations for GNU packages can be found
 | 
			
		||||
in *note Makefile Conventions: (standards)Makefile Conventions.
 | 
			
		||||
 | 
			
		||||
   The `configure' shell script attempts to guess correct values for
 | 
			
		||||
various system-dependent variables used during compilation.  It uses
 | 
			
		||||
@@ -51,7 +48,7 @@ may remove or edit it.
 | 
			
		||||
you want to change it or regenerate `configure' using a newer version
 | 
			
		||||
of `autoconf'.
 | 
			
		||||
 | 
			
		||||
The simplest way to compile this package is:
 | 
			
		||||
   The simplest way to compile this package is:
 | 
			
		||||
 | 
			
		||||
  1. `cd' to the directory containing the package's source code and type
 | 
			
		||||
     `./configure' to configure the package for your system.
 | 
			
		||||
@@ -62,12 +59,22 @@ The simplest way to compile this package is:
 | 
			
		||||
  2. Type `make' to compile the package.
 | 
			
		||||
 | 
			
		||||
  3. Optionally, type `make check' to run any self-tests that come with
 | 
			
		||||
     the package.
 | 
			
		||||
     the package, generally using the just-built uninstalled binaries.
 | 
			
		||||
 | 
			
		||||
  4. Type `make install' to install the programs and any data files and
 | 
			
		||||
     documentation.
 | 
			
		||||
     documentation.  When installing into a prefix owned by root, it is
 | 
			
		||||
     recommended that the package be configured and built as a regular
 | 
			
		||||
     user, and only the `make install' phase executed with root
 | 
			
		||||
     privileges.
 | 
			
		||||
 | 
			
		||||
  5. You can remove the program binaries and object files from the
 | 
			
		||||
  5. Optionally, type `make installcheck' to repeat any self-tests, but
 | 
			
		||||
     this time using the binaries in their final installed location.
 | 
			
		||||
     This target does not install anything.  Running this target as a
 | 
			
		||||
     regular user, particularly if the prior `make install' required
 | 
			
		||||
     root privileges, verifies that the installation completed
 | 
			
		||||
     correctly.
 | 
			
		||||
 | 
			
		||||
  6. You can remove the program binaries and object files from the
 | 
			
		||||
     source code directory by typing `make clean'.  To also remove the
 | 
			
		||||
     files that `configure' created (so you can compile the package for
 | 
			
		||||
     a different kind of computer), type `make distclean'.  There is
 | 
			
		||||
@@ -76,12 +83,22 @@ The simplest way to compile this package is:
 | 
			
		||||
     all sorts of other programs in order to regenerate files that came
 | 
			
		||||
     with the distribution.
 | 
			
		||||
 | 
			
		||||
  7. Often, you can also type `make uninstall' to remove the installed
 | 
			
		||||
     files again.  In practice, not all packages have tested that
 | 
			
		||||
     uninstallation works correctly, even though it is required by the
 | 
			
		||||
     GNU Coding Standards.
 | 
			
		||||
 | 
			
		||||
  8. Some packages, particularly those that use Automake, provide `make
 | 
			
		||||
     distcheck', which can by used by developers to test that all other
 | 
			
		||||
     targets like `make install' and `make uninstall' work correctly.
 | 
			
		||||
     This target is generally not run by end users.
 | 
			
		||||
 | 
			
		||||
Compilers and Options
 | 
			
		||||
=====================
 | 
			
		||||
 | 
			
		||||
Some systems require unusual options for compilation or linking that the
 | 
			
		||||
`configure' script does not know about.  Run `./configure --help' for
 | 
			
		||||
details on some of the pertinent environment variables.
 | 
			
		||||
   Some systems require unusual options for compilation or linking that
 | 
			
		||||
the `configure' script does not know about.  Run `./configure --help'
 | 
			
		||||
for details on some of the pertinent environment variables.
 | 
			
		||||
 | 
			
		||||
   You can give `configure' initial values for configuration parameters
 | 
			
		||||
by setting variables in the command line or in the environment.  Here
 | 
			
		||||
@@ -94,25 +111,41 @@ is an example:
 | 
			
		||||
Compiling For Multiple Architectures
 | 
			
		||||
====================================
 | 
			
		||||
 | 
			
		||||
You can compile the package for more than one kind of computer at the
 | 
			
		||||
   You can compile the package for more than one kind of computer at the
 | 
			
		||||
same time, by placing the object files for each architecture in their
 | 
			
		||||
own directory.  To do this, you can use GNU `make'.  `cd' to the
 | 
			
		||||
directory where you want the object files and executables to go and run
 | 
			
		||||
the `configure' script.  `configure' automatically checks for the
 | 
			
		||||
source code in the directory that `configure' is in and in `..'.
 | 
			
		||||
source code in the directory that `configure' is in and in `..'.  This
 | 
			
		||||
is known as a "VPATH" build.
 | 
			
		||||
 | 
			
		||||
   With a non-GNU `make', it is safer to compile the package for one
 | 
			
		||||
architecture at a time in the source code directory.  After you have
 | 
			
		||||
installed the package for one architecture, use `make distclean' before
 | 
			
		||||
reconfiguring for another architecture.
 | 
			
		||||
 | 
			
		||||
   On MacOS X 10.5 and later systems, you can create libraries and
 | 
			
		||||
executables that work on multiple system types--known as "fat" or
 | 
			
		||||
"universal" binaries--by specifying multiple `-arch' options to the
 | 
			
		||||
compiler but only a single `-arch' option to the preprocessor.  Like
 | 
			
		||||
this:
 | 
			
		||||
 | 
			
		||||
     ./configure CC="gcc -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
 | 
			
		||||
                 CXX="g++ -arch i386 -arch x86_64 -arch ppc -arch ppc64" \
 | 
			
		||||
                 CPP="gcc -E" CXXCPP="g++ -E"
 | 
			
		||||
 | 
			
		||||
   This is not guaranteed to produce working output in all cases, you
 | 
			
		||||
may have to build one architecture at a time and combine the results
 | 
			
		||||
using the `lipo' tool if you have problems.
 | 
			
		||||
 | 
			
		||||
Installation Names
 | 
			
		||||
==================
 | 
			
		||||
 | 
			
		||||
By default, `make install' installs the package's commands under
 | 
			
		||||
   By default, `make install' installs the package's commands under
 | 
			
		||||
`/usr/local/bin', include files under `/usr/local/include', etc.  You
 | 
			
		||||
can specify an installation prefix other than `/usr/local' by giving
 | 
			
		||||
`configure' the option `--prefix=PREFIX'.
 | 
			
		||||
`configure' the option `--prefix=PREFIX', where PREFIX must be an
 | 
			
		||||
absolute file name.
 | 
			
		||||
 | 
			
		||||
   You can specify separate installation prefixes for
 | 
			
		||||
architecture-specific files and architecture-independent files.  If you
 | 
			
		||||
@@ -123,16 +156,47 @@ Documentation and other data files still use the regular prefix.
 | 
			
		||||
   In addition, if you use an unusual directory layout you can give
 | 
			
		||||
options like `--bindir=DIR' to specify different values for particular
 | 
			
		||||
kinds of files.  Run `configure --help' for a list of the directories
 | 
			
		||||
you can set and what kinds of files go in them.
 | 
			
		||||
you can set and what kinds of files go in them.  In general, the
 | 
			
		||||
default for these options is expressed in terms of `${prefix}', so that
 | 
			
		||||
specifying just `--prefix' will affect all of the other directory
 | 
			
		||||
specifications that were not explicitly provided.
 | 
			
		||||
 | 
			
		||||
   The most portable way to affect installation locations is to pass the
 | 
			
		||||
correct locations to `configure'; however, many packages provide one or
 | 
			
		||||
both of the following shortcuts of passing variable assignments to the
 | 
			
		||||
`make install' command line to change installation locations without
 | 
			
		||||
having to reconfigure or recompile.
 | 
			
		||||
 | 
			
		||||
   The first method involves providing an override variable for each
 | 
			
		||||
affected directory.  For example, `make install
 | 
			
		||||
prefix=/alternate/directory' will choose an alternate location for all
 | 
			
		||||
directory configuration variables that were expressed in terms of
 | 
			
		||||
`${prefix}'.  Any directories that were specified during `configure',
 | 
			
		||||
but not in terms of `${prefix}', must each be overridden at install
 | 
			
		||||
time for the entire installation to be relocated.  The approach of
 | 
			
		||||
makefile variable overrides for each directory variable is required by
 | 
			
		||||
the GNU Coding Standards, and ideally causes no recompilation.
 | 
			
		||||
However, some platforms have known limitations with the semantics of
 | 
			
		||||
shared libraries that end up requiring recompilation when using this
 | 
			
		||||
method, particularly noticeable in packages that use GNU Libtool.
 | 
			
		||||
 | 
			
		||||
   The second method involves providing the `DESTDIR' variable.  For
 | 
			
		||||
example, `make install DESTDIR=/alternate/directory' will prepend
 | 
			
		||||
`/alternate/directory' before all installation names.  The approach of
 | 
			
		||||
`DESTDIR' overrides is not required by the GNU Coding Standards, and
 | 
			
		||||
does not work on platforms that have drive letters.  On the other hand,
 | 
			
		||||
it does better at avoiding recompilation issues, and works well even
 | 
			
		||||
when some directory options were not specified in terms of `${prefix}'
 | 
			
		||||
at `configure' time.
 | 
			
		||||
 | 
			
		||||
Optional Features
 | 
			
		||||
=================
 | 
			
		||||
 | 
			
		||||
   If the package supports it, you can cause programs to be installed
 | 
			
		||||
with an extra prefix or suffix on their names by giving `configure' the
 | 
			
		||||
option `--program-prefix=PREFIX' or `--program-suffix=SUFFIX'.
 | 
			
		||||
 | 
			
		||||
Optional Features
 | 
			
		||||
=================
 | 
			
		||||
 | 
			
		||||
Some packages pay attention to `--enable-FEATURE' options to
 | 
			
		||||
   Some packages pay attention to `--enable-FEATURE' options to
 | 
			
		||||
`configure', where FEATURE indicates an optional part of the package.
 | 
			
		||||
They may also pay attention to `--with-PACKAGE' options, where PACKAGE
 | 
			
		||||
is something like `gnu-as' or `x' (for the X Window System).  The
 | 
			
		||||
@@ -144,14 +208,58 @@ find the X include and library files automatically, but if it doesn't,
 | 
			
		||||
you can use the `configure' options `--x-includes=DIR' and
 | 
			
		||||
`--x-libraries=DIR' to specify their locations.
 | 
			
		||||
 | 
			
		||||
   Some packages offer the ability to configure how verbose the
 | 
			
		||||
execution of `make' will be.  For these packages, running `./configure
 | 
			
		||||
--enable-silent-rules' sets the default to minimal output, which can be
 | 
			
		||||
overridden with `make V=1'; while running `./configure
 | 
			
		||||
--disable-silent-rules' sets the default to verbose, which can be
 | 
			
		||||
overridden with `make V=0'.
 | 
			
		||||
 | 
			
		||||
Particular systems
 | 
			
		||||
==================
 | 
			
		||||
 | 
			
		||||
   On HP-UX, the default C compiler is not ANSI C compatible.  If GNU
 | 
			
		||||
CC is not installed, it is recommended to use the following options in
 | 
			
		||||
order to use an ANSI C compiler:
 | 
			
		||||
 | 
			
		||||
     ./configure CC="cc -Ae -D_XOPEN_SOURCE=500"
 | 
			
		||||
 | 
			
		||||
and if that doesn't work, install pre-built binaries of GCC for HP-UX.
 | 
			
		||||
 | 
			
		||||
   HP-UX `make' updates targets which have the same time stamps as
 | 
			
		||||
their prerequisites, which makes it generally unusable when shipped
 | 
			
		||||
generated files such as `configure' are involved.  Use GNU `make'
 | 
			
		||||
instead.
 | 
			
		||||
 | 
			
		||||
   On OSF/1 a.k.a. Tru64, some versions of the default C compiler cannot
 | 
			
		||||
parse its `<wchar.h>' header file.  The option `-nodtk' can be used as
 | 
			
		||||
a workaround.  If GNU CC is not installed, it is therefore recommended
 | 
			
		||||
to try
 | 
			
		||||
 | 
			
		||||
     ./configure CC="cc"
 | 
			
		||||
 | 
			
		||||
and if that doesn't work, try
 | 
			
		||||
 | 
			
		||||
     ./configure CC="cc -nodtk"
 | 
			
		||||
 | 
			
		||||
   On Solaris, don't put `/usr/ucb' early in your `PATH'.  This
 | 
			
		||||
directory contains several dysfunctional programs; working variants of
 | 
			
		||||
these programs are available in `/usr/bin'.  So, if you need `/usr/ucb'
 | 
			
		||||
in your `PATH', put it _after_ `/usr/bin'.
 | 
			
		||||
 | 
			
		||||
   On Haiku, software installed for all users goes in `/boot/common',
 | 
			
		||||
not `/usr/local'.  It is recommended to use the following options:
 | 
			
		||||
 | 
			
		||||
     ./configure --prefix=/boot/common
 | 
			
		||||
 | 
			
		||||
Specifying the System Type
 | 
			
		||||
==========================
 | 
			
		||||
 | 
			
		||||
There may be some features `configure' cannot figure out automatically,
 | 
			
		||||
but needs to determine by the type of machine the package will run on.
 | 
			
		||||
Usually, assuming the package is built to be run on the _same_
 | 
			
		||||
architectures, `configure' can figure that out, but if it prints a
 | 
			
		||||
message saying it cannot guess the machine type, give it the
 | 
			
		||||
   There may be some features `configure' cannot figure out
 | 
			
		||||
automatically, but needs to determine by the type of machine the package
 | 
			
		||||
will run on.  Usually, assuming the package is built to be run on the
 | 
			
		||||
_same_ architectures, `configure' can figure that out, but if it prints
 | 
			
		||||
a message saying it cannot guess the machine type, give it the
 | 
			
		||||
`--build=TYPE' option.  TYPE can either be a short name for the system
 | 
			
		||||
type, such as `sun4', or a canonical name which has the form:
 | 
			
		||||
 | 
			
		||||
@@ -159,7 +267,8 @@ type, such as `sun4', or a canonical name which has the form:
 | 
			
		||||
 | 
			
		||||
where SYSTEM can have one of these forms:
 | 
			
		||||
 | 
			
		||||
     OS KERNEL-OS
 | 
			
		||||
     OS
 | 
			
		||||
     KERNEL-OS
 | 
			
		||||
 | 
			
		||||
   See the file `config.sub' for the possible values of each field.  If
 | 
			
		||||
`config.sub' isn't included in this package, then this package doesn't
 | 
			
		||||
@@ -177,9 +286,9 @@ eventually be run) with `--host=TYPE'.
 | 
			
		||||
Sharing Defaults
 | 
			
		||||
================
 | 
			
		||||
 | 
			
		||||
If you want to set default values for `configure' scripts to share, you
 | 
			
		||||
can create a site shell script called `config.site' that gives default
 | 
			
		||||
values for variables like `CC', `cache_file', and `prefix'.
 | 
			
		||||
   If you want to set default values for `configure' scripts to share,
 | 
			
		||||
you can create a site shell script called `config.site' that gives
 | 
			
		||||
default values for variables like `CC', `cache_file', and `prefix'.
 | 
			
		||||
`configure' looks for `PREFIX/share/config.site' if it exists, then
 | 
			
		||||
`PREFIX/etc/config.site' if it exists.  Or, you can set the
 | 
			
		||||
`CONFIG_SITE' environment variable to the location of the site script.
 | 
			
		||||
@@ -188,7 +297,7 @@ A warning: not all `configure' scripts look for a site script.
 | 
			
		||||
Defining Variables
 | 
			
		||||
==================
 | 
			
		||||
 | 
			
		||||
Variables not defined in a site shell script can be set in the
 | 
			
		||||
   Variables not defined in a site shell script can be set in the
 | 
			
		||||
environment passed to `configure'.  However, some packages may run
 | 
			
		||||
configure again during the build, and the customized values of these
 | 
			
		||||
variables may be lost.  In order to avoid this problem, you should set
 | 
			
		||||
@@ -200,18 +309,27 @@ causes the specified `gcc' to be used as the C compiler (unless it is
 | 
			
		||||
overridden in the site shell script).
 | 
			
		||||
 | 
			
		||||
Unfortunately, this technique does not work for `CONFIG_SHELL' due to
 | 
			
		||||
an Autoconf bug.  Until the bug is fixed you can use this workaround:
 | 
			
		||||
an Autoconf limitation.  Until the limitation is lifted, you can use
 | 
			
		||||
this workaround:
 | 
			
		||||
 | 
			
		||||
     CONFIG_SHELL=/bin/bash /bin/bash ./configure CONFIG_SHELL=/bin/bash
 | 
			
		||||
     CONFIG_SHELL=/bin/bash ./configure CONFIG_SHELL=/bin/bash
 | 
			
		||||
 | 
			
		||||
`configure' Invocation
 | 
			
		||||
======================
 | 
			
		||||
 | 
			
		||||
`configure' recognizes the following options to control how it operates.
 | 
			
		||||
   `configure' recognizes the following options to control how it
 | 
			
		||||
operates.
 | 
			
		||||
 | 
			
		||||
`--help'
 | 
			
		||||
`-h'
 | 
			
		||||
     Print a summary of the options to `configure', and exit.
 | 
			
		||||
     Print a summary of all of the options to `configure', and exit.
 | 
			
		||||
 | 
			
		||||
`--help=short'
 | 
			
		||||
`--help=recursive'
 | 
			
		||||
     Print a summary of the options unique to this package's
 | 
			
		||||
     `configure', and exit.  The `short' variant lists options used
 | 
			
		||||
     only in the top level, while the `recursive' variant lists options
 | 
			
		||||
     also present in any nested packages.
 | 
			
		||||
 | 
			
		||||
`--version'
 | 
			
		||||
`-V'
 | 
			
		||||
@@ -238,6 +356,15 @@ an Autoconf bug.  Until the bug is fixed you can use this workaround:
 | 
			
		||||
     Look for the package's source code in directory DIR.  Usually
 | 
			
		||||
     `configure' can determine that directory automatically.
 | 
			
		||||
 | 
			
		||||
`--prefix=DIR'
 | 
			
		||||
     Use DIR as the installation prefix.  *note Installation Names::
 | 
			
		||||
     for more details, including other options available for fine-tuning
 | 
			
		||||
     the installation locations.
 | 
			
		||||
 | 
			
		||||
`--no-create'
 | 
			
		||||
`-n'
 | 
			
		||||
     Run the configure checks, but stop before creating any output
 | 
			
		||||
     files.
 | 
			
		||||
 | 
			
		||||
`configure' also accepts some other, not widely useful, options.  Run
 | 
			
		||||
`configure --help' for more details.
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										64
									
								
								Makefile.am
									
									
									
									
									
								
							
							
						
						
									
										64
									
								
								Makefile.am
									
									
									
									
									
								
							@@ -3,7 +3,7 @@ if WANT_DOC
 | 
			
		||||
SUBDIRS += doc
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
DIST_SUBDIRS = $(SUBDIRS) contrib src/common
 | 
			
		||||
DIST_SUBDIRS = $(SUBDIRS) src/common
 | 
			
		||||
 | 
			
		||||
ACLOCAL_AMFLAGS = -I m4 --install
 | 
			
		||||
AM_MAKEFLAGS = --no-print-directory
 | 
			
		||||
@@ -13,43 +13,48 @@ DISTCHECK_CONFIGURE_FLAGS = --enable-doc --disable-git-version
 | 
			
		||||
 | 
			
		||||
# Some files automatically included, so they aren't specified below:
 | 
			
		||||
#   AUTHORS, COPYING, NEWS, README
 | 
			
		||||
EXTRA_DIST = HACKING
 | 
			
		||||
EXTRA_DIST = HACKING test/tap.sh
 | 
			
		||||
 | 
			
		||||
# Sample makepkg prototype files
 | 
			
		||||
pkgdatadir = ${datadir}/${PACKAGE}
 | 
			
		||||
dist_pkgdata_DATA = \
 | 
			
		||||
	proto/PKGBUILD.proto \
 | 
			
		||||
	proto/PKGBUILD-split.proto \
 | 
			
		||||
	proto/proto.install \
 | 
			
		||||
	proto/ChangeLog.proto
 | 
			
		||||
	proto/PKGBUILD-vcs.proto \
 | 
			
		||||
	proto/proto.install
 | 
			
		||||
 | 
			
		||||
# run the pactest test suite and vercmp tests
 | 
			
		||||
check-local: test-pacman test-pacsort test-vercmp test-parseopts
 | 
			
		||||
$(top_srcdir)/test/pacman/tests/TESTS: $(wildcard test/pacman/tests/*.py)
 | 
			
		||||
	@printf "TESTS += %s\n" $^ | LC_ALL=C sort -u > "$@"
 | 
			
		||||
 | 
			
		||||
test-pacman: test/pacman src/pacman
 | 
			
		||||
	LC_ALL=C $(PYTHON) $(top_srcdir)/test/pacman/pactest.py --debug=1 \
 | 
			
		||||
		--test $(top_srcdir)/test/pacman/tests/*.py \
 | 
			
		||||
TESTS =  test/scripts/parseopts_test.sh \
 | 
			
		||||
				 test/scripts/human_to_size_test.sh \
 | 
			
		||||
				 test/scripts/makepkg-template_test.sh \
 | 
			
		||||
				 test/scripts/pacman-db-upgrade-v9.py \
 | 
			
		||||
				 test/util/vercmptest.sh
 | 
			
		||||
include $(top_srcdir)/test/pacman/tests/TESTS
 | 
			
		||||
 | 
			
		||||
TEST_SUITE_LOG = test/test-suite.log
 | 
			
		||||
TEST_EXTENSIONS = .py
 | 
			
		||||
AM_TESTS_ENVIRONMENT = \
 | 
			
		||||
	PMTEST_UTIL_DIR=$(top_builddir)/src/util/; export PMTEST_UTIL_DIR; \
 | 
			
		||||
	PMTEST_SCRIPT_DIR=$(top_builddir)/scripts/; export PMTEST_SCRIPT_DIR; \
 | 
			
		||||
	PMTEST_SCRIPTLIB_DIR=$(top_srcdir)/scripts/library/; export PMTEST_SCRIPTLIB_DIR; \
 | 
			
		||||
	PMTEST_LIBMAKEPKG_DIR=$(top_builddir)/scripts/libmakepkg/; export PMTEST_LIBMAKEPKG_DIR;
 | 
			
		||||
LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
 | 
			
		||||
								 $(top_srcdir)/build-aux/tap-driver.sh
 | 
			
		||||
PY_LOG_DRIVER = env AM_TAP_AWK='$(AWK)' $(SHELL) \
 | 
			
		||||
								 $(top_srcdir)/build-aux/tap-driver.sh
 | 
			
		||||
PY_LOG_COMPILER = $(PYTHON) $(top_srcdir)/test/pacman/pactest.py
 | 
			
		||||
AM_PY_LOG_FLAGS = \
 | 
			
		||||
		--scriptlet-shell $(SCRIPTLET_SHELL) \
 | 
			
		||||
		--ldconfig $(LDCONFIG) \
 | 
			
		||||
		-p $(top_builddir)/src/pacman/pacman
 | 
			
		||||
		--bindir $(top_builddir)/src/pacman \
 | 
			
		||||
		--bindir $(top_builddir)/scripts
 | 
			
		||||
 | 
			
		||||
test-pacsort: test/util src/util
 | 
			
		||||
	$(BASH_SHELL) $(top_srcdir)/test/util/pacsorttest.sh \
 | 
			
		||||
		$(top_builddir)/src/util/pacsort
 | 
			
		||||
 | 
			
		||||
test-vercmp: test/util src/util
 | 
			
		||||
	$(BASH_SHELL) $(top_srcdir)/test/util/vercmptest.sh \
 | 
			
		||||
		$(top_builddir)/src/util/vercmp
 | 
			
		||||
 | 
			
		||||
test-parseopts: test/scripts scripts
 | 
			
		||||
	$(BASH_SHELL) $(top_srcdir)/test/scripts/parseopts_test.sh \
 | 
			
		||||
		$(top_srcdir)/scripts/library/parseopts.sh
 | 
			
		||||
	$(BASH_SHELL) $(top_srcdir)/test/scripts/human_to_size_test.sh \
 | 
			
		||||
		$(top_srcdir)/scripts/library/human_to_size.sh
 | 
			
		||||
 | 
			
		||||
# create the pacman DB and cache directories upon install
 | 
			
		||||
# create the pacman DB, cache, makepkg-template and system hook directories upon install
 | 
			
		||||
install-data-local:
 | 
			
		||||
	for dir in "$(DESTDIR)$(localstatedir)/lib/pacman" "$(DESTDIR)$(localstatedir)/cache/pacman/pkg"; do \
 | 
			
		||||
	for dir in "$(DESTDIR)$(localstatedir)/lib/pacman" "$(DESTDIR)$(localstatedir)/cache/pacman/pkg" \
 | 
			
		||||
	           "$(DESTDIR)$(datarootdir)/makepkg-template" "$(DESTDIR)$(datarootdir)/libalpm/hooks"; do \
 | 
			
		||||
	  test -z "$$dir" || $(MKDIR_P) "$$dir"; \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
@@ -58,6 +63,9 @@ update-po:
 | 
			
		||||
	$(MAKE) -C scripts/po update-po
 | 
			
		||||
	$(MAKE) -C src/pacman/po update-po
 | 
			
		||||
 | 
			
		||||
.PHONY: test-pacman test-pacsort test-vercmp test-parseopts update-po
 | 
			
		||||
update-copyright:
 | 
			
		||||
	for file in $(shell sh -c 'git grep -l "Copyright .* Pacman Development" | grep -v "\.po"'); do \
 | 
			
		||||
	  sed -i -e "/Copyright (/s/-$(OLD)/-$(NEW)/" -e "/Copyright (/s/ $(OLD)/ $(OLD)-$(NEW)/" "$$file"; \
 | 
			
		||||
	done
 | 
			
		||||
 | 
			
		||||
# vim:set ts=2 sw=2 noet:
 | 
			
		||||
.PHONY: update-po update-copyright
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										339
									
								
								NEWS
									
									
									
									
									
								
							
							
						
						
									
										339
									
								
								NEWS
									
									
									
									
									
								
							@@ -1,5 +1,340 @@
 | 
			
		||||
VERSION         DESCRIPTION
 | 
			
		||||
-----------------------------------------------------------------------------
 | 
			
		||||
5.1.3         - Sanitize file path received from Content-Disposition header
 | 
			
		||||
                to fix potential arbitary code execution
 | 
			
		||||
5.1.2         - pacman-conf: add missing DisableDownloadTimeout support
 | 
			
		||||
              - Include version when checking optdepend install status
 | 
			
		||||
                during -Qi (FS#60106)
 | 
			
		||||
              - Improve error message for unresolvable urls (FS#48285)
 | 
			
		||||
              - Do not raise SIGINT when a downloaded file exceeds the expected
 | 
			
		||||
                size
 | 
			
		||||
              - Fix previous download interruption status carrying over to new
 | 
			
		||||
                downloads
 | 
			
		||||
              - Reset known signal handlers before running install scripts or
 | 
			
		||||
                hooks (FS#56756)
 | 
			
		||||
              - Properly handle signal interrupts while running install scripts
 | 
			
		||||
                or hooks (FS#60396)
 | 
			
		||||
              - Allow explicitly disabling signature checks when compiled
 | 
			
		||||
                without signature support (FS#60880)
 | 
			
		||||
              - makepkg: fix linting error on environment variables (FS#60681)
 | 
			
		||||
5.1.1         - Allow full path including root prefix to be passed to
 | 
			
		||||
                --overwrite
 | 
			
		||||
              - Revert deprecation of --root
 | 
			
		||||
              - Document comment syntax restrictions in pacman.conf
 | 
			
		||||
              - makepkg:
 | 
			
		||||
                - handle pre-existing directories when checking for write
 | 
			
		||||
                  permissions
 | 
			
		||||
                - reduce restrictions on pkgver in depends listings (FS#58776)
 | 
			
		||||
                - permit versioned optdepends
 | 
			
		||||
                - remove unintended chmod of $BUILDDIR (FS#58790)
 | 
			
		||||
                - fix issue when $startdir was not an absolute path (FS#58865)
 | 
			
		||||
                - fix syntax error when $pkgname is empty
 | 
			
		||||
                - fix --nocolor being passed to pacman (FS#58820)
 | 
			
		||||
                - fix issues with trap handling
 | 
			
		||||
                - fix several issues with debug packages (signing, printing of
 | 
			
		||||
                  package names, clearing of global package options, source
 | 
			
		||||
                  file inclusion)
 | 
			
		||||
                - fix --help text for --packagelist
 | 
			
		||||
              - pacman-conf: Fix detection of Usage option
 | 
			
		||||
5.1.0         - Add new --overwrite option and deprecate --force. This accepts a
 | 
			
		||||
                glob pattern with far more control than the widely abused force
 | 
			
		||||
                option which mostly just causes issues (FS#31549)
 | 
			
		||||
              - Add new --sysroot option and deprecate --root. This uses the
 | 
			
		||||
                guest configuration instead of the host configuration, which is
 | 
			
		||||
                what most people erroneously thought --root would do
 | 
			
		||||
              - introduce a 'disable-download-timeout' option
 | 
			
		||||
              - remove contrib - this is now maintained in a separate project
 | 
			
		||||
              - report the owner of an existing file, if any, when erroring out
 | 
			
		||||
                on a file conflict
 | 
			
		||||
              - resolve cyclic dependencies when calculating unneeded dependency
 | 
			
		||||
                trees (FS#41031)
 | 
			
		||||
              - report the needed command to download missing databases for the
 | 
			
		||||
                -F and -S actions
 | 
			
		||||
              - don't error if -Qo cannot find the file it is querying on disk
 | 
			
		||||
                (FS#55856)
 | 
			
		||||
              - support new-style OpenPGP format packets lengths
 | 
			
		||||
              - support EDDSA from gpgme 1.7.0
 | 
			
		||||
              - fix continuously trying to open invalid databases and reporting
 | 
			
		||||
                excessively excessive redundant error messages excessively
 | 
			
		||||
              - fix the download callback erroneously reporting itself too many
 | 
			
		||||
                times with --noprogressbar, or reporting inaccurate times for
 | 
			
		||||
                small files (FS#56408, FS#56468)
 | 
			
		||||
              - fix erroneous negative speed in download progressbar (FS#43434)
 | 
			
		||||
              - parse stdin as newline-separated instead of whitespace-separated
 | 
			
		||||
                (FS#52992)
 | 
			
		||||
              - when printing urls in the package cache, print the file url
 | 
			
		||||
                instead (FS#15868)
 | 
			
		||||
              - add color to group selection dialogs and -{F,Q}o
 | 
			
		||||
              - the -Q option now respects provides (FS#20650)
 | 
			
		||||
              - remove notification of system upgrade when only printing URLs
 | 
			
		||||
              - print replacements when using -Sup (FS#35812)
 | 
			
		||||
              - fix -Qk and -r checking for the root prefix twice (FS#48563)
 | 
			
		||||
              - Do not recognize # as a comment unless it is at the beginning of
 | 
			
		||||
                a line. This allows using it as a value in ini files (FS#48702)
 | 
			
		||||
              - ignore comments when examining INSTALL files (FS#51916)
 | 
			
		||||
              - match multi-byte user input properly (FS#47992)
 | 
			
		||||
              - abort transactions if even one database fails to sync (FS#47599)
 | 
			
		||||
              - do not resolve uid/gid to names when extracting files with -r
 | 
			
		||||
              - --dbonly now properly extracts metadata files (FS#52052)
 | 
			
		||||
              - remove support for internal checksumming implementations, and
 | 
			
		||||
                require at least one of openssl or nettle to exist
 | 
			
		||||
              - consider provides to satisfy optdepends when warning for removal
 | 
			
		||||
                or logging new optdepends during a transaction, as was already
 | 
			
		||||
                the case for -Qi
 | 
			
		||||
              - -Dk now reports if it is successful (FS#50087)
 | 
			
		||||
              - consider version for optdepends (FS#44957)
 | 
			
		||||
              - remove vim modelines in favor of EditorConfig
 | 
			
		||||
              - implement pacman-conf, a new tool to safely parse pacman.conf,
 | 
			
		||||
                and use it in internal scripts
 | 
			
		||||
              - bash completion now completes -Qn
 | 
			
		||||
              - various small documentation updates
 | 
			
		||||
              - makepkg:
 | 
			
		||||
                - Reproducible build support. makepkg now respects environment
 | 
			
		||||
                  SOURCE_DATE_EPOCH when creating package metadata, and unifies
 | 
			
		||||
                  source file timestamps to match
 | 
			
		||||
                - add more info to .BUILDINFO to aid in reproducing the build
 | 
			
		||||
                  environment of a package
 | 
			
		||||
                - it is now possible to check the signature of VCS sources
 | 
			
		||||
                  (currently only git is supported)
 | 
			
		||||
                - use informative exit codes when exiting with errors (FS#54204)
 | 
			
		||||
                - lint_pkgbuild has vastly improved linting of pkgname and
 | 
			
		||||
                  variables that can contain pkgname/pkgver (FS#57833)
 | 
			
		||||
                - implement linting for makepkg.conf
 | 
			
		||||
                - fix using libmakepkg in external scripts without extglob
 | 
			
		||||
                - fix handling of configurable directories e.g. PKGDEST to align
 | 
			
		||||
                  with their documented behavior, and consistently check that
 | 
			
		||||
                  they can be used (FS#43537)
 | 
			
		||||
                - parseopts, srcinfo, and integrity are now part of libmakepkg
 | 
			
		||||
                - consistently use coreutils for checksumming instead of openssl
 | 
			
		||||
                  (which may be replaced by nettle in pacman)
 | 
			
		||||
                - lint build_references now prints affected filenames (FS#31558)
 | 
			
		||||
                - lint_package can now abort on fatal packaging errors
 | 
			
		||||
                - lint_package now checks for filenames with newline characters
 | 
			
		||||
                - lint_package now checks for root-level /.dotfiles
 | 
			
		||||
                - debug packages are now per pkgbase, not per pkgname
 | 
			
		||||
                - debug packages now contain source files to allow the debugger
 | 
			
		||||
                  to step through code
 | 
			
		||||
                - remove optipng and upx support - these can now be plugged into
 | 
			
		||||
                  libmakepkg
 | 
			
		||||
                - fix emptydirs support with newer findutils (FS#48515)
 | 
			
		||||
                - ignore architecture for --printsrcinfo
 | 
			
		||||
                - makepkg --printsrcinfo now correctly lists depends_$CARCH
 | 
			
		||||
                  instead of merging this into depends
 | 
			
		||||
                - fix bug in is_array that broke packages with arch-dependent
 | 
			
		||||
                  sources only (FS#48340)
 | 
			
		||||
                - move package signing outside of fakeroot which is incompatible
 | 
			
		||||
                  with recent gnupg versions (FS#49946)
 | 
			
		||||
                - makepkg --clean now cleans up logfiles (FS#51039)
 | 
			
		||||
                - when using $PKGDEST, do not symlink build artifacts into
 | 
			
		||||
                  current directory
 | 
			
		||||
                - --packagelist now lists the built filenames, rather than all
 | 
			
		||||
                  possible basenames without extensions
 | 
			
		||||
                - fix --geninteg not properly ignoring renamed signature files
 | 
			
		||||
                - use localized date strings
 | 
			
		||||
                - ensure sane umask is set both before and after installing deps
 | 
			
		||||
                - adapt to file(1) changes in order to continue to strip PIE
 | 
			
		||||
                  executables
 | 
			
		||||
              - repo-add:
 | 
			
		||||
                - don't recreate the database when only verifying signature
 | 
			
		||||
                  (FS#48085)
 | 
			
		||||
                - fix error when repo directory path contains spaces (FS#50285)
 | 
			
		||||
              - pacman-key:
 | 
			
		||||
                - reject armored signatures
 | 
			
		||||
                - don't set a default keyserver, deferring to gpg's sane default
 | 
			
		||||
                - disable scdaemon as we don't use it and it breaks --lsign when
 | 
			
		||||
                  a smartcard is plugged into the machine
 | 
			
		||||
              - vercmp:
 | 
			
		||||
                - remove duplicate, undocumented --usage option
 | 
			
		||||
                - fail when the wrong number of arguments are used (FS#49093)
 | 
			
		||||
5.0.1         - fix alignment issues with wide character locales (FS#47980)
 | 
			
		||||
              - fix removal of .pacnew files (FS#47993)
 | 
			
		||||
              - fix triggering of Install hooks (FS#47996)
 | 
			
		||||
              - fix handling of stdin scripts called by pacman
 | 
			
		||||
              - hook activity is logged
 | 
			
		||||
              - documentataion updates for alpm-hooks (FS#48080)
 | 
			
		||||
              - makepkg:
 | 
			
		||||
                - increase robustness of variable array checks
 | 
			
		||||
                - makepkg -g does not perform current architecture checks
 | 
			
		||||
                - do not run prepare() with --noextract
 | 
			
		||||
                - all directories in the packaging directory are cleared
 | 
			
		||||
                  before each build
 | 
			
		||||
                - fix translations issues (FS#48057, FS#48298)
 | 
			
		||||
              - repo-add:
 | 
			
		||||
                - fix checking for non-existent database
 | 
			
		||||
              - contrib:
 | 
			
		||||
                - zsh_completion: updated makepkg options
 | 
			
		||||
5.0.0         - pacman can run hooks pre- and post-transaction. See the
 | 
			
		||||
                alpm-hooks(5) man page for details and an example hook (FS#2985)
 | 
			
		||||
              - pacman can now sync and read .files databases (-Fy) and do basic
 | 
			
		||||
                searching for files in sync repos (-Fs, -Fo) (FS#23787)
 | 
			
		||||
              - pacman can check the validity of the local and sync databases
 | 
			
		||||
                (-Dk and -Dkk respectively).  This replaces the 'testdb'
 | 
			
		||||
                software (FS#42444)
 | 
			
		||||
              - the package description output (-Si ,-Qi) is now correctly
 | 
			
		||||
                aligned regardless of locale (FS#43983, FS#45997)
 | 
			
		||||
              - ensure internal package version matches database version after
 | 
			
		||||
                downloading (FS#45687)
 | 
			
		||||
              - improved signal handling and lock file removal (FS#45995,
 | 
			
		||||
                FS#46375, FS#47011)
 | 
			
		||||
              - print more information when encountering dependency errors
 | 
			
		||||
              - improved configuration parsing with a new ini parser
 | 
			
		||||
              - handle a symlink to a directory being replaced by a directory
 | 
			
		||||
              - The 'pkgbase' variable is now recorded in the local package db
 | 
			
		||||
              - Remove support for ".pacorig" files.  Instead, packages files
 | 
			
		||||
                are extracted as a ".pacnew" and the original stays in place
 | 
			
		||||
              - prevent install scriptlets using stdin for user interaction
 | 
			
		||||
              - provides are considered when displaying optdepends install
 | 
			
		||||
                status (FS#36412)
 | 
			
		||||
              - always update corrupt database whether or not a newer version
 | 
			
		||||
                is found on the remote server
 | 
			
		||||
              - fix build issues when libarchive was in a non-standard location
 | 
			
		||||
              - Many issues found using Coverity were address (primarily freeing
 | 
			
		||||
                memory on error conditions)
 | 
			
		||||
              - The pactest suite was upgraded to allow parallel testing using
 | 
			
		||||
                the tap.sh library
 | 
			
		||||
              - makepkg:
 | 
			
		||||
                - makepkg is in the process of being split into a library. This
 | 
			
		||||
                  allows various areas to be extended by adding a file into
 | 
			
		||||
                  libmakepkg (e.g. package/PKGBUILD checking, adjusting
 | 
			
		||||
                  files before creating the final package).
 | 
			
		||||
                - PKGBUILD variables checked to be arrays or not as appropriate
 | 
			
		||||
                - pkgver() and prepare() are now run with --noextract (FS#43498,
 | 
			
		||||
                  FS#46800)
 | 
			
		||||
                - the ability to build a single package in a PKGBUILD has been
 | 
			
		||||
                  removed
 | 
			
		||||
                - the output when checking checksums for architecture specific
 | 
			
		||||
                  sources is improved (FS#43444)
 | 
			
		||||
                - improved handling of bazaar sources (FS#43448)
 | 
			
		||||
                - fix source package signing with SRCPKGDIR set
 | 
			
		||||
                - add option to compress png images with optipng
 | 
			
		||||
                - add --packagelist option, which lists all packages build from
 | 
			
		||||
                  a PKGBUILD
 | 
			
		||||
                - add --printsrcinfo flag to print SRCINFO file for a PKGBUILD
 | 
			
		||||
                - record build information in a .BUILDINFO file
 | 
			
		||||
                - add whirlpool to list of hashing options (FS#45859)
 | 
			
		||||
              - makepkg-template:
 | 
			
		||||
                - support multiple --template-dir
 | 
			
		||||
                - added a testsuite
 | 
			
		||||
              - repo-add:
 | 
			
		||||
                - Always generate the .files database
 | 
			
		||||
                - Only update database if the entire operation succeeds
 | 
			
		||||
                - unarmored package signatures are rejected
 | 
			
		||||
              - contrib:
 | 
			
		||||
                - checkupdates: give error when fakeroot is missing
 | 
			
		||||
                - checkupdates: provide packages versions in output
 | 
			
		||||
                - checkupdates: fix failure in some locales (FS#40405)
 | 
			
		||||
                - paccache: Add -q/--quiet
 | 
			
		||||
                - pacdiff: do not require DIFFPROG for -o/--output (FS#46184)
 | 
			
		||||
                - zsh_completion: updated to fix many missing options
 | 
			
		||||
4.2.1         - Remove warnings about incorrect directory ownership until
 | 
			
		||||
                packaging files with dynamic users/groups is improved
 | 
			
		||||
              - Do not require a specific automake version when building from
 | 
			
		||||
                the source tarball (FS#43655)
 | 
			
		||||
              - A number of typos and translation errors have been fixed
 | 
			
		||||
                (FS#43257, FS#43280, FS#43279, FS#43617, FS#43739)
 | 
			
		||||
              - set sane umask in pacman-db-upgrade (FS#43200) and make it
 | 
			
		||||
                more verbose
 | 
			
		||||
              - Use correct permissions when creating the log file
 | 
			
		||||
              - Fix memory management for file list storage
 | 
			
		||||
              - Set package origin when adding to db cache
 | 
			
		||||
              - makepkg:
 | 
			
		||||
                - Fix error when encountering an expired PGP key (FS#43269)
 | 
			
		||||
                - Fix error extracting PKGBUILD attributes (FS#43387)
 | 
			
		||||
                - Fix removal of static libraries when the shared library
 | 
			
		||||
                  uses the absolute path in symbolic links (FS#43395)
 | 
			
		||||
                - Improve Bazaar cloning (FS#43448)
 | 
			
		||||
                - Fix issues with architecture dependant checksum
 | 
			
		||||
                  verification (FS#43192)
 | 
			
		||||
                - Fix .SRCINFO file with architecture dependant fields
 | 
			
		||||
                  (FS#43247)
 | 
			
		||||
                - Fix compatibility with older bash versions
 | 
			
		||||
                - Allow git checkouts to be downloaded into directory ending
 | 
			
		||||
                  with ".git".
 | 
			
		||||
              - contrib:
 | 
			
		||||
                - updpkgsums no longer changes file permissions (FS#43272)
 | 
			
		||||
                - paccache does not remove all packages on libalpm error
 | 
			
		||||
                  (FS#43286)
 | 
			
		||||
4.2.0         - symlinks to directories on the filesystem are no longer
 | 
			
		||||
                treated as directories
 | 
			
		||||
              - pacman-db-upgrade - fix local database for files installed
 | 
			
		||||
                into directory symlinks
 | 
			
		||||
              - added --assume-installed option to help upgrades where not all
 | 
			
		||||
                installed packages have been rebuilt
 | 
			
		||||
              - --unrequired now filters needed optdepends too. Use twice
 | 
			
		||||
                to only filter direct dependencies
 | 
			
		||||
              - improved dependency resolving ensures correct ordering when
 | 
			
		||||
                installing updates (FS#32764)
 | 
			
		||||
              - A new configure keyword Usage can limit what operations a
 | 
			
		||||
                repository is used for
 | 
			
		||||
              - NoExtract and NoUpgrade can use inverted pattern matches
 | 
			
		||||
                (FS#31749)
 | 
			
		||||
              - Group queries can be filtered with --explicit/--deps (FS#19716)
 | 
			
		||||
              - Filesystem checking now only produces a warning for altered
 | 
			
		||||
                backup files (FS#34739)
 | 
			
		||||
              - pacman prints a warning if an installed directory has different
 | 
			
		||||
                permission to that already on the filesystem (FS#34740)
 | 
			
		||||
              - both current and new versions are displayed when querying
 | 
			
		||||
                updates
 | 
			
		||||
              - --print-format now implies --print
 | 
			
		||||
              - package scriptlets are not run when using --dbonly
 | 
			
		||||
              - invalid option combinations cause pacman to abort (FS#20950)
 | 
			
		||||
              - improve output when a package is missing a required signature
 | 
			
		||||
                (FS#28014)
 | 
			
		||||
              - PGP signature key IDs are listed with -Sii (FS#34742)
 | 
			
		||||
              - indicate ignored packages in -Qu output
 | 
			
		||||
              - use appropriate file size units with -Si/-Qi
 | 
			
		||||
              - plugged several memory leaks
 | 
			
		||||
              - read filelists from a packages .MTREE file if possible
 | 
			
		||||
              - ensure packages have all the required metadata before installing
 | 
			
		||||
                (FS#35514)
 | 
			
		||||
              - always remove lock file on exit (FS#35603)
 | 
			
		||||
              - fix overflow in integrity checking progress bar (FS#36608)
 | 
			
		||||
              - ensure downloads use correct filename even if the mirror uses a
 | 
			
		||||
                redirect (FS#36791)
 | 
			
		||||
              - cache PGP key IDs during availability checking (FS#38042)
 | 
			
		||||
              - fix reading responses with leading whitespace (FS#39976)
 | 
			
		||||
              - fix potential issues when handling of UTF8 filenames
 | 
			
		||||
                (FS#40805, FS#40762)
 | 
			
		||||
              - makepkg:
 | 
			
		||||
                - PKGBUILDs can now specify architecture specific sources,
 | 
			
		||||
                  dependencies, etc.
 | 
			
		||||
                - A .SRCINFO file is added to source packages for easy parsing
 | 
			
		||||
                - VCS package building attempts to be incremental (FS#35050)
 | 
			
		||||
                - bzr sources can have a '+' in them (FS#35244)
 | 
			
		||||
                - allow sources containing "::"
 | 
			
		||||
                - add --noprepare option
 | 
			
		||||
                - add -C/--cleanbuild option (FS#17175)
 | 
			
		||||
                - add --noarchive option
 | 
			
		||||
                - remove --asroot and enforce fakeroot usage
 | 
			
		||||
                - all PKGBUILDs require a package() function
 | 
			
		||||
                - PKGBUILDs can no longer be read from stdin
 | 
			
		||||
                - enable make style environmental overrides
 | 
			
		||||
                - Read CARCH environmental variable (FS#35030)
 | 
			
		||||
                - makedepends and checkdepends are installed together (FS#31557)
 | 
			
		||||
                - added support for sha224 checksums (FS#36776)
 | 
			
		||||
                - remove warning when license is not specified in PKGBUILD
 | 
			
		||||
                  (FS#37011)
 | 
			
		||||
                - only remove static libraries if they have a shared version
 | 
			
		||||
                - prevent makepkg creating armored signatures (FS#38503)
 | 
			
		||||
                - support stripping kernel modules
 | 
			
		||||
                - support the kernel.org PGP signing scheme (FS#31592)
 | 
			
		||||
                - sign created source package when using --sign
 | 
			
		||||
                - enforce source signatures to be trusted or have their full
 | 
			
		||||
                  fingerprint listed in the validpgpkeys array of the PKGBUILD
 | 
			
		||||
                - look for configuration in XDG_CONFIG_HOME/pacman/makepkg.conf
 | 
			
		||||
                  (FS#43030)
 | 
			
		||||
                - ensure vcs tools are available when source entries require
 | 
			
		||||
                  them
 | 
			
		||||
                - disallow pkgver/pkgrel/epoch overrides in split packages
 | 
			
		||||
                - improve parsing of PKGBUILD variables (FS#40361)
 | 
			
		||||
              - makepkg-template - new package build templating utility
 | 
			
		||||
                (FS#10375)
 | 
			
		||||
              - repo-add:
 | 
			
		||||
                - add option to remove package files from disk
 | 
			
		||||
              - contrib:
 | 
			
		||||
                - checkupdates: rename CHECKUPDATE_DB to CHECKUPDATES_DB
 | 
			
		||||
                - pacdiff: add a "Quit" option, and many other improvements
 | 
			
		||||
                - pacsysclean is removed
 | 
			
		||||
4.1.2         - validate %FILEPATH% when parsing repos to prevent arbitary
 | 
			
		||||
                file overwrites from malicious databases
 | 
			
		||||
              - makepkg:
 | 
			
		||||
@@ -655,7 +990,7 @@ VERSION         DESCRIPTION
 | 
			
		||||
                - fix overzealous use of macros
 | 
			
		||||
                - entire codebase builds with -pedantic GCC option
 | 
			
		||||
              - libalpm-specific changes:
 | 
			
		||||
                - moved location of sync DBs into their own folder to thwart
 | 
			
		||||
                - moved location of sync DBs into their own directory to thwart
 | 
			
		||||
                  deletion and remove naming limitations
 | 
			
		||||
                - REQUIREDBY entries are no longer used in local DB but are
 | 
			
		||||
                  computed on the fly when needed, which should resolve
 | 
			
		||||
@@ -1069,5 +1404,3 @@ VERSION         DESCRIPTION
 | 
			
		||||
                backed up, then it will be copied to "file.save"
 | 
			
		||||
              - Changed db_find_conflicts() to ignore directories
 | 
			
		||||
1.0           - Initial Release
 | 
			
		||||
 | 
			
		||||
vim: set et spell spelllang=en_us:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										124
									
								
								README
									
									
									
									
									
								
							
							
						
						
									
										124
									
								
								README
									
									
									
									
									
								
							@@ -507,3 +507,127 @@ API CHANGES BETWEEN 4.0 AND 4.1
 | 
			
		||||
   ALPM_EVENT_OPTDEP_REQUIRED, ALPM_EVENT_DATABASE_MISSING,
 | 
			
		||||
   ALPM_EVENT_KEYRING_START, ALPM_EVENT_KEYRING_DONE, ALPM_EVENT_KEY_DOWNLOAD_START,
 | 
			
		||||
   ALPM_EVENT_KEY_DOWNLOAD_DONE, ALPM_PROGRESS_KEYRING_START
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
API CHANGES BETWEEN 4.1 AND 4.2
 | 
			
		||||
===============================
 | 
			
		||||
 | 
			
		||||
[CHANGED]
 | 
			
		||||
- alpm_filelist_t - removed member resolved_path
 | 
			
		||||
- alpm_filelist_contains - now returns alpm_file_t
 | 
			
		||||
- event callback
 | 
			
		||||
   - alpm_event_t renamed to alpm_event_type_t
 | 
			
		||||
   - alpm_event_t union added
 | 
			
		||||
   - alpm_event_cb now takes only an alpm_event_t parameter
 | 
			
		||||
   - alpm_event_any_t, alpm_package_operation_t, alpm_event_package_operation_t,
 | 
			
		||||
     alpm_event_optdep_removal_t, alpm_event_delta_patch_t, alpm_event_scriptlet_info_t,
 | 
			
		||||
     alpm_event_database_missing_t, alpm_event_pkgdownload_t, alpm_event_pacnew_created_t,
 | 
			
		||||
     alpm_event_pacsave_created_t, alpm_event_pacorig_created_t added
 | 
			
		||||
   - ALPM_EVENT_*_START -> ALPM_EVENT_PACKAGE_OPERATION_START
 | 
			
		||||
   - ALPM_EVENT_*_DONE -> ALPM_EVENT_PACKAGE_OPERATION_DONE
 | 
			
		||||
- question callback
 | 
			
		||||
   - alpm_question_t renamed to alpm_question_type_t
 | 
			
		||||
   - alpm_question_t union added
 | 
			
		||||
   - alpm_cb_question now takes only an alpm_question_t parameter
 | 
			
		||||
   - alpm_question_any_t, alpm_question_install_ignorepkg_t, alpm_question_replace_t
 | 
			
		||||
     alpm_question_conflict_t, alpm_question_corrupted_t, alpm_question_remove_pkgs_t,
 | 
			
		||||
     alpm_question_select_provider_t, alpm_question_import_key_t added
 | 
			
		||||
 | 
			
		||||
[ADDED]
 | 
			
		||||
- memory management
 | 
			
		||||
  - alpm_fileconflict_free()
 | 
			
		||||
  - alpm_depmissing_free()
 | 
			
		||||
  - alpm_conflict_free()
 | 
			
		||||
  - alpm_dep_free()
 | 
			
		||||
- database usage
 | 
			
		||||
  - alpm_db_usage_t
 | 
			
		||||
  - alpm_db_set_usage()
 | 
			
		||||
  - alpm_db_get_usage()
 | 
			
		||||
- assume installed
 | 
			
		||||
  - alpm_option_get_assumeinstalled()
 | 
			
		||||
  - alpm_option_add_assumeinstalled()
 | 
			
		||||
  - alpm_option_set_assumeinstalled()
 | 
			
		||||
  - alpm_option_remove_assumeinstalled()
 | 
			
		||||
- using noupgrade/noextract
 | 
			
		||||
  - alpm_option_match_noupgrade()
 | 
			
		||||
  - alpm_option_match_noextract()
 | 
			
		||||
- utility functions
 | 
			
		||||
  - alpm_dep_from_string()
 | 
			
		||||
  - alpm_pkg_should_ignore()
 | 
			
		||||
  - alpm_decode_signature()
 | 
			
		||||
  - alpm_extract_keyid()
 | 
			
		||||
- flags
 | 
			
		||||
  - ALPM_EVENT_RETRIEVE_DONE, ALPM_EVENT_RETRIEVE_FAILED, ALPM_EVENT_PKGDOWNLOAD_START,
 | 
			
		||||
    ALPM_EVENT_PKGDOWNLOAD_DONE, ALPM_EVENT_PKGDOWNLOAD_FAILED, ALPM_EVENT_OPTDEP_REMOVAL,
 | 
			
		||||
    ALPM_EVENT_PACNEW_CREATED, ALPM_EVENT_PACSVAE_CREATED, ALPM_EVENT_PACORIG_CREATED
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
API CHANGES BETWEEN 4.2 AND 5.0
 | 
			
		||||
===============================
 | 
			
		||||
 | 
			
		||||
[REMOVED]
 | 
			
		||||
- alpm_siglevel_t - removed members ALPM_SIG_PACKAGE_SET, ALPM_SIG_PACKAGE_TRUST_SET
 | 
			
		||||
- removed .pacorig generation
 | 
			
		||||
  - ALPM_EVENT_PACORIG_CREATED
 | 
			
		||||
  - alpm_event_pacorig_created_t
 | 
			
		||||
  - alpm_event_t.pacorig_created
 | 
			
		||||
 | 
			
		||||
[ADDED]
 | 
			
		||||
- hook support
 | 
			
		||||
  - alpm_option_get_hookdirs()
 | 
			
		||||
  - alpm_option_set_hookdirs()
 | 
			
		||||
  - alpm_option_add_hookdir()
 | 
			
		||||
  - alpm_option_remove_hookdir()
 | 
			
		||||
  - alpm_event_hook_t, alpm_event_hook_run_t
 | 
			
		||||
  - alpm_hook_when_t
 | 
			
		||||
  - ALPM_EVENT_HOOK_START, ALPM_EVENT_HOOK_DONE
 | 
			
		||||
  - ALPM_EVENT_HOOK_RUN_START, ALPM_EVENT_HOOK_RUN_DONE
 | 
			
		||||
  - ALPM_ERR_TRANS_HOOK_FAILED
 | 
			
		||||
- different database extension support
 | 
			
		||||
  - alpm_option_get_dbext()
 | 
			
		||||
  - alpm_option_set_dbext()
 | 
			
		||||
- pkgbase accessor
 | 
			
		||||
  - alpm_pkg_get_base()
 | 
			
		||||
- transaction events
 | 
			
		||||
  - ALPM_EVENT_TRANSACTION_START, ALPM_EVENT_TRANSACTION_DONE
 | 
			
		||||
- database unlocking
 | 
			
		||||
  - alpm_unlock()
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
API CHANGES BETWEEN 5.0 AND 5.1
 | 
			
		||||
===============================
 | 
			
		||||
 | 
			
		||||
[CHANGED]
 | 
			
		||||
- alpm_errno_t - added member ALPM_ERR_OK
 | 
			
		||||
- alpm_siglevel_t - value of ALPM_SIG_USE_DEFAULT changed
 | 
			
		||||
- functions using bitfields return/pass an int instead of an enum
 | 
			
		||||
  - alpm_option_get_default_siglevel()
 | 
			
		||||
  - alpm_option_set_default_siglevel()
 | 
			
		||||
  - alpm_option_get_remote_file_siglevel()
 | 
			
		||||
  - alpm_option_set_remote_file_siglevel()
 | 
			
		||||
  - alpm_register_syncdb()
 | 
			
		||||
  - alpm_db_get_siglevel()
 | 
			
		||||
  - alpm_db_set_usage()
 | 
			
		||||
  - alpm_db_get_usage()
 | 
			
		||||
  - alpm_pkg_load()
 | 
			
		||||
  - alpm_pkg_get_validation()
 | 
			
		||||
  - alpm_trans_get_flags()
 | 
			
		||||
  - alpm_trans_init()
 | 
			
		||||
  - alpm_option_get_local_file_siglevel()
 | 
			
		||||
  - alpm_option_set_local_file_siglevel()
 | 
			
		||||
 | 
			
		||||
[ADDED]
 | 
			
		||||
- overwrite support
 | 
			
		||||
  - alpm_option_get_overwrite_files()
 | 
			
		||||
  - alpm_option_set_overwrite_files()
 | 
			
		||||
  - alpm_option_add_overwrite_file()
 | 
			
		||||
  - alpm_option_remove_overwrite_file()
 | 
			
		||||
- download timeout control
 | 
			
		||||
  - alpm_option_set_disable_dl_timeout()
 | 
			
		||||
- access make/checkdepends info
 | 
			
		||||
  - alpm_pkg_get_checkdepends()
 | 
			
		||||
  - alpm_pkg_get_makedepends()
 | 
			
		||||
- check pacman capabilities
 | 
			
		||||
  - alpm_capabilities()
 | 
			
		||||
- duplicate and add to list
 | 
			
		||||
  - alpm_list_append_strdup()
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										23
									
								
								RELEASE
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										23
									
								
								RELEASE
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,23 @@
 | 
			
		||||
The following checklist should be used for making a pacman release.
 | 
			
		||||
 | 
			
		||||
- Ensure "make distcheck" succeeds
 | 
			
		||||
- Call a freeze to development.
 | 
			
		||||
- Send translation updates to Transifex at least two weeks before a major
 | 
			
		||||
  release (see below).  At this stage, strings can only be changed for a
 | 
			
		||||
  major issue.
 | 
			
		||||
- Update NEWS and README files
 | 
			
		||||
- Pull translation updates from Transifex
 | 
			
		||||
- Update version in configure.ac as described in file
 | 
			
		||||
- Update doc/index.asciidoc
 | 
			
		||||
- Create a signed git tag (git tag -s vX.Y.Z -m "commit message")
 | 
			
		||||
- Create and sign release tarballs (generate with "make distcheck")
 | 
			
		||||
- Update pacman website
 | 
			
		||||
 | 
			
		||||
Transifex updates are handled using the transifex client. The basic process is:
 | 
			
		||||
- Pull updates from transifex ("tx pull -a -f --minimum-perc 75")
 | 
			
		||||
- Update po files ("make update-po")
 | 
			
		||||
- Fix all translation errors found
 | 
			
		||||
- Add any new locales to the relevant LINGUAS file
 | 
			
		||||
- Optional: Make any manual changes needed (e.g. fixing spacing in a string)
 | 
			
		||||
  and update po files again
 | 
			
		||||
- Push updated po files to transifex ("tx push -s -t --skip")
 | 
			
		||||
							
								
								
									
										22
									
								
								autoclean.sh
									
									
									
									
									
								
							
							
						
						
									
										22
									
								
								autoclean.sh
									
									
									
									
									
								
							@@ -1,22 +0,0 @@
 | 
			
		||||
#!/bin/sh -xu
 | 
			
		||||
 | 
			
		||||
[ -f Makefile ] && make distclean
 | 
			
		||||
 | 
			
		||||
rm -rf autom4te.cache
 | 
			
		||||
rm -f config.h.in config.h
 | 
			
		||||
rm -f config.status
 | 
			
		||||
rm -f configure
 | 
			
		||||
rm -f stamp*
 | 
			
		||||
rm -f aclocal.m4
 | 
			
		||||
rm -f compile
 | 
			
		||||
rm -f libtool
 | 
			
		||||
 | 
			
		||||
rm -f test/pacman/*.pyc
 | 
			
		||||
rm -f doc/html/*.html
 | 
			
		||||
rm -f doc/man3/*.3
 | 
			
		||||
 | 
			
		||||
find . \( -name 'Makefile' -o \
 | 
			
		||||
          -name 'Makefile.in' -o \
 | 
			
		||||
          -path '*/po/POTFILES' -o \
 | 
			
		||||
          -path '*/po/stamp-po' -o \
 | 
			
		||||
          -path '*/po/*.gmo' \) -exec rm -f {} +
 | 
			
		||||
							
								
								
									
										10
									
								
								autogen.sh
									
									
									
									
									
								
							
							
						
						
									
										10
									
								
								autogen.sh
									
									
									
									
									
								
							@@ -1,6 +1,6 @@
 | 
			
		||||
#!/bin/sh -xu
 | 
			
		||||
#!/bin/sh -x
 | 
			
		||||
 | 
			
		||||
aclocal -I m4 --install
 | 
			
		||||
autoheader
 | 
			
		||||
automake --foreign
 | 
			
		||||
autoconf
 | 
			
		||||
autoreconf -i
 | 
			
		||||
patch -d build-aux -Np0 -i ltmain-asneeded.patch
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										2
									
								
								build-aux/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										2
									
								
								build-aux/.gitignore
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@@ -0,0 +1,2 @@
 | 
			
		||||
*
 | 
			
		||||
!ltmain-asneeded.patch
 | 
			
		||||
							
								
								
									
										1505
									
								
								build-aux/config.guess
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1505
									
								
								build-aux/config.guess
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,614 +0,0 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
# Output a system dependent set of variables, describing how to set the
 | 
			
		||||
# run time search path of shared libraries in an executable.
 | 
			
		||||
#
 | 
			
		||||
#   Copyright 1996-2006 Free Software Foundation, Inc.
 | 
			
		||||
#   Taken from GNU libtool, 2001
 | 
			
		||||
#   Originally by Gordon Matzigkeit <gord@gnu.ai.mit.edu>, 1996
 | 
			
		||||
#
 | 
			
		||||
#   This file is free software; the Free Software Foundation gives
 | 
			
		||||
#   unlimited permission to copy and/or distribute it, with or without
 | 
			
		||||
#   modifications, as long as this notice is preserved.
 | 
			
		||||
#
 | 
			
		||||
# The first argument passed to this file is the canonical host specification,
 | 
			
		||||
#    CPU_TYPE-MANUFACTURER-OPERATING_SYSTEM
 | 
			
		||||
# or
 | 
			
		||||
#    CPU_TYPE-MANUFACTURER-KERNEL-OPERATING_SYSTEM
 | 
			
		||||
# The environment variables CC, GCC, LDFLAGS, LD, with_gnu_ld
 | 
			
		||||
# should be set by the caller.
 | 
			
		||||
#
 | 
			
		||||
# The set of defined variables is at the end of this script.
 | 
			
		||||
 | 
			
		||||
# Known limitations:
 | 
			
		||||
# - On IRIX 6.5 with CC="cc", the run time search patch must not be longer
 | 
			
		||||
#   than 256 bytes, otherwise the compiler driver will dump core. The only
 | 
			
		||||
#   known workaround is to choose shorter directory names for the build
 | 
			
		||||
#   directory and/or the installation directory.
 | 
			
		||||
 | 
			
		||||
# All known linkers require a `.a' archive for static linking (except MSVC,
 | 
			
		||||
# which needs '.lib').
 | 
			
		||||
libext=a
 | 
			
		||||
shrext=.so
 | 
			
		||||
 | 
			
		||||
host="$1"
 | 
			
		||||
host_cpu=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\1/'`
 | 
			
		||||
host_vendor=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\2/'`
 | 
			
		||||
host_os=`echo "$host" | sed 's/^\([^-]*\)-\([^-]*\)-\(.*\)$/\3/'`
 | 
			
		||||
 | 
			
		||||
# Code taken from libtool.m4's _LT_CC_BASENAME.
 | 
			
		||||
 | 
			
		||||
for cc_temp in $CC""; do
 | 
			
		||||
  case $cc_temp in
 | 
			
		||||
    compile | *[\\/]compile | ccache | *[\\/]ccache ) ;;
 | 
			
		||||
    distcc | *[\\/]distcc | purify | *[\\/]purify ) ;;
 | 
			
		||||
    \-*) ;;
 | 
			
		||||
    *) break;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
cc_basename=`echo "$cc_temp" | sed -e 's%^.*/%%'`
 | 
			
		||||
 | 
			
		||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_COMPILER_PIC.
 | 
			
		||||
 | 
			
		||||
wl=
 | 
			
		||||
if test "$GCC" = yes; then
 | 
			
		||||
  wl='-Wl,'
 | 
			
		||||
else
 | 
			
		||||
  case "$host_os" in
 | 
			
		||||
    aix*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    darwin*)
 | 
			
		||||
      case $cc_basename in
 | 
			
		||||
        xlc*)
 | 
			
		||||
          wl='-Wl,'
 | 
			
		||||
          ;;
 | 
			
		||||
      esac
 | 
			
		||||
      ;;
 | 
			
		||||
    mingw* | pw32* | os2*)
 | 
			
		||||
      ;;
 | 
			
		||||
    hpux9* | hpux10* | hpux11*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    irix5* | irix6* | nonstopux*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    newsos6)
 | 
			
		||||
      ;;
 | 
			
		||||
    linux*)
 | 
			
		||||
      case $cc_basename in
 | 
			
		||||
        icc* | ecc*)
 | 
			
		||||
          wl='-Wl,'
 | 
			
		||||
          ;;
 | 
			
		||||
        pgcc | pgf77 | pgf90)
 | 
			
		||||
          wl='-Wl,'
 | 
			
		||||
          ;;
 | 
			
		||||
        ccc*)
 | 
			
		||||
          wl='-Wl,'
 | 
			
		||||
          ;;
 | 
			
		||||
        como)
 | 
			
		||||
          wl='-lopt='
 | 
			
		||||
          ;;
 | 
			
		||||
        *)
 | 
			
		||||
          case `$CC -V 2>&1 | sed 5q` in
 | 
			
		||||
            *Sun\ C*)
 | 
			
		||||
              wl='-Wl,'
 | 
			
		||||
              ;;
 | 
			
		||||
          esac
 | 
			
		||||
          ;;
 | 
			
		||||
      esac
 | 
			
		||||
      ;;
 | 
			
		||||
    osf3* | osf4* | osf5*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    sco3.2v5*)
 | 
			
		||||
      ;;
 | 
			
		||||
    solaris*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    sunos4*)
 | 
			
		||||
      wl='-Qoption ld '
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv4 | sysv4.2uw2* | sysv4.3* | sysv5*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv4*MP*)
 | 
			
		||||
      ;;
 | 
			
		||||
    unicos*)
 | 
			
		||||
      wl='-Wl,'
 | 
			
		||||
      ;;
 | 
			
		||||
    uts4*)
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Code taken from libtool.m4's AC_LIBTOOL_PROG_LD_SHLIBS.
 | 
			
		||||
 | 
			
		||||
hardcode_libdir_flag_spec=
 | 
			
		||||
hardcode_libdir_separator=
 | 
			
		||||
hardcode_direct=no
 | 
			
		||||
hardcode_minus_L=no
 | 
			
		||||
 | 
			
		||||
case "$host_os" in
 | 
			
		||||
  cygwin* | mingw* | pw32*)
 | 
			
		||||
    # FIXME: the MSVC++ port hasn't been tested in a loooong time
 | 
			
		||||
    # When not using gcc, we currently assume that we are using
 | 
			
		||||
    # Microsoft Visual C++.
 | 
			
		||||
    if test "$GCC" != yes; then
 | 
			
		||||
      with_gnu_ld=no
 | 
			
		||||
    fi
 | 
			
		||||
    ;;
 | 
			
		||||
  interix*)
 | 
			
		||||
    # we just hope/assume this is gcc and not c89 (= MSVC++)
 | 
			
		||||
    with_gnu_ld=yes
 | 
			
		||||
    ;;
 | 
			
		||||
  openbsd*)
 | 
			
		||||
    with_gnu_ld=no
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
ld_shlibs=yes
 | 
			
		||||
if test "$with_gnu_ld" = yes; then
 | 
			
		||||
  # Set some defaults for GNU ld with shared library support. These
 | 
			
		||||
  # are reset later if shared libraries are not supported. Putting them
 | 
			
		||||
  # here allows them to be overridden if necessary.
 | 
			
		||||
  # Unlike libtool, we use -rpath here, not --rpath, since the documented
 | 
			
		||||
  # option of GNU ld is called -rpath, not --rpath.
 | 
			
		||||
  hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 | 
			
		||||
  case "$host_os" in
 | 
			
		||||
    aix3* | aix4* | aix5*)
 | 
			
		||||
      # On AIX/PPC, the GNU linker is very broken
 | 
			
		||||
      if test "$host_cpu" != ia64; then
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    amigaos*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      # Samuel A. Falvo II <kc5tja@dolphin.openprojects.net> reports
 | 
			
		||||
      # that the semantics of dynamic libraries on AmigaOS, at least up
 | 
			
		||||
      # to version 4, is to share data among multiple programs linked
 | 
			
		||||
      # with the same dynamic library.  Since this doesn't match the
 | 
			
		||||
      # behavior of shared libraries on other platforms, we cannot use
 | 
			
		||||
      # them.
 | 
			
		||||
      ld_shlibs=no
 | 
			
		||||
      ;;
 | 
			
		||||
    beos*)
 | 
			
		||||
      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 | 
			
		||||
        :
 | 
			
		||||
      else
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    cygwin* | mingw* | pw32*)
 | 
			
		||||
      # hardcode_libdir_flag_spec is actually meaningless, as there is
 | 
			
		||||
      # no search path for DLLs.
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      if $LD --help 2>&1 | grep 'auto-import' > /dev/null; then
 | 
			
		||||
        :
 | 
			
		||||
      else
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    interix3*)
 | 
			
		||||
      hardcode_direct=no
 | 
			
		||||
      hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
 | 
			
		||||
      ;;
 | 
			
		||||
    linux*)
 | 
			
		||||
      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 | 
			
		||||
        :
 | 
			
		||||
      else
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    netbsd*)
 | 
			
		||||
      ;;
 | 
			
		||||
    solaris*)
 | 
			
		||||
      if $LD -v 2>&1 | grep 'BFD 2\.8' > /dev/null; then
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      elif $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 | 
			
		||||
        :
 | 
			
		||||
      else
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX*)
 | 
			
		||||
      case `$LD -v 2>&1` in
 | 
			
		||||
        *\ [01].* | *\ 2.[0-9].* | *\ 2.1[0-5].*)
 | 
			
		||||
          ld_shlibs=no
 | 
			
		||||
          ;;
 | 
			
		||||
        *)
 | 
			
		||||
          if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 | 
			
		||||
            hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-rpath,$libdir`'
 | 
			
		||||
          else
 | 
			
		||||
            ld_shlibs=no
 | 
			
		||||
          fi
 | 
			
		||||
          ;;
 | 
			
		||||
      esac
 | 
			
		||||
      ;;
 | 
			
		||||
    sunos4*)
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
      if $LD --help 2>&1 | grep ': supported targets:.* elf' > /dev/null; then
 | 
			
		||||
        :
 | 
			
		||||
      else
 | 
			
		||||
        ld_shlibs=no
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
  if test "$ld_shlibs" = no; then
 | 
			
		||||
    hardcode_libdir_flag_spec=
 | 
			
		||||
  fi
 | 
			
		||||
else
 | 
			
		||||
  case "$host_os" in
 | 
			
		||||
    aix3*)
 | 
			
		||||
      # Note: this linker hardcodes the directories in LIBPATH if there
 | 
			
		||||
      # are no directories specified by -L.
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      if test "$GCC" = yes; then
 | 
			
		||||
        # Neither direct hardcoding nor static linking is supported with a
 | 
			
		||||
        # broken collect2.
 | 
			
		||||
        hardcode_direct=unsupported
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    aix4* | aix5*)
 | 
			
		||||
      if test "$host_cpu" = ia64; then
 | 
			
		||||
        # On IA64, the linker does run time linking by default, so we don't
 | 
			
		||||
        # have to do anything special.
 | 
			
		||||
        aix_use_runtimelinking=no
 | 
			
		||||
      else
 | 
			
		||||
        aix_use_runtimelinking=no
 | 
			
		||||
        # Test if we are trying to use run time linking or normal
 | 
			
		||||
        # AIX style linking. If -brtl is somewhere in LDFLAGS, we
 | 
			
		||||
        # need to do runtime linking.
 | 
			
		||||
        case $host_os in aix4.[23]|aix4.[23].*|aix5*)
 | 
			
		||||
          for ld_flag in $LDFLAGS; do
 | 
			
		||||
            if (test $ld_flag = "-brtl" || test $ld_flag = "-Wl,-brtl"); then
 | 
			
		||||
              aix_use_runtimelinking=yes
 | 
			
		||||
              break
 | 
			
		||||
            fi
 | 
			
		||||
          done
 | 
			
		||||
          ;;
 | 
			
		||||
        esac
 | 
			
		||||
      fi
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      hardcode_libdir_separator=':'
 | 
			
		||||
      if test "$GCC" = yes; then
 | 
			
		||||
        case $host_os in aix4.[012]|aix4.[012].*)
 | 
			
		||||
          collect2name=`${CC} -print-prog-name=collect2`
 | 
			
		||||
          if test -f "$collect2name" && \
 | 
			
		||||
            strings "$collect2name" | grep resolve_lib_name >/dev/null
 | 
			
		||||
          then
 | 
			
		||||
            # We have reworked collect2
 | 
			
		||||
            hardcode_direct=yes
 | 
			
		||||
          else
 | 
			
		||||
            # We have old collect2
 | 
			
		||||
            hardcode_direct=unsupported
 | 
			
		||||
            hardcode_minus_L=yes
 | 
			
		||||
            hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
            hardcode_libdir_separator=
 | 
			
		||||
          fi
 | 
			
		||||
          ;;
 | 
			
		||||
        esac
 | 
			
		||||
      fi
 | 
			
		||||
      # Begin _LT_AC_SYS_LIBPATH_AIX.
 | 
			
		||||
      echo 'int main () { return 0; }' > conftest.c
 | 
			
		||||
      ${CC} ${LDFLAGS} conftest.c -o conftest
 | 
			
		||||
      aix_libpath=`dump -H conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 | 
			
		||||
}'`
 | 
			
		||||
      if test -z "$aix_libpath"; then
 | 
			
		||||
        aix_libpath=`dump -HX64 conftest 2>/dev/null | sed -n -e '/Import File Strings/,/^$/ { /^0/ { s/^0  *\(.*\)$/\1/; p; }
 | 
			
		||||
}'`
 | 
			
		||||
      fi
 | 
			
		||||
      if test -z "$aix_libpath"; then
 | 
			
		||||
        aix_libpath="/usr/lib:/lib"
 | 
			
		||||
      fi
 | 
			
		||||
      rm -f conftest.c conftest
 | 
			
		||||
      # End _LT_AC_SYS_LIBPATH_AIX.
 | 
			
		||||
      if test "$aix_use_runtimelinking" = yes; then
 | 
			
		||||
        hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 | 
			
		||||
      else
 | 
			
		||||
        if test "$host_cpu" = ia64; then
 | 
			
		||||
          hardcode_libdir_flag_spec='${wl}-R $libdir:/usr/lib:/lib'
 | 
			
		||||
        else
 | 
			
		||||
          hardcode_libdir_flag_spec='${wl}-blibpath:$libdir:'"$aix_libpath"
 | 
			
		||||
        fi
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    amigaos*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      # see comment about different semantics on the GNU ld section
 | 
			
		||||
      ld_shlibs=no
 | 
			
		||||
      ;;
 | 
			
		||||
    bsdi[45]*)
 | 
			
		||||
      ;;
 | 
			
		||||
    cygwin* | mingw* | pw32*)
 | 
			
		||||
      # When not using gcc, we currently assume that we are using
 | 
			
		||||
      # Microsoft Visual C++.
 | 
			
		||||
      # hardcode_libdir_flag_spec is actually meaningless, as there is
 | 
			
		||||
      # no search path for DLLs.
 | 
			
		||||
      hardcode_libdir_flag_spec=' '
 | 
			
		||||
      libext=lib
 | 
			
		||||
      ;;
 | 
			
		||||
    darwin* | rhapsody*)
 | 
			
		||||
      hardcode_direct=no
 | 
			
		||||
      if test "$GCC" = yes ; then
 | 
			
		||||
        :
 | 
			
		||||
      else
 | 
			
		||||
        case $cc_basename in
 | 
			
		||||
          xlc*)
 | 
			
		||||
            ;;
 | 
			
		||||
          *)
 | 
			
		||||
            ld_shlibs=no
 | 
			
		||||
            ;;
 | 
			
		||||
        esac
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    dgux*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      ;;
 | 
			
		||||
    freebsd1*)
 | 
			
		||||
      ld_shlibs=no
 | 
			
		||||
      ;;
 | 
			
		||||
    freebsd2.2*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-R$libdir'
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    freebsd2*)
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    freebsd* | kfreebsd*-gnu | dragonfly*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-R$libdir'
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    hpux9*)
 | 
			
		||||
      hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
 | 
			
		||||
      hardcode_libdir_separator=:
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      # hardcode_minus_L: Not really in the search PATH,
 | 
			
		||||
      # but as the default location of the library.
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    hpux10*)
 | 
			
		||||
      if test "$with_gnu_ld" = no; then
 | 
			
		||||
        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
 | 
			
		||||
        hardcode_libdir_separator=:
 | 
			
		||||
        hardcode_direct=yes
 | 
			
		||||
        # hardcode_minus_L: Not really in the search PATH,
 | 
			
		||||
        # but as the default location of the library.
 | 
			
		||||
        hardcode_minus_L=yes
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    hpux11*)
 | 
			
		||||
      if test "$with_gnu_ld" = no; then
 | 
			
		||||
        hardcode_libdir_flag_spec='${wl}+b ${wl}$libdir'
 | 
			
		||||
        hardcode_libdir_separator=:
 | 
			
		||||
        case $host_cpu in
 | 
			
		||||
          hppa*64*|ia64*)
 | 
			
		||||
            hardcode_direct=no
 | 
			
		||||
            ;;
 | 
			
		||||
          *)
 | 
			
		||||
            hardcode_direct=yes
 | 
			
		||||
            # hardcode_minus_L: Not really in the search PATH,
 | 
			
		||||
            # but as the default location of the library.
 | 
			
		||||
            hardcode_minus_L=yes
 | 
			
		||||
            ;;
 | 
			
		||||
        esac
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    irix5* | irix6* | nonstopux*)
 | 
			
		||||
      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 | 
			
		||||
      hardcode_libdir_separator=:
 | 
			
		||||
      ;;
 | 
			
		||||
    netbsd*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-R$libdir'
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    newsos6)
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 | 
			
		||||
      hardcode_libdir_separator=:
 | 
			
		||||
      ;;
 | 
			
		||||
    openbsd*)
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      if test -z "`echo __ELF__ | $CC -E - | grep __ELF__`" || test "$host_os-$host_cpu" = "openbsd2.8-powerpc"; then
 | 
			
		||||
        hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
 | 
			
		||||
      else
 | 
			
		||||
        case "$host_os" in
 | 
			
		||||
          openbsd[01].* | openbsd2.[0-7] | openbsd2.[0-7].*)
 | 
			
		||||
            hardcode_libdir_flag_spec='-R$libdir'
 | 
			
		||||
            ;;
 | 
			
		||||
          *)
 | 
			
		||||
            hardcode_libdir_flag_spec='${wl}-rpath,$libdir'
 | 
			
		||||
            ;;
 | 
			
		||||
        esac
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    os2*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    osf3*)
 | 
			
		||||
      hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 | 
			
		||||
      hardcode_libdir_separator=:
 | 
			
		||||
      ;;
 | 
			
		||||
    osf4* | osf5*)
 | 
			
		||||
      if test "$GCC" = yes; then
 | 
			
		||||
        hardcode_libdir_flag_spec='${wl}-rpath ${wl}$libdir'
 | 
			
		||||
      else
 | 
			
		||||
        # Both cc and cxx compiler support -rpath directly
 | 
			
		||||
        hardcode_libdir_flag_spec='-rpath $libdir'
 | 
			
		||||
      fi
 | 
			
		||||
      hardcode_libdir_separator=:
 | 
			
		||||
      ;;
 | 
			
		||||
    solaris*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-R$libdir'
 | 
			
		||||
      ;;
 | 
			
		||||
    sunos4*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      hardcode_direct=yes
 | 
			
		||||
      hardcode_minus_L=yes
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv4)
 | 
			
		||||
      case $host_vendor in
 | 
			
		||||
        sni)
 | 
			
		||||
          hardcode_direct=yes # is this really true???
 | 
			
		||||
          ;;
 | 
			
		||||
        siemens)
 | 
			
		||||
          hardcode_direct=no
 | 
			
		||||
          ;;
 | 
			
		||||
        motorola)
 | 
			
		||||
          hardcode_direct=no #Motorola manual says yes, but my tests say they lie
 | 
			
		||||
          ;;
 | 
			
		||||
      esac
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv4.3*)
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv4*MP*)
 | 
			
		||||
      if test -d /usr/nec; then
 | 
			
		||||
        ld_shlibs=yes
 | 
			
		||||
      fi
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv4*uw2* | sysv5OpenUNIX* | sysv5UnixWare7.[01].[10]* | unixware7*)
 | 
			
		||||
      ;;
 | 
			
		||||
    sysv5* | sco3.2v5* | sco5v6*)
 | 
			
		||||
      hardcode_libdir_flag_spec='`test -z "$SCOABSPATH" && echo ${wl}-R,$libdir`'
 | 
			
		||||
      hardcode_libdir_separator=':'
 | 
			
		||||
      ;;
 | 
			
		||||
    uts4*)
 | 
			
		||||
      hardcode_libdir_flag_spec='-L$libdir'
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
      ld_shlibs=no
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Check dynamic linker characteristics
 | 
			
		||||
# Code taken from libtool.m4's AC_LIBTOOL_SYS_DYNAMIC_LINKER.
 | 
			
		||||
libname_spec='lib$name'
 | 
			
		||||
case "$host_os" in
 | 
			
		||||
  aix3*)
 | 
			
		||||
    ;;
 | 
			
		||||
  aix4* | aix5*)
 | 
			
		||||
    ;;
 | 
			
		||||
  amigaos*)
 | 
			
		||||
    ;;
 | 
			
		||||
  beos*)
 | 
			
		||||
    ;;
 | 
			
		||||
  bsdi[45]*)
 | 
			
		||||
    ;;
 | 
			
		||||
  cygwin* | mingw* | pw32*)
 | 
			
		||||
    shrext=.dll
 | 
			
		||||
    ;;
 | 
			
		||||
  darwin* | rhapsody*)
 | 
			
		||||
    shrext=.dylib
 | 
			
		||||
    ;;
 | 
			
		||||
  dgux*)
 | 
			
		||||
    ;;
 | 
			
		||||
  freebsd1*)
 | 
			
		||||
    ;;
 | 
			
		||||
  kfreebsd*-gnu)
 | 
			
		||||
    ;;
 | 
			
		||||
  freebsd* | dragonfly*)
 | 
			
		||||
    ;;
 | 
			
		||||
  gnu*)
 | 
			
		||||
    ;;
 | 
			
		||||
  hpux9* | hpux10* | hpux11*)
 | 
			
		||||
    case $host_cpu in
 | 
			
		||||
      ia64*)
 | 
			
		||||
        shrext=.so
 | 
			
		||||
        ;;
 | 
			
		||||
      hppa*64*)
 | 
			
		||||
        shrext=.sl
 | 
			
		||||
        ;;
 | 
			
		||||
      *)
 | 
			
		||||
        shrext=.sl
 | 
			
		||||
        ;;
 | 
			
		||||
    esac
 | 
			
		||||
    ;;
 | 
			
		||||
  interix3*)
 | 
			
		||||
    ;;
 | 
			
		||||
  irix5* | irix6* | nonstopux*)
 | 
			
		||||
    case "$host_os" in
 | 
			
		||||
      irix5* | nonstopux*)
 | 
			
		||||
        libsuff= shlibsuff=
 | 
			
		||||
        ;;
 | 
			
		||||
      *)
 | 
			
		||||
        case $LD in
 | 
			
		||||
          *-32|*"-32 "|*-melf32bsmip|*"-melf32bsmip ") libsuff= shlibsuff= ;;
 | 
			
		||||
          *-n32|*"-n32 "|*-melf32bmipn32|*"-melf32bmipn32 ") libsuff=32 shlibsuff=N32 ;;
 | 
			
		||||
          *-64|*"-64 "|*-melf64bmip|*"-melf64bmip ") libsuff=64 shlibsuff=64 ;;
 | 
			
		||||
          *) libsuff= shlibsuff= ;;
 | 
			
		||||
        esac
 | 
			
		||||
        ;;
 | 
			
		||||
    esac
 | 
			
		||||
    ;;
 | 
			
		||||
  linux*oldld* | linux*aout* | linux*coff*)
 | 
			
		||||
    ;;
 | 
			
		||||
  linux*)
 | 
			
		||||
    ;;
 | 
			
		||||
  knetbsd*-gnu)
 | 
			
		||||
    ;;
 | 
			
		||||
  netbsd*)
 | 
			
		||||
    ;;
 | 
			
		||||
  newsos6)
 | 
			
		||||
    ;;
 | 
			
		||||
  nto-qnx*)
 | 
			
		||||
    ;;
 | 
			
		||||
  openbsd*)
 | 
			
		||||
    ;;
 | 
			
		||||
  os2*)
 | 
			
		||||
    libname_spec='$name'
 | 
			
		||||
    shrext=.dll
 | 
			
		||||
    ;;
 | 
			
		||||
  osf3* | osf4* | osf5*)
 | 
			
		||||
    ;;
 | 
			
		||||
  solaris*)
 | 
			
		||||
    ;;
 | 
			
		||||
  sunos4*)
 | 
			
		||||
    ;;
 | 
			
		||||
  sysv4 | sysv4.3*)
 | 
			
		||||
    ;;
 | 
			
		||||
  sysv4*MP*)
 | 
			
		||||
    ;;
 | 
			
		||||
  sysv5* | sco3.2v5* | sco5v6* | unixware* | OpenUNIX* | sysv4*uw2*)
 | 
			
		||||
    ;;
 | 
			
		||||
  uts4*)
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
sed_quote_subst='s/\(["`$\\]\)/\\\1/g'
 | 
			
		||||
escaped_wl=`echo "X$wl" | sed -e 's/^X//' -e "$sed_quote_subst"`
 | 
			
		||||
shlibext=`echo "$shrext" | sed -e 's,^\.,,'`
 | 
			
		||||
escaped_hardcode_libdir_flag_spec=`echo "X$hardcode_libdir_flag_spec" | sed -e 's/^X//' -e "$sed_quote_subst"`
 | 
			
		||||
 | 
			
		||||
LC_ALL=C sed -e 's/^\([a-zA-Z0-9_]*\)=/acl_cv_\1=/' <<EOF
 | 
			
		||||
 | 
			
		||||
# How to pass a linker flag through the compiler.
 | 
			
		||||
wl="$escaped_wl"
 | 
			
		||||
 | 
			
		||||
# Static library suffix (normally "a").
 | 
			
		||||
libext="$libext"
 | 
			
		||||
 | 
			
		||||
# Shared library suffix (normally "so").
 | 
			
		||||
shlibext="$shlibext"
 | 
			
		||||
 | 
			
		||||
# Flag to hardcode \$libdir into a binary during linking.
 | 
			
		||||
# This must work even if \$libdir does not exist.
 | 
			
		||||
hardcode_libdir_flag_spec="$escaped_hardcode_libdir_flag_spec"
 | 
			
		||||
 | 
			
		||||
# Whether we need a single -rpath flag with a separated argument.
 | 
			
		||||
hardcode_libdir_separator="$hardcode_libdir_separator"
 | 
			
		||||
 | 
			
		||||
# Set to yes if using DIR/libNAME.so during linking hardcodes DIR into the
 | 
			
		||||
# resulting binary.
 | 
			
		||||
hardcode_direct="$hardcode_direct"
 | 
			
		||||
 | 
			
		||||
# Set to yes if using the -LDIR flag during linking hardcodes DIR into the
 | 
			
		||||
# resulting binary.
 | 
			
		||||
hardcode_minus_L="$hardcode_minus_L"
 | 
			
		||||
 | 
			
		||||
EOF
 | 
			
		||||
							
								
								
									
										1739
									
								
								build-aux/config.sub
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										1739
									
								
								build-aux/config.sub
									
									
									
									
										vendored
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,630 +0,0 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
# depcomp - compile a program generating dependencies as side-effects
 | 
			
		||||
 | 
			
		||||
scriptversion=2009-04-28.21; # UTC
 | 
			
		||||
 | 
			
		||||
# Copyright (C) 1999, 2000, 2003, 2004, 2005, 2006, 2007, 2009 Free
 | 
			
		||||
# Software Foundation, Inc.
 | 
			
		||||
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2, or (at your option)
 | 
			
		||||
# any later version.
 | 
			
		||||
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
# As a special exception to the GNU General Public License, if you
 | 
			
		||||
# distribute this file as part of a program that contains a
 | 
			
		||||
# configuration script generated by Autoconf, you may include it under
 | 
			
		||||
# the same distribution terms that you use for the rest of that program.
 | 
			
		||||
 | 
			
		||||
# Originally written by Alexandre Oliva <oliva@dcc.unicamp.br>.
 | 
			
		||||
 | 
			
		||||
case $1 in
 | 
			
		||||
  '')
 | 
			
		||||
     echo "$0: No command.  Try \`$0 --help' for more information." 1>&2
 | 
			
		||||
     exit 1;
 | 
			
		||||
     ;;
 | 
			
		||||
  -h | --h*)
 | 
			
		||||
    cat <<\EOF
 | 
			
		||||
Usage: depcomp [--help] [--version] PROGRAM [ARGS]
 | 
			
		||||
 | 
			
		||||
Run PROGRAMS ARGS to compile a file, generating dependencies
 | 
			
		||||
as side-effects.
 | 
			
		||||
 | 
			
		||||
Environment variables:
 | 
			
		||||
  depmode     Dependency tracking mode.
 | 
			
		||||
  source      Source file read by `PROGRAMS ARGS'.
 | 
			
		||||
  object      Object file output by `PROGRAMS ARGS'.
 | 
			
		||||
  DEPDIR      directory where to store dependencies.
 | 
			
		||||
  depfile     Dependency file to output.
 | 
			
		||||
  tmpdepfile  Temporary file to use when outputing dependencies.
 | 
			
		||||
  libtool     Whether libtool is used (yes/no).
 | 
			
		||||
 | 
			
		||||
Report bugs to <bug-automake@gnu.org>.
 | 
			
		||||
EOF
 | 
			
		||||
    exit $?
 | 
			
		||||
    ;;
 | 
			
		||||
  -v | --v*)
 | 
			
		||||
    echo "depcomp $scriptversion"
 | 
			
		||||
    exit $?
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if test -z "$depmode" || test -z "$source" || test -z "$object"; then
 | 
			
		||||
  echo "depcomp: Variables source, object and depmode must be set" 1>&2
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Dependencies for sub/bar.o or sub/bar.obj go into sub/.deps/bar.Po.
 | 
			
		||||
depfile=${depfile-`echo "$object" |
 | 
			
		||||
  sed 's|[^\\/]*$|'${DEPDIR-.deps}'/&|;s|\.\([^.]*\)$|.P\1|;s|Pobj$|Po|'`}
 | 
			
		||||
tmpdepfile=${tmpdepfile-`echo "$depfile" | sed 's/\.\([^.]*\)$/.T\1/'`}
 | 
			
		||||
 | 
			
		||||
rm -f "$tmpdepfile"
 | 
			
		||||
 | 
			
		||||
# Some modes work just like other modes, but use different flags.  We
 | 
			
		||||
# parameterize here, but still list the modes in the big case below,
 | 
			
		||||
# to make depend.m4 easier to write.  Note that we *cannot* use a case
 | 
			
		||||
# here, because this file can only contain one case statement.
 | 
			
		||||
if test "$depmode" = hp; then
 | 
			
		||||
  # HP compiler uses -M and no extra arg.
 | 
			
		||||
  gccflag=-M
 | 
			
		||||
  depmode=gcc
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test "$depmode" = dashXmstdout; then
 | 
			
		||||
   # This is just like dashmstdout with a different argument.
 | 
			
		||||
   dashmflag=-xM
 | 
			
		||||
   depmode=dashmstdout
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
cygpath_u="cygpath -u -f -"
 | 
			
		||||
if test "$depmode" = msvcmsys; then
 | 
			
		||||
   # This is just like msvisualcpp but w/o cygpath translation.
 | 
			
		||||
   # Just convert the backslash-escaped backslashes to single forward
 | 
			
		||||
   # slashes to satisfy depend.m4
 | 
			
		||||
   cygpath_u="sed s,\\\\\\\\,/,g"
 | 
			
		||||
   depmode=msvisualcpp
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case "$depmode" in
 | 
			
		||||
gcc3)
 | 
			
		||||
## gcc 3 implements dependency tracking that does exactly what
 | 
			
		||||
## we want.  Yay!  Note: for some reason libtool 1.4 doesn't like
 | 
			
		||||
## it if -MD -MP comes after the -MF stuff.  Hmm.
 | 
			
		||||
## Unfortunately, FreeBSD c89 acceptance of flags depends upon
 | 
			
		||||
## the command line argument order; so add the flags where they
 | 
			
		||||
## appear in depend2.am.  Note that the slowdown incurred here
 | 
			
		||||
## affects only configure: in makefiles, %FASTDEP% shortcuts this.
 | 
			
		||||
  for arg
 | 
			
		||||
  do
 | 
			
		||||
    case $arg in
 | 
			
		||||
    -c) set fnord "$@" -MT "$object" -MD -MP -MF "$tmpdepfile" "$arg" ;;
 | 
			
		||||
    *)  set fnord "$@" "$arg" ;;
 | 
			
		||||
    esac
 | 
			
		||||
    shift # fnord
 | 
			
		||||
    shift # $arg
 | 
			
		||||
  done
 | 
			
		||||
  "$@"
 | 
			
		||||
  stat=$?
 | 
			
		||||
  if test $stat -eq 0; then :
 | 
			
		||||
  else
 | 
			
		||||
    rm -f "$tmpdepfile"
 | 
			
		||||
    exit $stat
 | 
			
		||||
  fi
 | 
			
		||||
  mv "$tmpdepfile" "$depfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
gcc)
 | 
			
		||||
## There are various ways to get dependency output from gcc.  Here's
 | 
			
		||||
## why we pick this rather obscure method:
 | 
			
		||||
## - Don't want to use -MD because we'd like the dependencies to end
 | 
			
		||||
##   up in a subdir.  Having to rename by hand is ugly.
 | 
			
		||||
##   (We might end up doing this anyway to support other compilers.)
 | 
			
		||||
## - The DEPENDENCIES_OUTPUT environment variable makes gcc act like
 | 
			
		||||
##   -MM, not -M (despite what the docs say).
 | 
			
		||||
## - Using -M directly means running the compiler twice (even worse
 | 
			
		||||
##   than renaming).
 | 
			
		||||
  if test -z "$gccflag"; then
 | 
			
		||||
    gccflag=-MD,
 | 
			
		||||
  fi
 | 
			
		||||
  "$@" -Wp,"$gccflag$tmpdepfile"
 | 
			
		||||
  stat=$?
 | 
			
		||||
  if test $stat -eq 0; then :
 | 
			
		||||
  else
 | 
			
		||||
    rm -f "$tmpdepfile"
 | 
			
		||||
    exit $stat
 | 
			
		||||
  fi
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
  echo "$object : \\" > "$depfile"
 | 
			
		||||
  alpha=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz
 | 
			
		||||
## The second -e expression handles DOS-style file names with drive letters.
 | 
			
		||||
  sed -e 's/^[^:]*: / /' \
 | 
			
		||||
      -e 's/^['$alpha']:\/[^:]*: / /' < "$tmpdepfile" >> "$depfile"
 | 
			
		||||
## This next piece of magic avoids the `deleted header file' problem.
 | 
			
		||||
## The problem is that when a header file which appears in a .P file
 | 
			
		||||
## is deleted, the dependency causes make to die (because there is
 | 
			
		||||
## typically no way to rebuild the header).  We avoid this by adding
 | 
			
		||||
## dummy dependencies for each header file.  Too bad gcc doesn't do
 | 
			
		||||
## this for us directly.
 | 
			
		||||
  tr ' ' '
 | 
			
		||||
' < "$tmpdepfile" |
 | 
			
		||||
## Some versions of gcc put a space before the `:'.  On the theory
 | 
			
		||||
## that the space means something, we add a space to the output as
 | 
			
		||||
## well.
 | 
			
		||||
## Some versions of the HPUX 10.20 sed can't process this invocation
 | 
			
		||||
## correctly.  Breaking it into two sed invocations is a workaround.
 | 
			
		||||
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
hp)
 | 
			
		||||
  # This case exists only to let depend.m4 do its work.  It works by
 | 
			
		||||
  # looking at the text of this script.  This case will never be run,
 | 
			
		||||
  # since it is checked for above.
 | 
			
		||||
  exit 1
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
sgi)
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    "$@" "-Wp,-MDupdate,$tmpdepfile"
 | 
			
		||||
  else
 | 
			
		||||
    "$@" -MDupdate "$tmpdepfile"
 | 
			
		||||
  fi
 | 
			
		||||
  stat=$?
 | 
			
		||||
  if test $stat -eq 0; then :
 | 
			
		||||
  else
 | 
			
		||||
    rm -f "$tmpdepfile"
 | 
			
		||||
    exit $stat
 | 
			
		||||
  fi
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
 | 
			
		||||
  if test -f "$tmpdepfile"; then  # yes, the sourcefile depend on other files
 | 
			
		||||
    echo "$object : \\" > "$depfile"
 | 
			
		||||
 | 
			
		||||
    # Clip off the initial element (the dependent).  Don't try to be
 | 
			
		||||
    # clever and replace this with sed code, as IRIX sed won't handle
 | 
			
		||||
    # lines with more than a fixed number of characters (4096 in
 | 
			
		||||
    # IRIX 6.2 sed, 8192 in IRIX 6.5).  We also remove comment lines;
 | 
			
		||||
    # the IRIX cc adds comments like `#:fec' to the end of the
 | 
			
		||||
    # dependency line.
 | 
			
		||||
    tr ' ' '
 | 
			
		||||
' < "$tmpdepfile" \
 | 
			
		||||
    | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' | \
 | 
			
		||||
    tr '
 | 
			
		||||
' ' ' >> "$depfile"
 | 
			
		||||
    echo >> "$depfile"
 | 
			
		||||
 | 
			
		||||
    # The second pass generates a dummy entry for each header file.
 | 
			
		||||
    tr ' ' '
 | 
			
		||||
' < "$tmpdepfile" \
 | 
			
		||||
   | sed -e 's/^.*\.o://' -e 's/#.*$//' -e '/^$/ d' -e 's/$/:/' \
 | 
			
		||||
   >> "$depfile"
 | 
			
		||||
  else
 | 
			
		||||
    # The sourcefile does not contain any dependencies, so just
 | 
			
		||||
    # store a dummy comment line, to avoid errors with the Makefile
 | 
			
		||||
    # "include basename.Plo" scheme.
 | 
			
		||||
    echo "#dummy" > "$depfile"
 | 
			
		||||
  fi
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
aix)
 | 
			
		||||
  # The C for AIX Compiler uses -M and outputs the dependencies
 | 
			
		||||
  # in a .u file.  In older versions, this file always lives in the
 | 
			
		||||
  # current directory.  Also, the AIX compiler puts `$object:' at the
 | 
			
		||||
  # start of each line; $object doesn't have directory information.
 | 
			
		||||
  # Version 6 uses the directory in both cases.
 | 
			
		||||
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 | 
			
		||||
  test "x$dir" = "x$object" && dir=
 | 
			
		||||
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    tmpdepfile1=$dir$base.u
 | 
			
		||||
    tmpdepfile2=$base.u
 | 
			
		||||
    tmpdepfile3=$dir.libs/$base.u
 | 
			
		||||
    "$@" -Wc,-M
 | 
			
		||||
  else
 | 
			
		||||
    tmpdepfile1=$dir$base.u
 | 
			
		||||
    tmpdepfile2=$dir$base.u
 | 
			
		||||
    tmpdepfile3=$dir$base.u
 | 
			
		||||
    "$@" -M
 | 
			
		||||
  fi
 | 
			
		||||
  stat=$?
 | 
			
		||||
 | 
			
		||||
  if test $stat -eq 0; then :
 | 
			
		||||
  else
 | 
			
		||||
    rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
 | 
			
		||||
    exit $stat
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3"
 | 
			
		||||
  do
 | 
			
		||||
    test -f "$tmpdepfile" && break
 | 
			
		||||
  done
 | 
			
		||||
  if test -f "$tmpdepfile"; then
 | 
			
		||||
    # Each line is of the form `foo.o: dependent.h'.
 | 
			
		||||
    # Do two passes, one to just change these to
 | 
			
		||||
    # `$object: dependent.h' and one to simply `dependent.h:'.
 | 
			
		||||
    sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
 | 
			
		||||
    # That's a tab and a space in the [].
 | 
			
		||||
    sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 | 
			
		||||
  else
 | 
			
		||||
    # The sourcefile does not contain any dependencies, so just
 | 
			
		||||
    # store a dummy comment line, to avoid errors with the Makefile
 | 
			
		||||
    # "include basename.Plo" scheme.
 | 
			
		||||
    echo "#dummy" > "$depfile"
 | 
			
		||||
  fi
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
icc)
 | 
			
		||||
  # Intel's C compiler understands `-MD -MF file'.  However on
 | 
			
		||||
  #    icc -MD -MF foo.d -c -o sub/foo.o sub/foo.c
 | 
			
		||||
  # ICC 7.0 will fill foo.d with something like
 | 
			
		||||
  #    foo.o: sub/foo.c
 | 
			
		||||
  #    foo.o: sub/foo.h
 | 
			
		||||
  # which is wrong.  We want:
 | 
			
		||||
  #    sub/foo.o: sub/foo.c
 | 
			
		||||
  #    sub/foo.o: sub/foo.h
 | 
			
		||||
  #    sub/foo.c:
 | 
			
		||||
  #    sub/foo.h:
 | 
			
		||||
  # ICC 7.1 will output
 | 
			
		||||
  #    foo.o: sub/foo.c sub/foo.h
 | 
			
		||||
  # and will wrap long lines using \ :
 | 
			
		||||
  #    foo.o: sub/foo.c ... \
 | 
			
		||||
  #     sub/foo.h ... \
 | 
			
		||||
  #     ...
 | 
			
		||||
 | 
			
		||||
  "$@" -MD -MF "$tmpdepfile"
 | 
			
		||||
  stat=$?
 | 
			
		||||
  if test $stat -eq 0; then :
 | 
			
		||||
  else
 | 
			
		||||
    rm -f "$tmpdepfile"
 | 
			
		||||
    exit $stat
 | 
			
		||||
  fi
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
  # Each line is of the form `foo.o: dependent.h',
 | 
			
		||||
  # or `foo.o: dep1.h dep2.h \', or ` dep3.h dep4.h \'.
 | 
			
		||||
  # Do two passes, one to just change these to
 | 
			
		||||
  # `$object: dependent.h' and one to simply `dependent.h:'.
 | 
			
		||||
  sed "s,^[^:]*:,$object :," < "$tmpdepfile" > "$depfile"
 | 
			
		||||
  # Some versions of the HPUX 10.20 sed can't process this invocation
 | 
			
		||||
  # correctly.  Breaking it into two sed invocations is a workaround.
 | 
			
		||||
  sed 's,^[^:]*: \(.*\)$,\1,;s/^\\$//;/^$/d;/:$/d' < "$tmpdepfile" |
 | 
			
		||||
    sed -e 's/$/ :/' >> "$depfile"
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
hp2)
 | 
			
		||||
  # The "hp" stanza above does not work with aCC (C++) and HP's ia64
 | 
			
		||||
  # compilers, which have integrated preprocessors.  The correct option
 | 
			
		||||
  # to use with these is +Maked; it writes dependencies to a file named
 | 
			
		||||
  # 'foo.d', which lands next to the object file, wherever that
 | 
			
		||||
  # happens to be.
 | 
			
		||||
  # Much of this is similar to the tru64 case; see comments there.
 | 
			
		||||
  dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 | 
			
		||||
  test "x$dir" = "x$object" && dir=
 | 
			
		||||
  base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    tmpdepfile1=$dir$base.d
 | 
			
		||||
    tmpdepfile2=$dir.libs/$base.d
 | 
			
		||||
    "$@" -Wc,+Maked
 | 
			
		||||
  else
 | 
			
		||||
    tmpdepfile1=$dir$base.d
 | 
			
		||||
    tmpdepfile2=$dir$base.d
 | 
			
		||||
    "$@" +Maked
 | 
			
		||||
  fi
 | 
			
		||||
  stat=$?
 | 
			
		||||
  if test $stat -eq 0; then :
 | 
			
		||||
  else
 | 
			
		||||
     rm -f "$tmpdepfile1" "$tmpdepfile2"
 | 
			
		||||
     exit $stat
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2"
 | 
			
		||||
  do
 | 
			
		||||
    test -f "$tmpdepfile" && break
 | 
			
		||||
  done
 | 
			
		||||
  if test -f "$tmpdepfile"; then
 | 
			
		||||
    sed -e "s,^.*\.[a-z]*:,$object:," "$tmpdepfile" > "$depfile"
 | 
			
		||||
    # Add `dependent.h:' lines.
 | 
			
		||||
    sed -ne '2,${
 | 
			
		||||
	       s/^ *//
 | 
			
		||||
	       s/ \\*$//
 | 
			
		||||
	       s/$/:/
 | 
			
		||||
	       p
 | 
			
		||||
	     }' "$tmpdepfile" >> "$depfile"
 | 
			
		||||
  else
 | 
			
		||||
    echo "#dummy" > "$depfile"
 | 
			
		||||
  fi
 | 
			
		||||
  rm -f "$tmpdepfile" "$tmpdepfile2"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
tru64)
 | 
			
		||||
   # The Tru64 compiler uses -MD to generate dependencies as a side
 | 
			
		||||
   # effect.  `cc -MD -o foo.o ...' puts the dependencies into `foo.o.d'.
 | 
			
		||||
   # At least on Alpha/Redhat 6.1, Compaq CCC V6.2-504 seems to put
 | 
			
		||||
   # dependencies in `foo.d' instead, so we check for that too.
 | 
			
		||||
   # Subdirectories are respected.
 | 
			
		||||
   dir=`echo "$object" | sed -e 's|/[^/]*$|/|'`
 | 
			
		||||
   test "x$dir" = "x$object" && dir=
 | 
			
		||||
   base=`echo "$object" | sed -e 's|^.*/||' -e 's/\.o$//' -e 's/\.lo$//'`
 | 
			
		||||
 | 
			
		||||
   if test "$libtool" = yes; then
 | 
			
		||||
      # With Tru64 cc, shared objects can also be used to make a
 | 
			
		||||
      # static library.  This mechanism is used in libtool 1.4 series to
 | 
			
		||||
      # handle both shared and static libraries in a single compilation.
 | 
			
		||||
      # With libtool 1.4, dependencies were output in $dir.libs/$base.lo.d.
 | 
			
		||||
      #
 | 
			
		||||
      # With libtool 1.5 this exception was removed, and libtool now
 | 
			
		||||
      # generates 2 separate objects for the 2 libraries.  These two
 | 
			
		||||
      # compilations output dependencies in $dir.libs/$base.o.d and
 | 
			
		||||
      # in $dir$base.o.d.  We have to check for both files, because
 | 
			
		||||
      # one of the two compilations can be disabled.  We should prefer
 | 
			
		||||
      # $dir$base.o.d over $dir.libs/$base.o.d because the latter is
 | 
			
		||||
      # automatically cleaned when .libs/ is deleted, while ignoring
 | 
			
		||||
      # the former would cause a distcleancheck panic.
 | 
			
		||||
      tmpdepfile1=$dir.libs/$base.lo.d   # libtool 1.4
 | 
			
		||||
      tmpdepfile2=$dir$base.o.d          # libtool 1.5
 | 
			
		||||
      tmpdepfile3=$dir.libs/$base.o.d    # libtool 1.5
 | 
			
		||||
      tmpdepfile4=$dir.libs/$base.d      # Compaq CCC V6.2-504
 | 
			
		||||
      "$@" -Wc,-MD
 | 
			
		||||
   else
 | 
			
		||||
      tmpdepfile1=$dir$base.o.d
 | 
			
		||||
      tmpdepfile2=$dir$base.d
 | 
			
		||||
      tmpdepfile3=$dir$base.d
 | 
			
		||||
      tmpdepfile4=$dir$base.d
 | 
			
		||||
      "$@" -MD
 | 
			
		||||
   fi
 | 
			
		||||
 | 
			
		||||
   stat=$?
 | 
			
		||||
   if test $stat -eq 0; then :
 | 
			
		||||
   else
 | 
			
		||||
      rm -f "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
 | 
			
		||||
      exit $stat
 | 
			
		||||
   fi
 | 
			
		||||
 | 
			
		||||
   for tmpdepfile in "$tmpdepfile1" "$tmpdepfile2" "$tmpdepfile3" "$tmpdepfile4"
 | 
			
		||||
   do
 | 
			
		||||
     test -f "$tmpdepfile" && break
 | 
			
		||||
   done
 | 
			
		||||
   if test -f "$tmpdepfile"; then
 | 
			
		||||
      sed -e "s,^.*\.[a-z]*:,$object:," < "$tmpdepfile" > "$depfile"
 | 
			
		||||
      # That's a tab and a space in the [].
 | 
			
		||||
      sed -e 's,^.*\.[a-z]*:[	 ]*,,' -e 's,$,:,' < "$tmpdepfile" >> "$depfile"
 | 
			
		||||
   else
 | 
			
		||||
      echo "#dummy" > "$depfile"
 | 
			
		||||
   fi
 | 
			
		||||
   rm -f "$tmpdepfile"
 | 
			
		||||
   ;;
 | 
			
		||||
 | 
			
		||||
#nosideeffect)
 | 
			
		||||
  # This comment above is used by automake to tell side-effect
 | 
			
		||||
  # dependency tracking mechanisms from slower ones.
 | 
			
		||||
 | 
			
		||||
dashmstdout)
 | 
			
		||||
  # Important note: in order to support this mode, a compiler *must*
 | 
			
		||||
  # always write the preprocessed file to stdout, regardless of -o.
 | 
			
		||||
  "$@" || exit $?
 | 
			
		||||
 | 
			
		||||
  # Remove the call to Libtool.
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    while test "X$1" != 'X--mode=compile'; do
 | 
			
		||||
      shift
 | 
			
		||||
    done
 | 
			
		||||
    shift
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # Remove `-o $object'.
 | 
			
		||||
  IFS=" "
 | 
			
		||||
  for arg
 | 
			
		||||
  do
 | 
			
		||||
    case $arg in
 | 
			
		||||
    -o)
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    $object)
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
      set fnord "$@" "$arg"
 | 
			
		||||
      shift # fnord
 | 
			
		||||
      shift # $arg
 | 
			
		||||
      ;;
 | 
			
		||||
    esac
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
  test -z "$dashmflag" && dashmflag=-M
 | 
			
		||||
  # Require at least two characters before searching for `:'
 | 
			
		||||
  # in the target name.  This is to cope with DOS-style filenames:
 | 
			
		||||
  # a dependency such as `c:/foo/bar' could be seen as target `c' otherwise.
 | 
			
		||||
  "$@" $dashmflag |
 | 
			
		||||
    sed 's:^[  ]*[^: ][^:][^:]*\:[    ]*:'"$object"'\: :' > "$tmpdepfile"
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
  cat < "$tmpdepfile" > "$depfile"
 | 
			
		||||
  tr ' ' '
 | 
			
		||||
' < "$tmpdepfile" | \
 | 
			
		||||
## Some versions of the HPUX 10.20 sed can't process this invocation
 | 
			
		||||
## correctly.  Breaking it into two sed invocations is a workaround.
 | 
			
		||||
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
dashXmstdout)
 | 
			
		||||
  # This case only exists to satisfy depend.m4.  It is never actually
 | 
			
		||||
  # run, as this mode is specially recognized in the preamble.
 | 
			
		||||
  exit 1
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
makedepend)
 | 
			
		||||
  "$@" || exit $?
 | 
			
		||||
  # Remove any Libtool call
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    while test "X$1" != 'X--mode=compile'; do
 | 
			
		||||
      shift
 | 
			
		||||
    done
 | 
			
		||||
    shift
 | 
			
		||||
  fi
 | 
			
		||||
  # X makedepend
 | 
			
		||||
  shift
 | 
			
		||||
  cleared=no eat=no
 | 
			
		||||
  for arg
 | 
			
		||||
  do
 | 
			
		||||
    case $cleared in
 | 
			
		||||
    no)
 | 
			
		||||
      set ""; shift
 | 
			
		||||
      cleared=yes ;;
 | 
			
		||||
    esac
 | 
			
		||||
    if test $eat = yes; then
 | 
			
		||||
      eat=no
 | 
			
		||||
      continue
 | 
			
		||||
    fi
 | 
			
		||||
    case "$arg" in
 | 
			
		||||
    -D*|-I*)
 | 
			
		||||
      set fnord "$@" "$arg"; shift ;;
 | 
			
		||||
    # Strip any option that makedepend may not understand.  Remove
 | 
			
		||||
    # the object too, otherwise makedepend will parse it as a source file.
 | 
			
		||||
    -arch)
 | 
			
		||||
      eat=yes ;;
 | 
			
		||||
    -*|$object)
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
      set fnord "$@" "$arg"; shift ;;
 | 
			
		||||
    esac
 | 
			
		||||
  done
 | 
			
		||||
  obj_suffix=`echo "$object" | sed 's/^.*\././'`
 | 
			
		||||
  touch "$tmpdepfile"
 | 
			
		||||
  ${MAKEDEPEND-makedepend} -o"$obj_suffix" -f"$tmpdepfile" "$@"
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
  cat < "$tmpdepfile" > "$depfile"
 | 
			
		||||
  sed '1,2d' "$tmpdepfile" | tr ' ' '
 | 
			
		||||
' | \
 | 
			
		||||
## Some versions of the HPUX 10.20 sed can't process this invocation
 | 
			
		||||
## correctly.  Breaking it into two sed invocations is a workaround.
 | 
			
		||||
    sed -e 's/^\\$//' -e '/^$/d' -e '/:$/d' | sed -e 's/$/ :/' >> "$depfile"
 | 
			
		||||
  rm -f "$tmpdepfile" "$tmpdepfile".bak
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
cpp)
 | 
			
		||||
  # Important note: in order to support this mode, a compiler *must*
 | 
			
		||||
  # always write the preprocessed file to stdout.
 | 
			
		||||
  "$@" || exit $?
 | 
			
		||||
 | 
			
		||||
  # Remove the call to Libtool.
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    while test "X$1" != 'X--mode=compile'; do
 | 
			
		||||
      shift
 | 
			
		||||
    done
 | 
			
		||||
    shift
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  # Remove `-o $object'.
 | 
			
		||||
  IFS=" "
 | 
			
		||||
  for arg
 | 
			
		||||
  do
 | 
			
		||||
    case $arg in
 | 
			
		||||
    -o)
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    $object)
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
      set fnord "$@" "$arg"
 | 
			
		||||
      shift # fnord
 | 
			
		||||
      shift # $arg
 | 
			
		||||
      ;;
 | 
			
		||||
    esac
 | 
			
		||||
  done
 | 
			
		||||
 | 
			
		||||
  "$@" -E |
 | 
			
		||||
    sed -n -e '/^# [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' \
 | 
			
		||||
       -e '/^#line [0-9][0-9]* "\([^"]*\)".*/ s:: \1 \\:p' |
 | 
			
		||||
    sed '$ s: \\$::' > "$tmpdepfile"
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
  echo "$object : \\" > "$depfile"
 | 
			
		||||
  cat < "$tmpdepfile" >> "$depfile"
 | 
			
		||||
  sed < "$tmpdepfile" '/^$/d;s/^ //;s/ \\$//;s/$/ :/' >> "$depfile"
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
msvisualcpp)
 | 
			
		||||
  # Important note: in order to support this mode, a compiler *must*
 | 
			
		||||
  # always write the preprocessed file to stdout.
 | 
			
		||||
  "$@" || exit $?
 | 
			
		||||
 | 
			
		||||
  # Remove the call to Libtool.
 | 
			
		||||
  if test "$libtool" = yes; then
 | 
			
		||||
    while test "X$1" != 'X--mode=compile'; do
 | 
			
		||||
      shift
 | 
			
		||||
    done
 | 
			
		||||
    shift
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  IFS=" "
 | 
			
		||||
  for arg
 | 
			
		||||
  do
 | 
			
		||||
    case "$arg" in
 | 
			
		||||
    -o)
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    $object)
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    "-Gm"|"/Gm"|"-Gi"|"/Gi"|"-ZI"|"/ZI")
 | 
			
		||||
	set fnord "$@"
 | 
			
		||||
	shift
 | 
			
		||||
	shift
 | 
			
		||||
	;;
 | 
			
		||||
    *)
 | 
			
		||||
	set fnord "$@" "$arg"
 | 
			
		||||
	shift
 | 
			
		||||
	shift
 | 
			
		||||
	;;
 | 
			
		||||
    esac
 | 
			
		||||
  done
 | 
			
		||||
  "$@" -E 2>/dev/null |
 | 
			
		||||
  sed -n '/^#line [0-9][0-9]* "\([^"]*\)"/ s::\1:p' | $cygpath_u | sort -u > "$tmpdepfile"
 | 
			
		||||
  rm -f "$depfile"
 | 
			
		||||
  echo "$object : \\" > "$depfile"
 | 
			
		||||
  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::	\1 \\:p' >> "$depfile"
 | 
			
		||||
  echo "	" >> "$depfile"
 | 
			
		||||
  sed < "$tmpdepfile" -n -e 's% %\\ %g' -e '/^\(.*\)$/ s::\1\::p' >> "$depfile"
 | 
			
		||||
  rm -f "$tmpdepfile"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
msvcmsys)
 | 
			
		||||
  # This case exists only to let depend.m4 do its work.  It works by
 | 
			
		||||
  # looking at the text of this script.  This case will never be run,
 | 
			
		||||
  # since it is checked for above.
 | 
			
		||||
  exit 1
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
none)
 | 
			
		||||
  exec "$@"
 | 
			
		||||
  ;;
 | 
			
		||||
 | 
			
		||||
*)
 | 
			
		||||
  echo "Unknown depmode $depmode" 1>&2
 | 
			
		||||
  exit 1
 | 
			
		||||
  ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
# Local Variables:
 | 
			
		||||
# mode: shell-script
 | 
			
		||||
# sh-indentation: 2
 | 
			
		||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
 | 
			
		||||
# time-stamp-start: "scriptversion="
 | 
			
		||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
 | 
			
		||||
# time-stamp-time-zone: "UTC"
 | 
			
		||||
# time-stamp-end: "; # UTC"
 | 
			
		||||
# End:
 | 
			
		||||
@@ -1,524 +0,0 @@
 | 
			
		||||
#!/bin/sh
 | 
			
		||||
# install - install a program, script, or datafile
 | 
			
		||||
 | 
			
		||||
scriptversion=2010-02-06.18; # UTC
 | 
			
		||||
 | 
			
		||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was
 | 
			
		||||
# later released in X11R6 (xc/config/util/install.sh) with the
 | 
			
		||||
# following copyright and license.
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 1994 X Consortium
 | 
			
		||||
#
 | 
			
		||||
# Permission is hereby granted, free of charge, to any person obtaining a copy
 | 
			
		||||
# of this software and associated documentation files (the "Software"), to
 | 
			
		||||
# deal in the Software without restriction, including without limitation the
 | 
			
		||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 | 
			
		||||
# sell copies of the Software, and to permit persons to whom the Software is
 | 
			
		||||
# furnished to do so, subject to the following conditions:
 | 
			
		||||
#
 | 
			
		||||
# The above copyright notice and this permission notice shall be included in
 | 
			
		||||
# all copies or substantial portions of the Software.
 | 
			
		||||
#
 | 
			
		||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
 | 
			
		||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
 | 
			
		||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL THE
 | 
			
		||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN
 | 
			
		||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC-
 | 
			
		||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 | 
			
		||||
#
 | 
			
		||||
# Except as contained in this notice, the name of the X Consortium shall not
 | 
			
		||||
# be used in advertising or otherwise to promote the sale, use or other deal-
 | 
			
		||||
# ings in this Software without prior written authorization from the X Consor-
 | 
			
		||||
# tium.
 | 
			
		||||
#
 | 
			
		||||
#
 | 
			
		||||
# FSF changes to this file are in the public domain.
 | 
			
		||||
#
 | 
			
		||||
# Calling this script install-sh is preferred over install.sh, to prevent
 | 
			
		||||
# `make' implicit rules from creating a file called install from it
 | 
			
		||||
# when there is no Makefile.
 | 
			
		||||
#
 | 
			
		||||
# This script is compatible with the BSD install script, but was written
 | 
			
		||||
# from scratch.
 | 
			
		||||
 | 
			
		||||
nl='
 | 
			
		||||
'
 | 
			
		||||
IFS=" ""	$nl"
 | 
			
		||||
 | 
			
		||||
# set DOITPROG to echo to test this script
 | 
			
		||||
 | 
			
		||||
# Don't use :- since 4.3BSD and earlier shells don't like it.
 | 
			
		||||
doit=${DOITPROG-}
 | 
			
		||||
if test -z "$doit"; then
 | 
			
		||||
  doit_exec=exec
 | 
			
		||||
else
 | 
			
		||||
  doit_exec=$doit
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Put in absolute file names if you don't have them in your path;
 | 
			
		||||
# or use environment vars.
 | 
			
		||||
 | 
			
		||||
chgrpprog=${CHGRPPROG-chgrp}
 | 
			
		||||
chmodprog=${CHMODPROG-chmod}
 | 
			
		||||
chownprog=${CHOWNPROG-chown}
 | 
			
		||||
cmpprog=${CMPPROG-cmp}
 | 
			
		||||
cpprog=${CPPROG-cp}
 | 
			
		||||
mkdirprog=${MKDIRPROG-mkdir}
 | 
			
		||||
mvprog=${MVPROG-mv}
 | 
			
		||||
rmprog=${RMPROG-rm}
 | 
			
		||||
stripprog=${STRIPPROG-strip}
 | 
			
		||||
 | 
			
		||||
posix_glob='?'
 | 
			
		||||
initialize_posix_glob='
 | 
			
		||||
  test "$posix_glob" != "?" || {
 | 
			
		||||
    if (set -f) 2>/dev/null; then
 | 
			
		||||
      posix_glob=
 | 
			
		||||
    else
 | 
			
		||||
      posix_glob=:
 | 
			
		||||
    fi
 | 
			
		||||
  }
 | 
			
		||||
'
 | 
			
		||||
 | 
			
		||||
posix_mkdir=
 | 
			
		||||
 | 
			
		||||
# Desired mode of installed file.
 | 
			
		||||
mode=0755
 | 
			
		||||
 | 
			
		||||
chgrpcmd=
 | 
			
		||||
chmodcmd=$chmodprog
 | 
			
		||||
chowncmd=
 | 
			
		||||
mvcmd=$mvprog
 | 
			
		||||
rmcmd="$rmprog -f"
 | 
			
		||||
stripcmd=
 | 
			
		||||
 | 
			
		||||
src=
 | 
			
		||||
dst=
 | 
			
		||||
dir_arg=
 | 
			
		||||
dst_arg=
 | 
			
		||||
 | 
			
		||||
copy_on_change=false
 | 
			
		||||
no_target_directory=
 | 
			
		||||
 | 
			
		||||
usage="\
 | 
			
		||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE
 | 
			
		||||
   or: $0 [OPTION]... SRCFILES... DIRECTORY
 | 
			
		||||
   or: $0 [OPTION]... -t DIRECTORY SRCFILES...
 | 
			
		||||
   or: $0 [OPTION]... -d DIRECTORIES...
 | 
			
		||||
 | 
			
		||||
In the 1st form, copy SRCFILE to DSTFILE.
 | 
			
		||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY.
 | 
			
		||||
In the 4th, create DIRECTORIES.
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
     --help     display this help and exit.
 | 
			
		||||
     --version  display version info and exit.
 | 
			
		||||
 | 
			
		||||
  -c            (ignored)
 | 
			
		||||
  -C            install only if different (preserve the last data modification time)
 | 
			
		||||
  -d            create directories instead of installing files.
 | 
			
		||||
  -g GROUP      $chgrpprog installed files to GROUP.
 | 
			
		||||
  -m MODE       $chmodprog installed files to MODE.
 | 
			
		||||
  -o USER       $chownprog installed files to USER.
 | 
			
		||||
  -s            $stripprog installed files.
 | 
			
		||||
  -t DIRECTORY  install into DIRECTORY.
 | 
			
		||||
  -T            report an error if DSTFILE is a directory.
 | 
			
		||||
 | 
			
		||||
Environment variables override the default commands:
 | 
			
		||||
  CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG
 | 
			
		||||
  RMPROG STRIPPROG
 | 
			
		||||
"
 | 
			
		||||
 | 
			
		||||
while test $# -ne 0; do
 | 
			
		||||
  case $1 in
 | 
			
		||||
    -c) ;;
 | 
			
		||||
 | 
			
		||||
    -C) copy_on_change=true;;
 | 
			
		||||
 | 
			
		||||
    -d) dir_arg=true;;
 | 
			
		||||
 | 
			
		||||
    -g) chgrpcmd="$chgrpprog $2"
 | 
			
		||||
	shift;;
 | 
			
		||||
 | 
			
		||||
    --help) echo "$usage"; exit $?;;
 | 
			
		||||
 | 
			
		||||
    -m) mode=$2
 | 
			
		||||
	case $mode in
 | 
			
		||||
	  *' '* | *'	'* | *'
 | 
			
		||||
'*	  | *'*'* | *'?'* | *'['*)
 | 
			
		||||
	    echo "$0: invalid mode: $mode" >&2
 | 
			
		||||
	    exit 1;;
 | 
			
		||||
	esac
 | 
			
		||||
	shift;;
 | 
			
		||||
 | 
			
		||||
    -o) chowncmd="$chownprog $2"
 | 
			
		||||
	shift;;
 | 
			
		||||
 | 
			
		||||
    -s) stripcmd=$stripprog;;
 | 
			
		||||
 | 
			
		||||
    -t) dst_arg=$2
 | 
			
		||||
	shift;;
 | 
			
		||||
 | 
			
		||||
    -T) no_target_directory=true;;
 | 
			
		||||
 | 
			
		||||
    --version) echo "$0 $scriptversion"; exit $?;;
 | 
			
		||||
 | 
			
		||||
    --)	shift
 | 
			
		||||
	break;;
 | 
			
		||||
 | 
			
		||||
    -*)	echo "$0: invalid option: $1" >&2
 | 
			
		||||
	exit 1;;
 | 
			
		||||
 | 
			
		||||
    *)  break;;
 | 
			
		||||
  esac
 | 
			
		||||
  shift
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then
 | 
			
		||||
  # When -d is used, all remaining arguments are directories to create.
 | 
			
		||||
  # When -t is used, the destination is already specified.
 | 
			
		||||
  # Otherwise, the last argument is the destination.  Remove it from $@.
 | 
			
		||||
  for arg
 | 
			
		||||
  do
 | 
			
		||||
    if test -n "$dst_arg"; then
 | 
			
		||||
      # $@ is not empty: it contains at least $arg.
 | 
			
		||||
      set fnord "$@" "$dst_arg"
 | 
			
		||||
      shift # fnord
 | 
			
		||||
    fi
 | 
			
		||||
    shift # arg
 | 
			
		||||
    dst_arg=$arg
 | 
			
		||||
  done
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test $# -eq 0; then
 | 
			
		||||
  if test -z "$dir_arg"; then
 | 
			
		||||
    echo "$0: no input file specified." >&2
 | 
			
		||||
    exit 1
 | 
			
		||||
  fi
 | 
			
		||||
  # It's OK to call `install-sh -d' without argument.
 | 
			
		||||
  # This can happen when creating conditional directories.
 | 
			
		||||
  exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if test -z "$dir_arg"; then
 | 
			
		||||
  do_exit='(exit $ret); exit $ret'
 | 
			
		||||
  trap "ret=129; $do_exit" 1
 | 
			
		||||
  trap "ret=130; $do_exit" 2
 | 
			
		||||
  trap "ret=141; $do_exit" 13
 | 
			
		||||
  trap "ret=143; $do_exit" 15
 | 
			
		||||
 | 
			
		||||
  # Set umask so as not to create temps with too-generous modes.
 | 
			
		||||
  # However, 'strip' requires both read and write access to temps.
 | 
			
		||||
  case $mode in
 | 
			
		||||
    # Optimize common cases.
 | 
			
		||||
    *644) cp_umask=133;;
 | 
			
		||||
    *755) cp_umask=22;;
 | 
			
		||||
 | 
			
		||||
    *[0-7])
 | 
			
		||||
      if test -z "$stripcmd"; then
 | 
			
		||||
	u_plus_rw=
 | 
			
		||||
      else
 | 
			
		||||
	u_plus_rw='% 200'
 | 
			
		||||
      fi
 | 
			
		||||
      cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;;
 | 
			
		||||
    *)
 | 
			
		||||
      if test -z "$stripcmd"; then
 | 
			
		||||
	u_plus_rw=
 | 
			
		||||
      else
 | 
			
		||||
	u_plus_rw=,u+rw
 | 
			
		||||
      fi
 | 
			
		||||
      cp_umask=$mode$u_plus_rw;;
 | 
			
		||||
  esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
for src
 | 
			
		||||
do
 | 
			
		||||
  # Protect names starting with `-'.
 | 
			
		||||
  case $src in
 | 
			
		||||
    -*) src=./$src;;
 | 
			
		||||
  esac
 | 
			
		||||
 | 
			
		||||
  if test -n "$dir_arg"; then
 | 
			
		||||
    dst=$src
 | 
			
		||||
    dstdir=$dst
 | 
			
		||||
    test -d "$dstdir"
 | 
			
		||||
    dstdir_status=$?
 | 
			
		||||
  else
 | 
			
		||||
 | 
			
		||||
    # Waiting for this to be detected by the "$cpprog $src $dsttmp" command
 | 
			
		||||
    # might cause directories to be created, which would be especially bad
 | 
			
		||||
    # if $src (and thus $dsttmp) contains '*'.
 | 
			
		||||
    if test ! -f "$src" && test ! -d "$src"; then
 | 
			
		||||
      echo "$0: $src does not exist." >&2
 | 
			
		||||
      exit 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    if test -z "$dst_arg"; then
 | 
			
		||||
      echo "$0: no destination specified." >&2
 | 
			
		||||
      exit 1
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    dst=$dst_arg
 | 
			
		||||
    # Protect names starting with `-'.
 | 
			
		||||
    case $dst in
 | 
			
		||||
      -*) dst=./$dst;;
 | 
			
		||||
    esac
 | 
			
		||||
 | 
			
		||||
    # If destination is a directory, append the input filename; won't work
 | 
			
		||||
    # if double slashes aren't ignored.
 | 
			
		||||
    if test -d "$dst"; then
 | 
			
		||||
      if test -n "$no_target_directory"; then
 | 
			
		||||
	echo "$0: $dst_arg: Is a directory" >&2
 | 
			
		||||
	exit 1
 | 
			
		||||
      fi
 | 
			
		||||
      dstdir=$dst
 | 
			
		||||
      dst=$dstdir/`basename "$src"`
 | 
			
		||||
      dstdir_status=0
 | 
			
		||||
    else
 | 
			
		||||
      # Prefer dirname, but fall back on a substitute if dirname fails.
 | 
			
		||||
      dstdir=`
 | 
			
		||||
	(dirname "$dst") 2>/dev/null ||
 | 
			
		||||
	expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \
 | 
			
		||||
	     X"$dst" : 'X\(//\)[^/]' \| \
 | 
			
		||||
	     X"$dst" : 'X\(//\)$' \| \
 | 
			
		||||
	     X"$dst" : 'X\(/\)' \| . 2>/dev/null ||
 | 
			
		||||
	echo X"$dst" |
 | 
			
		||||
	    sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{
 | 
			
		||||
		   s//\1/
 | 
			
		||||
		   q
 | 
			
		||||
		 }
 | 
			
		||||
		 /^X\(\/\/\)[^/].*/{
 | 
			
		||||
		   s//\1/
 | 
			
		||||
		   q
 | 
			
		||||
		 }
 | 
			
		||||
		 /^X\(\/\/\)$/{
 | 
			
		||||
		   s//\1/
 | 
			
		||||
		   q
 | 
			
		||||
		 }
 | 
			
		||||
		 /^X\(\/\).*/{
 | 
			
		||||
		   s//\1/
 | 
			
		||||
		   q
 | 
			
		||||
		 }
 | 
			
		||||
		 s/.*/./; q'
 | 
			
		||||
      `
 | 
			
		||||
 | 
			
		||||
      test -d "$dstdir"
 | 
			
		||||
      dstdir_status=$?
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  obsolete_mkdir_used=false
 | 
			
		||||
 | 
			
		||||
  if test $dstdir_status != 0; then
 | 
			
		||||
    case $posix_mkdir in
 | 
			
		||||
      '')
 | 
			
		||||
	# Create intermediate dirs using mode 755 as modified by the umask.
 | 
			
		||||
	# This is like FreeBSD 'install' as of 1997-10-28.
 | 
			
		||||
	umask=`umask`
 | 
			
		||||
	case $stripcmd.$umask in
 | 
			
		||||
	  # Optimize common cases.
 | 
			
		||||
	  *[2367][2367]) mkdir_umask=$umask;;
 | 
			
		||||
	  .*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;;
 | 
			
		||||
 | 
			
		||||
	  *[0-7])
 | 
			
		||||
	    mkdir_umask=`expr $umask + 22 \
 | 
			
		||||
	      - $umask % 100 % 40 + $umask % 20 \
 | 
			
		||||
	      - $umask % 10 % 4 + $umask % 2
 | 
			
		||||
	    `;;
 | 
			
		||||
	  *) mkdir_umask=$umask,go-w;;
 | 
			
		||||
	esac
 | 
			
		||||
 | 
			
		||||
	# With -d, create the new directory with the user-specified mode.
 | 
			
		||||
	# Otherwise, rely on $mkdir_umask.
 | 
			
		||||
	if test -n "$dir_arg"; then
 | 
			
		||||
	  mkdir_mode=-m$mode
 | 
			
		||||
	else
 | 
			
		||||
	  mkdir_mode=
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	posix_mkdir=false
 | 
			
		||||
	case $umask in
 | 
			
		||||
	  *[123567][0-7][0-7])
 | 
			
		||||
	    # POSIX mkdir -p sets u+wx bits regardless of umask, which
 | 
			
		||||
	    # is incompatible with FreeBSD 'install' when (umask & 300) != 0.
 | 
			
		||||
	    ;;
 | 
			
		||||
	  *)
 | 
			
		||||
	    tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$
 | 
			
		||||
	    trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0
 | 
			
		||||
 | 
			
		||||
	    if (umask $mkdir_umask &&
 | 
			
		||||
		exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1
 | 
			
		||||
	    then
 | 
			
		||||
	      if test -z "$dir_arg" || {
 | 
			
		||||
		   # Check for POSIX incompatibilities with -m.
 | 
			
		||||
		   # HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or
 | 
			
		||||
		   # other-writeable bit of parent directory when it shouldn't.
 | 
			
		||||
		   # FreeBSD 6.1 mkdir -m -p sets mode of existing directory.
 | 
			
		||||
		   ls_ld_tmpdir=`ls -ld "$tmpdir"`
 | 
			
		||||
		   case $ls_ld_tmpdir in
 | 
			
		||||
		     d????-?r-*) different_mode=700;;
 | 
			
		||||
		     d????-?--*) different_mode=755;;
 | 
			
		||||
		     *) false;;
 | 
			
		||||
		   esac &&
 | 
			
		||||
		   $mkdirprog -m$different_mode -p -- "$tmpdir" && {
 | 
			
		||||
		     ls_ld_tmpdir_1=`ls -ld "$tmpdir"`
 | 
			
		||||
		     test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1"
 | 
			
		||||
		   }
 | 
			
		||||
		 }
 | 
			
		||||
	      then posix_mkdir=:
 | 
			
		||||
	      fi
 | 
			
		||||
	      rmdir "$tmpdir/d" "$tmpdir"
 | 
			
		||||
	    else
 | 
			
		||||
	      # Remove any dirs left behind by ancient mkdir implementations.
 | 
			
		||||
	      rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null
 | 
			
		||||
	    fi
 | 
			
		||||
	    trap '' 0;;
 | 
			
		||||
	esac;;
 | 
			
		||||
    esac
 | 
			
		||||
 | 
			
		||||
    if
 | 
			
		||||
      $posix_mkdir && (
 | 
			
		||||
	umask $mkdir_umask &&
 | 
			
		||||
	$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir"
 | 
			
		||||
      )
 | 
			
		||||
    then :
 | 
			
		||||
    else
 | 
			
		||||
 | 
			
		||||
      # The umask is ridiculous, or mkdir does not conform to POSIX,
 | 
			
		||||
      # or it failed possibly due to a race condition.  Create the
 | 
			
		||||
      # directory the slow way, step by step, checking for races as we go.
 | 
			
		||||
 | 
			
		||||
      case $dstdir in
 | 
			
		||||
	/*) prefix='/';;
 | 
			
		||||
	-*) prefix='./';;
 | 
			
		||||
	*)  prefix='';;
 | 
			
		||||
      esac
 | 
			
		||||
 | 
			
		||||
      eval "$initialize_posix_glob"
 | 
			
		||||
 | 
			
		||||
      oIFS=$IFS
 | 
			
		||||
      IFS=/
 | 
			
		||||
      $posix_glob set -f
 | 
			
		||||
      set fnord $dstdir
 | 
			
		||||
      shift
 | 
			
		||||
      $posix_glob set +f
 | 
			
		||||
      IFS=$oIFS
 | 
			
		||||
 | 
			
		||||
      prefixes=
 | 
			
		||||
 | 
			
		||||
      for d
 | 
			
		||||
      do
 | 
			
		||||
	test -z "$d" && continue
 | 
			
		||||
 | 
			
		||||
	prefix=$prefix$d
 | 
			
		||||
	if test -d "$prefix"; then
 | 
			
		||||
	  prefixes=
 | 
			
		||||
	else
 | 
			
		||||
	  if $posix_mkdir; then
 | 
			
		||||
	    (umask=$mkdir_umask &&
 | 
			
		||||
	     $doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break
 | 
			
		||||
	    # Don't fail if two instances are running concurrently.
 | 
			
		||||
	    test -d "$prefix" || exit 1
 | 
			
		||||
	  else
 | 
			
		||||
	    case $prefix in
 | 
			
		||||
	      *\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;;
 | 
			
		||||
	      *) qprefix=$prefix;;
 | 
			
		||||
	    esac
 | 
			
		||||
	    prefixes="$prefixes '$qprefix'"
 | 
			
		||||
	  fi
 | 
			
		||||
	fi
 | 
			
		||||
	prefix=$prefix/
 | 
			
		||||
      done
 | 
			
		||||
 | 
			
		||||
      if test -n "$prefixes"; then
 | 
			
		||||
	# Don't fail if two instances are running concurrently.
 | 
			
		||||
	(umask $mkdir_umask &&
 | 
			
		||||
	 eval "\$doit_exec \$mkdirprog $prefixes") ||
 | 
			
		||||
	  test -d "$dstdir" || exit 1
 | 
			
		||||
	obsolete_mkdir_used=true
 | 
			
		||||
      fi
 | 
			
		||||
    fi
 | 
			
		||||
  fi
 | 
			
		||||
 | 
			
		||||
  if test -n "$dir_arg"; then
 | 
			
		||||
    { test -z "$chowncmd" || $doit $chowncmd "$dst"; } &&
 | 
			
		||||
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } &&
 | 
			
		||||
    { test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false ||
 | 
			
		||||
      test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1
 | 
			
		||||
  else
 | 
			
		||||
 | 
			
		||||
    # Make a couple of temp file names in the proper directory.
 | 
			
		||||
    dsttmp=$dstdir/_inst.$$_
 | 
			
		||||
    rmtmp=$dstdir/_rm.$$_
 | 
			
		||||
 | 
			
		||||
    # Trap to clean up those temp files at exit.
 | 
			
		||||
    trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0
 | 
			
		||||
 | 
			
		||||
    # Copy the file name to the temp name.
 | 
			
		||||
    (umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") &&
 | 
			
		||||
 | 
			
		||||
    # and set any options; do chmod last to preserve setuid bits.
 | 
			
		||||
    #
 | 
			
		||||
    # If any of these fail, we abort the whole thing.  If we want to
 | 
			
		||||
    # ignore errors from any of these, just make sure not to ignore
 | 
			
		||||
    # errors from the above "$doit $cpprog $src $dsttmp" command.
 | 
			
		||||
    #
 | 
			
		||||
    { test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } &&
 | 
			
		||||
    { test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } &&
 | 
			
		||||
    { test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } &&
 | 
			
		||||
    { test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } &&
 | 
			
		||||
 | 
			
		||||
    # If -C, don't bother to copy if it wouldn't change the file.
 | 
			
		||||
    if $copy_on_change &&
 | 
			
		||||
       old=`LC_ALL=C ls -dlL "$dst"	2>/dev/null` &&
 | 
			
		||||
       new=`LC_ALL=C ls -dlL "$dsttmp"	2>/dev/null` &&
 | 
			
		||||
 | 
			
		||||
       eval "$initialize_posix_glob" &&
 | 
			
		||||
       $posix_glob set -f &&
 | 
			
		||||
       set X $old && old=:$2:$4:$5:$6 &&
 | 
			
		||||
       set X $new && new=:$2:$4:$5:$6 &&
 | 
			
		||||
       $posix_glob set +f &&
 | 
			
		||||
 | 
			
		||||
       test "$old" = "$new" &&
 | 
			
		||||
       $cmpprog "$dst" "$dsttmp" >/dev/null 2>&1
 | 
			
		||||
    then
 | 
			
		||||
      rm -f "$dsttmp"
 | 
			
		||||
    else
 | 
			
		||||
      # Rename the file to the real destination.
 | 
			
		||||
      $doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null ||
 | 
			
		||||
 | 
			
		||||
      # The rename failed, perhaps because mv can't rename something else
 | 
			
		||||
      # to itself, or perhaps because mv is so ancient that it does not
 | 
			
		||||
      # support -f.
 | 
			
		||||
      {
 | 
			
		||||
	# Now remove or move aside any old file at destination location.
 | 
			
		||||
	# We try this two ways since rm can't unlink itself on some
 | 
			
		||||
	# systems and the destination file might be busy for other
 | 
			
		||||
	# reasons.  In this case, the final cleanup might fail but the new
 | 
			
		||||
	# file should still install successfully.
 | 
			
		||||
	{
 | 
			
		||||
	  test ! -f "$dst" ||
 | 
			
		||||
	  $doit $rmcmd -f "$dst" 2>/dev/null ||
 | 
			
		||||
	  { $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null &&
 | 
			
		||||
	    { $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; }
 | 
			
		||||
	  } ||
 | 
			
		||||
	  { echo "$0: cannot unlink or rename $dst" >&2
 | 
			
		||||
	    (exit 1); exit 1
 | 
			
		||||
	  }
 | 
			
		||||
	} &&
 | 
			
		||||
 | 
			
		||||
	# Now rename the file to the real destination.
 | 
			
		||||
	$doit $mvcmd "$dsttmp" "$dst"
 | 
			
		||||
      }
 | 
			
		||||
    fi || exit 1
 | 
			
		||||
 | 
			
		||||
    trap '' 0
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# Local variables:
 | 
			
		||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
 | 
			
		||||
# time-stamp-start: "scriptversion="
 | 
			
		||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
 | 
			
		||||
# time-stamp-time-zone: "UTC"
 | 
			
		||||
# time-stamp-end: "; # UTC"
 | 
			
		||||
# End:
 | 
			
		||||
							
								
								
									
										33
									
								
								build-aux/ltmain-asneeded.patch
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								build-aux/ltmain-asneeded.patch
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,33 @@
 | 
			
		||||
--- ltmain.sh.orig	2013-06-26 14:31:53.472627840 +1000
 | 
			
		||||
+++ ltmain.sh	2013-06-26 14:30:56.137038936 +1000
 | 
			
		||||
@@ -5800,6 +5800,14 @@
 | 
			
		||||
 	arg=$func_stripname_result
 | 
			
		||||
 	;;
 | 
			
		||||
 
 | 
			
		||||
+      -Wl,*--as-needed*)
 | 
			
		||||
+	deplibs="$deplibs $wl--as-needed"
 | 
			
		||||
+	;;
 | 
			
		||||
+
 | 
			
		||||
+      -Wl,*--no-as-needed*)
 | 
			
		||||
+	deplibs="$deplibs $wl--no-as-needed"
 | 
			
		||||
+	;;
 | 
			
		||||
+
 | 
			
		||||
       -Wl,*)
 | 
			
		||||
 	func_stripname '-Wl,' '' "$arg"
 | 
			
		||||
 	args=$func_stripname_result
 | 
			
		||||
@@ -6160,6 +6168,15 @@
 | 
			
		||||
 	lib=
 | 
			
		||||
 	found=no
 | 
			
		||||
 	case $deplib in
 | 
			
		||||
+	-Wl,--as-needed|-Wl,--no-as-needed)
 | 
			
		||||
+	  if test "$linkmode,$pass" = "prog,link"; then
 | 
			
		||||
+	    compile_deplibs="$deplib $compile_deplibs"
 | 
			
		||||
+	    finalize_deplibs="$deplib $finalize_deplibs"
 | 
			
		||||
+	  else
 | 
			
		||||
+	    deplibs="$deplib $deplibs"
 | 
			
		||||
+	  fi
 | 
			
		||||
+	  continue
 | 
			
		||||
+	  ;;
 | 
			
		||||
 	-mt|-mthreads|-kthread|-Kthread|-pthread|-pthreads|--thread-safe \
 | 
			
		||||
         |-threads|-fopenmp|-openmp|-mp|-xopenmp|-omp|-qsmp=*)
 | 
			
		||||
 	  if test "$linkmode,$pass" = "prog,link"; then
 | 
			
		||||
							
								
								
									
										9672
									
								
								build-aux/ltmain.sh
									
									
									
									
									
								
							
							
						
						
									
										9672
									
								
								build-aux/ltmain.sh
									
									
									
									
									
								
							
										
											
												File diff suppressed because it is too large
												Load Diff
											
										
									
								
							@@ -1,215 +0,0 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
# Common wrapper for a few potentially missing GNU programs.
 | 
			
		||||
 | 
			
		||||
scriptversion=2012-06-26.16; # UTC
 | 
			
		||||
 | 
			
		||||
# Copyright (C) 1996-2013 Free Software Foundation, Inc.
 | 
			
		||||
# Originally written by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996.
 | 
			
		||||
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2, or (at your option)
 | 
			
		||||
# any later version.
 | 
			
		||||
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
# As a special exception to the GNU General Public License, if you
 | 
			
		||||
# distribute this file as part of a program that contains a
 | 
			
		||||
# configuration script generated by Autoconf, you may include it under
 | 
			
		||||
# the same distribution terms that you use for the rest of that program.
 | 
			
		||||
 | 
			
		||||
if test $# -eq 0; then
 | 
			
		||||
  echo 1>&2 "Try '$0 --help' for more information"
 | 
			
		||||
  exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case $1 in
 | 
			
		||||
 | 
			
		||||
  --is-lightweight)
 | 
			
		||||
    # Used by our autoconf macros to check whether the available missing
 | 
			
		||||
    # script is modern enough.
 | 
			
		||||
    exit 0
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
  --run)
 | 
			
		||||
    # Back-compat with the calling convention used by older automake.
 | 
			
		||||
    shift
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
  -h|--h|--he|--hel|--help)
 | 
			
		||||
    echo "\
 | 
			
		||||
$0 [OPTION]... PROGRAM [ARGUMENT]...
 | 
			
		||||
 | 
			
		||||
Run 'PROGRAM [ARGUMENT]...', returning a proper advice when this fails due
 | 
			
		||||
to PROGRAM being missing or too old.
 | 
			
		||||
 | 
			
		||||
Options:
 | 
			
		||||
  -h, --help      display this help and exit
 | 
			
		||||
  -v, --version   output version information and exit
 | 
			
		||||
 | 
			
		||||
Supported PROGRAM values:
 | 
			
		||||
  aclocal   autoconf  autoheader   autom4te  automake  makeinfo
 | 
			
		||||
  bison     yacc      flex         lex       help2man
 | 
			
		||||
 | 
			
		||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and
 | 
			
		||||
'g' are ignored when checking the name.
 | 
			
		||||
 | 
			
		||||
Send bug reports to <bug-automake@gnu.org>."
 | 
			
		||||
    exit $?
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
  -v|--v|--ve|--ver|--vers|--versi|--versio|--version)
 | 
			
		||||
    echo "missing $scriptversion (GNU Automake)"
 | 
			
		||||
    exit $?
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
  -*)
 | 
			
		||||
    echo 1>&2 "$0: unknown '$1' option"
 | 
			
		||||
    echo 1>&2 "Try '$0 --help' for more information"
 | 
			
		||||
    exit 1
 | 
			
		||||
    ;;
 | 
			
		||||
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
# Run the given program, remember its exit status.
 | 
			
		||||
"$@"; st=$?
 | 
			
		||||
 | 
			
		||||
# If it succeeded, we are done.
 | 
			
		||||
test $st -eq 0 && exit 0
 | 
			
		||||
 | 
			
		||||
# Also exit now if we it failed (or wasn't found), and '--version' was
 | 
			
		||||
# passed; such an option is passed most likely to detect whether the
 | 
			
		||||
# program is present and works.
 | 
			
		||||
case $2 in --version|--help) exit $st;; esac
 | 
			
		||||
 | 
			
		||||
# Exit code 63 means version mismatch.  This often happens when the user
 | 
			
		||||
# tries to use an ancient version of a tool on a file that requires a
 | 
			
		||||
# minimum version.
 | 
			
		||||
if test $st -eq 63; then
 | 
			
		||||
  msg="probably too old"
 | 
			
		||||
elif test $st -eq 127; then
 | 
			
		||||
  # Program was missing.
 | 
			
		||||
  msg="missing on your system"
 | 
			
		||||
else
 | 
			
		||||
  # Program was found and executed, but failed.  Give up.
 | 
			
		||||
  exit $st
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
perl_URL=http://www.perl.org/
 | 
			
		||||
flex_URL=http://flex.sourceforge.net/
 | 
			
		||||
gnu_software_URL=http://www.gnu.org/software
 | 
			
		||||
 | 
			
		||||
program_details ()
 | 
			
		||||
{
 | 
			
		||||
  case $1 in
 | 
			
		||||
    aclocal|automake)
 | 
			
		||||
      echo "The '$1' program is part of the GNU Automake package:"
 | 
			
		||||
      echo "<$gnu_software_URL/automake>"
 | 
			
		||||
      echo "It also requires GNU Autoconf, GNU m4 and Perl in order to run:"
 | 
			
		||||
      echo "<$gnu_software_URL/autoconf>"
 | 
			
		||||
      echo "<$gnu_software_URL/m4/>"
 | 
			
		||||
      echo "<$perl_URL>"
 | 
			
		||||
      ;;
 | 
			
		||||
    autoconf|autom4te|autoheader)
 | 
			
		||||
      echo "The '$1' program is part of the GNU Autoconf package:"
 | 
			
		||||
      echo "<$gnu_software_URL/autoconf/>"
 | 
			
		||||
      echo "It also requires GNU m4 and Perl in order to run:"
 | 
			
		||||
      echo "<$gnu_software_URL/m4/>"
 | 
			
		||||
      echo "<$perl_URL>"
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
give_advice ()
 | 
			
		||||
{
 | 
			
		||||
  # Normalize program name to check for.
 | 
			
		||||
  normalized_program=`echo "$1" | sed '
 | 
			
		||||
    s/^gnu-//; t
 | 
			
		||||
    s/^gnu//; t
 | 
			
		||||
    s/^g//; t'`
 | 
			
		||||
 | 
			
		||||
  printf '%s\n' "'$1' is $msg."
 | 
			
		||||
 | 
			
		||||
  configure_deps="'configure.ac' or m4 files included by 'configure.ac'"
 | 
			
		||||
  case $normalized_program in
 | 
			
		||||
    autoconf*)
 | 
			
		||||
      echo "You should only need it if you modified 'configure.ac',"
 | 
			
		||||
      echo "or m4 files included by it."
 | 
			
		||||
      program_details 'autoconf'
 | 
			
		||||
      ;;
 | 
			
		||||
    autoheader*)
 | 
			
		||||
      echo "You should only need it if you modified 'acconfig.h' or"
 | 
			
		||||
      echo "$configure_deps."
 | 
			
		||||
      program_details 'autoheader'
 | 
			
		||||
      ;;
 | 
			
		||||
    automake*)
 | 
			
		||||
      echo "You should only need it if you modified 'Makefile.am' or"
 | 
			
		||||
      echo "$configure_deps."
 | 
			
		||||
      program_details 'automake'
 | 
			
		||||
      ;;
 | 
			
		||||
    aclocal*)
 | 
			
		||||
      echo "You should only need it if you modified 'acinclude.m4' or"
 | 
			
		||||
      echo "$configure_deps."
 | 
			
		||||
      program_details 'aclocal'
 | 
			
		||||
      ;;
 | 
			
		||||
   autom4te*)
 | 
			
		||||
      echo "You might have modified some maintainer files that require"
 | 
			
		||||
      echo "the 'automa4te' program to be rebuilt."
 | 
			
		||||
      program_details 'autom4te'
 | 
			
		||||
      ;;
 | 
			
		||||
    bison*|yacc*)
 | 
			
		||||
      echo "You should only need it if you modified a '.y' file."
 | 
			
		||||
      echo "You may want to install the GNU Bison package:"
 | 
			
		||||
      echo "<$gnu_software_URL/bison/>"
 | 
			
		||||
      ;;
 | 
			
		||||
    lex*|flex*)
 | 
			
		||||
      echo "You should only need it if you modified a '.l' file."
 | 
			
		||||
      echo "You may want to install the Fast Lexical Analyzer package:"
 | 
			
		||||
      echo "<$flex_URL>"
 | 
			
		||||
      ;;
 | 
			
		||||
    help2man*)
 | 
			
		||||
      echo "You should only need it if you modified a dependency" \
 | 
			
		||||
           "of a man page."
 | 
			
		||||
      echo "You may want to install the GNU Help2man package:"
 | 
			
		||||
      echo "<$gnu_software_URL/help2man/>"
 | 
			
		||||
    ;;
 | 
			
		||||
    makeinfo*)
 | 
			
		||||
      echo "You should only need it if you modified a '.texi' file, or"
 | 
			
		||||
      echo "any other file indirectly affecting the aspect of the manual."
 | 
			
		||||
      echo "You might want to install the Texinfo package:"
 | 
			
		||||
      echo "<$gnu_software_URL/texinfo/>"
 | 
			
		||||
      echo "The spurious makeinfo call might also be the consequence of"
 | 
			
		||||
      echo "using a buggy 'make' (AIX, DU, IRIX), in which case you might"
 | 
			
		||||
      echo "want to install GNU make:"
 | 
			
		||||
      echo "<$gnu_software_URL/make/>"
 | 
			
		||||
      ;;
 | 
			
		||||
    *)
 | 
			
		||||
      echo "You might have modified some files without having the proper"
 | 
			
		||||
      echo "tools for further handling them.  Check the 'README' file, it"
 | 
			
		||||
      echo "often tells you about the needed prerequisites for installing"
 | 
			
		||||
      echo "this package.  You may also peek at any GNU archive site, in"
 | 
			
		||||
      echo "case some other package contains this missing '$1' program."
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
give_advice "$1" | sed -e '1s/^/WARNING: /' \
 | 
			
		||||
                       -e '2,$s/^/         /' >&2
 | 
			
		||||
 | 
			
		||||
# Propagate the correct exit status (expected to be 127 for a program
 | 
			
		||||
# not found, 63 for a program that failed due to version mismatch).
 | 
			
		||||
exit $st
 | 
			
		||||
 | 
			
		||||
# Local variables:
 | 
			
		||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
 | 
			
		||||
# time-stamp-start: "scriptversion="
 | 
			
		||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
 | 
			
		||||
# time-stamp-time-zone: "UTC"
 | 
			
		||||
# time-stamp-end: "; # UTC"
 | 
			
		||||
# End:
 | 
			
		||||
@@ -1,162 +0,0 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
# mkinstalldirs --- make directory hierarchy
 | 
			
		||||
 | 
			
		||||
scriptversion=2009-04-28.21; # UTC
 | 
			
		||||
 | 
			
		||||
# Original author: Noah Friedman <friedman@prep.ai.mit.edu>
 | 
			
		||||
# Created: 1993-05-16
 | 
			
		||||
# Public domain.
 | 
			
		||||
#
 | 
			
		||||
# This file is maintained in Automake, please report
 | 
			
		||||
# bugs to <bug-automake@gnu.org> or send patches to
 | 
			
		||||
# <automake-patches@gnu.org>.
 | 
			
		||||
 | 
			
		||||
nl='
 | 
			
		||||
'
 | 
			
		||||
IFS=" ""	$nl"
 | 
			
		||||
errstatus=0
 | 
			
		||||
dirmode=
 | 
			
		||||
 | 
			
		||||
usage="\
 | 
			
		||||
Usage: mkinstalldirs [-h] [--help] [--version] [-m MODE] DIR ...
 | 
			
		||||
 | 
			
		||||
Create each directory DIR (with mode MODE, if specified), including all
 | 
			
		||||
leading file name components.
 | 
			
		||||
 | 
			
		||||
Report bugs to <bug-automake@gnu.org>."
 | 
			
		||||
 | 
			
		||||
# process command line arguments
 | 
			
		||||
while test $# -gt 0 ; do
 | 
			
		||||
  case $1 in
 | 
			
		||||
    -h | --help | --h*)         # -h for help
 | 
			
		||||
      echo "$usage"
 | 
			
		||||
      exit $?
 | 
			
		||||
      ;;
 | 
			
		||||
    -m)                         # -m PERM arg
 | 
			
		||||
      shift
 | 
			
		||||
      test $# -eq 0 && { echo "$usage" 1>&2; exit 1; }
 | 
			
		||||
      dirmode=$1
 | 
			
		||||
      shift
 | 
			
		||||
      ;;
 | 
			
		||||
    --version)
 | 
			
		||||
      echo "$0 $scriptversion"
 | 
			
		||||
      exit $?
 | 
			
		||||
      ;;
 | 
			
		||||
    --)                         # stop option processing
 | 
			
		||||
      shift
 | 
			
		||||
      break
 | 
			
		||||
      ;;
 | 
			
		||||
    -*)                         # unknown option
 | 
			
		||||
      echo "$usage" 1>&2
 | 
			
		||||
      exit 1
 | 
			
		||||
      ;;
 | 
			
		||||
    *)                          # first non-opt arg
 | 
			
		||||
      break
 | 
			
		||||
      ;;
 | 
			
		||||
  esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
for file
 | 
			
		||||
do
 | 
			
		||||
  if test -d "$file"; then
 | 
			
		||||
    shift
 | 
			
		||||
  else
 | 
			
		||||
    break
 | 
			
		||||
  fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
case $# in
 | 
			
		||||
  0) exit 0 ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
# Solaris 8's mkdir -p isn't thread-safe.  If you mkdir -p a/b and
 | 
			
		||||
# mkdir -p a/c at the same time, both will detect that a is missing,
 | 
			
		||||
# one will create a, then the other will try to create a and die with
 | 
			
		||||
# a "File exists" error.  This is a problem when calling mkinstalldirs
 | 
			
		||||
# from a parallel make.  We use --version in the probe to restrict
 | 
			
		||||
# ourselves to GNU mkdir, which is thread-safe.
 | 
			
		||||
case $dirmode in
 | 
			
		||||
  '')
 | 
			
		||||
    if mkdir -p --version . >/dev/null 2>&1 && test ! -d ./--version; then
 | 
			
		||||
      echo "mkdir -p -- $*"
 | 
			
		||||
      exec mkdir -p -- "$@"
 | 
			
		||||
    else
 | 
			
		||||
      # On NextStep and OpenStep, the `mkdir' command does not
 | 
			
		||||
      # recognize any option.  It will interpret all options as
 | 
			
		||||
      # directories to create, and then abort because `.' already
 | 
			
		||||
      # exists.
 | 
			
		||||
      test -d ./-p && rmdir ./-p
 | 
			
		||||
      test -d ./--version && rmdir ./--version
 | 
			
		||||
    fi
 | 
			
		||||
    ;;
 | 
			
		||||
  *)
 | 
			
		||||
    if mkdir -m "$dirmode" -p --version . >/dev/null 2>&1 &&
 | 
			
		||||
       test ! -d ./--version; then
 | 
			
		||||
      echo "mkdir -m $dirmode -p -- $*"
 | 
			
		||||
      exec mkdir -m "$dirmode" -p -- "$@"
 | 
			
		||||
    else
 | 
			
		||||
      # Clean up after NextStep and OpenStep mkdir.
 | 
			
		||||
      for d in ./-m ./-p ./--version "./$dirmode";
 | 
			
		||||
      do
 | 
			
		||||
        test -d $d && rmdir $d
 | 
			
		||||
      done
 | 
			
		||||
    fi
 | 
			
		||||
    ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
for file
 | 
			
		||||
do
 | 
			
		||||
  case $file in
 | 
			
		||||
    /*) pathcomp=/ ;;
 | 
			
		||||
    *)  pathcomp= ;;
 | 
			
		||||
  esac
 | 
			
		||||
  oIFS=$IFS
 | 
			
		||||
  IFS=/
 | 
			
		||||
  set fnord $file
 | 
			
		||||
  shift
 | 
			
		||||
  IFS=$oIFS
 | 
			
		||||
 | 
			
		||||
  for d
 | 
			
		||||
  do
 | 
			
		||||
    test "x$d" = x && continue
 | 
			
		||||
 | 
			
		||||
    pathcomp=$pathcomp$d
 | 
			
		||||
    case $pathcomp in
 | 
			
		||||
      -*) pathcomp=./$pathcomp ;;
 | 
			
		||||
    esac
 | 
			
		||||
 | 
			
		||||
    if test ! -d "$pathcomp"; then
 | 
			
		||||
      echo "mkdir $pathcomp"
 | 
			
		||||
 | 
			
		||||
      mkdir "$pathcomp" || lasterr=$?
 | 
			
		||||
 | 
			
		||||
      if test ! -d "$pathcomp"; then
 | 
			
		||||
	errstatus=$lasterr
 | 
			
		||||
      else
 | 
			
		||||
	if test ! -z "$dirmode"; then
 | 
			
		||||
	  echo "chmod $dirmode $pathcomp"
 | 
			
		||||
	  lasterr=
 | 
			
		||||
	  chmod "$dirmode" "$pathcomp" || lasterr=$?
 | 
			
		||||
 | 
			
		||||
	  if test ! -z "$lasterr"; then
 | 
			
		||||
	    errstatus=$lasterr
 | 
			
		||||
	  fi
 | 
			
		||||
	fi
 | 
			
		||||
      fi
 | 
			
		||||
    fi
 | 
			
		||||
 | 
			
		||||
    pathcomp=$pathcomp/
 | 
			
		||||
  done
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
exit $errstatus
 | 
			
		||||
 | 
			
		||||
# Local Variables:
 | 
			
		||||
# mode: shell-script
 | 
			
		||||
# sh-indentation: 2
 | 
			
		||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
 | 
			
		||||
# time-stamp-start: "scriptversion="
 | 
			
		||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
 | 
			
		||||
# time-stamp-time-zone: "UTC"
 | 
			
		||||
# time-stamp-end: "; # UTC"
 | 
			
		||||
# End:
 | 
			
		||||
							
								
								
									
										652
									
								
								build-aux/tap-driver.sh
									
									
									
									
									
										Executable file
									
								
							
							
						
						
									
										652
									
								
								build-aux/tap-driver.sh
									
									
									
									
									
										Executable file
									
								
							@@ -0,0 +1,652 @@
 | 
			
		||||
#! /bin/sh
 | 
			
		||||
# Copyright (C) 2011-2013 Free Software Foundation, Inc.
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or modify
 | 
			
		||||
# it under the terms of the GNU General Public License as published by
 | 
			
		||||
# the Free Software Foundation; either version 2, or (at your option)
 | 
			
		||||
# any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
# As a special exception to the GNU General Public License, if you
 | 
			
		||||
# distribute this file as part of a program that contains a
 | 
			
		||||
# configuration script generated by Autoconf, you may include it under
 | 
			
		||||
# the same distribution terms that you use for the rest of that program.
 | 
			
		||||
 | 
			
		||||
# This file is maintained in Automake, please report
 | 
			
		||||
# bugs to <bug-automake@gnu.org> or send patches to
 | 
			
		||||
# <automake-patches@gnu.org>.
 | 
			
		||||
 | 
			
		||||
scriptversion=2011-12-27.17; # UTC
 | 
			
		||||
 | 
			
		||||
# Make unconditional expansion of undefined variables an error.  This
 | 
			
		||||
# helps a lot in preventing typo-related bugs.
 | 
			
		||||
set -u
 | 
			
		||||
 | 
			
		||||
me=tap-driver.sh
 | 
			
		||||
 | 
			
		||||
fatal ()
 | 
			
		||||
{
 | 
			
		||||
  echo "$me: fatal: $*" >&2
 | 
			
		||||
  exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
usage_error ()
 | 
			
		||||
{
 | 
			
		||||
  echo "$me: $*" >&2
 | 
			
		||||
  print_usage >&2
 | 
			
		||||
  exit 2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print_usage ()
 | 
			
		||||
{
 | 
			
		||||
  cat <<END
 | 
			
		||||
Usage:
 | 
			
		||||
  tap-driver.sh --test-name=NAME --log-file=PATH --trs-file=PATH
 | 
			
		||||
                [--expect-failure={yes|no}] [--color-tests={yes|no}]
 | 
			
		||||
                [--enable-hard-errors={yes|no}] [--ignore-exit]
 | 
			
		||||
                [--diagnostic-string=STRING] [--merge|--no-merge]
 | 
			
		||||
                [--comments|--no-comments] [--] TEST-COMMAND
 | 
			
		||||
The \`--test-name', \`--log-file' and \`--trs-file' options are mandatory.
 | 
			
		||||
END
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# TODO: better error handling in option parsing (in particular, ensure
 | 
			
		||||
# TODO: $log_file, $trs_file and $test_name are defined).
 | 
			
		||||
test_name= # Used for reporting.
 | 
			
		||||
log_file=  # Where to save the result and output of the test script.
 | 
			
		||||
trs_file=  # Where to save the metadata of the test run.
 | 
			
		||||
expect_failure=0
 | 
			
		||||
color_tests=0
 | 
			
		||||
merge=0
 | 
			
		||||
ignore_exit=0
 | 
			
		||||
comments=0
 | 
			
		||||
diag_string='#'
 | 
			
		||||
while test $# -gt 0; do
 | 
			
		||||
  case $1 in
 | 
			
		||||
  --help) print_usage; exit $?;;
 | 
			
		||||
  --version) echo "$me $scriptversion"; exit $?;;
 | 
			
		||||
  --test-name) test_name=$2; shift;;
 | 
			
		||||
  --log-file) log_file=$2; shift;;
 | 
			
		||||
  --trs-file) trs_file=$2; shift;;
 | 
			
		||||
  --color-tests) color_tests=$2; shift;;
 | 
			
		||||
  --expect-failure) expect_failure=$2; shift;;
 | 
			
		||||
  --enable-hard-errors) shift;; # No-op.
 | 
			
		||||
  --merge) merge=1;;
 | 
			
		||||
  --no-merge) merge=0;;
 | 
			
		||||
  --ignore-exit) ignore_exit=1;;
 | 
			
		||||
  --comments) comments=1;;
 | 
			
		||||
  --no-comments) comments=0;;
 | 
			
		||||
  --diagnostic-string) diag_string=$2; shift;;
 | 
			
		||||
  --) shift; break;;
 | 
			
		||||
  -*) usage_error "invalid option: '$1'";;
 | 
			
		||||
  esac
 | 
			
		||||
  shift
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
test $# -gt 0 || usage_error "missing test command"
 | 
			
		||||
 | 
			
		||||
case $expect_failure in
 | 
			
		||||
  yes) expect_failure=1;;
 | 
			
		||||
    *) expect_failure=0;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
if test $color_tests = yes; then
 | 
			
		||||
  init_colors='
 | 
			
		||||
    color_map["red"]="[0;31m" # Red.
 | 
			
		||||
    color_map["grn"]="[0;32m" # Green.
 | 
			
		||||
    color_map["lgn"]="[1;32m" # Light green.
 | 
			
		||||
    color_map["blu"]="[1;34m" # Blue.
 | 
			
		||||
    color_map["mgn"]="[0;35m" # Magenta.
 | 
			
		||||
    color_map["std"]="[m"     # No color.
 | 
			
		||||
    color_for_result["ERROR"] = "mgn"
 | 
			
		||||
    color_for_result["PASS"]  = "grn"
 | 
			
		||||
    color_for_result["XPASS"] = "red"
 | 
			
		||||
    color_for_result["FAIL"]  = "red"
 | 
			
		||||
    color_for_result["XFAIL"] = "lgn"
 | 
			
		||||
    color_for_result["SKIP"]  = "blu"'
 | 
			
		||||
else
 | 
			
		||||
  init_colors=''
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# :; is there to work around a bug in bash 3.2 (and earlier) which
 | 
			
		||||
# does not always set '$?' properly on redirection failure.
 | 
			
		||||
# See the Autoconf manual for more details.
 | 
			
		||||
:;{
 | 
			
		||||
  (
 | 
			
		||||
    # Ignore common signals (in this subshell only!), to avoid potential
 | 
			
		||||
    # problems with Korn shells.  Some Korn shells are known to propagate
 | 
			
		||||
    # to themselves signals that have killed a child process they were
 | 
			
		||||
    # waiting for; this is done at least for SIGINT (and usually only for
 | 
			
		||||
    # it, in truth).  Without the `trap' below, such a behaviour could
 | 
			
		||||
    # cause a premature exit in the current subshell, e.g., in case the
 | 
			
		||||
    # test command it runs gets terminated by a SIGINT.  Thus, the awk
 | 
			
		||||
    # script we are piping into would never seen the exit status it
 | 
			
		||||
    # expects on its last input line (which is displayed below by the
 | 
			
		||||
    # last `echo $?' statement), and would thus die reporting an internal
 | 
			
		||||
    # error.
 | 
			
		||||
    # For more information, see the Autoconf manual and the threads:
 | 
			
		||||
    # <http://lists.gnu.org/archive/html/bug-autoconf/2011-09/msg00004.html>
 | 
			
		||||
    # <http://mail.opensolaris.org/pipermail/ksh93-integration-discuss/2009-February/004121.html>
 | 
			
		||||
    trap : 1 3 2 13 15
 | 
			
		||||
    if test $merge -gt 0; then
 | 
			
		||||
      exec 2>&1
 | 
			
		||||
    else
 | 
			
		||||
      exec 2>&3
 | 
			
		||||
    fi
 | 
			
		||||
    "$@"
 | 
			
		||||
    echo $?
 | 
			
		||||
  ) | LC_ALL=C ${AM_TAP_AWK-awk} \
 | 
			
		||||
        -v me="$me" \
 | 
			
		||||
        -v test_script_name="$test_name" \
 | 
			
		||||
        -v log_file="$log_file" \
 | 
			
		||||
        -v trs_file="$trs_file" \
 | 
			
		||||
        -v expect_failure="$expect_failure" \
 | 
			
		||||
        -v merge="$merge" \
 | 
			
		||||
        -v ignore_exit="$ignore_exit" \
 | 
			
		||||
        -v comments="$comments" \
 | 
			
		||||
        -v diag_string="$diag_string" \
 | 
			
		||||
'
 | 
			
		||||
# FIXME: the usages of "cat >&3" below could be optimized when using
 | 
			
		||||
# FIXME: GNU awk, and/on on systems that supports /dev/fd/.
 | 
			
		||||
 | 
			
		||||
# Implementation note: in what follows, `result_obj` will be an
 | 
			
		||||
# associative array that (partly) simulates a TAP result object
 | 
			
		||||
# from the `TAP::Parser` perl module.
 | 
			
		||||
 | 
			
		||||
## ----------- ##
 | 
			
		||||
##  FUNCTIONS  ##
 | 
			
		||||
## ----------- ##
 | 
			
		||||
 | 
			
		||||
function fatal(msg)
 | 
			
		||||
{
 | 
			
		||||
  print me ": " msg | "cat >&2"
 | 
			
		||||
  exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function abort(where)
 | 
			
		||||
{
 | 
			
		||||
  fatal("internal error " where)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Convert a boolean to a "yes"/"no" string.
 | 
			
		||||
function yn(bool)
 | 
			
		||||
{
 | 
			
		||||
  return bool ? "yes" : "no";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function add_test_result(result)
 | 
			
		||||
{
 | 
			
		||||
  if (!test_results_index)
 | 
			
		||||
    test_results_index = 0
 | 
			
		||||
  test_results_list[test_results_index] = result
 | 
			
		||||
  test_results_index += 1
 | 
			
		||||
  test_results_seen[result] = 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Whether the test script should be re-run by "make recheck".
 | 
			
		||||
function must_recheck()
 | 
			
		||||
{
 | 
			
		||||
  for (k in test_results_seen)
 | 
			
		||||
    if (k != "XFAIL" && k != "PASS" && k != "SKIP")
 | 
			
		||||
      return 1
 | 
			
		||||
  return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# Whether the content of the log file associated to this test should
 | 
			
		||||
# be copied into the "global" test-suite.log.
 | 
			
		||||
function copy_in_global_log()
 | 
			
		||||
{
 | 
			
		||||
  for (k in test_results_seen)
 | 
			
		||||
    if (k != "PASS")
 | 
			
		||||
      return 1
 | 
			
		||||
  return 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# FIXME: this can certainly be improved ...
 | 
			
		||||
function get_global_test_result()
 | 
			
		||||
{
 | 
			
		||||
    if ("ERROR" in test_results_seen)
 | 
			
		||||
      return "ERROR"
 | 
			
		||||
    if ("FAIL" in test_results_seen || "XPASS" in test_results_seen)
 | 
			
		||||
      return "FAIL"
 | 
			
		||||
    all_skipped = 1
 | 
			
		||||
    for (k in test_results_seen)
 | 
			
		||||
      if (k != "SKIP")
 | 
			
		||||
        all_skipped = 0
 | 
			
		||||
    if (all_skipped)
 | 
			
		||||
      return "SKIP"
 | 
			
		||||
    return "PASS";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function stringify_result_obj(result_obj)
 | 
			
		||||
{
 | 
			
		||||
  if (result_obj["is_unplanned"] || result_obj["number"] != testno)
 | 
			
		||||
    return "ERROR"
 | 
			
		||||
 | 
			
		||||
  if (plan_seen == LATE_PLAN)
 | 
			
		||||
    return "ERROR"
 | 
			
		||||
 | 
			
		||||
  if (result_obj["directive"] == "TODO")
 | 
			
		||||
    return result_obj["is_ok"] ? "XPASS" : "XFAIL"
 | 
			
		||||
 | 
			
		||||
  if (result_obj["directive"] == "SKIP")
 | 
			
		||||
    return result_obj["is_ok"] ? "SKIP" : COOKED_FAIL;
 | 
			
		||||
 | 
			
		||||
  if (length(result_obj["directive"]))
 | 
			
		||||
      abort("in function stringify_result_obj()")
 | 
			
		||||
 | 
			
		||||
  return result_obj["is_ok"] ? COOKED_PASS : COOKED_FAIL
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function decorate_result(result)
 | 
			
		||||
{
 | 
			
		||||
  color_name = color_for_result[result]
 | 
			
		||||
  if (color_name)
 | 
			
		||||
    return color_map[color_name] "" result "" color_map["std"]
 | 
			
		||||
  # If we are not using colorized output, or if we do not know how
 | 
			
		||||
  # to colorize the given result, we should return it unchanged.
 | 
			
		||||
  return result
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function report(result, details)
 | 
			
		||||
{
 | 
			
		||||
  if (result ~ /^(X?(PASS|FAIL)|SKIP|ERROR)/)
 | 
			
		||||
    {
 | 
			
		||||
      msg = ": " test_script_name
 | 
			
		||||
      add_test_result(result)
 | 
			
		||||
    }
 | 
			
		||||
  else if (result == "#")
 | 
			
		||||
    {
 | 
			
		||||
      msg = " " test_script_name ":"
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      abort("in function report()")
 | 
			
		||||
    }
 | 
			
		||||
  if (length(details))
 | 
			
		||||
    msg = msg " " details
 | 
			
		||||
  # Output on console might be colorized.
 | 
			
		||||
  print decorate_result(result) msg
 | 
			
		||||
  # Log the result in the log file too, to help debugging (this is
 | 
			
		||||
  # especially true when said result is a TAP error or "Bail out!").
 | 
			
		||||
  print result msg | "cat >&3";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function testsuite_error(error_message)
 | 
			
		||||
{
 | 
			
		||||
  report("ERROR", "- " error_message)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function handle_tap_result()
 | 
			
		||||
{
 | 
			
		||||
  details = result_obj["number"];
 | 
			
		||||
  if (length(result_obj["description"]))
 | 
			
		||||
    details = details " " result_obj["description"]
 | 
			
		||||
 | 
			
		||||
  if (plan_seen == LATE_PLAN)
 | 
			
		||||
    {
 | 
			
		||||
      details = details " # AFTER LATE PLAN";
 | 
			
		||||
    }
 | 
			
		||||
  else if (result_obj["is_unplanned"])
 | 
			
		||||
    {
 | 
			
		||||
       details = details " # UNPLANNED";
 | 
			
		||||
    }
 | 
			
		||||
  else if (result_obj["number"] != testno)
 | 
			
		||||
    {
 | 
			
		||||
       details = sprintf("%s # OUT-OF-ORDER (expecting %d)",
 | 
			
		||||
                         details, testno);
 | 
			
		||||
    }
 | 
			
		||||
  else if (result_obj["directive"])
 | 
			
		||||
    {
 | 
			
		||||
      details = details " # " result_obj["directive"];
 | 
			
		||||
      if (length(result_obj["explanation"]))
 | 
			
		||||
        details = details " " result_obj["explanation"]
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  report(stringify_result_obj(result_obj), details)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# `skip_reason` should be empty whenever planned > 0.
 | 
			
		||||
function handle_tap_plan(planned, skip_reason)
 | 
			
		||||
{
 | 
			
		||||
  planned += 0 # Avoid getting confused if, say, `planned` is "00"
 | 
			
		||||
  if (length(skip_reason) && planned > 0)
 | 
			
		||||
    abort("in function handle_tap_plan()")
 | 
			
		||||
  if (plan_seen)
 | 
			
		||||
    {
 | 
			
		||||
      # Error, only one plan per stream is acceptable.
 | 
			
		||||
      testsuite_error("multiple test plans")
 | 
			
		||||
      return;
 | 
			
		||||
    }
 | 
			
		||||
  planned_tests = planned
 | 
			
		||||
  # The TAP plan can come before or after *all* the TAP results; we speak
 | 
			
		||||
  # respectively of an "early" or a "late" plan.  If we see the plan line
 | 
			
		||||
  # after at least one TAP result has been seen, assume we have a late
 | 
			
		||||
  # plan; in this case, any further test result seen after the plan will
 | 
			
		||||
  # be flagged as an error.
 | 
			
		||||
  plan_seen = (testno >= 1 ? LATE_PLAN : EARLY_PLAN)
 | 
			
		||||
  # If testno > 0, we have an error ("too many tests run") that will be
 | 
			
		||||
  # automatically dealt with later, so do not worry about it here.  If
 | 
			
		||||
  # $plan_seen is true, we have an error due to a repeated plan, and that
 | 
			
		||||
  # has already been dealt with above.  Otherwise, we have a valid "plan
 | 
			
		||||
  # with SKIP" specification, and should report it as a particular kind
 | 
			
		||||
  # of SKIP result.
 | 
			
		||||
  if (planned == 0 && testno == 0)
 | 
			
		||||
    {
 | 
			
		||||
      if (length(skip_reason))
 | 
			
		||||
        skip_reason = "- "  skip_reason;
 | 
			
		||||
      report("SKIP", skip_reason);
 | 
			
		||||
    }
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function extract_tap_comment(line)
 | 
			
		||||
{
 | 
			
		||||
  if (index(line, diag_string) == 1)
 | 
			
		||||
    {
 | 
			
		||||
      # Strip leading `diag_string` from `line`.
 | 
			
		||||
      line = substr(line, length(diag_string) + 1)
 | 
			
		||||
      # And strip any leading and trailing whitespace left.
 | 
			
		||||
      sub("^[ \t]*", "", line)
 | 
			
		||||
      sub("[ \t]*$", "", line)
 | 
			
		||||
      # Return what is left (if any).
 | 
			
		||||
      return line;
 | 
			
		||||
    }
 | 
			
		||||
  return "";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# When this function is called, we know that line is a TAP result line,
 | 
			
		||||
# so that it matches the (perl) RE "^(not )?ok\b".
 | 
			
		||||
function setup_result_obj(line)
 | 
			
		||||
{
 | 
			
		||||
  # Get the result, and remove it from the line.
 | 
			
		||||
  result_obj["is_ok"] = (substr(line, 1, 2) == "ok" ? 1 : 0)
 | 
			
		||||
  sub("^(not )?ok[ \t]*", "", line)
 | 
			
		||||
 | 
			
		||||
  # If the result has an explicit number, get it and strip it; otherwise,
 | 
			
		||||
  # automatically assing the next progresive number to it.
 | 
			
		||||
  if (line ~ /^[0-9]+$/ || line ~ /^[0-9]+[^a-zA-Z0-9_]/)
 | 
			
		||||
    {
 | 
			
		||||
      match(line, "^[0-9]+")
 | 
			
		||||
      # The final `+ 0` is to normalize numbers with leading zeros.
 | 
			
		||||
      result_obj["number"] = substr(line, 1, RLENGTH) + 0
 | 
			
		||||
      line = substr(line, RLENGTH + 1)
 | 
			
		||||
    }
 | 
			
		||||
  else
 | 
			
		||||
    {
 | 
			
		||||
      result_obj["number"] = testno
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  if (plan_seen == LATE_PLAN)
 | 
			
		||||
    # No further test results are acceptable after a "late" TAP plan
 | 
			
		||||
    # has been seen.
 | 
			
		||||
    result_obj["is_unplanned"] = 1
 | 
			
		||||
  else if (plan_seen && testno > planned_tests)
 | 
			
		||||
    result_obj["is_unplanned"] = 1
 | 
			
		||||
  else
 | 
			
		||||
    result_obj["is_unplanned"] = 0
 | 
			
		||||
 | 
			
		||||
  # Strip trailing and leading whitespace.
 | 
			
		||||
  sub("^[ \t]*", "", line)
 | 
			
		||||
  sub("[ \t]*$", "", line)
 | 
			
		||||
 | 
			
		||||
  # This will have to be corrected if we have a "TODO"/"SKIP" directive.
 | 
			
		||||
  result_obj["description"] = line
 | 
			
		||||
  result_obj["directive"] = ""
 | 
			
		||||
  result_obj["explanation"] = ""
 | 
			
		||||
 | 
			
		||||
  if (index(line, "#") == 0)
 | 
			
		||||
    return # No possible directive, nothing more to do.
 | 
			
		||||
 | 
			
		||||
  # Directives are case-insensitive.
 | 
			
		||||
  rx = "[ \t]*#[ \t]*([tT][oO][dD][oO]|[sS][kK][iI][pP])[ \t]*"
 | 
			
		||||
 | 
			
		||||
  # See whether we have the directive, and if yes, where.
 | 
			
		||||
  pos = match(line, rx "$")
 | 
			
		||||
  if (!pos)
 | 
			
		||||
    pos = match(line, rx "[^a-zA-Z0-9_]")
 | 
			
		||||
 | 
			
		||||
  # If there was no TAP directive, we have nothing more to do.
 | 
			
		||||
  if (!pos)
 | 
			
		||||
    return
 | 
			
		||||
 | 
			
		||||
  # Let`s now see if the TAP directive has been escaped.  For example:
 | 
			
		||||
  #  escaped:     ok \# SKIP
 | 
			
		||||
  #  not escaped: ok \\# SKIP
 | 
			
		||||
  #  escaped:     ok \\\\\# SKIP
 | 
			
		||||
  #  not escaped: ok \ # SKIP
 | 
			
		||||
  if (substr(line, pos, 1) == "#")
 | 
			
		||||
    {
 | 
			
		||||
      bslash_count = 0
 | 
			
		||||
      for (i = pos; i > 1 && substr(line, i - 1, 1) == "\\"; i--)
 | 
			
		||||
        bslash_count += 1
 | 
			
		||||
      if (bslash_count % 2)
 | 
			
		||||
        return # Directive was escaped.
 | 
			
		||||
    }
 | 
			
		||||
 | 
			
		||||
  # Strip the directive and its explanation (if any) from the test
 | 
			
		||||
  # description.
 | 
			
		||||
  result_obj["description"] = substr(line, 1, pos - 1)
 | 
			
		||||
  # Now remove the test description from the line, that has been dealt
 | 
			
		||||
  # with already.
 | 
			
		||||
  line = substr(line, pos)
 | 
			
		||||
  # Strip the directive, and save its value (normalized to upper case).
 | 
			
		||||
  sub("^[ \t]*#[ \t]*", "", line)
 | 
			
		||||
  result_obj["directive"] = toupper(substr(line, 1, 4))
 | 
			
		||||
  line = substr(line, 5)
 | 
			
		||||
  # Now get the explanation for the directive (if any), with leading
 | 
			
		||||
  # and trailing whitespace removed.
 | 
			
		||||
  sub("^[ \t]*", "", line)
 | 
			
		||||
  sub("[ \t]*$", "", line)
 | 
			
		||||
  result_obj["explanation"] = line
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function get_test_exit_message(status)
 | 
			
		||||
{
 | 
			
		||||
  if (status == 0)
 | 
			
		||||
    return ""
 | 
			
		||||
  if (status !~ /^[1-9][0-9]*$/)
 | 
			
		||||
    abort("getting exit status")
 | 
			
		||||
  if (status < 127)
 | 
			
		||||
    exit_details = ""
 | 
			
		||||
  else if (status == 127)
 | 
			
		||||
    exit_details = " (command not found?)"
 | 
			
		||||
  else if (status >= 128 && status <= 255)
 | 
			
		||||
    exit_details = sprintf(" (terminated by signal %d?)", status - 128)
 | 
			
		||||
  else if (status > 256 && status <= 384)
 | 
			
		||||
    # We used to report an "abnormal termination" here, but some Korn
 | 
			
		||||
    # shells, when a child process die due to signal number n, can leave
 | 
			
		||||
    # in $? an exit status of 256+n instead of the more standard 128+n.
 | 
			
		||||
    # Apparently, both behaviours are allowed by POSIX (2008), so be
 | 
			
		||||
    # prepared to handle them both.  See also Austing Group report ID
 | 
			
		||||
    # 0000051 <http://www.austingroupbugs.net/view.php?id=51>
 | 
			
		||||
    exit_details = sprintf(" (terminated by signal %d?)", status - 256)
 | 
			
		||||
  else
 | 
			
		||||
    # Never seen in practice.
 | 
			
		||||
    exit_details = " (abnormal termination)"
 | 
			
		||||
  return sprintf("exited with status %d%s", status, exit_details)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
function write_test_results()
 | 
			
		||||
{
 | 
			
		||||
  print ":global-test-result: " get_global_test_result() > trs_file
 | 
			
		||||
  print ":recheck: "  yn(must_recheck()) > trs_file
 | 
			
		||||
  print ":copy-in-global-log: " yn(copy_in_global_log()) > trs_file
 | 
			
		||||
  for (i = 0; i < test_results_index; i += 1)
 | 
			
		||||
    print ":test-result: " test_results_list[i] > trs_file
 | 
			
		||||
  close(trs_file);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
BEGIN {
 | 
			
		||||
 | 
			
		||||
## ------- ##
 | 
			
		||||
##  SETUP  ##
 | 
			
		||||
## ------- ##
 | 
			
		||||
 | 
			
		||||
'"$init_colors"'
 | 
			
		||||
 | 
			
		||||
# Properly initialized once the TAP plan is seen.
 | 
			
		||||
planned_tests = 0
 | 
			
		||||
 | 
			
		||||
COOKED_PASS = expect_failure ? "XPASS": "PASS";
 | 
			
		||||
COOKED_FAIL = expect_failure ? "XFAIL": "FAIL";
 | 
			
		||||
 | 
			
		||||
# Enumeration-like constants to remember which kind of plan (if any)
 | 
			
		||||
# has been seen.  It is important that NO_PLAN evaluates "false" as
 | 
			
		||||
# a boolean.
 | 
			
		||||
NO_PLAN = 0
 | 
			
		||||
EARLY_PLAN = 1
 | 
			
		||||
LATE_PLAN = 2
 | 
			
		||||
 | 
			
		||||
testno = 0     # Number of test results seen so far.
 | 
			
		||||
bailed_out = 0 # Whether a "Bail out!" directive has been seen.
 | 
			
		||||
 | 
			
		||||
# Whether the TAP plan has been seen or not, and if yes, which kind
 | 
			
		||||
# it is ("early" is seen before any test result, "late" otherwise).
 | 
			
		||||
plan_seen = NO_PLAN
 | 
			
		||||
 | 
			
		||||
## --------- ##
 | 
			
		||||
##  PARSING  ##
 | 
			
		||||
## --------- ##
 | 
			
		||||
 | 
			
		||||
is_first_read = 1
 | 
			
		||||
 | 
			
		||||
while (1)
 | 
			
		||||
  {
 | 
			
		||||
    # Involutions required so that we are able to read the exit status
 | 
			
		||||
    # from the last input line.
 | 
			
		||||
    st = getline
 | 
			
		||||
    if (st < 0) # I/O error.
 | 
			
		||||
      fatal("I/O error while reading from input stream")
 | 
			
		||||
    else if (st == 0) # End-of-input
 | 
			
		||||
      {
 | 
			
		||||
        if (is_first_read)
 | 
			
		||||
          abort("in input loop: only one input line")
 | 
			
		||||
        break
 | 
			
		||||
      }
 | 
			
		||||
    if (is_first_read)
 | 
			
		||||
      {
 | 
			
		||||
        is_first_read = 0
 | 
			
		||||
        nextline = $0
 | 
			
		||||
        continue
 | 
			
		||||
      }
 | 
			
		||||
    else
 | 
			
		||||
      {
 | 
			
		||||
        curline = nextline
 | 
			
		||||
        nextline = $0
 | 
			
		||||
        $0 = curline
 | 
			
		||||
      }
 | 
			
		||||
    # Copy any input line verbatim into the log file.
 | 
			
		||||
    print | "cat >&3"
 | 
			
		||||
    # Parsing of TAP input should stop after a "Bail out!" directive.
 | 
			
		||||
    if (bailed_out)
 | 
			
		||||
      continue
 | 
			
		||||
 | 
			
		||||
    # TAP test result.
 | 
			
		||||
    if ($0 ~ /^(not )?ok$/ || $0 ~ /^(not )?ok[^a-zA-Z0-9_]/)
 | 
			
		||||
      {
 | 
			
		||||
        testno += 1
 | 
			
		||||
        setup_result_obj($0)
 | 
			
		||||
        handle_tap_result()
 | 
			
		||||
      }
 | 
			
		||||
    # TAP plan (normal or "SKIP" without explanation).
 | 
			
		||||
    else if ($0 ~ /^1\.\.[0-9]+[ \t]*$/)
 | 
			
		||||
      {
 | 
			
		||||
        # The next two lines will put the number of planned tests in $0.
 | 
			
		||||
        sub("^1\\.\\.", "")
 | 
			
		||||
        sub("[^0-9]*$", "")
 | 
			
		||||
        handle_tap_plan($0, "")
 | 
			
		||||
        continue
 | 
			
		||||
      }
 | 
			
		||||
    # TAP "SKIP" plan, with an explanation.
 | 
			
		||||
    else if ($0 ~ /^1\.\.0+[ \t]*#/)
 | 
			
		||||
      {
 | 
			
		||||
        # The next lines will put the skip explanation in $0, stripping
 | 
			
		||||
        # any leading and trailing whitespace.  This is a little more
 | 
			
		||||
        # tricky in truth, since we want to also strip a potential leading
 | 
			
		||||
        # "SKIP" string from the message.
 | 
			
		||||
        sub("^[^#]*#[ \t]*(SKIP[: \t][ \t]*)?", "")
 | 
			
		||||
        sub("[ \t]*$", "");
 | 
			
		||||
        handle_tap_plan(0, $0)
 | 
			
		||||
      }
 | 
			
		||||
    # "Bail out!" magic.
 | 
			
		||||
    # Older versions of prove and TAP::Harness (e.g., 3.17) did not
 | 
			
		||||
    # recognize a "Bail out!" directive when preceded by leading
 | 
			
		||||
    # whitespace, but more modern versions (e.g., 3.23) do.  So we
 | 
			
		||||
    # emulate the latter, "more modern" behaviour.
 | 
			
		||||
    else if ($0 ~ /^[ \t]*Bail out!/)
 | 
			
		||||
      {
 | 
			
		||||
        bailed_out = 1
 | 
			
		||||
        # Get the bailout message (if any), with leading and trailing
 | 
			
		||||
        # whitespace stripped.  The message remains stored in `$0`.
 | 
			
		||||
        sub("^[ \t]*Bail out![ \t]*", "");
 | 
			
		||||
        sub("[ \t]*$", "");
 | 
			
		||||
        # Format the error message for the
 | 
			
		||||
        bailout_message = "Bail out!"
 | 
			
		||||
        if (length($0))
 | 
			
		||||
          bailout_message = bailout_message " " $0
 | 
			
		||||
        testsuite_error(bailout_message)
 | 
			
		||||
      }
 | 
			
		||||
    # Maybe we have too look for dianogtic comments too.
 | 
			
		||||
    else if (comments != 0)
 | 
			
		||||
      {
 | 
			
		||||
        comment = extract_tap_comment($0);
 | 
			
		||||
        if (length(comment))
 | 
			
		||||
          report("#", comment);
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
## -------- ##
 | 
			
		||||
##  FINISH  ##
 | 
			
		||||
## -------- ##
 | 
			
		||||
 | 
			
		||||
# A "Bail out!" directive should cause us to ignore any following TAP
 | 
			
		||||
# error, as well as a non-zero exit status from the TAP producer.
 | 
			
		||||
if (!bailed_out)
 | 
			
		||||
  {
 | 
			
		||||
    if (!plan_seen)
 | 
			
		||||
      {
 | 
			
		||||
        testsuite_error("missing test plan")
 | 
			
		||||
      }
 | 
			
		||||
    else if (planned_tests != testno)
 | 
			
		||||
      {
 | 
			
		||||
        bad_amount = testno > planned_tests ? "many" : "few"
 | 
			
		||||
        testsuite_error(sprintf("too %s tests run (expected %d, got %d)",
 | 
			
		||||
                                bad_amount, planned_tests, testno))
 | 
			
		||||
      }
 | 
			
		||||
    if (!ignore_exit)
 | 
			
		||||
      {
 | 
			
		||||
        # Fetch exit status from the last line.
 | 
			
		||||
        exit_message = get_test_exit_message(nextline)
 | 
			
		||||
        if (exit_message)
 | 
			
		||||
          testsuite_error(exit_message)
 | 
			
		||||
      }
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
write_test_results()
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
} # End of "BEGIN" block.
 | 
			
		||||
'
 | 
			
		||||
 | 
			
		||||
# TODO: document that we consume the file descriptor 3 :-(
 | 
			
		||||
} 3>"$log_file"
 | 
			
		||||
 | 
			
		||||
test $? -eq 0 || fatal "I/O or internal error"
 | 
			
		||||
 | 
			
		||||
# Local Variables:
 | 
			
		||||
# mode: shell-script
 | 
			
		||||
# sh-indentation: 2
 | 
			
		||||
# eval: (add-hook 'write-file-hooks 'time-stamp)
 | 
			
		||||
# time-stamp-start: "scriptversion="
 | 
			
		||||
# time-stamp-format: "%:y-%02m-%02d.%02H"
 | 
			
		||||
# time-stamp-time-zone: "UTC"
 | 
			
		||||
# time-stamp-end: "; # UTC"
 | 
			
		||||
# End:
 | 
			
		||||
							
								
								
									
										143
									
								
								configure.ac
									
									
									
									
									
								
							
							
						
						
									
										143
									
								
								configure.ac
									
									
									
									
									
								
							@@ -1,7 +1,7 @@
 | 
			
		||||
#                                               -*- Autoconf -*-
 | 
			
		||||
# Process this file with autoconf to produce a configure script.
 | 
			
		||||
# Minimum version of autoconf required
 | 
			
		||||
AC_PREREQ(2.62)
 | 
			
		||||
AC_PREREQ(2.64)
 | 
			
		||||
 | 
			
		||||
# UPDATING VERSION NUMBERS FOR RELEASES
 | 
			
		||||
#
 | 
			
		||||
@@ -41,13 +41,13 @@ AC_PREREQ(2.62)
 | 
			
		||||
#   Bugfix releases:
 | 
			
		||||
#     pacman_version_micro += 1
 | 
			
		||||
 | 
			
		||||
m4_define([lib_current], [8])
 | 
			
		||||
m4_define([lib_revision], [2])
 | 
			
		||||
m4_define([lib_current], [11])
 | 
			
		||||
m4_define([lib_revision], [3])
 | 
			
		||||
m4_define([lib_age], [0])
 | 
			
		||||
 | 
			
		||||
m4_define([pacman_version_major], [4])
 | 
			
		||||
m4_define([pacman_version_major], [5])
 | 
			
		||||
m4_define([pacman_version_minor], [1])
 | 
			
		||||
m4_define([pacman_version_micro], [2])
 | 
			
		||||
m4_define([pacman_version_micro], [3])
 | 
			
		||||
m4_define([pacman_version],
 | 
			
		||||
          [pacman_version_major.pacman_version_minor.pacman_version_micro])
 | 
			
		||||
 | 
			
		||||
@@ -57,9 +57,10 @@ AC_CONFIG_SRCDIR([config.h.in])
 | 
			
		||||
AC_CONFIG_HEADERS([config.h])
 | 
			
		||||
AC_CONFIG_MACRO_DIR([m4])
 | 
			
		||||
AC_CONFIG_AUX_DIR([build-aux])
 | 
			
		||||
AC_REQUIRE_AUX_FILE([tap-driver.sh])
 | 
			
		||||
 | 
			
		||||
AC_CANONICAL_HOST
 | 
			
		||||
AM_INIT_AUTOMAKE([1.11])
 | 
			
		||||
AM_INIT_AUTOMAKE([1.11 foreign])
 | 
			
		||||
AM_SILENT_RULES([yes])
 | 
			
		||||
 | 
			
		||||
LT_INIT
 | 
			
		||||
@@ -97,6 +98,11 @@ AC_ARG_WITH(buildscript,
 | 
			
		||||
	AS_HELP_STRING([--with-buildscript=name], [set the build script name used by makepkg]),
 | 
			
		||||
	[BUILDSCRIPT=$withval], [BUILDSCRIPT=PKGBUILD])
 | 
			
		||||
 | 
			
		||||
# Help line for buildscript filename
 | 
			
		||||
AC_ARG_WITH(makepkg-template-dir,
 | 
			
		||||
	AS_HELP_STRING([--with-makepkg-template-dir=name], [set the template dir used by makepkg-template]),
 | 
			
		||||
	[TEMPLATE_DIR=$withval], [TEMPLATE_DIR=/usr/share/makepkg-template])
 | 
			
		||||
 | 
			
		||||
# Help line for debug package suffix
 | 
			
		||||
AC_ARG_WITH(debug-suffix,
 | 
			
		||||
	AS_HELP_STRING([--with-debug-suffix=name], [set the suffix for split debugging symbol packages used by makepkg]),
 | 
			
		||||
@@ -114,10 +120,11 @@ AC_ARG_WITH(ldconfig,
 | 
			
		||||
		[set the full path to ldconfig]),
 | 
			
		||||
	[LDCONFIG=$withval], [LDCONFIG=/sbin/ldconfig])
 | 
			
		||||
 | 
			
		||||
# Help line for using OpenSSL
 | 
			
		||||
AC_ARG_WITH(openssl,
 | 
			
		||||
	AS_HELP_STRING([--with-openssl], [use OpenSSL crypto implementations instead of internal routines]),
 | 
			
		||||
	[], [with_openssl=check])
 | 
			
		||||
# Help line for selecting a crypto library
 | 
			
		||||
AC_ARG_WITH(crypto,
 | 
			
		||||
	AS_HELP_STRING([--with-crypto={openssl|nettle}],
 | 
			
		||||
		[select crypto implementation @<:@default=openssl@:>@]),
 | 
			
		||||
	[with_crypto=$withval], [with_crypto=openssl])
 | 
			
		||||
 | 
			
		||||
# Help line for using gpgme
 | 
			
		||||
AC_ARG_WITH(gpgme,
 | 
			
		||||
@@ -125,9 +132,9 @@ AC_ARG_WITH(gpgme,
 | 
			
		||||
	[], [with_gpgme=check])
 | 
			
		||||
 | 
			
		||||
# Help line for using libcurl
 | 
			
		||||
AC_ARG_WITH(curl,
 | 
			
		||||
AC_ARG_WITH(libcurl,
 | 
			
		||||
	AS_HELP_STRING([--with-libcurl], [use libcurl for the internal downloader]),
 | 
			
		||||
	[], [with_curl=check])
 | 
			
		||||
	[], [with_libcurl=check])
 | 
			
		||||
 | 
			
		||||
# Help line for documentation
 | 
			
		||||
AC_ARG_ENABLE(doc,
 | 
			
		||||
@@ -159,13 +166,32 @@ AC_ARG_ENABLE(git-version,
 | 
			
		||||
# testing compilation against gpgme).
 | 
			
		||||
AC_SYS_LARGEFILE
 | 
			
		||||
 | 
			
		||||
# Record large file flags in pkgconfig file
 | 
			
		||||
if test "$enable_largefile" != no; then
 | 
			
		||||
	if test "$ac_cv_sys_file_offset_bits" != 'no'; then
 | 
			
		||||
		LFS_CFLAGS="-D_FILE_OFFSET_BITS=$ac_cv_sys_file_offset_bits"
 | 
			
		||||
	fi
 | 
			
		||||
fi
 | 
			
		||||
AC_SUBST(LFS_CFLAGS)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Checks for programs.
 | 
			
		||||
AC_PROG_AWK
 | 
			
		||||
AC_PROG_CC_C99
 | 
			
		||||
AC_PROG_INSTALL
 | 
			
		||||
AC_CHECK_PROGS([PYTHON], [python2.7 python2.6 python2.5 python2 python], [false])
 | 
			
		||||
AC_CHECK_PROGS([PYTHON], [python2.7 python2 python], [false])
 | 
			
		||||
AC_PATH_PROGS([BASH_SHELL], [bash bash4], [false])
 | 
			
		||||
 | 
			
		||||
# check for perl 5.10.1 (needed by makepkg-template)
 | 
			
		||||
AC_PATH_PROG([PERL],[perl])
 | 
			
		||||
AC_DEFUN([AX_PROG_PERL_VERSION],
 | 
			
		||||
	[AC_CACHE_CHECK([for Perl version $1 or later], [ax_cv_prog_perl_version],
 | 
			
		||||
		[AS_IF(["$PERL" -e 'require v$1;' >/dev/null 2>&1],
 | 
			
		||||
			[ax_cv_prog_perl_version=yes],
 | 
			
		||||
			[ax_cv_prog_perl_version=no])])
 | 
			
		||||
	AS_IF([test x"$ax_cv_prog_perl_version" = xyes], [$2], [$3])])
 | 
			
		||||
AX_PROG_PERL_VERSION([5.10.1], [], [AC_MSG_ERROR([perl is too old])])
 | 
			
		||||
 | 
			
		||||
AS_IF([test "x$BASH_SHELL" = "xfalse"],
 | 
			
		||||
	AC_MSG_WARN([*** bash >= 4.1.0 is required for pacman scripts]),
 | 
			
		||||
	[bash_version_major=`$BASH_SHELL -c 'echo "${BASH_VERSINFO[[0]]}"'`
 | 
			
		||||
@@ -190,30 +216,47 @@ AC_CHECK_LIB([m], [fabs], ,
 | 
			
		||||
	AC_MSG_ERROR([libm is needed to compile pacman!]))
 | 
			
		||||
 | 
			
		||||
# Check for libarchive
 | 
			
		||||
PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 2.8.0], ,
 | 
			
		||||
	AC_MSG_ERROR([*** libarchive >= 2.8.0 is needed to compile pacman!]))
 | 
			
		||||
PKG_CHECK_MODULES(LIBARCHIVE, [libarchive >= 3.0.0], ,
 | 
			
		||||
	AC_MSG_ERROR([*** libarchive >= 3.0.0 is needed to compile pacman!]))
 | 
			
		||||
 | 
			
		||||
# Check for OpenSSL
 | 
			
		||||
have_openssl=no
 | 
			
		||||
if test "x$with_openssl" != "xno"; then
 | 
			
		||||
have_nettle=no
 | 
			
		||||
if test "x$with_crypto" = "xnettle"; then
 | 
			
		||||
	AC_SUBST(pc_crypto, [nettle])
 | 
			
		||||
	PKG_CHECK_MODULES(NETTLE, [nettle],
 | 
			
		||||
		[AC_DEFINE(HAVE_LIBNETTLE, 1, [Define whether to use nettle]) have_nettle=yes], have_nettle=no)
 | 
			
		||||
	if test "x$have_nettle" = xno -a "x$with_crypto" = xnettle; then
 | 
			
		||||
		AC_MSG_ERROR([*** nettle support requested but libraries not found])
 | 
			
		||||
	fi
 | 
			
		||||
else if test "x$with_crypto" = "xopenssl"; then
 | 
			
		||||
	AC_SUBST(pc_crypto, [libcrypto])
 | 
			
		||||
	PKG_CHECK_MODULES(LIBSSL, [libcrypto],
 | 
			
		||||
		[AC_DEFINE(HAVE_LIBSSL, 1, [Define if libcrypto is available]) have_openssl=yes], have_openssl=no)
 | 
			
		||||
	if test "x$have_openssl" = xno -a "x$with_openssl" = xyes; then
 | 
			
		||||
	if test "x$have_openssl" = xno; then
 | 
			
		||||
		AC_MSG_ERROR([*** openssl support requested but libraries not found])
 | 
			
		||||
	fi
 | 
			
		||||
else
 | 
			
		||||
	AC_MSG_ERROR([*** unknown crypto support library requested - $with_crypto])
 | 
			
		||||
fi
 | 
			
		||||
fi
 | 
			
		||||
AM_CONDITIONAL(HAVE_LIBSSL, [test "$have_openssl" = "yes"])
 | 
			
		||||
AM_CONDITIONAL(HAVE_LIBNETTLE, [test "$have_nettle" = "yes"])
 | 
			
		||||
 | 
			
		||||
# Check for libcurl
 | 
			
		||||
have_libcurl=no
 | 
			
		||||
if test "x$with_libcurl" != "xno"; then
 | 
			
		||||
	PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.19.4],
 | 
			
		||||
	PKG_CHECK_MODULES(LIBCURL, [libcurl >= 7.32.0],
 | 
			
		||||
		[AC_DEFINE(HAVE_LIBCURL, 1, [Define if libcurl is available]) have_libcurl=yes], have_libcurl=no)
 | 
			
		||||
	if test "x$have_libcurl" = xno -a "x$with_libcurl" = xyes; then
 | 
			
		||||
		AC_MSG_ERROR([*** libcurl >= 7.19.4 is required for internal downloader support])
 | 
			
		||||
		AC_MSG_ERROR([*** libcurl >= 7.32.0 is required for internal downloader support])
 | 
			
		||||
	fi
 | 
			
		||||
fi
 | 
			
		||||
AM_CONDITIONAL(HAVE_LIBCURL, [test "$have_libcurl" = "yes"])
 | 
			
		||||
# used to generate libalpm.pc
 | 
			
		||||
if test "x$have_libcurl" = xyes; then
 | 
			
		||||
	AC_SUBST(pc_libcurl, [libcurl])
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Check for gpgme
 | 
			
		||||
AC_MSG_CHECKING(whether to link with libgpgme)
 | 
			
		||||
@@ -283,13 +326,12 @@ PATH_MAX_DEFINED
 | 
			
		||||
AC_FUNC_FORK
 | 
			
		||||
AC_FUNC_GETMNTENT
 | 
			
		||||
AC_FUNC_LSTAT_FOLLOWS_SLASHED_SYMLINK
 | 
			
		||||
AC_FUNC_MALLOC
 | 
			
		||||
AC_FUNC_MKTIME
 | 
			
		||||
AC_FUNC_STRCOLL
 | 
			
		||||
AC_CHECK_FUNCS([dup2 getcwd getmntinfo gettimeofday memmove memset \
 | 
			
		||||
                mkdir realpath regcomp rmdir setenv setlocale strcasecmp \
 | 
			
		||||
                strchr strcspn strdup strerror strndup strrchr strsep strstr \
 | 
			
		||||
                strtol swprintf tcflush wcwidth uname])
 | 
			
		||||
                strchr strcspn strdup strerror strndup strnlen strrchr \
 | 
			
		||||
                strsep strstr strtol swprintf tcflush wcwidth uname])
 | 
			
		||||
AC_CHECK_MEMBERS([struct stat.st_blksize],,,[[#include <sys/stat.h>]])
 | 
			
		||||
 | 
			
		||||
# For the diskspace code
 | 
			
		||||
@@ -300,46 +342,58 @@ AC_CHECK_MEMBERS([struct statfs.f_flags],,,[[#include <sys/param.h>
 | 
			
		||||
 | 
			
		||||
# Check if we can use symbol visibility support in GCC
 | 
			
		||||
GCC_VISIBILITY_CC
 | 
			
		||||
# Check if we have -fgnu89-inline flag
 | 
			
		||||
GCC_GNU89_INLINE_CC
 | 
			
		||||
 | 
			
		||||
# Host-dependant definitions
 | 
			
		||||
DEFAULT_DUFLAGS=" -sk --apparent-size"
 | 
			
		||||
DEFAULT_SEDINPLACEFLAGS=" --follow-symlinks -i"
 | 
			
		||||
INODECMD="stat -c '%i %n'"
 | 
			
		||||
SIZECMD="stat -c %s"
 | 
			
		||||
SEDINPLACE="sed --follow-symlinks -i"
 | 
			
		||||
DUFLAGS="-sk --apparent-size"
 | 
			
		||||
OWNERCMD="stat -c '%u:%g'"
 | 
			
		||||
MODECMD="stat -c '%a'"
 | 
			
		||||
STRIP_BINARIES="--strip-all"
 | 
			
		||||
STRIP_SHARED="--strip-unneeded"
 | 
			
		||||
STRIP_STATIC="--strip-debug"
 | 
			
		||||
case "${host_os}" in
 | 
			
		||||
	*bsd*)
 | 
			
		||||
		INODECMD="stat -f '%i %N'"
 | 
			
		||||
		SIZECMD="stat -f %z"
 | 
			
		||||
		SEDINPLACE="sed -i \"\""
 | 
			
		||||
		DUFLAGS="-sk"
 | 
			
		||||
		OWNERCMD="stat -f '%u:%g'"
 | 
			
		||||
		MODECMD="stat -f '%Lp'"
 | 
			
		||||
		DEFAULT_SEDINPLACEFLAGS=" -i \"\""
 | 
			
		||||
		DEFAULT_DUFLAGS=" -sk"
 | 
			
		||||
		;;
 | 
			
		||||
	darwin*)
 | 
			
		||||
		host_os_darwin=yes
 | 
			
		||||
		INODECMD="/usr/bin/stat -f '%i %N'"
 | 
			
		||||
		SIZECMD="/usr/bin/stat -f %z"
 | 
			
		||||
		SEDINPLACE="/usr/bin/sed -i ''"
 | 
			
		||||
		DUFLAGS="-sk"
 | 
			
		||||
		OWNERCMD="/usr/bin/stat -f '%u:%g'"
 | 
			
		||||
		MODECMD="/usr/bin/stat -f '%Lp'"
 | 
			
		||||
		DEFAULT_SEDINPLACEFLAGS=" -i ''"
 | 
			
		||||
		DEFAULT_DUFLAGS=" -sk"
 | 
			
		||||
		STRIP_BINARIES=""
 | 
			
		||||
		STRIP_SHARED="-S"
 | 
			
		||||
		STRIP_STATIC="-S"
 | 
			
		||||
		;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
AM_CONDITIONAL([DARWIN], test "x$host_os_darwin" = "xyes")
 | 
			
		||||
AC_PATH_PROGS([DUPATH], [du], [du], [/usr/bin$PATH_SEPARATOR/bin] )
 | 
			
		||||
AC_PATH_PROGS([SEDPATH], [sed], [sed], [/usr/bin$PATH_SEPARATOR/bin] )
 | 
			
		||||
AC_SUBST(INODECMD)
 | 
			
		||||
AC_SUBST(SIZECMD)
 | 
			
		||||
AC_SUBST(SEDINPLACE)
 | 
			
		||||
AC_SUBST(DUFLAGS)
 | 
			
		||||
AC_SUBST(OWNERCMD)
 | 
			
		||||
AC_SUBST(MODECMD)
 | 
			
		||||
AC_SUBST(STRIP_BINARIES)
 | 
			
		||||
AC_SUBST(STRIP_SHARED)
 | 
			
		||||
AC_SUBST(STRIP_STATIC)
 | 
			
		||||
 | 
			
		||||
# Flags for du
 | 
			
		||||
if test "${DUFLAGS+set}" != "set"; then
 | 
			
		||||
    DUFLAGS="${DEFAULT_DUFLAGS}"
 | 
			
		||||
fi
 | 
			
		||||
AC_ARG_VAR(DUFLAGS, [flags for du, overriding the default])
 | 
			
		||||
 | 
			
		||||
# Flags for sed in place
 | 
			
		||||
if test "${SEDINPLACEFLAGS+set}" != "set"; then
 | 
			
		||||
    SEDINPLACEFLAGS="${DEFAULT_SEDINPLACEFLAGS}"
 | 
			
		||||
fi
 | 
			
		||||
AC_ARG_VAR(SEDINPLACEFLAGS, [flags for sed, overriding the default])
 | 
			
		||||
 | 
			
		||||
# Variables plugged into makepkg.conf
 | 
			
		||||
CARCH="${host%%-*}"
 | 
			
		||||
CHOST="${host}"
 | 
			
		||||
@@ -457,6 +511,9 @@ AC_DEFINE_UNQUOTED([SRCEXT], "$SRCEXT", [The file extension used by pacman sourc
 | 
			
		||||
# Set makepkg build script name
 | 
			
		||||
AC_SUBST(BUILDSCRIPT)
 | 
			
		||||
AC_DEFINE_UNQUOTED([BUILDSCRIPT], "$BUILDSCRIPT", [The build script name used by makepkg])
 | 
			
		||||
# Set makepkg-template template directory
 | 
			
		||||
AC_SUBST(TEMPLATE_DIR)
 | 
			
		||||
AC_DEFINE_UNQUOTED([TEMPLATE_DIR], "$TEMPLATE_DIR", [The template directory used by makepkg-teplate])
 | 
			
		||||
# Set makepkg split debugging symbol package suffix
 | 
			
		||||
AC_SUBST(DEBUGSUFFIX)
 | 
			
		||||
AC_DEFINE_UNQUOTED([DEBUGSUFFIX], "$DEBUGSUFFIX", [The suffix for debugging symbol packages used by makepkg])
 | 
			
		||||
@@ -485,7 +542,6 @@ test/pacman/Makefile
 | 
			
		||||
test/pacman/tests/Makefile
 | 
			
		||||
test/scripts/Makefile
 | 
			
		||||
test/util/Makefile
 | 
			
		||||
contrib/Makefile
 | 
			
		||||
Makefile
 | 
			
		||||
])
 | 
			
		||||
AC_OUTPUT
 | 
			
		||||
@@ -505,14 +561,15 @@ ${PACKAGE_NAME}:
 | 
			
		||||
    compiler               : ${CC}
 | 
			
		||||
    preprocessor flags     : ${CPPFLAGS}
 | 
			
		||||
    compiler flags         : ${WARNING_CFLAGS} ${CFLAGS}
 | 
			
		||||
    library flags          : ${LIBS} ${LIBSSL_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
 | 
			
		||||
    library flags          : ${LIBS} ${LIBSSL_LIBS} ${NETTLE_LIBS} ${LIBARCHIVE_LIBS} ${LIBCURL_LIBS} ${GPGME_LIBS}
 | 
			
		||||
    linker flags           : ${LDFLAGS}
 | 
			
		||||
 | 
			
		||||
    Architecture           : ${CARCH}
 | 
			
		||||
    Host Type              : ${CHOST}
 | 
			
		||||
    File inode command     : ${INODECMD}
 | 
			
		||||
    Filesize command       : ${SIZECMD}
 | 
			
		||||
    In-place sed command   : ${SEDINPLACE}
 | 
			
		||||
    File owner command     : ${OWNERCMD}
 | 
			
		||||
    File mode command      : ${MODECMD}
 | 
			
		||||
    In-place sed command   : ${SEDPATH} ${SEDINPLACEFLAGS}
 | 
			
		||||
 | 
			
		||||
    libalpm version        : ${LIB_VERSION}
 | 
			
		||||
    libalpm version info   : ${LIB_VERSION_INFO}
 | 
			
		||||
@@ -524,16 +581,16 @@ ${PACKAGE_NAME}:
 | 
			
		||||
    package extension      : ${PKGEXT}
 | 
			
		||||
    source pkg extension   : ${SRCEXT}
 | 
			
		||||
    build script name      : ${BUILDSCRIPT}
 | 
			
		||||
    template directory     : ${TEMPLATE_DIR}
 | 
			
		||||
 | 
			
		||||
  Compilation options:
 | 
			
		||||
    Use libcurl            : ${have_libcurl}
 | 
			
		||||
    Use GPGME              : ${have_gpgme}
 | 
			
		||||
    Use OpenSSL            : ${have_openssl}
 | 
			
		||||
    Use nettle             : ${have_nettle}
 | 
			
		||||
    Run make in doc/ dir   : ${wantdoc} ${asciidoc}
 | 
			
		||||
    Doxygen support        : ${usedoxygen}
 | 
			
		||||
    debug support          : ${debug}
 | 
			
		||||
    extra warning flags    : ${warningflags}
 | 
			
		||||
    use git version        : ${wantgitver}
 | 
			
		||||
"
 | 
			
		||||
 | 
			
		||||
# vim:set ts=2 sw=2 noet:
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										13
									
								
								contrib/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								contrib/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,13 +0,0 @@
 | 
			
		||||
bacman
 | 
			
		||||
bash_completion
 | 
			
		||||
checkupdates
 | 
			
		||||
paccache
 | 
			
		||||
pacdiff
 | 
			
		||||
paclist
 | 
			
		||||
paclog-pkglist
 | 
			
		||||
pacscripts
 | 
			
		||||
pacsearch
 | 
			
		||||
pacsysclean
 | 
			
		||||
rankmirrors
 | 
			
		||||
updpkgsums
 | 
			
		||||
zsh_completion
 | 
			
		||||
@@ -1,110 +0,0 @@
 | 
			
		||||
# enforce that all scripts have a --help and --version option
 | 
			
		||||
AUTOMAKE_OPTIONS = std-options
 | 
			
		||||
 | 
			
		||||
bin_SCRIPTS = \
 | 
			
		||||
  $(OURSCRIPTS)
 | 
			
		||||
 | 
			
		||||
BASHSCRIPTS = \
 | 
			
		||||
	bacman \
 | 
			
		||||
	checkupdates \
 | 
			
		||||
	paccache \
 | 
			
		||||
	pacdiff \
 | 
			
		||||
	paclist \
 | 
			
		||||
	paclog-pkglist \
 | 
			
		||||
	pacscripts \
 | 
			
		||||
	pacsysclean \
 | 
			
		||||
	rankmirrors \
 | 
			
		||||
	updpkgsums
 | 
			
		||||
 | 
			
		||||
OTHERSCRIPTS = \
 | 
			
		||||
	pacsearch
 | 
			
		||||
 | 
			
		||||
OURSCRIPTS = \
 | 
			
		||||
	$(BASHSCRIPTS) \
 | 
			
		||||
	$(OTHERSCRIPTS)
 | 
			
		||||
 | 
			
		||||
OURFILES = \
 | 
			
		||||
	bash_completion \
 | 
			
		||||
	zsh_completion
 | 
			
		||||
 | 
			
		||||
EXTRA_DIST = \
 | 
			
		||||
	PKGBUILD.vim \
 | 
			
		||||
	bacman.sh.in \
 | 
			
		||||
	bash_completion.in \
 | 
			
		||||
	checkupdates.sh.in \
 | 
			
		||||
	paccache.sh.in \
 | 
			
		||||
	paclog-pkglist.sh.in \
 | 
			
		||||
	pacdiff.sh.in \
 | 
			
		||||
	paclist.sh.in \
 | 
			
		||||
	pacscripts.sh.in \
 | 
			
		||||
	pacsearch.in \
 | 
			
		||||
	pacsysclean.sh.in \
 | 
			
		||||
	rankmirrors.sh.in \
 | 
			
		||||
	updpkgsums.sh.in \
 | 
			
		||||
	vimprojects \
 | 
			
		||||
	zsh_completion.in \
 | 
			
		||||
	README
 | 
			
		||||
 | 
			
		||||
# Files that should be removed, but which Automake does not know.
 | 
			
		||||
MOSTLYCLEANFILES = $(OURSCRIPTS) $(OURFILES) *.tmp
 | 
			
		||||
 | 
			
		||||
if USE_GIT_VERSION
 | 
			
		||||
GIT_VERSION := $(shell sh -c 'git describe --abbrev=4 --dirty | sed s/^v//')
 | 
			
		||||
REAL_PACKAGE_VERSION = $(GIT_VERSION)
 | 
			
		||||
else
 | 
			
		||||
REAL_PACKAGE_VERSION = $(PACKAGE_VERSION)
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
edit = sed \
 | 
			
		||||
	-e 's|@sysconfdir[@]|$(sysconfdir)|g' \
 | 
			
		||||
	-e 's|@localstatedir[@]|$(localstatedir)|g' \
 | 
			
		||||
	-e 's|@PACKAGE_VERSION[@]|$(REAL_PACKAGE_VERSION)|g' \
 | 
			
		||||
	-e 's|@SIZECMD[@]|$(SIZECMD)|g' \
 | 
			
		||||
	-e 's|@SCRIPTNAME[@]|$@|g' \
 | 
			
		||||
	-e '1s|!/bin/bash|!$(BASH_SHELL)|g'
 | 
			
		||||
 | 
			
		||||
$(OTHERSCRIPTS): Makefile
 | 
			
		||||
	$(AM_V_at)$(RM) $@ $@.tmp
 | 
			
		||||
	$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
 | 
			
		||||
	$(AM_V_at)chmod +x,a-w $@.tmp
 | 
			
		||||
	$(AM_V_at)mv $@.tmp $@
 | 
			
		||||
 | 
			
		||||
$(BASHSCRIPTS): Makefile
 | 
			
		||||
	$(AM_V_at)$(RM) $@
 | 
			
		||||
	$(AM_V_GEN)test -f $(srcdir)/$@.sh.in && m4 -P -I $(srcdir) $(srcdir)/$@.sh.in | $(edit) >$@
 | 
			
		||||
	$(AM_V_at)chmod +x,a-w $@
 | 
			
		||||
	@$(BASH_SHELL) -O extglob -n $@
 | 
			
		||||
 | 
			
		||||
$(OURFILES): Makefile
 | 
			
		||||
	$(AM_V_at)$(RM) $@ $@.tmp
 | 
			
		||||
	$(AM_V_GEN)$(edit) $(srcdir)/$@.in >$@.tmp
 | 
			
		||||
	$(AM_V_at)chmod a-w $@.tmp
 | 
			
		||||
	$(AM_V_at)mv $@.tmp $@
 | 
			
		||||
 | 
			
		||||
all-am: $(OURSCRIPTS) $(OURFILES)
 | 
			
		||||
 | 
			
		||||
install-data-local:
 | 
			
		||||
	$(MKDIR_P) $(DESTDIR)$(sysconfdir)/bash_completion.d/
 | 
			
		||||
	$(INSTALL_DATA) bash_completion $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
 | 
			
		||||
	$(MKDIR_P) $(DESTDIR)$(datarootdir)/zsh/site-functions/
 | 
			
		||||
	$(INSTALL_DATA) zsh_completion $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
 | 
			
		||||
 | 
			
		||||
uninstall-local:
 | 
			
		||||
	$(RM) $(DESTDIR)$(sysconfdir)/bash_completion.d/pacman
 | 
			
		||||
	$(RM) $(DESTDIR)$(datarootdir)/zsh/site-functions/_pacman
 | 
			
		||||
 | 
			
		||||
bacman: $(srcdir)/bacman.sh.in
 | 
			
		||||
bash_completion: $(srcdir)/bash_completion.in
 | 
			
		||||
checkupdates: $(srcdir)/checkupdates.sh.in
 | 
			
		||||
paccache: $(srcdir)/paccache.sh.in $(top_srcdir)/scripts/library/parseopts.sh $(top_srcdir)/scripts/library/size_to_human.sh
 | 
			
		||||
pacdiff: $(srcdir)/pacdiff.sh.in
 | 
			
		||||
paclist: $(srcdir)/paclist.sh.in
 | 
			
		||||
paclog-pkglist: $(srcdir)/paclog-pkglist.sh.in
 | 
			
		||||
pacscripts: $(srcdir)/pacscripts.sh.in
 | 
			
		||||
pacsearch: $(srcdir)/pacsearch.in
 | 
			
		||||
pacsysclean: $(srcdir)/pacsysclean.sh.in
 | 
			
		||||
rankmirrors: $(srcdir)/rankmirrors.sh.in
 | 
			
		||||
updpkgsums: $(srcdir)/updpkgsums.sh.in
 | 
			
		||||
zsh_completion: $(srcdir)/zsh_completion.in
 | 
			
		||||
 | 
			
		||||
# vim:set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,320 +0,0 @@
 | 
			
		||||
" Vim syntax file
 | 
			
		||||
" Language:     PKGBUILD
 | 
			
		||||
" Maintainer:   Alessio 'mOLOk' Bolognino <themolok at gmail.com>
 | 
			
		||||
" Last Change:  2007/05/08
 | 
			
		||||
" Version Info: PKGBUILD-0.2 (colorphobic)
 | 
			
		||||
 | 
			
		||||
" For version 5.x: Clear all syntax items
 | 
			
		||||
" For version 6.x: Quit when a syntax file was already loaded
 | 
			
		||||
if version < 600
 | 
			
		||||
	syntax clear
 | 
			
		||||
elseif exists("b:current_syntax")
 | 
			
		||||
	finish
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
let b:main_syntax = "sh"
 | 
			
		||||
let b:is_bash = 1
 | 
			
		||||
runtime! syntax/sh.vim
 | 
			
		||||
 | 
			
		||||
" case on
 | 
			
		||||
syn case match
 | 
			
		||||
 | 
			
		||||
" pkgname
 | 
			
		||||
" FIXME if '=' is in pkgname/pkgver, it highlights whole string, not just '='
 | 
			
		||||
syn keyword pb_k_pkgname pkgname contained
 | 
			
		||||
syn match pbValidPkgname /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgname
 | 
			
		||||
syn match pbIllegalPkgname /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
 | 
			
		||||
syn match pbPkgnameGroup /^pkgname=.*/ contains=pbIllegalPkgname,pb_k_pkgname,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" pkgbase
 | 
			
		||||
" FIXME if '=' is in pkgbase/pkgname/pkgver, it highlights whole string, not just '='
 | 
			
		||||
syn keyword pb_k_pkgbase pkgbase contained
 | 
			
		||||
syn match pbValidPkgbase /\([[:alnum:]]\|+\|-\|_\){,32}/ contained contains=pbIllegalPkgbase
 | 
			
		||||
syn match pbIllegalPkgbase /[[:upper:]]\|[^[:alnum:]-+_=]\|=.*=\|=['"]\?.\{33,\}['"]\?/ contained
 | 
			
		||||
syn match pbPkgbaseGroup /^pkgbase=.*/ contains=pbIllegalPkgbase,pb_k_pkgbase,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" pkgver
 | 
			
		||||
syn keyword pb_k_pkgver pkgver contained
 | 
			
		||||
syn match pbValidPkgver /\([[:alnum:]]\|\.\|+\|_\)/ contained contains=pbIllegalPkgver
 | 
			
		||||
syn match pbIllegalPkgver /[^[:alnum:]+=\.\_]\|=.*=/ contained
 | 
			
		||||
syn match pbPkgverGroup /^pkgver=.*/ contains=pbIllegalPkgver,pbValidPkgver,pb_k_pkgver,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" pkgrel
 | 
			
		||||
syn keyword pb_k_pkgrel pkgrel contained
 | 
			
		||||
syn match pbValidPkgrel /[[:digit:]]*/ contained contains=pbIllegalPkgrel
 | 
			
		||||
syn match pbIllegalPkgrel /[^[:digit:]=]\|=.*=/ contained
 | 
			
		||||
syn match pbPkgrelGroup /^pkgrel=.*/ contains=pbIllegalPkgrel,pbValidPkgrel,pb_k_pkgrel,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" pkgdesc
 | 
			
		||||
syn keyword pb_k_desc pkgdesc contained
 | 
			
		||||
" 90 chars: 80 for description, 8 for pkgdesc and 2 for ''
 | 
			
		||||
syn match pbIllegalPkgdesc /.\{90,}\|=['"]\?.*['" ]\+[iI][sS] [aA]/ contained contains=pbPkgdescSign
 | 
			
		||||
syn match pbValidPkgdesc /[^='"]\.\{,80}/ contained contains=pbIllegalPkgdesc
 | 
			
		||||
syn match pbPkgdescGroup /^pkgdesc=.*/ contains=pbIllegalPkgdesc,pb_k_desc,pbValidPkgdesc,shDoubleQuote,shSingleQuote
 | 
			
		||||
syn match pbPkgdescSign /[='"]/ contained
 | 
			
		||||
 | 
			
		||||
" epoch
 | 
			
		||||
syn keyword pb_k_epoch epoch contained
 | 
			
		||||
syn match pbValidEpoch /[[:digit:]]*/ contained contains=pbIllegalEpoch
 | 
			
		||||
syn match pbIllegalEpoch /[^[:digit:]=]\|=.*=/ contained
 | 
			
		||||
syn match pbEpochGroup /^epoch=.*/ contains=pbIllegalEpoch,pbValidEpoch,pb_k_epoch,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" url
 | 
			
		||||
syn keyword pb_k_url url contained
 | 
			
		||||
syn match pbValidUrl /['"]*\(https\|http\|ftp\)\:\/.*\.\+.*/ contained
 | 
			
		||||
 | 
			
		||||
syn match pbIllegalUrl /[^=]/ contained contains=pbValidUrl
 | 
			
		||||
syn match pbUrlGroup /^url=.*/ contains=pbValidUrl,pb_k_url,pbIllegalUrl,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" license
 | 
			
		||||
syn keyword pb_k_license license contained
 | 
			
		||||
" echo $(pacman -Ql licenses | grep '/usr/share/licenses/common/' | cut -d'/' -f6 | sort -u)
 | 
			
		||||
syn keyword pbLicense  AGPL AGPL3 Apache APACHE Artistic2.0 CCPL CDDL CPL EPL FDL FDL1.2 FDL1.3 GPL GPL2 GPL3 LGPL LGPL2.1 LGPL3 LPPL MPL PerlArtistic PHP PSF RUBY W3C ZPL contained
 | 
			
		||||
" special cases from https://wiki.archlinux.org/index.php/Arch_Packaging_Standards
 | 
			
		||||
syn keyword pbLicenseSpecial  BSD MIT ZLIB Python contained
 | 
			
		||||
syn match pbLicenseCustom /custom\(:[[:alnum:]]*\)*/ contained
 | 
			
		||||
syn match pbIllegalLicense /[^='"() ]/ contained contains=pbLicenseCustom,pbLicenseSpecial,pbLicense
 | 
			
		||||
syn region pbLicenseGroup start=/^license=(/ end=/)/ contains=pb_k_license,pbLicenseCustom,pbLicenseSpecial,pbLicense,pbIllegalLicense
 | 
			
		||||
 | 
			
		||||
" backup
 | 
			
		||||
syn keyword pb_k_backup backup contained
 | 
			
		||||
syn match pbValidBackup   /\.\?[[:alpha:]]*\/[[:alnum:]\{\}+._$-]*]*/ contained
 | 
			
		||||
syn region pbBackupGroup start=/^backup=(/ end=/)/ contains=pb_k_backup,pbValidBackup,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" arch
 | 
			
		||||
syn keyword pb_k_arch arch contained
 | 
			
		||||
syn keyword pbArch i686 x86_64 ppc any contained
 | 
			
		||||
syn match pbIllegalArch /[^='"() ]/ contained contains=pbArch
 | 
			
		||||
syn region pbArchGroup start=/^arch=(/ end=/)/ contains=pb_k_arch,pbArch,pbIllegalArch
 | 
			
		||||
 | 
			
		||||
" groups
 | 
			
		||||
syn keyword pb_k_groups groups contained
 | 
			
		||||
syn match pbValidGroups /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbGroupsGroup start=/^groups=(/ end=/)/ contains=pb_k_groups,pbValidGroups,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" depends
 | 
			
		||||
syn keyword pb_k_depends depends contained
 | 
			
		||||
syn match pbValidDepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbDependsGroup start=/^depends=(/ end=/)/ contains=pb_k_depends,pbValidDepends,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" makedepends
 | 
			
		||||
syn keyword pb_k_makedepends makedepends contained
 | 
			
		||||
syn match pbValidMakedepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbMakedependsGroup start=/^makedepends=(/ end=/)/ contains=pb_k_makedepends,pbValidMakedepends,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" optdepends
 | 
			
		||||
syn keyword pb_k_optdepends optdepends contained
 | 
			
		||||
syn match pbValidOptdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbOptdependsGroup start=/^optdepends=(/ end=/)/ contains=pb_k_optdepends,pbValidOptdepends,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" checkdepends
 | 
			
		||||
syn keyword pb_k_ckdepends checkdepends contained
 | 
			
		||||
syn match pbValidCkdepends /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbCkdependsGroup start=/^checkdepends=(/ end=/)/ contains=pb_k_ckdepends,pbValidCkdepends,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" conflicts
 | 
			
		||||
syn keyword pb_k_conflicts conflicts contained
 | 
			
		||||
syn match pbValidConflicts /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbConflictsGroup start=/^conflicts=(/ end=/)/ contains=pb_k_conflicts,pbValidConflicts,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" provides
 | 
			
		||||
syn keyword pb_k_provides provides contained
 | 
			
		||||
syn match pbValidProvides /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbProvidesGroup start=/^provides=(/ end=/)/ contains=pb_k_provides,pbValidProvides,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" replaces
 | 
			
		||||
syn keyword pb_k_replaces replaces contained
 | 
			
		||||
syn match pbValidReplaces /\([[:alnum:]]\|+\|-\|_\)*/ contained
 | 
			
		||||
syn region pbReplacesGroup start=/^replaces=(/  end=/)/ contains=pb_k_replaces,pbValidReplaces,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" install
 | 
			
		||||
" XXX remove install from bashStatement, fix strange bug
 | 
			
		||||
syn clear bashStatement
 | 
			
		||||
syn keyword bashStatement chmod clear complete du egrep expr fgrep find gnufind gnugrep grep less ls mkdir mv rm rmdir rpm sed sleep sort strip tail touch
 | 
			
		||||
 | 
			
		||||
syn keyword pb_k_install install contained
 | 
			
		||||
syn match pbValidInstall /\([[:alnum:]]\|\$\|+\|-\|_\)*\.install/ contained
 | 
			
		||||
syn match pbIllegalInstall /[^=]/ contained contains=pbValidInstall
 | 
			
		||||
syn match pbInstallGroup /^install=.*/ contains=pb_k_install,pbValidInstall,pbIllegalInstall,shDeref,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" changelog
 | 
			
		||||
syn keyword pb_k_changelog changelog contained
 | 
			
		||||
syn match pbValidChangelog /\([[:alnum:]]\|\$\|+\|-\|_\)*/ contained
 | 
			
		||||
syn match pbIllegalChangelog /[^=]/ contained contains=pbValidChangelog
 | 
			
		||||
syn match pbChangelogGroup /^changelog=.*/ contains=pb_k_changelog,pbValidChangelog,pbIllegalChangelog,shDeref,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" source:
 | 
			
		||||
" XXX remove source from shStatement, fix strange bug
 | 
			
		||||
syn clear shStatement
 | 
			
		||||
syn keyword shStatement xxx wait getopts return autoload whence printf true popd nohup enable r trap readonly fc fg kill ulimit umask disown stop pushd read history logout times local exit test pwd time eval integer suspend dirs shopt hash false newgrp bg print jobs continue functions exec help cd break unalias chdir type shift builtin let bind
 | 
			
		||||
 | 
			
		||||
syn keyword pb_k_source source contained
 | 
			
		||||
syn match pbIllegalSource /\(http\|ftp\|https\).*\.\+\(dl\|download.\?\)\.\(sourceforge\|sf\).net/
 | 
			
		||||
syn region pbSourceGroup  start=/^source=(/ end=/)/ contains=pb_k_source,pbIllegalSource,shNumber,shDoubleQuote,shSingleQuote,pbDerefEmulation
 | 
			
		||||
syn match pbDerefEmulation /\$[{]\?[[:alnum:]_]*[}]\?/ contained
 | 
			
		||||
hi def link pbDerefEmulation PreProc
 | 
			
		||||
 | 
			
		||||
" md5sums
 | 
			
		||||
syn keyword pb_k_md5sums md5sums contained
 | 
			
		||||
syn match pbIllegalMd5sums /[^='"()\/ ]/ contained contains=pbValidMd5sums
 | 
			
		||||
syn match pbValidMd5sums /\x\{32\}/ contained
 | 
			
		||||
syn region pbMd5sumsGroup start=/^md5sums/ end=/)/ contains=pb_k_md5sums,pbMd5Quotes,pbMd5Hash,pbIllegalMd5sums keepend
 | 
			
		||||
syn match pbMd5Quotes /'.*'\|".*"/ contained contains=pbMd5Hash,pbIllegalMd5sums
 | 
			
		||||
syn match pbMd5Hash /\x\+/ contained contains=pbValidMd5sums
 | 
			
		||||
hi def link pbMd5Quotes Keyword
 | 
			
		||||
hi def link pbMd5Hash Error
 | 
			
		||||
hi def link pbValidMd5sums  Number
 | 
			
		||||
 | 
			
		||||
" sha1sums
 | 
			
		||||
syn keyword pb_k_sha1sums sha1sums contained
 | 
			
		||||
syn match pbIllegalSha1sums /[^='"()\/ ]/ contained contains=pbValidSha1sums
 | 
			
		||||
syn match pbValidSha1sums /\x\{40\}/ contained
 | 
			
		||||
syn region pbSha1sumsGroup start=/^sha1sums/ end=/)/ contains=pb_k_sha1sums,pbSha1Quotes,pbSha1Hash,pbIllegalSha1sums keepend
 | 
			
		||||
syn match pbSha1Quotes /'.*'\|".*"/ contained contains=pbSha1Hash,pbIllegalSha1sums
 | 
			
		||||
syn match pbSha1Hash /\x\+/ contained contains=pbValidSha1sums
 | 
			
		||||
hi def link pbSha1Quotes Keyword
 | 
			
		||||
hi def link pbSha1Hash Error
 | 
			
		||||
hi def link pbValidSha1sums  Number
 | 
			
		||||
 | 
			
		||||
" sha256sums
 | 
			
		||||
syn keyword pb_k_sha256sums sha256sums contained
 | 
			
		||||
syn match pbIllegalSha256sums /[^='"()\/ ]/ contained contains=pbValidSha256sums
 | 
			
		||||
syn match pbValidSha256sums /\x\{64\}/ contained
 | 
			
		||||
syn region pbSha256sumsGroup start=/^sha256sums/ end=/)/ contains=pb_k_sha256sums,pbSha256Quotes,pbSha256Hash,pbIllegalSha256sums keepend
 | 
			
		||||
syn match pbSha256Quotes /'.*'\|".*"/ contained contains=pbSha256Hash,pbIllegalSha256sums
 | 
			
		||||
syn match pbSha256Hash /\x\+/ contained contains=pbValidSha256sums
 | 
			
		||||
hi def link pbSha256Quotes Keyword
 | 
			
		||||
hi def link pbSha256Hash Error
 | 
			
		||||
hi def link pbValidSha256sums  Number
 | 
			
		||||
 | 
			
		||||
" sha384sums
 | 
			
		||||
syn keyword pb_k_sha384sums sha384sums contained
 | 
			
		||||
syn match pbIllegalSha384sums /[^='"()\/ ]/ contained contains=pbValidSha384sums
 | 
			
		||||
syn match pbValidSha384sums /\x\{96\}/ contained
 | 
			
		||||
syn region pbSha384sumsGroup start=/^sha384sums/ end=/)/ contains=pb_k_sha384sums,pbSha384Quotes,pbSha384Hash,pbIllegalSha384sums keepend
 | 
			
		||||
syn match pbSha384Quotes /'.*'\|".*"/ contained contains=pbSha384Hash,pbIllegalSha384sums
 | 
			
		||||
syn match pbSha384Hash /\x\+/ contained contains=pbValidSha384sums
 | 
			
		||||
hi def link pbSha384Quotes Keyword
 | 
			
		||||
hi def link pbSha384Hash Error
 | 
			
		||||
hi def link pbValidSha384sums  Number
 | 
			
		||||
 | 
			
		||||
" sha512sums
 | 
			
		||||
syn keyword pb_k_sha512sums sha512sums contained
 | 
			
		||||
syn match pbIllegalSha512sums /[^='"()\/ ]/ contained contains=pbValidSha512sums
 | 
			
		||||
syn match pbValidSha512sums /\x\{128\}/ contained
 | 
			
		||||
syn region pbSha512sumsGroup start=/^sha512sums/ end=/)/ contains=pb_k_sha512sums,pbSha512Quotes,pbSha512Hash,pbIllegalSha512sums keepend
 | 
			
		||||
syn match pbSha512Quotes /'.*'\|".*"/ contained contains=pbSha512Hash,pbIllegalSha512sums
 | 
			
		||||
syn match pbSha512Hash /\x\+/ contained contains=pbValidSha512sums
 | 
			
		||||
hi def link pbSha512Quotes Keyword
 | 
			
		||||
hi def link pbSha512Hash Error
 | 
			
		||||
hi def link pbValidSha512sums  Number
 | 
			
		||||
 | 
			
		||||
" options
 | 
			
		||||
syn keyword pb_k_options options contained
 | 
			
		||||
syn match pbOptions /\(no\)\?\(strip\|docs\|libtool\|emptydirs\|zipman\|purge\|upx\|fakeroot\|distcc\|color\|ccache\|check\|sign\|makeflags\|buildflags\)/ contained
 | 
			
		||||
syn match   pbOptionsNeg     /\!/ contained
 | 
			
		||||
syn match   pbOptionsDeprec  /no/ contained
 | 
			
		||||
syn region pbOptionsGroup start=/^options=(/ end=/)/ contains=pb_k_options,pbOptions,pbOptionsNeg,pbOptionsDeprec,pbIllegalOption
 | 
			
		||||
syn match pbIllegalOption /[^!"'()= ]/ contained contains=pbOptionsDeprec,pbOptions
 | 
			
		||||
 | 
			
		||||
" noextract
 | 
			
		||||
syn match pbNoextract /[[:alnum:]+._${}-]\+/ contained
 | 
			
		||||
syn keyword pb_k_noextract noextract  contained
 | 
			
		||||
syn region pbNoextractGroup  start=/^noextract=(/ end=/)/ contains=pb_k_noextract,pbNoextract,shDoubleQuote,shSingleQuote
 | 
			
		||||
 | 
			
		||||
" comments
 | 
			
		||||
syn keyword    pb_k_maintainer Maintainer Contributor contained
 | 
			
		||||
syn match      pbMaintainerGroup /Maintainer.*/ contains=pbMaintainer contained
 | 
			
		||||
 | 
			
		||||
syn match pbDate /[0-9]\{4}\/[0-9]\{2}\/[0-9]\{2}/ contained
 | 
			
		||||
 | 
			
		||||
syn cluster    pbCommentGroup	contains=pbTodo,pb_k_maintainer,pbMaintainerGroup,pbDate
 | 
			
		||||
syn keyword    pbTodo	contained	COMBAK FIXME TODO XXX
 | 
			
		||||
syn match      pbComment	"^#.*$"	contains=@pbCommentGroup
 | 
			
		||||
syn match      pbComment	"[^0-9]#.*$"	contains=@pbCommentGroup
 | 
			
		||||
 | 
			
		||||
" quotes are handled by sh.vim
 | 
			
		||||
 | 
			
		||||
hi def link pbComment Comment
 | 
			
		||||
hi def link pbTodo Todo
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalPkgname Error
 | 
			
		||||
hi def link pb_k_pkgname pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalPkgbase Error
 | 
			
		||||
hi def link pb_k_pkgbase pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalPkgver Error
 | 
			
		||||
hi def link pb_k_pkgver pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalPkgrel Error
 | 
			
		||||
hi def link pb_k_pkgrel pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalPkgdesc Error
 | 
			
		||||
hi def link pb_k_desc pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalEpoch Error
 | 
			
		||||
hi def link pb_k_epoch pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalUrl Error
 | 
			
		||||
hi def link pb_k_url pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_license pbKeywords
 | 
			
		||||
hi def link pbIllegalLicense Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_backup pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_arch pbKeywords
 | 
			
		||||
hi def link pbIllegalArch Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_groups pbKeywords
 | 
			
		||||
hi def link pb_k_makedepends pbKeywords
 | 
			
		||||
hi def link pb_k_optdepends pbKeywords
 | 
			
		||||
hi def link pb_k_ckdepends pbKeywords
 | 
			
		||||
hi def link pb_k_depends pbKeywords
 | 
			
		||||
hi def link pb_k_replaces pbKeywords
 | 
			
		||||
hi def link pb_k_conflicts pbKeywords
 | 
			
		||||
hi def link pb_k_provides pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalInstall Error
 | 
			
		||||
hi def link pb_k_install pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbIllegalChangelog Error
 | 
			
		||||
hi def link pb_k_changelog pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_source pbKeywords
 | 
			
		||||
hi def link pbIllegalSource Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_md5sums pbKeywords
 | 
			
		||||
hi def link pbIllegalMd5sums Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_sha1sums pbKeywords
 | 
			
		||||
hi def link pbIllegalSha1sums Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_sha256sums pbKeywords
 | 
			
		||||
hi def link pbIllegalSha256sums Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_sha384sums pbKeywords
 | 
			
		||||
hi def link pbIllegalSha384sums Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_sha512sums pbKeywords
 | 
			
		||||
hi def link pbIllegalSha512sums Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_options pbKeywords
 | 
			
		||||
hi def link pbOptionsDeprec Todo
 | 
			
		||||
hi def link pbIllegalOption Error
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_noextract pbKeywords
 | 
			
		||||
hi def link pbNoextract Normal
 | 
			
		||||
 | 
			
		||||
hi def link pb_k_maintainer pbKeywords
 | 
			
		||||
 | 
			
		||||
hi def link pbKeywords Keyword
 | 
			
		||||
 | 
			
		||||
hi def link pbDate Special
 | 
			
		||||
 | 
			
		||||
"syntax include @SHELL syntax/sh.vim
 | 
			
		||||
"syntax region BUILD start=/^build()/ end=/^}/ contains=@SHELL
 | 
			
		||||
"let b:current_syntax = "PKGBUILD"
 | 
			
		||||
 | 
			
		||||
" vim: ft=vim
 | 
			
		||||
@@ -1,43 +0,0 @@
 | 
			
		||||
Here is a brief description of the files included in this directory:
 | 
			
		||||
 | 
			
		||||
PKGBUILD.vim - a vim/gvim syntax file for PKGBUILDs. Colors known variable
 | 
			
		||||
names, highlights common errors such as invalid characters in pkgname or
 | 
			
		||||
pkgver, etc.
 | 
			
		||||
 | 
			
		||||
bacman - regenerate a pacman package based on installed files and the pacman
 | 
			
		||||
database entries. Useful for reuse, or possible config file extension.
 | 
			
		||||
 | 
			
		||||
bash_completion - a bash completion script for pacman, install in
 | 
			
		||||
/etc/bash_completion.d/ for use (but rename to something descriptive!).
 | 
			
		||||
 | 
			
		||||
checkupdates - print a list of pending updates without touching the system
 | 
			
		||||
sync databases (for safety on rolling release distributions).
 | 
			
		||||
 | 
			
		||||
paccache - a flexible package cache cleaning utility that allows greater
 | 
			
		||||
control over which packages are removed.
 | 
			
		||||
 | 
			
		||||
pacdiff - a simple pacnew/pacorig/pacsave updater for /etc/.
 | 
			
		||||
 | 
			
		||||
paclist - list all packages installed from a given repository. Useful for
 | 
			
		||||
seeing which packages you may have installed from the testing repository,
 | 
			
		||||
for instance.
 | 
			
		||||
 | 
			
		||||
paclog-pkglist - lists currently installs packages based pacman's log.
 | 
			
		||||
 | 
			
		||||
pacscripts - tries to print out the {pre,post}_{install,remove,upgrade}
 | 
			
		||||
scripts of a given package.
 | 
			
		||||
 | 
			
		||||
pacsearch - a colorized search combining both -Ss and -Qs output. Installed
 | 
			
		||||
packages are easily identified with a *** and local-only packages are also
 | 
			
		||||
listed.
 | 
			
		||||
 | 
			
		||||
pacsysclean - lists installed packages sorted by size.
 | 
			
		||||
 | 
			
		||||
rankmirrors - ranks pacman mirrors by their connection and opening speed.
 | 
			
		||||
 | 
			
		||||
updpkgsums - performs an in place update of the checksums in a PKGBUILD.
 | 
			
		||||
 | 
			
		||||
vimprojects - a project file for the vim project plugin.
 | 
			
		||||
 | 
			
		||||
zsh_completion - a zsh completion script, install (with a rename) to
 | 
			
		||||
/usr/share/zsh/site-functions/.
 | 
			
		||||
@@ -1,313 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
#   bacman: recreate a package from a running system
 | 
			
		||||
#   This script rebuilds an already installed package using metadata
 | 
			
		||||
#   stored into the pacman database and system files
 | 
			
		||||
#
 | 
			
		||||
#   Copyright (c) 2008 locci <carlocci_at_gmail_dot_com>
 | 
			
		||||
#   Copyright (c) 2008-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
#   This program is free software; you can redistribute it and/or modify
 | 
			
		||||
#   it under the terms of the GNU General Public License as published by
 | 
			
		||||
#   the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
#   (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#   This program is distributed in the hope that it will be useful,
 | 
			
		||||
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
#   GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
#   You should have received a copy of the GNU General Public License
 | 
			
		||||
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
shopt -s nullglob
 | 
			
		||||
 | 
			
		||||
declare -r myname='bacman'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
USE_COLOR='y'
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/output_format.sh)
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# User Friendliness
 | 
			
		||||
#
 | 
			
		||||
usage() {
 | 
			
		||||
	echo "This program recreates a package using pacman's db and system files"
 | 
			
		||||
	echo "Usage:   $myname [--nocolor] <installed package name>"
 | 
			
		||||
	echo "Example: $myname kernel26"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2008 locci <carlocci_at_gmail_dot_com>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [[ $1 == "--nocolor" ]]; then
 | 
			
		||||
	USE_COLOR='n'
 | 
			
		||||
	shift
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/term_colors.sh)
 | 
			
		||||
 | 
			
		||||
if (( $# != 1 )); then
 | 
			
		||||
	usage
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ $1 = -@(h|-help) ]]; then
 | 
			
		||||
	usage
 | 
			
		||||
	exit 0
 | 
			
		||||
elif [[ $1 = -@(V|-version) ]]; then
 | 
			
		||||
	version
 | 
			
		||||
	exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Fakeroot support
 | 
			
		||||
#
 | 
			
		||||
if (( EUID )); then
 | 
			
		||||
	if [[ -f /usr/bin/fakeroot ]]; then
 | 
			
		||||
		msg "Entering fakeroot environment"
 | 
			
		||||
		export INFAKEROOT="1"
 | 
			
		||||
		/usr/bin/fakeroot -u -- "$0" "$@"
 | 
			
		||||
		exit $?
 | 
			
		||||
	else
 | 
			
		||||
		warning "installing fakeroot or running $myname as root is required to"
 | 
			
		||||
		plain   "         preserve the ownership permissions of files in some packages\n"
 | 
			
		||||
	fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Setting environmental variables
 | 
			
		||||
#
 | 
			
		||||
if [[ ! -r @sysconfdir@/pacman.conf ]]; then
 | 
			
		||||
	error "unable to read @sysconfdir@/pacman.conf"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
eval $(awk '/DBPath/ {print $1$2$3}' @sysconfdir@/pacman.conf)
 | 
			
		||||
pac_db="${DBPath:-@localstatedir@/lib/pacman/}/local"
 | 
			
		||||
 | 
			
		||||
if [[ ! -r @sysconfdir@/makepkg.conf ]]; then
 | 
			
		||||
	error "unable to read @sysconfdir@/makepkg.conf"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
source "@sysconfdir@/makepkg.conf"
 | 
			
		||||
if [[ -r ~/.makepkg.conf ]]; then
 | 
			
		||||
	source ~/.makepkg.conf
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
pkg_dest="${PKGDEST:-$PWD}"
 | 
			
		||||
pkg_pkger=${PACKAGER:-'Unknown Packager'}
 | 
			
		||||
 | 
			
		||||
pkg_name="$1"
 | 
			
		||||
pkg_dir=("$pac_db/$pkg_name"-+([^-])-+([^-]))
 | 
			
		||||
pkg_namver=("${pkg_dir[@]##*/}")
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Checks everything is in place
 | 
			
		||||
#
 | 
			
		||||
if [[ ! -d $pac_db ]]; then
 | 
			
		||||
	error "pacman database directory ${pac_db} not found"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if (( ${#pkg_dir[@]} != 1 )); then
 | 
			
		||||
	error "%d entries for package %s found in pacman database" \
 | 
			
		||||
		${#pkg_dir[@]} "${pkg_name}"
 | 
			
		||||
	msg2 "%s" "${pkg_dir[@]}"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ ! -d $pkg_dir ]]; then
 | 
			
		||||
	error "package %s is found in pacman database," "${pkg_name}"
 | 
			
		||||
	plain "       but \`%s' is not a directory" "${pkg_dir}"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Begin
 | 
			
		||||
#
 | 
			
		||||
msg "Package: ${pkg_namver}"
 | 
			
		||||
work_dir=$(mktemp -d --tmpdir bacman.XXXXXXXXXX)
 | 
			
		||||
cd "$work_dir" || exit 1
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# File copying
 | 
			
		||||
#
 | 
			
		||||
msg2 "Copying package files..."
 | 
			
		||||
 | 
			
		||||
cat "$pkg_dir"/files |
 | 
			
		||||
while read i; do
 | 
			
		||||
	if [[ -z $i ]]; then
 | 
			
		||||
		continue
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [[ $i == %+([A-Z])% ]]; then
 | 
			
		||||
		current=$i
 | 
			
		||||
		continue
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	case "$current" in
 | 
			
		||||
		%FILES%)
 | 
			
		||||
			ret=0
 | 
			
		||||
			if [[ -e /$i ]]; then
 | 
			
		||||
				bsdtar -cnf - "/$i" 2> /dev/null | bsdtar -xpf -
 | 
			
		||||
 | 
			
		||||
				# Workaround to bsdtar not reporting a missing file as an error
 | 
			
		||||
				if ! [[ -e $work_dir/$i || -L $work_dir/$i ]]; then
 | 
			
		||||
					error "unable to add /$i to the package"
 | 
			
		||||
					plain "       If your user does not have permssion to read this file then"
 | 
			
		||||
					plain "       you will need to run $myname as root"
 | 
			
		||||
					rm -rf "$work_dir"
 | 
			
		||||
					exit 1
 | 
			
		||||
				fi
 | 
			
		||||
			else
 | 
			
		||||
				warning "package file /$i is missing"
 | 
			
		||||
			fi
 | 
			
		||||
			;;
 | 
			
		||||
	esac
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
ret=$?
 | 
			
		||||
if (( ret )); then
 | 
			
		||||
	rm -rf "$work_dir"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
pkg_size=$(du -sk | awk '{print $1 * 1024}')
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# .PKGINFO stuff
 | 
			
		||||
# TODO adopt makepkg's write_pkginfo() into this or scripts/library
 | 
			
		||||
#
 | 
			
		||||
msg2 "Generating .PKGINFO metadata..."
 | 
			
		||||
echo "# Generated by $myname $myver"    > .PKGINFO
 | 
			
		||||
if [[ $INFAKEROOT == "1" ]]; then
 | 
			
		||||
	echo "# Using $(fakeroot -v)"    >> .PKGINFO
 | 
			
		||||
fi
 | 
			
		||||
echo "# $(LC_ALL=C date)"            >> .PKGINFO
 | 
			
		||||
echo "#"                    >> .PKGINFO
 | 
			
		||||
 | 
			
		||||
while read i; do
 | 
			
		||||
	if [[ -z $i ]]; then
 | 
			
		||||
		continue;
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [[ $i == %+([A-Z])% ]]; then
 | 
			
		||||
		current=$i
 | 
			
		||||
		continue
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	case "$current" in
 | 
			
		||||
		# desc
 | 
			
		||||
		%NAME%)
 | 
			
		||||
			echo "pkgname = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%VERSION%)
 | 
			
		||||
			echo "pkgver = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%DESC%)
 | 
			
		||||
			echo "pkgdesc = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%URL%)
 | 
			
		||||
			echo "url = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%LICENSE%)
 | 
			
		||||
			echo "license = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%ARCH%)
 | 
			
		||||
			echo "arch = $i"    >> .PKGINFO
 | 
			
		||||
			pkg_arch="$i"
 | 
			
		||||
			;;
 | 
			
		||||
		%BUILDDATE%)
 | 
			
		||||
			echo "builddate = $(date -u "+%s")"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%PACKAGER%)
 | 
			
		||||
			echo "packager = $pkg_pkger"        >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%SIZE%)
 | 
			
		||||
			echo "size = $pkg_size"        >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%GROUPS%)
 | 
			
		||||
			echo "group = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%REPLACES%)
 | 
			
		||||
			echo "replaces = $i"    >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%DEPENDS%)
 | 
			
		||||
			echo "depend = $i"   >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%OPTDEPENDS%)
 | 
			
		||||
			echo "optdepend = $i" >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%CONFLICTS%)
 | 
			
		||||
			echo "conflict = $i" >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
		%PROVIDES%)
 | 
			
		||||
			echo "provides = $i"  >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
 | 
			
		||||
		# files
 | 
			
		||||
		%BACKUP%)
 | 
			
		||||
			# strip the md5sum after the tab
 | 
			
		||||
			echo "backup = ${i%%$'\t'*}"   >> .PKGINFO
 | 
			
		||||
			;;
 | 
			
		||||
	esac
 | 
			
		||||
done < <(cat "$pkg_dir"/{desc,files})
 | 
			
		||||
 | 
			
		||||
comp_files=".PKGINFO"
 | 
			
		||||
 | 
			
		||||
if [[ -f $pkg_dir/install ]]; then
 | 
			
		||||
	cp "$pkg_dir/install" "$work_dir/.INSTALL"
 | 
			
		||||
	comp_files+=" .INSTALL"
 | 
			
		||||
fi
 | 
			
		||||
if [[ -f $pkg_dir/changelog ]]; then
 | 
			
		||||
	cp "$pkg_dir/changelog" "$work_dir/.CHANGELOG"
 | 
			
		||||
	comp_files+=" .CHANGELOG"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Fixes owner:group and permissions for .PKGINFO, .CHANGELOG, .INSTALL
 | 
			
		||||
#
 | 
			
		||||
chown root:root "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
 | 
			
		||||
chmod 644 "$work_dir"/{.PKGINFO,.CHANGELOG,.INSTALL} 2> /dev/null
 | 
			
		||||
 | 
			
		||||
#
 | 
			
		||||
# Generate the package
 | 
			
		||||
#
 | 
			
		||||
msg2 "Generating the package..."
 | 
			
		||||
 | 
			
		||||
pkg_file="$pkg_dest/$pkg_namver-$pkg_arch${PKGEXT}"
 | 
			
		||||
ret=0
 | 
			
		||||
 | 
			
		||||
# TODO: Maybe this can be set globally for robustness
 | 
			
		||||
shopt -s -o pipefail
 | 
			
		||||
bsdtar -cf - $comp_files * |
 | 
			
		||||
case "$PKGEXT" in
 | 
			
		||||
	*tar.gz)  gzip -c -f -n ;;
 | 
			
		||||
	*tar.bz2) bzip2 -c -f ;;
 | 
			
		||||
	*tar.xz)  xz -c -z - ;;
 | 
			
		||||
	*tar.Z)   compress -c -f ;;
 | 
			
		||||
	*tar)     cat ;;
 | 
			
		||||
	*) warning "'%s' is not a valid archive extension." \
 | 
			
		||||
	"$PKGEXT"; cat ;;
 | 
			
		||||
esac > "${pkg_file}"; ret=$?
 | 
			
		||||
 | 
			
		||||
if (( ret )); then
 | 
			
		||||
	error "Unable to write package to $pkg_dest"
 | 
			
		||||
	plain "       Maybe the disk is full or you do not have write access"
 | 
			
		||||
	rm -rf "$work_dir"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
rm -rf "$work_dir"
 | 
			
		||||
 | 
			
		||||
msg "Done."
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,44 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
#   checkupdates: Safely print a list of pending updates.
 | 
			
		||||
#
 | 
			
		||||
#   Copyright (c) 2013 Kyle Keen <keenerd@gmail.com>
 | 
			
		||||
#
 | 
			
		||||
#   This program is free software; you can redistribute it and/or modify
 | 
			
		||||
#   it under the terms of the GNU General Public License as published by
 | 
			
		||||
#   the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
#   (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#   This program is distributed in the hope that it will be useful,
 | 
			
		||||
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
#   GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
#   You should have received a copy of the GNU General Public License
 | 
			
		||||
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
if (( $# > 0 )); then
 | 
			
		||||
	echo "checkupdates: Safely print a list of pending updates."
 | 
			
		||||
	echo "Use: checkupdates"
 | 
			
		||||
	echo "Export the 'CHECKUPDATES_DB' variable to change the path of the temporary database."
 | 
			
		||||
	exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ -z $CHECKUPDATES_DB ]]; then
 | 
			
		||||
	CHECKUPDATES_DB="${TMPDIR:-/tmp}/checkup-db-${USER}/"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
trap 'rm -f $CHECKUPDATES_DB/db.lck' INT TERM EXIT
 | 
			
		||||
 | 
			
		||||
DBPath="${DBPath:-@localstatedir@/lib/pacman/}"
 | 
			
		||||
eval $(awk -F' *= *' '$1 ~ /DBPath/ { print $1 "=" $2 }' @sysconfdir@/pacman.conf)
 | 
			
		||||
 | 
			
		||||
mkdir -p "$CHECKUPDATES_DB"
 | 
			
		||||
ln -s "${DBPath}/local" "$CHECKUPDATES_DB" &> /dev/null
 | 
			
		||||
fakeroot pacman -Sy --dbpath "$CHECKUPDATES_DB" --logfile /dev/null &> /dev/null
 | 
			
		||||
pacman -Qqu --dbpath "$CHECKUPDATES_DB" 2> /dev/null
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,317 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
# pacache - flexible pacman cache cleaning
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the GNU General Public License
 | 
			
		||||
# as published by the Free Software Foundation; either version 2
 | 
			
		||||
# of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
 | 
			
		||||
declare -r myname='paccache'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
declare -a candidates=() cmdopts=() whitelist=() blacklist=()
 | 
			
		||||
declare -i delete=0 dryrun=0 filecount=0 move=0 needsroot=0 totalsaved=0 verbose=0
 | 
			
		||||
declare    cachedir=@localstatedir@/cache/pacman/pkg delim=$'\n' keep=3 movedir= scanarch=
 | 
			
		||||
 | 
			
		||||
USE_COLOR='y'
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/output_format.sh)
 | 
			
		||||
m4_include(../scripts/library/parseopts.sh)
 | 
			
		||||
 | 
			
		||||
die() {
 | 
			
		||||
	error "$@"
 | 
			
		||||
	exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# reads a list of files on stdin and prints out deletion candidates
 | 
			
		||||
pkgfilter() {
 | 
			
		||||
	# there's whitelist and blacklist parameters passed to this
 | 
			
		||||
	# script after the block of awk.
 | 
			
		||||
 | 
			
		||||
	awk -v keep="$1" -v scanarch="$2" '
 | 
			
		||||
	function parse_filename(filename,     parts, count, i, pkgname, arch) {
 | 
			
		||||
 | 
			
		||||
		count = split(filename, parts, "-")
 | 
			
		||||
 | 
			
		||||
		i = 1
 | 
			
		||||
		pkgname = parts[i++]
 | 
			
		||||
		while (i <= count - 3) {
 | 
			
		||||
			pkgname = pkgname "-" parts[i++]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		arch = substr(parts[count], 1, index(parts[count], ".") - 1)
 | 
			
		||||
 | 
			
		||||
		# filter on whitelist or blacklist
 | 
			
		||||
		if (wlen && !whitelist[pkgname]) return
 | 
			
		||||
		if (blen && blacklist[pkgname]) return
 | 
			
		||||
 | 
			
		||||
		if ("" == packages[pkgname,arch]) {
 | 
			
		||||
			packages[pkgname,arch] = filename
 | 
			
		||||
		} else {
 | 
			
		||||
			packages[pkgname,arch] = packages[pkgname,arch] SUBSEP filename
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	BEGIN {
 | 
			
		||||
		# create whitelist
 | 
			
		||||
		wlen = ARGV[1]; delete ARGV[1]
 | 
			
		||||
		for (i = 2; i < 2 + wlen; i++) {
 | 
			
		||||
			whitelist[ARGV[i]] = 1
 | 
			
		||||
			delete ARGV[i]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		# create blacklist
 | 
			
		||||
		blen = ARGV[i]; delete ARGV[i]
 | 
			
		||||
		while (i++ < ARGC) {
 | 
			
		||||
			blacklist[ARGV[i]] = 1
 | 
			
		||||
			delete ARGV[i]
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		# read package filenames
 | 
			
		||||
		while (getline < "/dev/stdin") {
 | 
			
		||||
			parse_filename($0)
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for (pkglist in packages) {
 | 
			
		||||
			# idx[1,2] = idx[pkgname,arch]
 | 
			
		||||
			split(pkglist, idx, SUBSEP)
 | 
			
		||||
 | 
			
		||||
			# enforce architecture match if specified
 | 
			
		||||
			if (!scanarch || scanarch == idx[2]) {
 | 
			
		||||
				count = split(packages[idx[1], idx[2]], pkgs, SUBSEP)
 | 
			
		||||
				for(i = 1; i <= count - keep; i++) {
 | 
			
		||||
					print pkgs[i]
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}' "${@:3}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/size_to_human.sh)
 | 
			
		||||
 | 
			
		||||
runcmd() {
 | 
			
		||||
	if (( needsroot && EUID != 0 )); then
 | 
			
		||||
		msg "Privilege escalation required"
 | 
			
		||||
		if sudo -v &>/dev/null && sudo -l &>/dev/null; then
 | 
			
		||||
			sudo "$@"
 | 
			
		||||
		else
 | 
			
		||||
			die 'Unable to escalate privileges using sudo'
 | 
			
		||||
		fi
 | 
			
		||||
	else
 | 
			
		||||
		"$@"
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
summarize() {
 | 
			
		||||
	local -i filecount=$1; shift
 | 
			
		||||
	local seenarch= seen= arch= name=
 | 
			
		||||
	local -r pkg_re='(.+)-[^-]+-[0-9]+-([^.]+)\.pkg.*'
 | 
			
		||||
 | 
			
		||||
	if (( delete )); then
 | 
			
		||||
		printf -v output 'finished: %d packages removed' "$filecount"
 | 
			
		||||
	elif (( move )); then
 | 
			
		||||
		printf -v output "finished: %d packages moved to '%s'" "$filecount" "$movedir"
 | 
			
		||||
	elif (( dryrun )); then
 | 
			
		||||
		if (( verbose )); then
 | 
			
		||||
			msg "Candidate packages:"
 | 
			
		||||
			while read -r pkg; do
 | 
			
		||||
				if (( verbose >= 3 )); then
 | 
			
		||||
					[[ $pkg =~ $pkg_re ]] && name=${BASH_REMATCH[1]} arch=${BASH_REMATCH[2]}
 | 
			
		||||
					if [[ -z $seen || $seenarch != "$arch" || $seen != "$name" ]]; then
 | 
			
		||||
						seen=$name seenarch=$arch
 | 
			
		||||
						printf '%s (%s):\n' "$name" "$arch"
 | 
			
		||||
					fi
 | 
			
		||||
					printf '  %s\n' "$pkg"
 | 
			
		||||
				elif (( verbose >= 2 )); then
 | 
			
		||||
					printf "$PWD/%s$delim" "$pkg"
 | 
			
		||||
				else
 | 
			
		||||
					printf "%s$delim" "$pkg"
 | 
			
		||||
				fi
 | 
			
		||||
			done < <(printf '%s\n' "$@" | pacsort --files)
 | 
			
		||||
		fi
 | 
			
		||||
		printf -v output 'finished dry run: %d candidates' "$filecount"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	printf '\n' >&2
 | 
			
		||||
	msg "$output (diskspace saved: %s)" "$(size_to_human "$totalsaved")"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	cat <<EOF
 | 
			
		||||
usage: $myname <operation> [options] [targets...]
 | 
			
		||||
 | 
			
		||||
$myname is a flexible pacman cache cleaning utility, which has numerous
 | 
			
		||||
options to help control how much, and what, is deleted from any directory
 | 
			
		||||
containing pacman package tarballs.
 | 
			
		||||
 | 
			
		||||
  Operations:
 | 
			
		||||
    -d, --dryrun            perform a dry run, only finding candidate packages.
 | 
			
		||||
    -m, --move <dir>        move candidate packages to 'movedir'.
 | 
			
		||||
    -r, --remove            remove candidate packages.
 | 
			
		||||
 | 
			
		||||
  Options:
 | 
			
		||||
    -a, --arch <arch>       scan for 'arch' (default: all architectures).
 | 
			
		||||
    -c, --cachedir <dir>    scan 'cachedir' for packages (default: @localstatedir@/cache/pacman/pkg).
 | 
			
		||||
    -f, --force             apply force to mv(1) and rm(1) operations.
 | 
			
		||||
    -h, --help              display this help message and exit.
 | 
			
		||||
    -i, --ignore <pkgs>     ignore 'pkgs', comma separated. Alternatively, specify '-' to
 | 
			
		||||
                              read package names from stdin, newline delimited.
 | 
			
		||||
    -k, --keep <num>        keep 'num' of each package in 'cachedir' (default: 3).
 | 
			
		||||
    --nocolor               remove color from output.
 | 
			
		||||
    -u, --uninstalled       target uninstalled packages.
 | 
			
		||||
    -v, --verbose           increase verbosity. specify up to 3 times.
 | 
			
		||||
    -z, --null              use null delimiters for candidate names (only with -v and -vv)
 | 
			
		||||
 | 
			
		||||
EOF
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
OPT_SHORT=':a:c:dfhi:k:m:rsuVvz'
 | 
			
		||||
OPT_LONG=('arch:' 'cachedir:' 'dryrun' 'force' 'help' 'ignore:' 'keep:' 'move'
 | 
			
		||||
          'nocolor' 'remove' 'uninstalled' 'version' 'verbose' 'null')
 | 
			
		||||
 | 
			
		||||
if ! parseopts "$OPT_SHORT" "${OPT_LONG[@]}" -- "$@"; then
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
set -- "${OPTRET[@]}"
 | 
			
		||||
unset OPT_SHORT OPT_LONG OPTRET
 | 
			
		||||
 | 
			
		||||
while :; do
 | 
			
		||||
	case $1 in
 | 
			
		||||
		-a|--arch)
 | 
			
		||||
			scanarch=$2
 | 
			
		||||
			shift ;;
 | 
			
		||||
		-c|--cachedir)
 | 
			
		||||
			cachedir=$2
 | 
			
		||||
			shift ;;
 | 
			
		||||
		-d|--dryrun)
 | 
			
		||||
			dryrun=1 ;;
 | 
			
		||||
		-f|--force)
 | 
			
		||||
			cmdopts=(-f) ;;
 | 
			
		||||
		-h|--help)
 | 
			
		||||
			usage
 | 
			
		||||
			exit 0 ;;
 | 
			
		||||
		-i|--ignore)
 | 
			
		||||
			if [[ $2 = '-' ]]; then
 | 
			
		||||
				[[ ! -t 0 ]] && IFS=$'\n' read -r -d '' -a ign
 | 
			
		||||
			else
 | 
			
		||||
				IFS=',' read -r -a ign <<< "$2"
 | 
			
		||||
			fi
 | 
			
		||||
			blacklist+=("${ign[@]}")
 | 
			
		||||
			unset i ign
 | 
			
		||||
			shift ;;
 | 
			
		||||
		-k|--keep)
 | 
			
		||||
			keep=$2
 | 
			
		||||
			if [[ -z $keep || -n ${keep//[0-9]/} ]]; then
 | 
			
		||||
				die 'argument to option -k must be a non-negative integer'
 | 
			
		||||
			else
 | 
			
		||||
				keep=$(( 10#$keep ))
 | 
			
		||||
			fi
 | 
			
		||||
			shift ;;
 | 
			
		||||
		--nocolor)
 | 
			
		||||
			USE_COLOR='n' ;;
 | 
			
		||||
		-m|--move)
 | 
			
		||||
			move=1 movedir=$2
 | 
			
		||||
			shift ;;
 | 
			
		||||
		-r|--remove)
 | 
			
		||||
			delete=1 ;;
 | 
			
		||||
		-u|--uninstalled)
 | 
			
		||||
			IFS=$'\n' read -r -d '' -a ign < <(pacman -Qq)
 | 
			
		||||
			blacklist+=("${ign[@]}")
 | 
			
		||||
			unset ign ;;
 | 
			
		||||
		-V|--version)
 | 
			
		||||
			version
 | 
			
		||||
			exit 0 ;;
 | 
			
		||||
		-v|--verbose)
 | 
			
		||||
			(( ++verbose )) ;;
 | 
			
		||||
		-z|--null)
 | 
			
		||||
			delim='\0' ;;
 | 
			
		||||
		--)
 | 
			
		||||
			shift
 | 
			
		||||
			break 2 ;;
 | 
			
		||||
	esac
 | 
			
		||||
	shift
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/term_colors.sh)
 | 
			
		||||
 | 
			
		||||
# remaining args are a whitelist
 | 
			
		||||
whitelist=("$@")
 | 
			
		||||
 | 
			
		||||
# sanity checks
 | 
			
		||||
case $(( dryrun+delete+move )) in
 | 
			
		||||
	0) die "no operation specified (use -h for help)" ;;
 | 
			
		||||
	[^1]) die "only one operation may be used at a time" ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
[[ -d $cachedir ]] ||
 | 
			
		||||
	die "cachedir '%s' does not exist or is not a directory" "$cachedir"
 | 
			
		||||
 | 
			
		||||
[[ $movedir && ! -d $movedir ]] &&
 | 
			
		||||
	die "move-to directory '%s' does not exist or is not a directory" "$movedir"
 | 
			
		||||
 | 
			
		||||
if (( move || delete )); then
 | 
			
		||||
	# make it an absolute path since we're about to chdir
 | 
			
		||||
	[[ ${movedir:0:1} != '/' ]] && movedir=$PWD/$movedir
 | 
			
		||||
	[[ ! -w $cachedir || ( $movedir && ! -w $movedir ) ]] && needsroot=1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# unlikely that this will fail, but better make sure
 | 
			
		||||
cd "$cachedir" >/dev/null || die "failed to chdir to '%s'" "$cachedir"
 | 
			
		||||
 | 
			
		||||
# note that these results are returned in an arbitrary order from awk, but
 | 
			
		||||
# they'll be resorted (in summarize) iff we have a verbosity level set.
 | 
			
		||||
IFS=$'\n' read -r -d '' -a candidates < \
 | 
			
		||||
	<(printf '%s\n' *.pkg.tar?(.+([^.])) | pacsort --files |
 | 
			
		||||
		pkgfilter "$keep" "$scanarch" \
 | 
			
		||||
			"${#whitelist[*]}" "${whitelist[@]}" \
 | 
			
		||||
			"${#blacklist[*]}" "${blacklist[@]}")
 | 
			
		||||
 | 
			
		||||
if (( ! ${#candidates[*]} )); then
 | 
			
		||||
	msg 'no candidate packages found for pruning'
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# grab this prior to signature scavenging
 | 
			
		||||
pkgcount=${#candidates[*]}
 | 
			
		||||
 | 
			
		||||
# copy the list, merging in any found sigs
 | 
			
		||||
for cand in "${candidates[@]}"; do
 | 
			
		||||
  candtemp+=("$cand")
 | 
			
		||||
  [[ -f $cand.sig ]] && candtemp+=("$cand.sig")
 | 
			
		||||
done
 | 
			
		||||
candidates=("${candtemp[@]}")
 | 
			
		||||
unset candtemp
 | 
			
		||||
 | 
			
		||||
# do this before we destroy anything
 | 
			
		||||
totalsaved=$(@SIZECMD@ "${candidates[@]}" | awk '{ sum += $1 } END { print sum }')
 | 
			
		||||
 | 
			
		||||
# crush. kill. destroy.
 | 
			
		||||
(( verbose )) && cmdopts+=(-v)
 | 
			
		||||
if (( delete )); then
 | 
			
		||||
	printf '%s\0' "${candidates[@]}" | runcmd xargs -0 rm "${cmdopts[@]}"
 | 
			
		||||
elif (( move )); then
 | 
			
		||||
	printf '%s\0' "${candidates[@]}" | runcmd xargs -0 mv "${cmdopts[@]}" -t "$movedir"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
summarize "$pkgcount" "${candidates[@]}"
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,102 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#   pacdiff : a simple pacnew/pacorig/pacsave updater
 | 
			
		||||
#
 | 
			
		||||
#   Copyright (c) 2007 Aaron Griffin <aaronmgriffin@gmail.com>
 | 
			
		||||
#   Copyright (c) 2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
#   This program is free software; you can redistribute it and/or modify
 | 
			
		||||
#   it under the terms of the GNU General Public License as published by
 | 
			
		||||
#   the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
#   (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#   This program is distributed in the hope that it will be useful,
 | 
			
		||||
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
#   GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
#   You should have received a copy of the GNU General Public License
 | 
			
		||||
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
declare -r myname='pacdiff'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
diffprog=${DIFFPROG:-vimdiff}
 | 
			
		||||
diffsearchpath=${DIFFSEARCHPATH:-/etc}
 | 
			
		||||
locate=0
 | 
			
		||||
USE_COLOR='y'
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/output_format.sh)
 | 
			
		||||
 | 
			
		||||
m4_include(../scripts/library/term_colors.sh)
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	echo "$myname : a simple pacnew/pacorig/pacsave updater"
 | 
			
		||||
	echo "Usage : $myname [-l]"
 | 
			
		||||
	echo "  -l/--locate makes $myname use locate rather than find"
 | 
			
		||||
	echo "  DIFFPROG variable allows to override the default vimdiff"
 | 
			
		||||
	echo "  DIFFSEARCHPATH allows to override the default /etc path"
 | 
			
		||||
	echo "Example : DIFFPROG=meld DIFFSEARCHPATH=\"/boot /etc /usr\" $myname"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2007 Aaron Griffin <aaronmgriffin@gmail.com>'
 | 
			
		||||
	echo 'Copyright (C) 2013 Pacman Development Team <pacman-dev@archlinux.org>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
cmd() {
 | 
			
		||||
	if [ $locate -eq 1 ]; then
 | 
			
		||||
		locate -0 -e -b \*.pacnew \*.pacorig \*.pacsave
 | 
			
		||||
	else
 | 
			
		||||
		find $diffsearchpath \( -name \*.pacnew -o -name \*.pacorig -o -name \*.pacsave \) -print0
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [ $# -gt 0 ]; then
 | 
			
		||||
	case $1 in
 | 
			
		||||
		-l|--locate)
 | 
			
		||||
		locate=1;;
 | 
			
		||||
		-V|--version)
 | 
			
		||||
		version; exit 0;;
 | 
			
		||||
		-h|--help)
 | 
			
		||||
		usage; exit 0;;
 | 
			
		||||
		*)
 | 
			
		||||
		usage; exit 1;;
 | 
			
		||||
	esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# see http://mywiki.wooledge.org/BashFAQ/020
 | 
			
		||||
while IFS= read -u 3 -r -d '' pacfile; do
 | 
			
		||||
	file="${pacfile%.pac*}"
 | 
			
		||||
	file_type="pac${pacfile##*.pac}"
 | 
			
		||||
 | 
			
		||||
	msg "%s file found for %s" "$file_type" "$file"
 | 
			
		||||
	if [ ! -f "$file" ]; then
 | 
			
		||||
		warning "$file does not exist"
 | 
			
		||||
		rm -iv "$pacfile"
 | 
			
		||||
		continue
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if cmp -s "$pacfile" "$file"; then
 | 
			
		||||
		msg2 "Files are identical, removing..."
 | 
			
		||||
		rm -v "$pacfile"
 | 
			
		||||
	else
 | 
			
		||||
		ask "(V)iew, (S)kip, (R)emove %s, (O)verwrite with %s: [v/s/r/o] " "$file_type" "$file_type"
 | 
			
		||||
		while read c; do
 | 
			
		||||
			case $c in
 | 
			
		||||
				r|R) rm -v "$pacfile"; break ;;
 | 
			
		||||
				o|O) mv -v "$pacfile" "$file"; break ;;
 | 
			
		||||
				v|V)
 | 
			
		||||
				$diffprog "$pacfile" "$file"
 | 
			
		||||
				rm -iv "$pacfile"; break ;;
 | 
			
		||||
				s|S) break ;;
 | 
			
		||||
				*) ask "Invalid answer. Try again: [v/s/r/o] "; continue ;;
 | 
			
		||||
			esac
 | 
			
		||||
		done
 | 
			
		||||
	fi
 | 
			
		||||
done 3< <(cmd)
 | 
			
		||||
 | 
			
		||||
exit 0
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,64 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
# paclist - List all packages installed from a given repo
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>
 | 
			
		||||
# Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the GNU General Public License
 | 
			
		||||
# as published by the Free Software Foundation; either version 2
 | 
			
		||||
# of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
declare -r myname='paclist'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
export TEXTDOMAIN='pacman'
 | 
			
		||||
export TEXTDOMAINDIR='/usr/share/locale'
 | 
			
		||||
 | 
			
		||||
# determine whether we have gettext; make it a no-op if we do not
 | 
			
		||||
if ! type gettext &>/dev/null; then
 | 
			
		||||
	gettext() {
 | 
			
		||||
		echo "$@"
 | 
			
		||||
	}
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	printf '%s - List all packages installed from a given repo\n' "$myname"
 | 
			
		||||
	printf 'Usage:   %s <repo>\n' "$myname"
 | 
			
		||||
	printf 'Example: %s testing\n' "$myname"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2008 Dan McGee <dpmcgee@gmail.com>'
 | 
			
		||||
	echo 'Copyright (C) 2011 Dave Reisner <dreisner@archlinux.org>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [[ -z $1 ]]; then
 | 
			
		||||
	usage
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
if [[ $1 = -@(h|-help) ]]; then
 | 
			
		||||
	usage
 | 
			
		||||
	exit 0
 | 
			
		||||
elif [[ $1 = -@(V|-version) ]]; then
 | 
			
		||||
	version
 | 
			
		||||
	exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
printf -v installed '[%s]' "$(gettext installed)"
 | 
			
		||||
pacman -Sl $1 | awk -v i="$installed" '$NF == i { print $2,$3 }'
 | 
			
		||||
 | 
			
		||||
# exit with pacman's return value, not awk's
 | 
			
		||||
exit ${PIPESTATUS[0]}
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,93 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
# paclog-pkglist - Parse a log file into a list of currently installed packages
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2011 Dave Reisner <dave@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the GNU General Public License
 | 
			
		||||
# as published by the Free Software Foundation; either version 2
 | 
			
		||||
# of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
declare -r myname='paclog-pkglist'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
export TEXTDOMAIN='pacman'
 | 
			
		||||
export TEXTDOMAINDIR='/usr/share/locale'
 | 
			
		||||
declare logfile=${1:-@localstatedir@/log/pacman.log}
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	printf 'usage:   %s [pacman log]\n' "$myname"
 | 
			
		||||
	printf 'example: %s @localstatedir@/log/pacman.log\n' "$myname"
 | 
			
		||||
	printf '\ndefaults to: @localstatedir@/log/pacman.log\n'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2011 Dave Reisner <dave@archlinux.org>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [[ $1 ]]; then
 | 
			
		||||
	if [[ $1 = -@(h|-help) ]]; then
 | 
			
		||||
		usage
 | 
			
		||||
		exit 0
 | 
			
		||||
	elif [[ $1 = -@(V|-version) ]]; then
 | 
			
		||||
		version
 | 
			
		||||
		exit 0
 | 
			
		||||
	elif [[ ! -e $logfile ]]; then
 | 
			
		||||
		printf $"target not found: %s\n" "$1"
 | 
			
		||||
		exit 1
 | 
			
		||||
	fi
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
<"$logfile" awk '
 | 
			
		||||
{
 | 
			
		||||
	if ($3 ~ /^\[.*\]$/) {
 | 
			
		||||
		# new style with caller name
 | 
			
		||||
		action  = $4
 | 
			
		||||
		pkgname = $5
 | 
			
		||||
		pkgver  = $6
 | 
			
		||||
		upgver  = $8
 | 
			
		||||
		nfields = NF
 | 
			
		||||
	} else {
 | 
			
		||||
		action  = $3
 | 
			
		||||
		pkgname = $4
 | 
			
		||||
		pkgver  = $5
 | 
			
		||||
		upgver  = $7
 | 
			
		||||
		nfields = (NF + 1)    # compensate for missing caller field
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nfields == 6 && action == "installed" {
 | 
			
		||||
	gsub(/[()]/, "", pkgver)
 | 
			
		||||
	pkg[pkgname] = pkgver
 | 
			
		||||
	next
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nfields == 8 && (action == "upgraded" || action == "downgraded") {
 | 
			
		||||
	sub(/\)/, "", upgver)
 | 
			
		||||
	pkg[pkgname] = upgver
 | 
			
		||||
	next
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
nfields == 6 && action == "removed" {
 | 
			
		||||
	pkg[pkgname] = -1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
END {
 | 
			
		||||
	for (i in pkg) {
 | 
			
		||||
		if (pkg[i] != -1) {
 | 
			
		||||
			printf "%s %s\n",i,pkg[i]
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}' | sort
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,139 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
#   pacscripts : tries to print out the {pre,post}_{install,remove,upgrade}
 | 
			
		||||
#   scripts of a given package
 | 
			
		||||
#
 | 
			
		||||
#   Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>
 | 
			
		||||
#   Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>
 | 
			
		||||
#   Copyright (c) 2009-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
#   This program is free software; you can redistribute it and/or modify
 | 
			
		||||
#   it under the terms of the GNU General Public License as published by
 | 
			
		||||
#   the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
#   (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#   This program is distributed in the hope that it will be useful,
 | 
			
		||||
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
#   GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
#   You should have received a copy of the GNU General Public License
 | 
			
		||||
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
#
 | 
			
		||||
 | 
			
		||||
# bash options
 | 
			
		||||
set -o nounset
 | 
			
		||||
set -o errexit
 | 
			
		||||
 | 
			
		||||
declare -r myname='pacscripts'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
conf="@sysconfdir@/pacman.conf"
 | 
			
		||||
 | 
			
		||||
if [ ! -r "$conf" ]; then
 | 
			
		||||
	echo "ERROR: unable to read $conf"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
eval $(awk '/DBPath/ {print $1$2$3}' "$conf")
 | 
			
		||||
eval $(awk '/CacheDir/ {print $1$2$3}' "$conf")
 | 
			
		||||
pac_db="${DBPath:-@localstatedir@/lib/pacman}/local"
 | 
			
		||||
pac_cache="${CacheDir:-@localstatedir@/cache/pacman/pkg}"
 | 
			
		||||
 | 
			
		||||
error() {
 | 
			
		||||
	local mesg=$1; shift
 | 
			
		||||
	printf "==> $(gettext "ERROR:") ${mesg}\n" "$@" >&2
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	echo "This program prints out the {pre,post}_{install,remove,upgrade} scripts"
 | 
			
		||||
	echo "of a given package."
 | 
			
		||||
	echo "Usage: $myname pkgname|pkgfile"
 | 
			
		||||
	echo
 | 
			
		||||
	echo " OPTIONS:"
 | 
			
		||||
	echo "  -h, --help                 Print this help message"
 | 
			
		||||
	echo "  -v, --version              Print program name and version"
 | 
			
		||||
	echo
 | 
			
		||||
	echo "Example: $myname gconf-editor"
 | 
			
		||||
	echo "Example: $myname gconf-editor-2.24.1-1-x86_64.pkg.tar.gz"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (c) 2009 Giulio "giulivo" Fidente <giulivo.navigante@gmail.com>'
 | 
			
		||||
	echo 'Copyright (c) 2009 Xavier Chantry <shiningxc@gmail.com>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
spacman() {
 | 
			
		||||
	if [ $EUID -eq 0 ]; then
 | 
			
		||||
		pacman "$@"
 | 
			
		||||
	else
 | 
			
		||||
		if ! type -p sudo; then
 | 
			
		||||
			error "Cannot find the sudo binary! Is sudo installed?"
 | 
			
		||||
			error "Otherwise try to run the program as root"
 | 
			
		||||
			exit 1
 | 
			
		||||
		else
 | 
			
		||||
			sudo pacman "$@"
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print_db() {
 | 
			
		||||
	pkg=$(pacman -Q "$1")
 | 
			
		||||
	pkg=${pkg/ /-}
 | 
			
		||||
	if [ -f $pac_db/$pkg*/install ]; then
 | 
			
		||||
		cat $pac_db/$pkg*/install
 | 
			
		||||
		echo
 | 
			
		||||
		return 0
 | 
			
		||||
	else
 | 
			
		||||
		error "Package $1 does not include any .INSTALL script"
 | 
			
		||||
		return 1
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print_pkg() {
 | 
			
		||||
	if ! bsdtar -xqOf "$1" .INSTALL 2>/dev/null; then
 | 
			
		||||
		error "Package $1 does not include any .INSTALL script"
 | 
			
		||||
		return 1
 | 
			
		||||
	fi
 | 
			
		||||
	echo
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
print_scriptlet() {
 | 
			
		||||
	if [ -f "$1" ]; then
 | 
			
		||||
		if bsdtar tf "$1" .PKGINFO &>/dev/null; then
 | 
			
		||||
			print_pkg "$1"
 | 
			
		||||
			return
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
	if pacman -Q "$1" &>/dev/null; then
 | 
			
		||||
		print_db "$1"
 | 
			
		||||
		return
 | 
			
		||||
	fi
 | 
			
		||||
	if ! pacman -Si $1 &>/dev/null; then
 | 
			
		||||
		error "Package $1 not found"
 | 
			
		||||
		return 1
 | 
			
		||||
	fi
 | 
			
		||||
	url=$(pacman -Sddp $1)
 | 
			
		||||
	filename=$(basename $url)
 | 
			
		||||
	if [ ! -f "$pac_cache/$filename" ]; then
 | 
			
		||||
		if ! spacman -Sddw --noconfirm $1 >&2; then
 | 
			
		||||
			error "Failed to download $1"
 | 
			
		||||
			return 1
 | 
			
		||||
		fi
 | 
			
		||||
		echo >&2
 | 
			
		||||
	fi
 | 
			
		||||
	print_pkg "$pac_cache/$filename"
 | 
			
		||||
	return
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if [ $# -ne 1 ] ; then
 | 
			
		||||
	usage
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
case "$1" in
 | 
			
		||||
	--help|-h) usage; exit 0 ;;
 | 
			
		||||
	--version|-V) version; exit 0 ;;
 | 
			
		||||
	*) print_scriptlet $1 ;;
 | 
			
		||||
esac
 | 
			
		||||
@@ -1,148 +0,0 @@
 | 
			
		||||
#!/usr/bin/perl
 | 
			
		||||
# pacsearch - Adds color and install information to a 'pacman -Ss' search
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2008-2011 Dan McGee <dan@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
# Based off original shell script version:
 | 
			
		||||
# Copyright (C) 2006-2007 Dan McGee <dan@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the GNU General Public License
 | 
			
		||||
# as published by the Free Software Foundation; either version 2
 | 
			
		||||
# of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
#TODO: colors flag on commandline
 | 
			
		||||
 | 
			
		||||
use strict;
 | 
			
		||||
use warnings;
 | 
			
		||||
 | 
			
		||||
my $myname = 'pacsearch';
 | 
			
		||||
my $myver = '@PACKAGE_VERSION@';
 | 
			
		||||
 | 
			
		||||
sub usage {
 | 
			
		||||
	print "$myname - Add color and install information to a pacman -Ss search\n";
 | 
			
		||||
	print "Usage:   $myname <pattern>\n";
 | 
			
		||||
	print "Example: $myname ^gnome\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
sub version {
 | 
			
		||||
	printf "%s %s\n", $myname, $myver;
 | 
			
		||||
	print "Copyright (C) 2008-2011 Dan McGee <dan\@archlinux.org>\n\n";
 | 
			
		||||
	print "Based off original shell script version:\n";
 | 
			
		||||
	print "Copyright (C) 2006-2007 Dan McGee <dan\@archlinux.org>\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($#ARGV lt 0 || $ARGV[0] eq "--help" || $ARGV[0] eq "-h") {
 | 
			
		||||
	usage;
 | 
			
		||||
	if ($#ARGV lt 0) {
 | 
			
		||||
		exit 1;
 | 
			
		||||
	}
 | 
			
		||||
	exit 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
if ($ARGV[0] eq "--version" || $ARGV[0] eq "-V") {
 | 
			
		||||
	version;
 | 
			
		||||
	exit 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# define our colors to use when printing
 | 
			
		||||
my $CLR1 = "\e[0;34m";
 | 
			
		||||
my $CLR2 = "\e[0;32m";
 | 
			
		||||
my $CLR3 = "\e[0;35m";
 | 
			
		||||
my $CLR4 = "\e[0;36m";
 | 
			
		||||
my $CLR5 = "\e[0;31m";
 | 
			
		||||
my $CLR6 = "\e[0;33m";
 | 
			
		||||
my $CLR7 = "\e[1;36m";
 | 
			
		||||
my $INST = "\e[1;31m";
 | 
			
		||||
my $BASE = "\e[0m";
 | 
			
		||||
 | 
			
		||||
# color a "repo/pkgname pkgver" line based on the repository name
 | 
			
		||||
sub to_color {
 | 
			
		||||
	my $line = shift;
 | 
			
		||||
	# get the installed text colored first
 | 
			
		||||
	$line =~ s/(\[.*\]$)/$INST$1$BASE/;
 | 
			
		||||
	# and now the repo and dealings
 | 
			
		||||
	$line =~ s/(^core\/.*)/$CLR1$1$BASE/;
 | 
			
		||||
	$line =~ s/(^extra\/.*)/$CLR2$1$BASE/;
 | 
			
		||||
	$line =~ s/(^community\/.*)/$CLR3$1$BASE/;
 | 
			
		||||
	$line =~ s/(^testing\/.*)/$CLR4$1$BASE/;
 | 
			
		||||
	$line =~ s/(^community-testing\/.*)/$CLR5$1$BASE/;
 | 
			
		||||
	$line =~ s/(^multilib\/.*)/$CLR6$1$BASE/;
 | 
			
		||||
	$line =~ s/(^local\/.*)/$CLR7$1$BASE/;
 | 
			
		||||
	# any other unknown repository
 | 
			
		||||
	$line =~ s/(^[\w-]*\/.*)/$CLR6$1$BASE/;
 | 
			
		||||
	return $line;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my %allpkgs = ();
 | 
			
		||||
 | 
			
		||||
my $syncout = `pacman -Ss '@ARGV'`;
 | 
			
		||||
# split each sync search entry into its own array entry
 | 
			
		||||
my @syncpkgs = split(/\n^(?=\w)/m, $syncout);
 | 
			
		||||
# remove the extra \n from the last desc entry
 | 
			
		||||
if ($#syncpkgs >= 0) {
 | 
			
		||||
	chomp($syncpkgs[$#syncpkgs]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# counter var for packages, used here and in the query loop too
 | 
			
		||||
my $cnt = 0;
 | 
			
		||||
foreach $_ (@syncpkgs) {
 | 
			
		||||
	# we grab 4 fields here: repo, name/ver, installed, and desc
 | 
			
		||||
	my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
 | 
			
		||||
	if(not @pkgfields) {
 | 
			
		||||
		# skip any non-matching line and just print it for the user
 | 
			
		||||
		print $_, "\n";
 | 
			
		||||
		next;
 | 
			
		||||
	}
 | 
			
		||||
	# since installed is optional, we should fill it in if necessary
 | 
			
		||||
	$pkgfields[2] = "" if not defined $pkgfields[2];
 | 
			
		||||
	# add a fifth field that indicates original order
 | 
			
		||||
	push (@pkgfields, $cnt++);
 | 
			
		||||
	# add each sync pkg by name/ver to a hash table for quick lookup
 | 
			
		||||
	$allpkgs{$pkgfields[1]} = [ @pkgfields ];
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
my $queryout = `pacman -Qs '@ARGV'`;
 | 
			
		||||
# split each querysearch entry into its own array entry
 | 
			
		||||
my @querypkgs = split(/\n^(?=\w)/m, $queryout);
 | 
			
		||||
# remove the extra \n from the last desc entry
 | 
			
		||||
if ($#querypkgs >= 0) {
 | 
			
		||||
	chomp ($querypkgs[$#querypkgs]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
foreach $_ (@querypkgs) {
 | 
			
		||||
	# we grab 4 fields here: repo, name/ver, installed, and desc
 | 
			
		||||
	my @pkgfields = /^(.*?)\/(.*?) ?(\[.*\])?\n(.*)$/s;
 | 
			
		||||
	# skip any non-matching line
 | 
			
		||||
	next if not defined $pkgfields[1];
 | 
			
		||||
	# since installed is optional, we should fill it in if necessary
 | 
			
		||||
	$pkgfields[2] = "" if not defined $pkgfields[2];
 | 
			
		||||
	# check if the package was listed in the sync out
 | 
			
		||||
	if (not exists $allpkgs{$pkgfields[1]}) {
 | 
			
		||||
		$pkgfields[2] = "[installed]";
 | 
			
		||||
		# add a fifth field that indicates original order (after sync)
 | 
			
		||||
		push (@pkgfields, $cnt++);
 | 
			
		||||
		# add our local-only package to the hash
 | 
			
		||||
		$allpkgs{$pkgfields[1]} = [ @pkgfields ];
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# sort by original order (the fifth field) and print
 | 
			
		||||
foreach $_ ( sort{ @{$allpkgs{$a}}[4] <=> @{$allpkgs{$b}}[4] } keys %allpkgs) {
 | 
			
		||||
	my @v = @{$allpkgs{$_}};
 | 
			
		||||
	my $line = "$v[0]/$v[1] $v[2]";
 | 
			
		||||
	$line = to_color($line);
 | 
			
		||||
	# print colorized "repo/pkgname pkgver" string with possible installed text
 | 
			
		||||
	print "$line\n";
 | 
			
		||||
	print "$v[3]\n";
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#vim: set noet:
 | 
			
		||||
@@ -1,64 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
 | 
			
		||||
# pacsysclean - Sort installed packages by increasing installed size. Useful for system clean-up.
 | 
			
		||||
 | 
			
		||||
declare -r myname='pacsysclean'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
PACMAN_OPTS=
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	echo "$myname - Sort installed packages by increasing installed size."
 | 
			
		||||
	echo
 | 
			
		||||
	echo "Usage: $myname [options]"
 | 
			
		||||
	echo
 | 
			
		||||
	echo "Options:"
 | 
			
		||||
	echo "  -o <options>     Specify custom pacman query options (e.g., dt)"
 | 
			
		||||
	echo "  -h, --help       Show this help message and exit"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2011 Eric Bélanger <snowmaniscool@gmail.com>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
if [ -n "$1" ]; then
 | 
			
		||||
	case "$1" in
 | 
			
		||||
		-o) PACMAN_OPTS="${2}" ;;
 | 
			
		||||
		-h|--help) usage; exit 0 ;;
 | 
			
		||||
		-V|--version) version; exit 0 ;;
 | 
			
		||||
		*) usage; exit 1 ;;
 | 
			
		||||
	esac
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
IFS=$'\n'
 | 
			
		||||
name="^Name.*: (.*)$"
 | 
			
		||||
size="^Installed Size.*: (.*) KiB$"
 | 
			
		||||
 | 
			
		||||
[[ $PACMAN_OPTS && $PACMAN_OPTS != -* ]] && PACMAN_OPTS="-$PACMAN_OPTS"
 | 
			
		||||
 | 
			
		||||
for line in $(LANG=C pacman -Qi $PACMAN_OPTS); do
 | 
			
		||||
	if [[ $line =~ $name ]]; then
 | 
			
		||||
		printf "%s\t" ${BASH_REMATCH[1]}
 | 
			
		||||
	elif [[ $line =~ $size ]]; then
 | 
			
		||||
		printf "%s\n" ${BASH_REMATCH[1]}
 | 
			
		||||
	fi
 | 
			
		||||
done | sort -g -k2 | awk '
 | 
			
		||||
BEGIN {
 | 
			
		||||
	split("KiB MiB GiB TiB PiB EiB ZiB YiB", suffix)
 | 
			
		||||
}
 | 
			
		||||
function format_size(size) {
 | 
			
		||||
	count = 1
 | 
			
		||||
	while (size + 0 > 1024) {
 | 
			
		||||
				 size /= 1024
 | 
			
		||||
				 count++
 | 
			
		||||
	}
 | 
			
		||||
	sizestr = sprintf("%.2f %s", size, suffix[count])
 | 
			
		||||
	return sizestr
 | 
			
		||||
}
 | 
			
		||||
{
 | 
			
		||||
	printf("%s\t%s\n", format_size($2), $1);
 | 
			
		||||
}'
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,212 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
#   rankmirrors - read a list of mirrors from a file and rank them by speed
 | 
			
		||||
#   @configure_input@
 | 
			
		||||
#
 | 
			
		||||
#   Copyright (c) 2009 Matthew Bruenig <matthewbruenig@gmail.com>
 | 
			
		||||
#
 | 
			
		||||
#   This program is free software; you can redistribute it and/or modify
 | 
			
		||||
#   it under the terms of the GNU General Public License as published by
 | 
			
		||||
#   the Free Software Foundation; either version 3 of the License, or
 | 
			
		||||
#   (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
#   This program is distributed in the hope that it will be useful,
 | 
			
		||||
#   but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
#   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
#   GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
#   You should have received a copy of the GNU General Public License
 | 
			
		||||
#   along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
# traps interrupt key to spit out pre-interrupt info
 | 
			
		||||
trap finaloutput INT
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	echo "Usage: rankmirrors [options] MIRRORFILE | URL"
 | 
			
		||||
	echo
 | 
			
		||||
	echo "Ranks pacman mirrors by their connection and opening speed. Pacman mirror"
 | 
			
		||||
	echo "files are located in @sysconfdir@/pacman.d/. It can also rank one mirror if the URL is"
 | 
			
		||||
	echo "provided."
 | 
			
		||||
	echo
 | 
			
		||||
	echo "Options:"
 | 
			
		||||
	echo "  --version      show program's version number and exit"
 | 
			
		||||
	echo "  -h, --help     show this help message and exit"
 | 
			
		||||
	echo "  -n NUM         number of servers to output, 0 for all"
 | 
			
		||||
	echo "  -t, --times    only output mirrors and their response times"
 | 
			
		||||
	echo "  -u, --url      test a specific url"
 | 
			
		||||
	echo "  -v, --verbose  be verbose in ouptut"
 | 
			
		||||
	echo "  -r, --repo     specify a specific repo name instead of guessing"
 | 
			
		||||
	exit 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	echo "rankmirrors (pacman) @PACKAGE_VERSION@"
 | 
			
		||||
	echo "Copyright (c) 2009 Matthew Bruenig <matthewbruenig@gmail.com>."
 | 
			
		||||
	echo
 | 
			
		||||
	echo "This is free software; see the source for copying conditions."
 | 
			
		||||
	echo "There is NO WARRANTY, to the extent permitted by law."
 | 
			
		||||
	exit 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
err() {
 | 
			
		||||
	echo "$1" >&2
 | 
			
		||||
	exit 1
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# gettime fetchurl (e.g gettime http://foo.com/core/os/i686/core.db.tar.gz)
 | 
			
		||||
# returns the fetching time, or timeout, or unreachable
 | 
			
		||||
gettime() {
 | 
			
		||||
	IFS=' ' output=( $(curl -s -m 10 -w "%{time_total} %{http_code}" "$1" -o/dev/null) )
 | 
			
		||||
	(( $? == 28 )) && echo timeout && return
 | 
			
		||||
	(( ${output[1]} >= 400 || ! ${output[1]} )) && echo unreachable && return
 | 
			
		||||
	echo "${output[0]}"
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# getfetchurl serverurl (e.g. getturl http://foo.com/core/os/i686)
 | 
			
		||||
# if $repo is in the line, then assumes core
 | 
			
		||||
# if $arch is in the line, then assumes $(uname -m)
 | 
			
		||||
# returns a fetchurl (e.g. http://foo.com/core/os/i686/core.db.tar.gz)
 | 
			
		||||
ARCH="$(uname -m)"
 | 
			
		||||
getfetchurl() {
 | 
			
		||||
	local strippedurl="${1%/}"
 | 
			
		||||
 | 
			
		||||
	local replacedurl="${strippedurl//'$arch'/$ARCH}"
 | 
			
		||||
	if [[ ! $TARGETREPO ]]; then
 | 
			
		||||
		replacedurl="${replacedurl//'$repo'/core}"
 | 
			
		||||
		local tmp="${replacedurl%/*}"
 | 
			
		||||
		tmp="${tmp%/*}"
 | 
			
		||||
 | 
			
		||||
		local reponame="${tmp##*/}"
 | 
			
		||||
	else
 | 
			
		||||
		replacedurl="${replacedurl//'$repo'/$TARGETREPO}"
 | 
			
		||||
		local reponame="$TARGETREPO"
 | 
			
		||||
	fi
 | 
			
		||||
 | 
			
		||||
	if [[ -z $reponame || $reponame = $replacedurl ]]; then
 | 
			
		||||
		echo "fail"
 | 
			
		||||
	else
 | 
			
		||||
		local fetchurl="${replacedurl}/$reponame.db"
 | 
			
		||||
		echo "$fetchurl"
 | 
			
		||||
	fi
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
# This exists to remove the need for a separate interrupt function
 | 
			
		||||
finaloutput() {
 | 
			
		||||
	IFS=$'\n' read -r -d '' -a sortedarray < \
 | 
			
		||||
		<(printf '%s\n' "${timesarray[@]}" | LC_COLLATE=C sort)
 | 
			
		||||
 | 
			
		||||
	# Final output for mirrorfile
 | 
			
		||||
	numiterator="0"
 | 
			
		||||
	if [[ $TIMESONLY ]]; then
 | 
			
		||||
		echo
 | 
			
		||||
		echo " Servers sorted by time (seconds):"
 | 
			
		||||
		for line in "${sortedarray[@]}"; do
 | 
			
		||||
			echo "${line#* } : ${line% *}"
 | 
			
		||||
			((numiterator++))
 | 
			
		||||
			(( NUM && numiterator >= NUM )) && break
 | 
			
		||||
		done
 | 
			
		||||
	else
 | 
			
		||||
		for line in "${sortedarray[@]}"; do
 | 
			
		||||
			echo "Server = ${line#* }"
 | 
			
		||||
			((numiterator++))
 | 
			
		||||
			(( NUM && numiterator >= NUM )) && break
 | 
			
		||||
		done
 | 
			
		||||
	fi
 | 
			
		||||
	exit 0
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
# Argument parsing
 | 
			
		||||
[[ $1 ]] || usage
 | 
			
		||||
while [[ $1 ]]; do
 | 
			
		||||
	if [[ ${1:0:2} = -- ]]; then
 | 
			
		||||
		case "${1:2}" in
 | 
			
		||||
			help) usage ;;
 | 
			
		||||
			version) version ;;
 | 
			
		||||
			times) TIMESONLY=1 ; shift ;;
 | 
			
		||||
			verbose) VERBOSE=1 ; shift ;;
 | 
			
		||||
			url) CHECKURL=1; [[ $2 ]] || err "Must specify url."; URL="$2"; shift 2;;
 | 
			
		||||
			repo) [[ $2 ]] || err "Must specify repo name."; TARGETREPO="$2"; shift 2;;
 | 
			
		||||
			*) err "\`$1' is an invalid argument."
 | 
			
		||||
		esac
 | 
			
		||||
	elif [[ ${1:0:1} = - ]]; then
 | 
			
		||||
 | 
			
		||||
		if [[ ! ${1:1:1} ]]; then
 | 
			
		||||
			[[ -t 0 ]] && err "Stdin is empty."
 | 
			
		||||
			IFS=$'\n' linearray=( $(</dev/stdin) )
 | 
			
		||||
			STDIN=1
 | 
			
		||||
			shift
 | 
			
		||||
		else
 | 
			
		||||
			snum=1
 | 
			
		||||
			for ((i=1 ; i<${#1}; i++)); do
 | 
			
		||||
				case ${1:$i:1} in
 | 
			
		||||
					h) usage ;;
 | 
			
		||||
					t) TIMESONLY=1 ;;
 | 
			
		||||
					v) VERBOSE=1 ;;
 | 
			
		||||
					u) CHECKURL=1; [[ $2 ]] || err "Must specify url."; URL="$2"; snum=2;;
 | 
			
		||||
					r) [[ $2 ]] || err "Must specify repo name."; TARGETREPO="$2"; snum=2;;
 | 
			
		||||
					n) [[ $2 ]] || err "Must specify number." ; NUM="$2" ; snum=2;;
 | 
			
		||||
					*) err "\`-$1' is an invald argument." ;;
 | 
			
		||||
				esac
 | 
			
		||||
			done
 | 
			
		||||
			shift $snum
 | 
			
		||||
		fi
 | 
			
		||||
	elif [[ -f $1 ]]; then
 | 
			
		||||
		FILE="1"
 | 
			
		||||
		IFS=$'\n' linearray=( $(<$1) )
 | 
			
		||||
		[[ $linearray ]] || err "File is empty."
 | 
			
		||||
		shift
 | 
			
		||||
	else
 | 
			
		||||
		err "\`$1' does not exist."
 | 
			
		||||
	fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# Some sanity checks
 | 
			
		||||
[[ $NUM ]] || NUM=0
 | 
			
		||||
[[ $FILE && $CHECKURL ]] && err "Cannot specify a url and mirrorfile."
 | 
			
		||||
[[ $FILE || $CHECKURL || $STDIN ]] || err "Must specify url, mirrorfile, or stdin."
 | 
			
		||||
 | 
			
		||||
# Single url handling
 | 
			
		||||
if [[ $CHECKURL ]]; then
 | 
			
		||||
	url="$(getfetchurl "$URL")"
 | 
			
		||||
	[[ $url = fail ]] && err "url \`$URL' is malformed."
 | 
			
		||||
	[[ $VERBOSE ]] && echo "Testing $url..."
 | 
			
		||||
	time=$(gettime "$url")
 | 
			
		||||
	echo "$URL : $time"
 | 
			
		||||
	exit 0
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Get url results from mirrorfile, fill up the array, and so on
 | 
			
		||||
if [[ $TIMESONLY ]]; then
 | 
			
		||||
	echo "Querying servers, this may take some time..."
 | 
			
		||||
elif [[ $FILE ]]; then
 | 
			
		||||
	echo "# Server list generated by rankmirrors on $(date +%Y-%m-%d)"
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
timesarray=()
 | 
			
		||||
for line in  "${linearray[@]}"; do
 | 
			
		||||
	if [[ $line =~ ^[[:space:]]*# ]]; then
 | 
			
		||||
		[[ $TIMESONLY ]] || echo $line
 | 
			
		||||
	elif [[ $line =~ ^[[:space:]]*Server ]]; then
 | 
			
		||||
 | 
			
		||||
		# Getting values and times and such
 | 
			
		||||
		server="${line#*= }"
 | 
			
		||||
		server="${server%%#*}"
 | 
			
		||||
		url="$(getfetchurl "$server")"
 | 
			
		||||
		[[ $url = fail ]] && err "url \`$URL' is malformed."
 | 
			
		||||
		time=$(gettime "$url")
 | 
			
		||||
		timesarray+=("$time $server")
 | 
			
		||||
 | 
			
		||||
		# Output
 | 
			
		||||
		if [[ $VERBOSE && $TIMESONLY ]]; then
 | 
			
		||||
			echo "$server ... $time"
 | 
			
		||||
		elif [[ $VERBOSE ]]; then
 | 
			
		||||
			echo "# $server ... $time"
 | 
			
		||||
		elif [[ $TIMESONLY ]]; then
 | 
			
		||||
			echo -n "   *"
 | 
			
		||||
		fi
 | 
			
		||||
	fi
 | 
			
		||||
done
 | 
			
		||||
finaloutput
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,93 +0,0 @@
 | 
			
		||||
#!/bin/bash
 | 
			
		||||
#
 | 
			
		||||
# updpkgsums - update source checksums in-place in PKGBUILDs
 | 
			
		||||
#
 | 
			
		||||
# Copyright (C) 2012-2013 Dave Reisner <dreisner@archlinux.org>
 | 
			
		||||
#
 | 
			
		||||
# This program is free software; you can redistribute it and/or
 | 
			
		||||
# modify it under the terms of the GNU General Public License
 | 
			
		||||
# as published by the Free Software Foundation; either version 2
 | 
			
		||||
# of the License, or (at your option) any later version.
 | 
			
		||||
#
 | 
			
		||||
# This program is distributed in the hope that it will be useful,
 | 
			
		||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
# GNU General Public License for more details.
 | 
			
		||||
#
 | 
			
		||||
# You should have received a copy of the GNU General Public License
 | 
			
		||||
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 | 
			
		||||
shopt -s extglob
 | 
			
		||||
 | 
			
		||||
declare -r myname='updpkgsums'
 | 
			
		||||
declare -r myver='@PACKAGE_VERSION@'
 | 
			
		||||
 | 
			
		||||
usage() {
 | 
			
		||||
	printf 'usage: %s [buildfile]\n\n' "$myname"
 | 
			
		||||
	printf '    -h, --help        display this help message and exit\n'
 | 
			
		||||
	printf '    -V, --version     display version information and exit\n\n'
 | 
			
		||||
	printf '%s will perform an in place update the checksums in the\n' "$myname"
 | 
			
		||||
	printf 'path specified by [buildfile], defaulting to PKGBUILD in the current\n'
 | 
			
		||||
	printf 'working directory.\n'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
version() {
 | 
			
		||||
	printf "%s %s\n" "$myname" "$myver"
 | 
			
		||||
	echo 'Copyright (C) 2012-2013 Dave Reisner <dreisner@archlinux.org>'
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
case $1 in
 | 
			
		||||
	-h|--help) usage; exit ;;
 | 
			
		||||
	-V|--version) version; exit ;;
 | 
			
		||||
esac
 | 
			
		||||
 | 
			
		||||
buildfile=${1:-PKGBUILD}
 | 
			
		||||
if [[ ! -f $buildfile ]]; then
 | 
			
		||||
	printf '==> ERROR: %s not found or is not a file\n' "$buildfile"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Resolve any symlinks to avoid replacing the symlink with a file. But, we
 | 
			
		||||
# have to do this portably -- readlink's flags are inconsistent across OSes.
 | 
			
		||||
while [[ -L $buildfile ]]; do
 | 
			
		||||
	buildfile=$(readlink "$buildfile")
 | 
			
		||||
	if [[ $buildfile = */* ]]; then
 | 
			
		||||
		cd "${buildfile%/*}"
 | 
			
		||||
		buildfile=${buildfile##*/}
 | 
			
		||||
	fi
 | 
			
		||||
done
 | 
			
		||||
 | 
			
		||||
# cd into the directory with the build file. This avoids creating random src/
 | 
			
		||||
# directories scattered about the filesystem, and avoids cases where we might
 | 
			
		||||
# not be able to write in the $PWD.
 | 
			
		||||
if [[ $buildfile = */* ]]; then
 | 
			
		||||
	cd "${buildfile%/*}"
 | 
			
		||||
	buildfile=${buildfile##*/}
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
# Check $PWD/ for permission to unlink the $buildfile and write a new one
 | 
			
		||||
if [[ ! -w . ]]; then
 | 
			
		||||
	printf $'==> ERROR: No write permission in `%s\'\n' "$PWD"
 | 
			
		||||
	exit 1
 | 
			
		||||
fi
 | 
			
		||||
 | 
			
		||||
{
 | 
			
		||||
	# Generate the new sums and try to unlink the file before writing stdin back
 | 
			
		||||
	# into it. This final precaution shouldn't fail based on the previous checks,
 | 
			
		||||
	# but it's better to be extra careful before unlinking files.
 | 
			
		||||
	newsums=$(makepkg -g -p "$buildfile") && rm -f "$buildfile" &&
 | 
			
		||||
	exec awk -v newsums="$newsums" '
 | 
			
		||||
	/^[[:blank:]]*(md|sha)[[:digit:]]+sums=/,/\)[[:blank:]]*(#.*)?$/ {
 | 
			
		||||
		if (!w) {
 | 
			
		||||
			print newsums
 | 
			
		||||
			w++
 | 
			
		||||
		}
 | 
			
		||||
		next
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	1
 | 
			
		||||
	END { if (!w) print newsums }
 | 
			
		||||
	' > "$buildfile"
 | 
			
		||||
} < "$buildfile"
 | 
			
		||||
 | 
			
		||||
# vim: set ts=2 sw=2 noet:
 | 
			
		||||
@@ -1,25 +0,0 @@
 | 
			
		||||
This is a project file
 | 
			
		||||
for the vim-project plugin.
 | 
			
		||||
Save it as ~/.vimprojects
 | 
			
		||||
 | 
			
		||||
$ pacman -S vim-project
 | 
			
		||||
change the pacman path below
 | 
			
		||||
$ vim
 | 
			
		||||
:Project
 | 
			
		||||
 | 
			
		||||
Press \r in the project view
 | 
			
		||||
on a project name to generate
 | 
			
		||||
the list of files
 | 
			
		||||
 | 
			
		||||
pacman=~/devel/pacman/ CD=. filter="*.ac *.am" flags=S {
 | 
			
		||||
  libalpm=lib/libalpm/ filter="*.c *.h *.am" {
 | 
			
		||||
  }
 | 
			
		||||
  pacman=src/pacman/ filter="*.c *.h *.am" {
 | 
			
		||||
  }
 | 
			
		||||
  scripts=scripts/ filter="*.sh.in *.py.in *.am" {
 | 
			
		||||
  }
 | 
			
		||||
  utils=src/util filter="*.c *.h *.am" {
 | 
			
		||||
  }
 | 
			
		||||
  contrib=contrib CD=. {
 | 
			
		||||
  }
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										13
									
								
								doc/.gitignore
									
									
									
									
										vendored
									
									
								
							
							
						
						
									
										13
									
								
								doc/.gitignore
									
									
									
									
										vendored
									
									
								
							@@ -1,15 +1,4 @@
 | 
			
		||||
PKGBUILD.5
 | 
			
		||||
libalpm.3
 | 
			
		||||
makepkg.8
 | 
			
		||||
makepkg.conf.5
 | 
			
		||||
pacman.8
 | 
			
		||||
pacman-key.8
 | 
			
		||||
pacman.conf.5
 | 
			
		||||
pactree.8
 | 
			
		||||
pkgdelta.8
 | 
			
		||||
repo-add.8
 | 
			
		||||
repo-remove.8
 | 
			
		||||
vercmp.8
 | 
			
		||||
*.[1-8]
 | 
			
		||||
asciidoc-manpage.css
 | 
			
		||||
asciidoc.css
 | 
			
		||||
asciidoc.js
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										70
									
								
								doc/BUILDINFO.5.asciidoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										70
									
								
								doc/BUILDINFO.5.asciidoc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,70 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
BUILDINFO(5)
 | 
			
		||||
============
 | 
			
		||||
 | 
			
		||||
Name
 | 
			
		||||
----
 | 
			
		||||
BUILDINFO - Makepkg package build information file
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
This manual page describes the format of a BUILDINFO file found in the root of
 | 
			
		||||
a package created by makepkg. The file contains a description of the package's
 | 
			
		||||
build environment. The information is formatted in key-value pairs separated by
 | 
			
		||||
a '=', one value per line. Arrays are represented multiple keys with the same
 | 
			
		||||
value.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
This is a description of the contents of version '1' of the
 | 
			
		||||
BUILDINFO file format.
 | 
			
		||||
 | 
			
		||||
*format*::
 | 
			
		||||
	Denotes the file format version, represented by a plain positive integer.
 | 
			
		||||
 | 
			
		||||
*pkgname*::
 | 
			
		||||
	The name of the package.
 | 
			
		||||
 | 
			
		||||
*pkgbase*::
 | 
			
		||||
 | 
			
		||||
	The base name of a package, usually the same as the pkgname except for
 | 
			
		||||
	split packages.
 | 
			
		||||
 | 
			
		||||
*pkgver*::
 | 
			
		||||
	The version of the package including pkgrel and epoch.
 | 
			
		||||
 | 
			
		||||
*pkgarch*::
 | 
			
		||||
	The architecture of the package.
 | 
			
		||||
 | 
			
		||||
*pkgbuild_sha256sum*::
 | 
			
		||||
	The sha256sum in hex format of the PKGBUILD used to build the package.
 | 
			
		||||
 | 
			
		||||
*packager*::
 | 
			
		||||
	The details of the packager that built the package.
 | 
			
		||||
 | 
			
		||||
*builddate*::
 | 
			
		||||
	The build date of the package in epoch.
 | 
			
		||||
 | 
			
		||||
*builddir*::
 | 
			
		||||
	The directory where the package was built.
 | 
			
		||||
 | 
			
		||||
*buildenv (array)*::
 | 
			
		||||
	The build environment specified in makepkg.conf.
 | 
			
		||||
 | 
			
		||||
*options (array)*::
 | 
			
		||||
	The options set specified when building the package.
 | 
			
		||||
 | 
			
		||||
*installed (array)*::
 | 
			
		||||
	The installed packages at build time including the version information of
 | 
			
		||||
	the package. Formatted as "$pkgname-$pkgver-$pkgrel-$pkgarch".
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
 | 
			
		||||
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -4,28 +4,31 @@
 | 
			
		||||
# man_MANS if --enable-asciidoc and/or --enable-doxygen are used.
 | 
			
		||||
 | 
			
		||||
ASCIIDOC_MANS = \
 | 
			
		||||
	alpm-hooks.5 \
 | 
			
		||||
	pacman.8 \
 | 
			
		||||
	makepkg.8 \
 | 
			
		||||
	makepkg-template.1 \
 | 
			
		||||
	repo-add.8 \
 | 
			
		||||
	vercmp.8 \
 | 
			
		||||
	pkgdelta.8 \
 | 
			
		||||
	pacman-key.8 \
 | 
			
		||||
	pactree.8 \
 | 
			
		||||
	PKGBUILD.5 \
 | 
			
		||||
	makepkg.conf.5 \
 | 
			
		||||
	pacman.conf.5 \
 | 
			
		||||
	libalpm.3
 | 
			
		||||
	libalpm.3 \
 | 
			
		||||
	BUILDINFO.5
 | 
			
		||||
 | 
			
		||||
DOXYGEN_MANS = $(wildcard man3/*.3)
 | 
			
		||||
 | 
			
		||||
HTML_MANPAGES = \
 | 
			
		||||
	alpm-hooks.5.html \
 | 
			
		||||
	pacman.8.html \
 | 
			
		||||
	makepkg.8.html \
 | 
			
		||||
	makepkg-template.1.html \
 | 
			
		||||
	repo-add.8.html \
 | 
			
		||||
	vercmp.8.html \
 | 
			
		||||
	pkgdelta.8.html \
 | 
			
		||||
	pacman-key.8.html \
 | 
			
		||||
	pactree.8.html \
 | 
			
		||||
	PKGBUILD.5.html \
 | 
			
		||||
	makepkg.conf.5.html \
 | 
			
		||||
	pacman.conf.5.html \
 | 
			
		||||
@@ -44,22 +47,24 @@ HTML_DOCS = \
 | 
			
		||||
EXTRA_DIST = \
 | 
			
		||||
	asciidoc.conf \
 | 
			
		||||
	asciidoc-override.css \
 | 
			
		||||
	pacman.8.txt \
 | 
			
		||||
	makepkg.8.txt \
 | 
			
		||||
	repo-add.8.txt \
 | 
			
		||||
	vercmp.8.txt \
 | 
			
		||||
	pkgdelta.8.txt \
 | 
			
		||||
	pacman-key.8.txt \
 | 
			
		||||
	pactree.8.txt \
 | 
			
		||||
	PKGBUILD.5.txt \
 | 
			
		||||
	alpm-hooks.5.asciidoc \
 | 
			
		||||
	pacman.8.asciidoc \
 | 
			
		||||
	makepkg.8.asciidoc \
 | 
			
		||||
	makepkg-template.1.asciidoc \
 | 
			
		||||
	repo-add.8.asciidoc \
 | 
			
		||||
	vercmp.8.asciidoc \
 | 
			
		||||
	pkgdelta.8.asciidoc \
 | 
			
		||||
	pacman-key.8.asciidoc \
 | 
			
		||||
	PKGBUILD.5.asciidoc \
 | 
			
		||||
	PKGBUILD-example.txt \
 | 
			
		||||
	makepkg.conf.5.txt \
 | 
			
		||||
	pacman.conf.5.txt \
 | 
			
		||||
	libalpm.3.txt \
 | 
			
		||||
	footer.txt \
 | 
			
		||||
	index.txt \
 | 
			
		||||
	submitting-patches.txt \
 | 
			
		||||
	translation-help.txt \
 | 
			
		||||
	makepkg.conf.5.asciidoc \
 | 
			
		||||
	pacman.conf.5.asciidoc \
 | 
			
		||||
	BUILDINFO.5.asciidoc \
 | 
			
		||||
	libalpm.3.asciidoc \
 | 
			
		||||
	footer.asciidoc \
 | 
			
		||||
	index.asciidoc \
 | 
			
		||||
	submitting-patches.asciidoc \
 | 
			
		||||
	translation-help.asciidoc \
 | 
			
		||||
	Doxyfile \
 | 
			
		||||
	$(ASCIIDOC_MANS) \
 | 
			
		||||
	$(DOXYGEN_MANS)
 | 
			
		||||
@@ -115,21 +120,21 @@ ASCIIDOC_OPTS = \
 | 
			
		||||
	-a pacman_date="`date +%Y-%m-%d`" \
 | 
			
		||||
	-a pkgdatadir=$(pkgdatadir) \
 | 
			
		||||
	-a localstatedir=$(localstatedir) \
 | 
			
		||||
	-a sysconfdir=$(sysconfdir)
 | 
			
		||||
	-a sysconfdir=$(sysconfdir) \
 | 
			
		||||
	-a datarootdir=$(datarootdir)
 | 
			
		||||
 | 
			
		||||
A2X_OPTS = \
 | 
			
		||||
	--no-xmllint \
 | 
			
		||||
	-d manpage \
 | 
			
		||||
	-f manpage \
 | 
			
		||||
	--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0' \
 | 
			
		||||
	--destination-dir='./'
 | 
			
		||||
	--xsltproc-opts='-param man.endnotes.list.enabled 0 -param man.endnotes.are.numbered 0'
 | 
			
		||||
 | 
			
		||||
# These rules are due to the includes and files of the asciidoc text
 | 
			
		||||
$(ASCIIDOC_MANS): asciidoc.conf footer.txt Makefile.am
 | 
			
		||||
	$(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.txt
 | 
			
		||||
$(ASCIIDOC_MANS): asciidoc.conf footer.asciidoc Makefile.am
 | 
			
		||||
	$(AM_V_GEN)a2x $(A2X_OPTS) --asciidoc-opts="$(ASCIIDOC_OPTS) --out-file=./$@.xml" $(srcdir)/$@.asciidoc
 | 
			
		||||
 | 
			
		||||
%.html: %.txt
 | 
			
		||||
	$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.txt | \
 | 
			
		||||
%.html: %.asciidoc
 | 
			
		||||
	$(AM_V_GEN)asciidoc $(ASCIIDOC_OPTS) -o - $*.asciidoc | \
 | 
			
		||||
		sed -e 's/\r$$//' > $@
 | 
			
		||||
 | 
			
		||||
HACKING.html: ../HACKING
 | 
			
		||||
@@ -137,7 +142,7 @@ HACKING.html: ../HACKING
 | 
			
		||||
		sed -e 's/\r$$//' > $@
 | 
			
		||||
 | 
			
		||||
# Customizations for certain HTML docs
 | 
			
		||||
$(HTML_MANPAGES): asciidoc.conf footer.txt Makefile.am
 | 
			
		||||
$(HTML_MANPAGES): asciidoc.conf footer.asciidoc Makefile.am
 | 
			
		||||
$(HTML_OTHER): asciidoc.conf Makefile.am
 | 
			
		||||
%.html: ASCIIDOC_OPTS += -a linkcss -a toc -a icons -a max-width=960px -a stylesheet=asciidoc-override.css
 | 
			
		||||
%.8.html: ASCIIDOC_OPTS += -d manpage
 | 
			
		||||
@@ -145,17 +150,18 @@ $(HTML_OTHER): asciidoc.conf Makefile.am
 | 
			
		||||
%.3.html: ASCIIDOC_OPTS += -d manpage
 | 
			
		||||
 | 
			
		||||
# Dependency rules
 | 
			
		||||
pacman.8 pacman.8.html: pacman.8.txt
 | 
			
		||||
makepkg.8 makepkg.8.html: makepkg.8.txt
 | 
			
		||||
repo-add.8 repo-add.8.html: repo-add.8.txt
 | 
			
		||||
vercmp.8 vercmp.8.html: vercmp.8.txt
 | 
			
		||||
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.txt
 | 
			
		||||
pacman-key.8 pacman-key.8.html: pacman-key.8.txt
 | 
			
		||||
pactree.8 pactree.8.html: pactree.8.txt
 | 
			
		||||
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.txt PKGBUILD-example.txt
 | 
			
		||||
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.txt
 | 
			
		||||
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.txt
 | 
			
		||||
libalpm.3 libalpm.3.html: libalpm.3.txt
 | 
			
		||||
alpm-hooks.5 alpm-hooks.5.html: alpm-hooks.5.asciidoc
 | 
			
		||||
pacman.8 pacman.8.html: pacman.8.asciidoc
 | 
			
		||||
makepkg.8 makepkg.8.html: makepkg.8.asciidoc
 | 
			
		||||
makepkg-template.1 makepkg-template.1.html: makepkg-template.1.asciidoc
 | 
			
		||||
repo-add.8 repo-add.8.html: repo-add.8.asciidoc
 | 
			
		||||
vercmp.8 vercmp.8.html: vercmp.8.asciidoc
 | 
			
		||||
pkgdelta.8 pkgdelta.8.html: pkgdelta.8.asciidoc
 | 
			
		||||
pacman-key.8 pacman-key.8.html: pacman-key.8.asciidoc
 | 
			
		||||
PKGBUILD.5 PKGBUILD.5.html: PKGBUILD.5.asciidoc PKGBUILD-example.txt
 | 
			
		||||
makepkg.conf.5 makepkg.conf.5.html: makepkg.conf.5.asciidoc
 | 
			
		||||
pacman.conf.5 pacman.conf.5.html: pacman.conf.5.asciidoc
 | 
			
		||||
libalpm.3 libalpm.3.html: libalpm.3.asciidoc
 | 
			
		||||
# this one is just a symlink
 | 
			
		||||
repo-remove.8: repo-add.8
 | 
			
		||||
	$(RM) repo-remove.8
 | 
			
		||||
@@ -170,5 +176,3 @@ install-data-hook:
 | 
			
		||||
 | 
			
		||||
uninstall-hook:
 | 
			
		||||
	$(RM) $(DESTDIR)$(mandir)/man8/repo-remove.8
 | 
			
		||||
 | 
			
		||||
# vim:set ts=2 sw=2 noet:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,24 +1,27 @@
 | 
			
		||||
# Maintainer: Joe User <joe.user@example.com>
 | 
			
		||||
 | 
			
		||||
pkgname=patch
 | 
			
		||||
pkgver=2.5.4
 | 
			
		||||
pkgrel=3
 | 
			
		||||
pkgver=2.7.1
 | 
			
		||||
pkgrel=1
 | 
			
		||||
pkgdesc="A utility to apply patch files to original sources"
 | 
			
		||||
arch=('i686' 'x86_64')
 | 
			
		||||
url="https://www.gnu.org/software/patch/patch.html"
 | 
			
		||||
license=('GPL')
 | 
			
		||||
groups=('base-devel')
 | 
			
		||||
depends=('glibc' 'ed')
 | 
			
		||||
source=(ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.gz)
 | 
			
		||||
md5sums=('ee5ae84d115f051d87fcaaef3b4ae782')
 | 
			
		||||
depends=('glibc')
 | 
			
		||||
makedepends=('ed')
 | 
			
		||||
optdepends=('ed: for "patch -e" functionality')
 | 
			
		||||
source=("ftp://ftp.gnu.org/gnu/$pkgname/$pkgname-$pkgver.tar.xz"{,.sig})
 | 
			
		||||
md5sums=('e9ae5393426d3ad783a300a338c09b72'
 | 
			
		||||
         'SKIP')
 | 
			
		||||
 | 
			
		||||
build() {
 | 
			
		||||
  cd "$srcdir"/$pkgname-$pkgver
 | 
			
		||||
  ./configure --prefix=/usr
 | 
			
		||||
  make
 | 
			
		||||
	cd "$srcdir/$pkgname-$pkgver"
 | 
			
		||||
	./configure --prefix=/usr
 | 
			
		||||
	make
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
package() {
 | 
			
		||||
  cd "$srcdir"/$pkgname-$pkgver
 | 
			
		||||
  make prefix="$pkgdir"/usr install
 | 
			
		||||
	cd "$srcdir/$pkgname-$pkgver"
 | 
			
		||||
	make DESTDIR="$pkgdir/" install
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
PKGBUILD(5)
 | 
			
		||||
===========
 | 
			
		||||
 | 
			
		||||
@@ -21,16 +18,18 @@ PKGBUILD is written, the actual package is built using makepkg and installed
 | 
			
		||||
with pacman.
 | 
			
		||||
 | 
			
		||||
NOTE: An example PKGBUILD, useful for reference, is located in '{pkgdatadir}'
 | 
			
		||||
along with other example files such as a ChangeLog and an install
 | 
			
		||||
script. You can copy the provided PKGBUILD.proto file to a new package build
 | 
			
		||||
directory and make customizations to suit your needs.
 | 
			
		||||
along with other example files such as an install script. You can copy the
 | 
			
		||||
provided PKGBUILD.proto file to a new package build directory and make
 | 
			
		||||
customizations to suit your needs.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options and Directives
 | 
			
		||||
----------------------
 | 
			
		||||
The following is a list of standard options and directives available for use
 | 
			
		||||
in a PKGBUILD. These are all understood and interpreted by makepkg, and most
 | 
			
		||||
of them will be directly transferred to the built package.
 | 
			
		||||
of them will be directly transferred to the built package. The mandatory
 | 
			
		||||
fields for a minimally functional PKGBUILD are *pkgname*, *pkgver*, *pkgrel*
 | 
			
		||||
and *arch*.
 | 
			
		||||
 | 
			
		||||
If you need to create any custom variables for use in your build process, it is
 | 
			
		||||
recommended to prefix their name with an '_' (underscore).
 | 
			
		||||
@@ -46,23 +45,24 @@ similar to `$_basekernver`.
 | 
			
		||||
 | 
			
		||||
*pkgver*::
 | 
			
		||||
	The version of the software as released from the author (e.g., '2.7.1').
 | 
			
		||||
	The variable is not allowed to contain colons or hyphens.
 | 
			
		||||
	The variable is not allowed to contain colons, forward slashes, hyphens
 | 
			
		||||
	or whitespace.
 | 
			
		||||
+
 | 
			
		||||
The `pkgver` variable can be automatically updated by providing a `pkgver()` function
 | 
			
		||||
in the PKGBUILD that outputs the new package version.  This is run after downloading
 | 
			
		||||
and extracting the sources so can use those files in determining the new `pkgver`.
 | 
			
		||||
This is most useful when used with sources from version control systems (see below).
 | 
			
		||||
The `pkgver` variable can be automatically updated by providing a `pkgver()`
 | 
			
		||||
function in the PKGBUILD that outputs the new package version.
 | 
			
		||||
This is run after downloading and extracting the sources and running the
 | 
			
		||||
`prepare()` function (if present), so it can use those files in determining the
 | 
			
		||||
new `pkgver`.  This is most useful when used with sources from version control
 | 
			
		||||
systems (see below).
 | 
			
		||||
 | 
			
		||||
*pkgrel*::
 | 
			
		||||
	This is the release number specific to the Arch Linux release. This
 | 
			
		||||
	This is the release number specific to the distribution. This
 | 
			
		||||
	allows package maintainers to make updates to the package's configure
 | 
			
		||||
	flags, for example. This is typically set to '1' for each new upstream
 | 
			
		||||
	software release and incremented for intermediate PKGBUILD updates. The
 | 
			
		||||
	variable is not allowed to contain hyphens.
 | 
			
		||||
 | 
			
		||||
*pkgdesc*::
 | 
			
		||||
	This should be a brief description of the package and its functionality.
 | 
			
		||||
	Try to keep the description to one line of text and not use the package's name.
 | 
			
		||||
	variable is a postive integer, with an optional subrelease level
 | 
			
		||||
	specified by adding another postive integer separated by a period
 | 
			
		||||
	(i.e. in the form x.y).
 | 
			
		||||
 | 
			
		||||
*epoch*::
 | 
			
		||||
	Used to force the package to be seen as newer than any previous versions
 | 
			
		||||
@@ -73,9 +73,14 @@ This is most useful when used with sources from version control systems (see bel
 | 
			
		||||
	version comparison logic. See linkman:pacman[8] for more information on
 | 
			
		||||
	version comparisons.
 | 
			
		||||
 | 
			
		||||
*pkgdesc*::
 | 
			
		||||
	This should be a brief description of the package and its functionality.
 | 
			
		||||
	Try to keep the description to one line of text and to not use the package's
 | 
			
		||||
	name.
 | 
			
		||||
 | 
			
		||||
*url*::
 | 
			
		||||
	This field contains a URL that is associated with the software being
 | 
			
		||||
	packaged. Typically the project's website.
 | 
			
		||||
	packaged. This is typically the project's web site.
 | 
			
		||||
 | 
			
		||||
*license (array)*::
 | 
			
		||||
	This field specifies the license(s) that apply to the package.
 | 
			
		||||
@@ -91,13 +96,14 @@ This is most useful when used with sources from version control systems (see bel
 | 
			
		||||
 | 
			
		||||
*install*::
 | 
			
		||||
	Specifies a special install script that is to be included in the package.
 | 
			
		||||
	This file should reside in the same directory as the PKGBUILD, and will
 | 
			
		||||
	This file should reside in the same directory as the PKGBUILD and will
 | 
			
		||||
	be copied into the package by makepkg. It does not need to be included
 | 
			
		||||
	in the source array (e.g., `install=$pkgname.install`).
 | 
			
		||||
 | 
			
		||||
*changelog*::
 | 
			
		||||
	Specifies a changelog file that is to be included in the package.
 | 
			
		||||
	This file should reside in the same directory as the PKGBUILD, and will
 | 
			
		||||
	The changelog file should end in a single newline.
 | 
			
		||||
	This file should reside in the same directory as the PKGBUILD and will
 | 
			
		||||
	be copied into the package by makepkg. It does not need to be included
 | 
			
		||||
	in the source array (e.g., `changelog=$pkgname.changelog`).
 | 
			
		||||
 | 
			
		||||
@@ -105,10 +111,14 @@ This is most useful when used with sources from version control systems (see bel
 | 
			
		||||
	An array of source files required to build the package. Source files
 | 
			
		||||
	must either reside in the same directory as the PKGBUILD, or be a
 | 
			
		||||
	fully-qualified URL that makepkg can use to download the file.
 | 
			
		||||
	To make the PKGBUILD as useful as possible, use the `$pkgname` and `$pkgver`
 | 
			
		||||
	variables if possible when specifying the download location. Compressed files
 | 
			
		||||
	will be extracted automatically unless found in
 | 
			
		||||
	the noextract array described below.
 | 
			
		||||
	To simplify the maintenance of PKGBUILDs, use the `$pkgname` and `$pkgver`
 | 
			
		||||
	variables when specifying the download location, if possible.
 | 
			
		||||
	Compressed files will be extracted automatically unless found in the
 | 
			
		||||
	noextract array described below.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific sources can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'source_x86_64=()'. There must be a
 | 
			
		||||
corresponding integrity array with checksums, e.g. 'md5sums_x86_64=()'.
 | 
			
		||||
+
 | 
			
		||||
It is also possible to change the name of the downloaded file, which is helpful
 | 
			
		||||
with weird URLs and for handling multiple source files with the same
 | 
			
		||||
@@ -118,12 +128,21 @@ makepkg also supports building developmental versions of packages using sources
 | 
			
		||||
downloaded from version control systems (VCS). For more information, see
 | 
			
		||||
<<VCS,Using VCS Sources>> below.
 | 
			
		||||
+
 | 
			
		||||
Files in the source array with extensions `.sig`, `.sign` or `.asc` are recognized by
 | 
			
		||||
makepkg as PGP signatures and will be automatically used to verify the integrity
 | 
			
		||||
of the corresponding source file.
 | 
			
		||||
Files in the source array with extensions `.sig`, `.sign` or, `.asc` are
 | 
			
		||||
recognized by makepkg as PGP signatures and will be automatically used to verify
 | 
			
		||||
the integrity of the corresponding source file.
 | 
			
		||||
 | 
			
		||||
*validpgpkeys (array)*::
 | 
			
		||||
	An array of PGP fingerprints. If this array is non-empty, makepkg will
 | 
			
		||||
	only accept signatures from the keys listed here and will ignore the
 | 
			
		||||
	trust values from the keyring. If the source file was signed with a
 | 
			
		||||
	subkey, makepkg will still use the primary key for comparison.
 | 
			
		||||
+
 | 
			
		||||
Only full fingerprints are accepted. They must be uppercase and must not
 | 
			
		||||
contain whitespace characters.
 | 
			
		||||
 | 
			
		||||
*noextract (array)*::
 | 
			
		||||
	An array of filenames corresponding to those from the source array. Files
 | 
			
		||||
	An array of file names corresponding to those from the source array. Files
 | 
			
		||||
	listed here will not be extracted with the rest of the source files. This
 | 
			
		||||
	is useful for packages that use compressed data directly.
 | 
			
		||||
 | 
			
		||||
@@ -135,7 +154,7 @@ of the corresponding source file.
 | 
			
		||||
	be skipped. To easily generate md5sums, run ``makepkg -g >> PKGBUILD''.
 | 
			
		||||
	If desired, move the md5sums line to an appropriate location.
 | 
			
		||||
 | 
			
		||||
*sha1sums, sha256sums, sha384sums, sha512sums (arrays)*::
 | 
			
		||||
*sha1sums, sha224sums, sha256sums, sha384sums, sha512sums (arrays)*::
 | 
			
		||||
	Alternative integrity checks that makepkg supports; these all behave
 | 
			
		||||
	similar to the md5sums option described above. To enable use and generation
 | 
			
		||||
	of these checksums, be sure to set up the `INTEGRITY_CHECK` option in
 | 
			
		||||
@@ -149,13 +168,14 @@ of the corresponding source file.
 | 
			
		||||
*arch (array)*::
 | 
			
		||||
	Defines on which architectures the given package is available (e.g.,
 | 
			
		||||
	`arch=('i686' 'x86_64')`). Packages that contain no architecture specific
 | 
			
		||||
	files should use `arch=('any')`.
 | 
			
		||||
	files should use `arch=('any')`. Valid characters for members of this array
 | 
			
		||||
	are alphanumerics and ```_`''.
 | 
			
		||||
 | 
			
		||||
*backup (array)*::
 | 
			
		||||
	An array of filenames, without preceding slashes, that
 | 
			
		||||
	An array of file names, without preceding slashes, that
 | 
			
		||||
	should be backed up if the package is removed or upgraded. This is
 | 
			
		||||
	commonly used for packages placing configuration files in /etc. See
 | 
			
		||||
	Handling Config Files in linkman:pacman[8] for more information.
 | 
			
		||||
	commonly used for packages placing configuration files in '/etc'. See
 | 
			
		||||
	`"Handling Config Files"` in linkman:pacman[8] for more information.
 | 
			
		||||
 | 
			
		||||
*depends (array)*::
 | 
			
		||||
	An array of packages this package depends on to run. Entries in
 | 
			
		||||
@@ -168,33 +188,49 @@ of the corresponding source file.
 | 
			
		||||
If the dependency name appears to be a library (ends with .so), makepkg will
 | 
			
		||||
try to find a binary that depends on the library in the built package and
 | 
			
		||||
append the version needed by the binary. Appending the version yourself
 | 
			
		||||
disables auto detection.
 | 
			
		||||
disables automatic detection.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific depends can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'depends_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*makedepends (array)*::
 | 
			
		||||
	An array of packages this package depends on to build but are not
 | 
			
		||||
	needed at runtime. Packages in this list follow the same format as
 | 
			
		||||
	depends.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific makedepends can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'makedepends_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*checkdepends (array)*::
 | 
			
		||||
	An array of packages this package depends on to run its test suite
 | 
			
		||||
	but are not needed at runtime. Packages in this list follow the same
 | 
			
		||||
	format as depends. These dependencies are only considered when the
 | 
			
		||||
	check() function is present and is to be run by makepkg.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific checkdepends can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'checkdepends_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*optdepends (array)*::
 | 
			
		||||
	An array of packages (and accompanying reasons) that are not essential for
 | 
			
		||||
	base functionality, but may be necessary to make full use of the contents
 | 
			
		||||
	of this package. optdepends are currently for informational purposes only
 | 
			
		||||
	and are not utilized by pacman during dependency resolution. The format
 | 
			
		||||
	for specifying optdepends is:
 | 
			
		||||
	and are not utilized by pacman during dependency resolution. Packages in
 | 
			
		||||
	this list follow the same format as depends, with an optional description
 | 
			
		||||
	appended. The format for specifying optdepends descriptions is:
 | 
			
		||||
 | 
			
		||||
	optdepends=('fakeroot: for makepkg usage as normal user')
 | 
			
		||||
	optdepends=('python: for library bindings')
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific optdepends can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'optdepends_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*conflicts (array)*::
 | 
			
		||||
	An array of packages that will conflict with this package (i.e. they
 | 
			
		||||
	cannot both be installed at the same time). This directive follows the
 | 
			
		||||
	same format as depends. Versioned conflicts are supported using the
 | 
			
		||||
	operators as described in `depends`.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific conflicts can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'conflicts_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*provides (array)*::
 | 
			
		||||
	An array of ``virtual provisions'' this package provides. This allows
 | 
			
		||||
@@ -209,7 +245,10 @@ only specific versions of a package may be provided.
 | 
			
		||||
+
 | 
			
		||||
If the provision name appears to be a library (ends with .so), makepkg will
 | 
			
		||||
try to find the library in the built package and append the correct
 | 
			
		||||
version. Appending the version yourself disables auto detection.
 | 
			
		||||
version. Appending the version yourself disables automatic detection.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific provides can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'provides_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*replaces (array)*::
 | 
			
		||||
	An array of packages this package should replace. This can be used
 | 
			
		||||
@@ -220,6 +259,9 @@ version. Appending the version yourself disables auto detection.
 | 
			
		||||
+
 | 
			
		||||
Sysupgrade is currently the only pacman operation that utilizes this field.
 | 
			
		||||
A normal sync or upgrade will not use its value.
 | 
			
		||||
+
 | 
			
		||||
Additional architecture-specific replaces can be added by appending an
 | 
			
		||||
underscore and the architecture name e.g., 'replaces_x86_64=()'.
 | 
			
		||||
 | 
			
		||||
*options (array)*::
 | 
			
		||||
	This array allows you to override some of makepkg's default behavior
 | 
			
		||||
@@ -245,7 +287,7 @@ A normal sync or upgrade will not use its value.
 | 
			
		||||
 | 
			
		||||
	*staticlibs*;;
 | 
			
		||||
		Leave static library (.a) files in packages. Specify `!staticlibs` to
 | 
			
		||||
		remove them.
 | 
			
		||||
		remove them (if they have a shared counterpart).
 | 
			
		||||
 | 
			
		||||
	*emptydirs*;;
 | 
			
		||||
		Leave empty directories in packages.
 | 
			
		||||
@@ -253,9 +295,6 @@ A normal sync or upgrade will not use its value.
 | 
			
		||||
	*zipman*;;
 | 
			
		||||
		Compress man and info pages with gzip.
 | 
			
		||||
 | 
			
		||||
	*upx*;;
 | 
			
		||||
		Compress binary executable files using UPX.
 | 
			
		||||
 | 
			
		||||
	*ccache*;;
 | 
			
		||||
		Allow the use of ccache during build. More useful in its negative
 | 
			
		||||
		form `!ccache` with select packages that have problems building
 | 
			
		||||
@@ -287,63 +326,64 @@ A normal sync or upgrade will not use its value.
 | 
			
		||||
 | 
			
		||||
Packaging Functions
 | 
			
		||||
-------------------
 | 
			
		||||
 | 
			
		||||
In addition to the above directives, PKGBUILDs require a set of functions that
 | 
			
		||||
provide instructions to build and install the package.  As a minimum, the PKGBUILD
 | 
			
		||||
must contain a package() function which installs all the package's files into the
 | 
			
		||||
packaging directory, with optional prepare(), build() and check() being used to
 | 
			
		||||
create those files from source.
 | 
			
		||||
provide instructions to build and install the package. As a minimum, the
 | 
			
		||||
PKGBUILD must contain a `package()` function which installs all the package's
 | 
			
		||||
files into the packaging directory, with optional `prepare()`, `build()`, and
 | 
			
		||||
`check()` functions being used to create those files from source.
 | 
			
		||||
 | 
			
		||||
*package() Function*::
 | 
			
		||||
	The package() function is used to install files into the directory that
 | 
			
		||||
	The `package()` function is used to install files into the directory that
 | 
			
		||||
	will become the root directory of the built package and is run after all
 | 
			
		||||
	the optional functions listed below. When specified in combination with
 | 
			
		||||
	the fakeroot BUILDENV option in linkman:makepkg.conf[5], fakeroot usage
 | 
			
		||||
	will be limited to running the packaging stage. All other functions will
 | 
			
		||||
	be run as the user calling makepkg.
 | 
			
		||||
	the optional functions listed below. The packaging stage is run using
 | 
			
		||||
	fakeroot to ensure correct file permissions in the resulting package.
 | 
			
		||||
	All other functions will be run as the user calling makepkg.
 | 
			
		||||
 | 
			
		||||
*prepare() Function*::
 | 
			
		||||
	An optional prepare() function can be specified in which operations that
 | 
			
		||||
	are to be run in order to prepare the sources for building (such as
 | 
			
		||||
	patching) are performed. This function is run after the source extraction
 | 
			
		||||
	and before the build() function and is skipped when source extraction is
 | 
			
		||||
	skipped.
 | 
			
		||||
	An optional `prepare()` function can be specified in which operations to
 | 
			
		||||
	prepare the sources for building, such as patching, are performed. This
 | 
			
		||||
	function is run after the source extraction and before the `build()`
 | 
			
		||||
	function. The `prepare()` function is skipped when source extraction
 | 
			
		||||
	is skipped.
 | 
			
		||||
 | 
			
		||||
*build() Function*::
 | 
			
		||||
	The optional build() function is use to compile and/or adjust the source
 | 
			
		||||
	files in preparation to be installed by the package() function. This is
 | 
			
		||||
	directly sourced and executed by makepkg, so anything that bash or the
 | 
			
		||||
	The optional `build()` function is use to compile and/or adjust the source
 | 
			
		||||
	files in preparation to be installed by the `package()` function. This is
 | 
			
		||||
	directly sourced and executed by makepkg, so anything that Bash or the
 | 
			
		||||
	system has available is available for use here. Be sure any exotic
 | 
			
		||||
	commands used are covered by `makedepends`.
 | 
			
		||||
	commands used are covered by the `makedepends` array.
 | 
			
		||||
+
 | 
			
		||||
If you create any variables of your own in the build function, it is
 | 
			
		||||
recommended to use the bash `local` keyword to scope the variable to inside
 | 
			
		||||
the build function.
 | 
			
		||||
If you create any variables of your own in the `build()` function, it is
 | 
			
		||||
recommended to use the Bash `local` keyword to scope the variable to inside
 | 
			
		||||
the `build()` function.
 | 
			
		||||
 | 
			
		||||
*check() Function*::
 | 
			
		||||
	An optional check() function can be specified in which a package's
 | 
			
		||||
	test-suite may be run. This function is run between the build() and
 | 
			
		||||
	package() functions. Be sure any exotic commands used are covered by
 | 
			
		||||
	`checkdepends`.
 | 
			
		||||
	An optional `check()` function can be specified in which a package's
 | 
			
		||||
	test-suite may be run. This function is run between the `build()` and
 | 
			
		||||
	`package()` functions. Be sure any exotic commands used are covered by the
 | 
			
		||||
	`checkdepends` array.
 | 
			
		||||
 | 
			
		||||
All of the above variables such as `$pkgname` and `$pkgver` are available for use
 | 
			
		||||
in the build function. In addition, makepkg defines the following variables for use
 | 
			
		||||
during the build and install process:
 | 
			
		||||
All of the above variables such as `$pkgname` and `$pkgver` are available for
 | 
			
		||||
use in the packaging functions. In addition, makepkg defines the following
 | 
			
		||||
variables:
 | 
			
		||||
 | 
			
		||||
*srcdir*::
 | 
			
		||||
       This contains the directory where makepkg extracts, or copies, all source
 | 
			
		||||
       files.
 | 
			
		||||
	This contains the directory where makepkg extracts, or copies, all source
 | 
			
		||||
	files.
 | 
			
		||||
+
 | 
			
		||||
All of the packaging functions defined above are run starting inside `$srcdir`
 | 
			
		||||
 | 
			
		||||
*pkgdir*::
 | 
			
		||||
       This contains the directory where makepkg bundles the installed package
 | 
			
		||||
       (this directory will become the root directory of your built package).
 | 
			
		||||
       This variable should only be used in the package() function.
 | 
			
		||||
	This contains the directory where makepkg bundles the installed package.
 | 
			
		||||
	This directory will become the root directory of your built package. This
 | 
			
		||||
	variable should only be used in the `package()` function.
 | 
			
		||||
 | 
			
		||||
*startdir*::
 | 
			
		||||
	This contains the absolute path to the directory where the PKGBUILD is
 | 
			
		||||
	located, which is usually the output of `$(pwd)` when makepkg is started.
 | 
			
		||||
	Use of this variable is deprecated and strongly discouraged.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Package Splitting
 | 
			
		||||
-----------------
 | 
			
		||||
makepkg supports building multiple packages from a single PKGBUILD. This is
 | 
			
		||||
@@ -354,17 +394,25 @@ Each split package uses a corresponding packaging function with name
 | 
			
		||||
All options and directives for the split packages default to the global values
 | 
			
		||||
given in the PKGBUILD. Nevertheless, the following ones can be overridden within
 | 
			
		||||
each split package's packaging function:
 | 
			
		||||
`pkgver`, `pkgrel`, `epoch`, `pkgdesc`, `arch`, `url`, `license`, `groups`,
 | 
			
		||||
`depends`, `optdepends`, `provides`, `conflicts`, `replaces`, `backup`,
 | 
			
		||||
`options`, `install` and `changelog`.
 | 
			
		||||
`pkgdesc`, `arch`, `url`, `license`, `groups`, `depends`, `optdepends`,
 | 
			
		||||
`provides`, `conflicts`, `replaces`, `backup`, `options`, `install`, and
 | 
			
		||||
`changelog`.
 | 
			
		||||
 | 
			
		||||
Note that makepkg does not consider split package `depends` when checking
 | 
			
		||||
if dependencies are installed before package building and with `--syncdeps`.
 | 
			
		||||
All packages required to make the package are required to be specified in
 | 
			
		||||
the global `depends` and `makedepends` arrays.
 | 
			
		||||
 | 
			
		||||
An optional global directive is available when building a split package:
 | 
			
		||||
 | 
			
		||||
*pkgbase*::
 | 
			
		||||
	The name used to refer to the group of packages in the output of makepkg
 | 
			
		||||
	and in the naming of source-only tarballs.  If not specified, the first
 | 
			
		||||
	element in the `pkgname` array is used.  The variable is not allowed to
 | 
			
		||||
	begin with a hyphen.
 | 
			
		||||
	and in the naming of source-only tarballs. If not specified, the first
 | 
			
		||||
	element in the `pkgname` array is used. Valid characters for this
 | 
			
		||||
	variable are alphanumerics, and any of the following characters:
 | 
			
		||||
	```@ . _ + -`''. Additionally, the variable is not allowed to start with
 | 
			
		||||
	hyphens or dots.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Install/Upgrade/Remove Scripting
 | 
			
		||||
--------------------------------
 | 
			
		||||
@@ -374,10 +422,10 @@ itself after installation and perform an opposite action upon removal.
 | 
			
		||||
 | 
			
		||||
The exact time the script is run varies with each operation, and should be
 | 
			
		||||
self-explanatory. Note that during an upgrade operation, none of the install
 | 
			
		||||
or remove scripts will be called.
 | 
			
		||||
or remove functions will be called.
 | 
			
		||||
 | 
			
		||||
Scripts are passed either one or two ``full version strings'', where a full
 | 
			
		||||
version string is either 'pkgver-pkgrel' or 'epoch:pkgver-pkgrel' if epoch is
 | 
			
		||||
version string is either 'pkgver-pkgrel' or 'epoch:pkgver-pkgrel', if epoch is
 | 
			
		||||
non-zero.
 | 
			
		||||
 | 
			
		||||
*pre_install*::
 | 
			
		||||
@@ -413,25 +461,29 @@ The install script does not need to be specified in the source array. A
 | 
			
		||||
template install file is available in '{pkgdatadir}' as 'proto.install' for
 | 
			
		||||
reference with all of the available functions defined.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Using VCS Sources[[VCS]]
 | 
			
		||||
------------------------
 | 
			
		||||
Building a developmental version of a package using sources from a version control
 | 
			
		||||
system (VCS) is enabled by specifying the source in the form
 | 
			
		||||
`source=('folder::url#fragment')`. Currently makepkg supports the `bzr`, `git`, `hg` and
 | 
			
		||||
`svn` protocols.
 | 
			
		||||
Building a developmental version of a package using sources from a version
 | 
			
		||||
control system (VCS) is enabled by specifying the source in the form
 | 
			
		||||
`source=('directory::url#fragment?query')`. Currently makepkg supports the
 | 
			
		||||
Bazaar, Git, Subversion, and Mercurial version control systems. For other
 | 
			
		||||
version control systems, manual cloning of upstream repositories must be done
 | 
			
		||||
in the `prepare()` function.
 | 
			
		||||
 | 
			
		||||
The source URL is divided into three components:
 | 
			
		||||
The source URL is divided into four components:
 | 
			
		||||
 | 
			
		||||
*folder*::
 | 
			
		||||
	(optional) Specifies an alternate folder name for makepkg to download the VCS
 | 
			
		||||
	source into.
 | 
			
		||||
*directory*::
 | 
			
		||||
	(optional) Specifies an alternate directory name for makepkg to download
 | 
			
		||||
	the VCS source into.
 | 
			
		||||
 | 
			
		||||
*url*::
 | 
			
		||||
	The url to the VCS repo. This must include the the vcs in the URL protocol for
 | 
			
		||||
	makepkg to recognize this as a VCS source.  If the protocol does not include
 | 
			
		||||
	the VCS name, it can be added by prefixing the URL with `vcs+`. For example,
 | 
			
		||||
	using a git repository over `http` would have a source URL in the form
 | 
			
		||||
	`git+http://...`.
 | 
			
		||||
	The URL to the VCS repository. This must include the VCS in the URL protocol
 | 
			
		||||
	for makepkg to recognize this as a VCS source. If the protocol does not
 | 
			
		||||
	include the VCS name, it can be added by prefixing the URL with `vcs+`. For
 | 
			
		||||
	example, using a Git repository over HTTPS would have a source URL in the
 | 
			
		||||
	form:
 | 
			
		||||
	`git+https://...`.
 | 
			
		||||
 | 
			
		||||
*fragment*::
 | 
			
		||||
	(optional) Allows specifying a revision number or branch for makepkg to checkout
 | 
			
		||||
@@ -451,19 +503,26 @@ The source URL is divided into three components:
 | 
			
		||||
	*svn*;;
 | 
			
		||||
		revision
 | 
			
		||||
 | 
			
		||||
*query*::
 | 
			
		||||
	(optional) Allows specifying whether a VCS checkout should be checked for
 | 
			
		||||
	PGP-signed revisions. The source line should have the format
 | 
			
		||||
	`source=(url#fragment?signed)` or `source=(url?signed#fragment)`. Currently
 | 
			
		||||
	only supported by Git.
 | 
			
		||||
 | 
			
		||||
Example
 | 
			
		||||
-------
 | 
			
		||||
The following is an example PKGBUILD for the 'patch' package. For more
 | 
			
		||||
examples, look through the build files of your distribution's packages. For
 | 
			
		||||
those using Arch Linux, consult the ABS tree.
 | 
			
		||||
those using Arch Linux, consult the Arch Build System (ABS) tree.
 | 
			
		||||
 | 
			
		||||
[source,sh]
 | 
			
		||||
-------------------------------
 | 
			
		||||
include::PKGBUILD-example.txt[]
 | 
			
		||||
-------------------------------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:makepkg[8], linkman:pacman[8], linkman:makepkg.conf[5]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
							
								
								
									
										132
									
								
								doc/alpm-hooks.5.asciidoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										132
									
								
								doc/alpm-hooks.5.asciidoc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,132 @@
 | 
			
		||||
alpm-hooks(5)
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
NAME
 | 
			
		||||
----
 | 
			
		||||
 | 
			
		||||
alpm-hooks - alpm hook file format
 | 
			
		||||
 | 
			
		||||
SYNOPSIS
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
--------
 | 
			
		||||
[Trigger] (Required, Repeatable)
 | 
			
		||||
Operation = Install|Upgrade|Remove (Required, Repeatable)
 | 
			
		||||
Type = File|Package (Required)
 | 
			
		||||
Target = <Path|PkgName> (Required, Repeatable)
 | 
			
		||||
 | 
			
		||||
[Action] (Required)
 | 
			
		||||
Description = ... (Optional)
 | 
			
		||||
When = PreTransaction|PostTransaction (Required)
 | 
			
		||||
Exec = <Command> (Required)
 | 
			
		||||
Depends = <PkgName> (Optional)
 | 
			
		||||
AbortOnFail (Optional, PreTransaction only)
 | 
			
		||||
NeedsTargets (Optional)
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
DESCRIPTION
 | 
			
		||||
-----------
 | 
			
		||||
 | 
			
		||||
libalpm provides the ability to specify hooks to run before or after
 | 
			
		||||
transactions based on the packages and/or files being modified.  Hooks consist
 | 
			
		||||
of a single '[Action]' section describing the action to be run and one or more
 | 
			
		||||
'[Trigger]' section describing which transactions it should be run for.
 | 
			
		||||
 | 
			
		||||
Hooks are read from files located in the system hook directory
 | 
			
		||||
+{datarootdir}/libalpm/hooks+, and additional custom directories specified in
 | 
			
		||||
linkman:pacman.conf[5] (the default is +{sysconfdir}/pacman.d/hooks+).  The
 | 
			
		||||
file names are required to have the suffix ".hook".  Hooks are run in
 | 
			
		||||
alphabetical order of their file name, where the ordering ignores the suffix.
 | 
			
		||||
 | 
			
		||||
TRIGGERS
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
Hooks must contain at least one '[Trigger]' section that determines which
 | 
			
		||||
transactions will cause the hook to run.  If multiple trigger sections are
 | 
			
		||||
defined the hook will run if the transaction matches *any* of the triggers.
 | 
			
		||||
 | 
			
		||||
*Operation =* Install|Upgrade|Remove::
 | 
			
		||||
	Select the type of operation to match targets against.  May be specified
 | 
			
		||||
	multiple times.  Installations are considered an upgrade if the package or
 | 
			
		||||
	file is already present on the system regardless of whether the new package
 | 
			
		||||
	version is actually greater than the currently installed version.  For File
 | 
			
		||||
	triggers, this is true even if the file changes ownership from one package
 | 
			
		||||
	to another.  Required.
 | 
			
		||||
 | 
			
		||||
*Type =* File|Package::
 | 
			
		||||
	Select whether targets are matched against transaction packages or files.
 | 
			
		||||
	See CAVEATS for special notes regarding File triggers.  Required.
 | 
			
		||||
 | 
			
		||||
*Target =* <path|package>::
 | 
			
		||||
	The file path or package name to match against the active transaction.
 | 
			
		||||
	File paths refer to the files in the package archive; the installation root
 | 
			
		||||
	should *not* be included in the path.  Shell-style glob patterns are
 | 
			
		||||
	allowed. It is possible to invert matches by prepending a file with an
 | 
			
		||||
	exclamation mark. May be specified multiple times. Required.
 | 
			
		||||
 | 
			
		||||
ACTIONS
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
*Description =* ...::
 | 
			
		||||
	An optional description that describes the action being taken by the
 | 
			
		||||
	hook for use in front-end output.
 | 
			
		||||
 | 
			
		||||
*Exec =* <command>::
 | 
			
		||||
	Command to run.  Command arguments are split on whitespace.  Values
 | 
			
		||||
	containing whitespace should be enclosed in quotes.  Required.
 | 
			
		||||
 | 
			
		||||
*When =* PreTransaction|PostTransaction::
 | 
			
		||||
	When to run the hook.  Required.
 | 
			
		||||
 | 
			
		||||
*Depends =* <package>::
 | 
			
		||||
	Packages that must be installed for the hook to run. May be specified
 | 
			
		||||
	multiple times.
 | 
			
		||||
 | 
			
		||||
*AbortOnFail*::
 | 
			
		||||
	Causes the transaction to be aborted if the hook exits non-zero.  Only
 | 
			
		||||
	applies to PreTransaction hooks.
 | 
			
		||||
 | 
			
		||||
*NeedsTargets*::
 | 
			
		||||
	Causes the list of matched trigger targets to be passed to the running hook
 | 
			
		||||
	on 'stdin'.
 | 
			
		||||
 | 
			
		||||
OVERRIDING HOOKS
 | 
			
		||||
----------------
 | 
			
		||||
 | 
			
		||||
Hooks may be overridden by placing a file with the same name in a higher
 | 
			
		||||
priority hook directory.  Hooks may be disabled by overriding them with
 | 
			
		||||
a symlink to '/dev/null'.
 | 
			
		||||
 | 
			
		||||
EXAMPLES
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
--------
 | 
			
		||||
# Force disks to sync to reduce the risk of data corruption
 | 
			
		||||
 | 
			
		||||
[Trigger]
 | 
			
		||||
Operation = Install
 | 
			
		||||
Operation = Upgrade
 | 
			
		||||
Operation = Remove
 | 
			
		||||
Type = Package
 | 
			
		||||
Target = *
 | 
			
		||||
 | 
			
		||||
[Action]
 | 
			
		||||
Depends = coreutils
 | 
			
		||||
When = PostTransaction
 | 
			
		||||
Exec = /usr/bin/sync
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
CAVEATS
 | 
			
		||||
-------
 | 
			
		||||
 | 
			
		||||
There are situations when file triggers may act in unexpected ways.  Hooks are
 | 
			
		||||
triggered using the file list of the installed, upgraded, or removed package.
 | 
			
		||||
When installing or upgrading a file that is extracted with a '.pacnew'
 | 
			
		||||
extension, the original file name is used in triggering the hook.  When
 | 
			
		||||
removing a package, all files owned by that package can trigger a hook whether
 | 
			
		||||
or not they were actually present on the file system before package removal.
 | 
			
		||||
 | 
			
		||||
PostTransaction hooks will *not* run if the transaction fails to complete for
 | 
			
		||||
any reason.
 | 
			
		||||
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
 | 
			
		||||
See the pacman website at https://www.archlinux.org/pacman/[] for current
 | 
			
		||||
information on pacman and its related tools.
 | 
			
		||||
@@ -8,7 +5,7 @@ information on pacman and its related tools.
 | 
			
		||||
 | 
			
		||||
Bugs
 | 
			
		||||
----
 | 
			
		||||
Bugs? You must be kidding, there are no bugs in this software. But if we
 | 
			
		||||
Bugs? You must be kidding; there are no bugs in this software. But if we
 | 
			
		||||
happen to be wrong, send us an email with as much detail as possible to
 | 
			
		||||
mailto:pacman-dev@archlinux.org[].
 | 
			
		||||
 | 
			
		||||
@@ -19,6 +16,7 @@ Authors
 | 
			
		||||
Current maintainers:
 | 
			
		||||
 | 
			
		||||
* Allan McRae <allan@archlinux.org>
 | 
			
		||||
* Andrew Gregory <andrew.gregory.8@gmail.com>
 | 
			
		||||
* Dan McGee <dan@archlinux.org>
 | 
			
		||||
* Dave Reisner <dreisner@archlinux.org>
 | 
			
		||||
 | 
			
		||||
@@ -21,24 +21,28 @@ option) with a master server through the use of package databases. Prior to
 | 
			
		||||
this, packages would have to be installed manually using the '\--add' and
 | 
			
		||||
'\--upgrade' operations.
 | 
			
		||||
 | 
			
		||||
Version 3.0 was the switch to a two-part pacman- a backend named libalpm
 | 
			
		||||
(library for Arch Linux Package Management), and the familiar pacman frontend.
 | 
			
		||||
Version 3.0 was the switch to a two-part pacman -- a back-end named libalpm
 | 
			
		||||
(library for Arch Linux Package Management) and the familiar pacman front-end.
 | 
			
		||||
Speed in many cases was improved, along with dependency and conflict resolution
 | 
			
		||||
being able to handle a much wider variety of cases. The switch to a
 | 
			
		||||
library-based program should also make it easier in the future to develop
 | 
			
		||||
alternative front ends.
 | 
			
		||||
 | 
			
		||||
Version 4.0 added package signing and verification capabilities to the entire
 | 
			
		||||
makepkg/repo-add/pacman toolchain via GNUPG and GPGME.
 | 
			
		||||
makepkg/repo-add/pacman toolchain via GnuPG and GPGME.
 | 
			
		||||
 | 
			
		||||
Version 5.0 added support for pre/post-transaction hooks and sync database file
 | 
			
		||||
list operations.
 | 
			
		||||
 | 
			
		||||
Documentation
 | 
			
		||||
-------------
 | 
			
		||||
 | 
			
		||||
Manpages
 | 
			
		||||
~~~~~~~~
 | 
			
		||||
There are several manpages available for the programs, utilities, and
 | 
			
		||||
Man Pages
 | 
			
		||||
~~~~~~~~~
 | 
			
		||||
There are several man pages available for the programs, utilities, and
 | 
			
		||||
configuration files dealing with pacman.
 | 
			
		||||
 | 
			
		||||
* linkman:alpm-hooks[5]
 | 
			
		||||
* linkman:PKGBUILD[5]
 | 
			
		||||
* linkman:libalpm[3]
 | 
			
		||||
* linkman:makepkg[8]
 | 
			
		||||
@@ -71,6 +75,13 @@ Releases
 | 
			
		||||
[frame="topbot",grid="none",options="header,autowidth"]
 | 
			
		||||
!======
 | 
			
		||||
!Version !Date
 | 
			
		||||
!5.1.2  !2018-12-25
 | 
			
		||||
!5.1.1  !2018-07-27
 | 
			
		||||
!5.1.0  !2018-05-28
 | 
			
		||||
!5.0.1  !2016-02-23
 | 
			
		||||
!5.0.0  !2016-01-30
 | 
			
		||||
!4.2.1  !2015-02-20
 | 
			
		||||
!4.2.0  !2014-12-19
 | 
			
		||||
!4.1.2  !2013-06-18
 | 
			
		||||
!4.1.1  !2013-05-07
 | 
			
		||||
!4.1.0  !2013-04-01
 | 
			
		||||
@@ -98,14 +109,14 @@ Releases
 | 
			
		||||
!3.2.1 !2008-08-26
 | 
			
		||||
!3.2.0 !2008-07-30
 | 
			
		||||
!3.1.4 !2008-04-01
 | 
			
		||||
!3.1.3 !2008-03-06
 | 
			
		||||
!3.1.2 !2008-02-20
 | 
			
		||||
!3.1.1 !2008-01-20
 | 
			
		||||
!======
 | 
			
		||||
|
 | 
			
		||||
[frame="topbot",grid="none",options="header,autowidth"]
 | 
			
		||||
!======
 | 
			
		||||
!Version !Date
 | 
			
		||||
!3.1.3 !2008-03-06
 | 
			
		||||
!3.1.2 !2008-02-20
 | 
			
		||||
!3.1.1 !2008-01-20
 | 
			
		||||
!3.1.0 !2008-01-09
 | 
			
		||||
!3.0.6 !2007-09-16
 | 
			
		||||
!3.0.5 !2007-06-17
 | 
			
		||||
@@ -133,12 +144,12 @@ Releases
 | 
			
		||||
!2.8 !2004-07-03
 | 
			
		||||
!2.7.9 !2004-04-30
 | 
			
		||||
!2.7.8 !2004-04-29
 | 
			
		||||
!2.7.7 !2004-04-15
 | 
			
		||||
!======
 | 
			
		||||
|
 | 
			
		||||
[frame="topbot",grid="none",options="header,autowidth"]
 | 
			
		||||
!======
 | 
			
		||||
!Version !Date
 | 
			
		||||
!2.7.7 !2004-04-15
 | 
			
		||||
!2.7.6 !2004-04-04
 | 
			
		||||
!2.7.5 !2004-03-02
 | 
			
		||||
!2.7.4 !2004-02-18
 | 
			
		||||
@@ -172,7 +183,7 @@ Releases
 | 
			
		||||
|======
 | 
			
		||||
 | 
			
		||||
Source code for all releases is available at
 | 
			
		||||
link:ftp://ftp.archlinux.org/other/pacman/[]. To install, download the newest
 | 
			
		||||
link:https://sources.archlinux.org/other/pacman/[]. To install, download the newest
 | 
			
		||||
available source tarball, unpack it in a directory, and run the three magic
 | 
			
		||||
commands:
 | 
			
		||||
 | 
			
		||||
@@ -194,7 +205,7 @@ link:https://mailman.archlinux.org/pipermail/pacman-dev/[view the archives].
 | 
			
		||||
 | 
			
		||||
Source Code
 | 
			
		||||
~~~~~~~~~~~
 | 
			
		||||
Development of pacman is currently done in GIT. The central repository is
 | 
			
		||||
Development of pacman is currently done in Git. The central repository is
 | 
			
		||||
hosted by Arch Linux, although some of the developers have their own trees (ask
 | 
			
		||||
on the above mailing lists if you are interested in finding the locations of
 | 
			
		||||
these trees).
 | 
			
		||||
@@ -238,7 +249,7 @@ Bugs
 | 
			
		||||
----
 | 
			
		||||
If you find bugs (which is quite likely), please email them to the pacman-dev
 | 
			
		||||
mailing last at mailto:pacman-dev@archlinux.org[] with specific information
 | 
			
		||||
such as your commandline, the nature of the bug, and even the package database
 | 
			
		||||
such as your command-line, the nature of the bug, and even the package database
 | 
			
		||||
if it helps.
 | 
			
		||||
 | 
			
		||||
You can also post a bug to the Arch Linux bug tracker
 | 
			
		||||
@@ -247,11 +258,7 @@ bugs under the Pacman project.
 | 
			
		||||
 | 
			
		||||
Copyright
 | 
			
		||||
---------
 | 
			
		||||
pacman is Copyright (C) 2006-2013 Pacman Development Team
 | 
			
		||||
pacman is Copyright (C) 2006-2018 Pacman Development Team
 | 
			
		||||
<pacman-dev@archlinux.org> and Copyright (C) 2002-2006 Judd Vinet
 | 
			
		||||
<jvinet@zeroflux.org> and is licensed through the GNU General Public License,
 | 
			
		||||
version 2 or later.
 | 
			
		||||
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
libalpm(3)
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
@@ -34,6 +31,7 @@ See linkman:pacman.conf[5] for more details on configuring libalpm using the
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman[8], linkman:makepkg[8], linkman:pacman.conf[5]
 | 
			
		||||
linkman:alpm-hooks[5], linkman:makepkg[8], linkman:pacman[8],
 | 
			
		||||
linkman:pacman.conf[5]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
							
								
								
									
										118
									
								
								doc/makepkg-template.1.asciidoc
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										118
									
								
								doc/makepkg-template.1.asciidoc
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,118 @@
 | 
			
		||||
makepkg-template(1)
 | 
			
		||||
===================
 | 
			
		||||
 | 
			
		||||
Name
 | 
			
		||||
----
 | 
			
		||||
makepkg-template - package build templating utility
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
'makepkg-template' [options]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
-----------
 | 
			
		||||
'makepkg-template' is a script to ease the work of maintaining multiple similar
 | 
			
		||||
PKGBUILDs.  It allows you to move most of the code from the PKGBUILD into a
 | 
			
		||||
template file and uses markers to allow in-place updating of existing PKGBUILDs
 | 
			
		||||
if the template has been changed.
 | 
			
		||||
 | 
			
		||||
Template files can contain any code allowed in a PKGBUILD. You can think of
 | 
			
		||||
them like external files included with "." or "source", but they will be
 | 
			
		||||
inlined into the PKGBUILD by 'makepkg-template' so you do not depend on the
 | 
			
		||||
template file when building the package.
 | 
			
		||||
 | 
			
		||||
Markers are bash comments in the form of:
 | 
			
		||||
 | 
			
		||||
	# template start; key=value; key2=value2; ...
 | 
			
		||||
 | 
			
		||||
and
 | 
			
		||||
 | 
			
		||||
	# template end;
 | 
			
		||||
 | 
			
		||||
Currently used keys are: name (mandatory) and version. Template names are limited to
 | 
			
		||||
alphanumerics, "@", "+", ".", "-", and "_". Versions are limited to numbers and ".".
 | 
			
		||||
 | 
			
		||||
For initial creation there is a one line short cut which does not need an end marker:
 | 
			
		||||
 | 
			
		||||
	# template input; key=value;
 | 
			
		||||
 | 
			
		||||
Using this short-cut will result in 'makepkg-template' replacing it with start
 | 
			
		||||
and end markers and the template code on the first run.
 | 
			
		||||
 | 
			
		||||
Template files should be stored in one directory and filenames should be
 | 
			
		||||
"$template_name-$version.template" with a symlink "$template_name.template"
 | 
			
		||||
pointing to the most recent template. If the version is not set in the marker,
 | 
			
		||||
'makepkg-template' will automatically use the target of "$template_name.template",
 | 
			
		||||
otherwise the specified version will be used.  This allows for easier
 | 
			
		||||
verification of untrusted PKGBUILDs if the template is trusted. You verify the
 | 
			
		||||
non-template code and then use a command similar to this:
 | 
			
		||||
 | 
			
		||||
	diff -u <(makepkg-template -o -) PKGBUILD
 | 
			
		||||
 | 
			
		||||
Template files may also contain markers leading to nested templates in the
 | 
			
		||||
resulting PKGBUILD. If you use markers in a template, please set the version
 | 
			
		||||
you used/tested with in the start/input marker so other people can properly
 | 
			
		||||
recreate from templates.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*-p, \--input* <build script>::
 | 
			
		||||
	Read the package script `build script` instead of the default.
 | 
			
		||||
 | 
			
		||||
*-o, \--output* <build script>::
 | 
			
		||||
	Write the updated file to `build script` instead of overwriting the input file.
 | 
			
		||||
 | 
			
		||||
*-n, \--newest*::
 | 
			
		||||
	Always use the newest available template file.
 | 
			
		||||
 | 
			
		||||
*\--template-dir* <dir>::
 | 
			
		||||
	Change the dir where we are looking for template files. This option may be
 | 
			
		||||
	given multiple times in which case files found in directory given last will
 | 
			
		||||
	take precedence.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Example PKGBUILD
 | 
			
		||||
----------------
 | 
			
		||||
 | 
			
		||||
	pkgname=perl-config-simple
 | 
			
		||||
	pkgver=4.58
 | 
			
		||||
	pkgrel=1
 | 
			
		||||
	pkgdesc="simple configuration file class"
 | 
			
		||||
	arch=('any')
 | 
			
		||||
	license=('PerlArtistic' 'GPL')
 | 
			
		||||
	depends=('perl')
 | 
			
		||||
	source=("http://search.cpan.org/CPAN/authors/id/S/SH/SHERZODR/Config-Simple-${pkgver}.tar.gz")
 | 
			
		||||
	md5sums=('f014aec54f0a1e2e880d317180fce502')
 | 
			
		||||
	_distname="Config-Simple"
 | 
			
		||||
 | 
			
		||||
	# template start; name=perl-module; version=1.0;
 | 
			
		||||
	_distdir="${_distname}-${pkgver}"
 | 
			
		||||
	url="https://metacpan.org/release/${_distname}"
 | 
			
		||||
	options+=('!emptydirs')
 | 
			
		||||
 | 
			
		||||
	build() {
 | 
			
		||||
		cd "$srcdir/$_distdir"
 | 
			
		||||
		perl Makefile.PL INSTALLDIRS=vendor
 | 
			
		||||
		make
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	check() {
 | 
			
		||||
		cd "$srcdir/$_distdir"
 | 
			
		||||
		make test
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	package() {
 | 
			
		||||
		cd "$srcdir/$_distdir"
 | 
			
		||||
		make DESTDIR="$pkgdir" install
 | 
			
		||||
	}
 | 
			
		||||
	# template end;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:makepkg[8], linkman:PKGBUILD[5]
 | 
			
		||||
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
makepkg(8)
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
@@ -11,7 +8,7 @@ makepkg - package build utility
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
'makepkg' [options]
 | 
			
		||||
'makepkg' [options] [ENVVAR=value] [ENVVAR+=value] ...
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
@@ -33,13 +30,9 @@ building packages. If you wish to share your build output with others when
 | 
			
		||||
seeking help or for other purposes, you may wish to run "`LC_ALL=C makepkg`" so
 | 
			
		||||
your logs and output are not localized.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*\--asroot*::
 | 
			
		||||
	Allow makepkg to run as root. This is for security purposes as it is
 | 
			
		||||
	normally dangerous to do so. This will also disable use of fakeroot and
 | 
			
		||||
	sudo.
 | 
			
		||||
 | 
			
		||||
*-A, \--ignorearch*::
 | 
			
		||||
	Ignore a missing or incomplete arch field in the build script. This is
 | 
			
		||||
	for rebuilding packages from source when the PKGBUILD may be slightly
 | 
			
		||||
@@ -49,7 +42,7 @@ Options
 | 
			
		||||
	Clean up leftover work files and directories after a successful build.
 | 
			
		||||
 | 
			
		||||
*\--config* <file>::
 | 
			
		||||
	Use an alternate config file instead of the +{sysconfdir}/makepkg.conf+
 | 
			
		||||
	Use an alternate configuration file instead of the +{sysconfdir}/makepkg.conf+
 | 
			
		||||
	default.
 | 
			
		||||
 | 
			
		||||
*-d, \--nodeps*::
 | 
			
		||||
@@ -68,7 +61,9 @@ Options
 | 
			
		||||
*\--verifysource*::
 | 
			
		||||
	For each source file in the source array of PKGBUILD, download the file
 | 
			
		||||
	if required and perform the integrity checks. No extraction or build is
 | 
			
		||||
	performed. Useful for performing subsequent offline builds.
 | 
			
		||||
	performed. Dependencies specified in the PKGBUILD will not be handled
 | 
			
		||||
	unless `--syncdeps` is used. Useful for performing subsequent offline
 | 
			
		||||
	builds.
 | 
			
		||||
 | 
			
		||||
*-f, \--force*::
 | 
			
		||||
	makepkg will not build a package if a built package already exists in
 | 
			
		||||
@@ -105,11 +100,11 @@ Options
 | 
			
		||||
	linkman:pacman[8].
 | 
			
		||||
 | 
			
		||||
*-L, \--log*::
 | 
			
		||||
	Enable makepkg build logging. This will use the *tee* program to send
 | 
			
		||||
	output of the `build()` function to both the console and to a text file in
 | 
			
		||||
	the build directory named `pkgname-pkgver-pkgrel-arch.log`. As mentioned
 | 
			
		||||
	above, the build log will be localized so you may want to set your locale
 | 
			
		||||
	accordingly if sharing the log output with others.
 | 
			
		||||
	Enable logging. This will use the *tee* program to send the output of each
 | 
			
		||||
	of the PKGBUILD functions to both the console and to a text file in the
 | 
			
		||||
	build directory named `pkgbase-pkgver-pkgrel-arch-<function>.log`.
 | 
			
		||||
	As mentioned above, the logs will be localized so you may want to set your
 | 
			
		||||
	locale accordingly if sharing the log output with others.
 | 
			
		||||
 | 
			
		||||
*-m, \--nocolor*::
 | 
			
		||||
	Disable color in output messages.
 | 
			
		||||
@@ -121,7 +116,8 @@ Options
 | 
			
		||||
 | 
			
		||||
*-p* <buildscript>::
 | 
			
		||||
	Read the package script `buildscript` instead of the `PKGBUILD` default;
 | 
			
		||||
	see linkman:PKGBUILD[5].
 | 
			
		||||
	see linkman:PKGBUILD[5]. The `buildscript` must be located in the directory
 | 
			
		||||
	makepkg is called from.
 | 
			
		||||
 | 
			
		||||
*-r, \--rmdeps*::
 | 
			
		||||
	Upon successful build, remove any dependencies installed by makepkg
 | 
			
		||||
@@ -129,8 +125,8 @@ Options
 | 
			
		||||
 | 
			
		||||
*-R, \--repackage*::
 | 
			
		||||
	Repackage contents of the package without rebuilding the package. This
 | 
			
		||||
	is useful if you forgot a depend or install file in your PKGBUILD and
 | 
			
		||||
	the build itself will not change.
 | 
			
		||||
	is useful if you forgot, for example, a dependency or install file in your
 | 
			
		||||
	PKGBUILD and the build itself will not change.
 | 
			
		||||
 | 
			
		||||
*-s, \--syncdeps*::
 | 
			
		||||
	Install missing dependencies using pacman. When build-time or run-time
 | 
			
		||||
@@ -147,24 +143,31 @@ Options
 | 
			
		||||
*-V, \--version*::
 | 
			
		||||
	Display version information.
 | 
			
		||||
 | 
			
		||||
*-C, \--cleanbuild*::
 | 
			
		||||
	Remove the $srcdir before building the package.
 | 
			
		||||
 | 
			
		||||
*\--allsource*::
 | 
			
		||||
	Do not actually build the package, but build a source-only tarball that
 | 
			
		||||
	includes all sources, including those that are normally download via
 | 
			
		||||
	includes all sources, including those that are normally downloaded via
 | 
			
		||||
	makepkg. This is useful for passing a single tarball to another program
 | 
			
		||||
	such as a chroot or remote builder. It will also satisfy requirements of
 | 
			
		||||
	the GPL when distributing binary packages.
 | 
			
		||||
 | 
			
		||||
*\--pkg* <list>::
 | 
			
		||||
	Only build listed packages from a split package. Multiple packages should
 | 
			
		||||
	be comma separated in the list. This option can be specified multiple times.
 | 
			
		||||
 | 
			
		||||
*\--check*::
 | 
			
		||||
	Run the check() function in the PKGBUILD, overriding the setting in
 | 
			
		||||
	linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
*\--noarchive*::
 | 
			
		||||
	Do not create the archive at the end of the build process. This can be
 | 
			
		||||
	useful to test the package() function or if your target distribution does
 | 
			
		||||
	not use pacman.
 | 
			
		||||
 | 
			
		||||
*\--nocheck*::
 | 
			
		||||
	Do not run the check() function in the PKGBUILD or handle the checkdepends.
 | 
			
		||||
 | 
			
		||||
*\--noprepare*::
 | 
			
		||||
	Do not run the prepare() function in the PKGBUILD.
 | 
			
		||||
 | 
			
		||||
*\--sign*::
 | 
			
		||||
	Sign the resulting package with gpg, overriding the setting in
 | 
			
		||||
	linkman:makepkg.conf[5].
 | 
			
		||||
@@ -183,16 +186,23 @@ Options
 | 
			
		||||
 | 
			
		||||
*\--needed*::
 | 
			
		||||
	(Passed to pacman) Tell pacman not to reinstall a target if it is already
 | 
			
		||||
	up to date. (used with -i / --install).
 | 
			
		||||
	up-to-date. (used with '-i' / '\--install').
 | 
			
		||||
 | 
			
		||||
*\--asdeps*::
 | 
			
		||||
	(Passed to pacman) Install packages as non-explicitly installed (used
 | 
			
		||||
	with -i / --install).
 | 
			
		||||
	with '-i' / '\--install').
 | 
			
		||||
 | 
			
		||||
*\--noprogressbar*::
 | 
			
		||||
	(Passed to pacman) Prevent pacman from displaying a progress bar;
 | 
			
		||||
	useful if you are redirecting makepkg output to file.
 | 
			
		||||
 | 
			
		||||
*\--packagelist*::
 | 
			
		||||
	List the package filenames that would be produced without building. Listed
 | 
			
		||||
	package filenames include PKGDEST and PKGEXT.
 | 
			
		||||
 | 
			
		||||
*\--printsrcinfo*::
 | 
			
		||||
	Generate and print the SRCINFO file to stdout.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Additional Features
 | 
			
		||||
-------------------
 | 
			
		||||
@@ -202,38 +212,138 @@ separate utility 'versionpkg'. See linkman:PKGBUILD[5] for details on how to
 | 
			
		||||
set up a development PKGBUILD.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Reproducibility
 | 
			
		||||
---------------
 | 
			
		||||
makepkg is designed to be compatible with
 | 
			
		||||
link:https://reproducible-builds.org/docs/[Reproducible Builds]. If the
 | 
			
		||||
**SOURCE_DATE_EPOCH** environment variable is set, it will be exported to
 | 
			
		||||
subprocesses, and source and package file modification times and package
 | 
			
		||||
metadata will be unified based on the timestamp specified.
 | 
			
		||||
 | 
			
		||||
If the **SOURCE_DATE_EPOCH** environment variable is not set, makepkg will use
 | 
			
		||||
its own start date for internal use, but will not unify source file timestamps
 | 
			
		||||
before building.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Environment Variables
 | 
			
		||||
---------------------
 | 
			
		||||
*PACMAN*::
 | 
			
		||||
**PACMAN**::
 | 
			
		||||
	The command that will be used to check for missing dependencies and to
 | 
			
		||||
	install and remove packages. Pacman's -Qq, -Rns, -S, -T, and -U
 | 
			
		||||
	install and remove packages. Pacman's '-Qq', '-Rns', '-S', '-T', and '-U'
 | 
			
		||||
	operations must be supported by this command. If the variable is not
 | 
			
		||||
	set or empty, makepkg will fall back to `pacman'.
 | 
			
		||||
 | 
			
		||||
**PKGDEST=**"/path/to/folder"::
 | 
			
		||||
	Folder where the resulting packages will be stored. Overrides the
 | 
			
		||||
**MAKEPKG_CONF=**"/path/to/file"::
 | 
			
		||||
	Use an alternate config file instead of the +{sysconfdir}/makepkg.conf+
 | 
			
		||||
	default.
 | 
			
		||||
 | 
			
		||||
**PKGDEST=**"/path/to/directory"::
 | 
			
		||||
	Directory where the resulting packages will be stored. Overrides the
 | 
			
		||||
	corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**SRCDEST=**"/path/to/folder"::
 | 
			
		||||
	Folder where the downloaded sources will be stored. Overrides the
 | 
			
		||||
**SRCDEST=**"/path/to/directory"::
 | 
			
		||||
	Directory where the downloaded sources will be stored. Overrides the
 | 
			
		||||
	corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**SRCPKGDEST=**"/path/to/directory"::
 | 
			
		||||
	Directory where source package files will be stored. Overrides the
 | 
			
		||||
	corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**LOGDEST=**"/path/to/directory"::
 | 
			
		||||
	Directory where generated log files will be stored. Overrides the
 | 
			
		||||
	corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**PACKAGER=**"John Doe <john@doe.com>"::
 | 
			
		||||
	String to identify the creator of the resulting package. Overrides
 | 
			
		||||
	the corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**BUILDDIR=**"/path/to/folder"::
 | 
			
		||||
	Folder where the package will be built. Overrides the corresponding
 | 
			
		||||
**BUILDDIR=**"/path/to/directory"::
 | 
			
		||||
	Directory where the package will be built. Overrides the corresponding
 | 
			
		||||
	value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**CARCH=**"(i686|x86_64)"::
 | 
			
		||||
	Force build for a specific architecture. Useful for cross-compiling.
 | 
			
		||||
	Overrides the corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
 | 
			
		||||
	Sets the compression used when making compiled or source packages.
 | 
			
		||||
	Overrides the corresponding value defined in linkman:makepkg.conf[5].
 | 
			
		||||
 | 
			
		||||
**GNUPGHOME=**"/path/to/directory"::
 | 
			
		||||
	Directory where the gpg keyring for signing the built package is stored.
 | 
			
		||||
 | 
			
		||||
**GPGKEY=**"keyid"::
 | 
			
		||||
	Specify a key to use when signing packages, overriding the GPGKEY setting
 | 
			
		||||
	in linkman:makepkg.conf[5]
 | 
			
		||||
 | 
			
		||||
**SOURCE_DATE_EPOCH=**"<date>"::
 | 
			
		||||
	Used for link:https://reproducible-builds.org/docs/[Reproducible Builds].
 | 
			
		||||
 | 
			
		||||
Configuration
 | 
			
		||||
-------------
 | 
			
		||||
See linkman:makepkg.conf[5] for more details on configuring makepkg using the
 | 
			
		||||
'makepkg.conf' file.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Errors
 | 
			
		||||
------
 | 
			
		||||
On exit, makepkg will return one of the following error codes.
 | 
			
		||||
 | 
			
		||||
0::
 | 
			
		||||
	Normal exit condition.
 | 
			
		||||
 | 
			
		||||
1::
 | 
			
		||||
	Unknown cause of failure.
 | 
			
		||||
 | 
			
		||||
2::
 | 
			
		||||
	Error in configuration file.
 | 
			
		||||
 | 
			
		||||
3::
 | 
			
		||||
	User specified an invalid option
 | 
			
		||||
 | 
			
		||||
4::
 | 
			
		||||
	Error in user-supplied function in PKGBUILD.
 | 
			
		||||
 | 
			
		||||
5::
 | 
			
		||||
	Failed to create a viable package.
 | 
			
		||||
 | 
			
		||||
6::
 | 
			
		||||
	A source or auxiliary file specified in the PKGBUILD is
 | 
			
		||||
	missing.
 | 
			
		||||
 | 
			
		||||
7::
 | 
			
		||||
	The PKGDIR is missing.
 | 
			
		||||
 | 
			
		||||
8::
 | 
			
		||||
	Failed to install dependencies.
 | 
			
		||||
 | 
			
		||||
9::
 | 
			
		||||
	Failed to remove dependencies.
 | 
			
		||||
 | 
			
		||||
10::
 | 
			
		||||
	User attempted to run makepkg as root.
 | 
			
		||||
 | 
			
		||||
11::
 | 
			
		||||
	User lacks permissions to build or install to a given
 | 
			
		||||
	location.
 | 
			
		||||
 | 
			
		||||
12::
 | 
			
		||||
	Error parsing PKGBUILD.
 | 
			
		||||
 | 
			
		||||
13::
 | 
			
		||||
	A package has already been built.
 | 
			
		||||
 | 
			
		||||
14::
 | 
			
		||||
	The package failed to install.
 | 
			
		||||
 | 
			
		||||
15::
 | 
			
		||||
	Programs necessary to run makepkg are missing.
 | 
			
		||||
 | 
			
		||||
16::
 | 
			
		||||
	Specified GPG key does not exist.
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:makepkg.conf[5], linkman:PKGBUILD[5], linkman:pacman[8]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
makepkg.conf(5)
 | 
			
		||||
===============
 | 
			
		||||
 | 
			
		||||
@@ -11,14 +8,14 @@ makepkg.conf - makepkg configuration file
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
{sysconfdir}/makepkg.conf, ~/.makepkg.conf
 | 
			
		||||
{sysconfdir}/makepkg.conf, $XDG_CONFIG_HOME/pacman/makepkg.conf, ~/.makepkg.conf
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
-----------
 | 
			
		||||
Configuration options for makekpg are stored in makepkg.conf. This file is
 | 
			
		||||
sourced, so you can include any special compiler flags you wish to use. This is
 | 
			
		||||
helpful for building for different architectures, or with different
 | 
			
		||||
Configuration options for makepkg are stored in makepkg.conf. This file is
 | 
			
		||||
sourced so you can include any special compiler flags you wish to use. This is
 | 
			
		||||
helpful when building for different architectures or with different
 | 
			
		||||
optimizations. However, only the variables described below are exported to the
 | 
			
		||||
build environment.
 | 
			
		||||
 | 
			
		||||
@@ -26,8 +23,9 @@ NOTE: This does not guarantee that all package Makefiles will use your exported
 | 
			
		||||
variables. Some of them are non-standard.
 | 
			
		||||
 | 
			
		||||
The system-wide configuration file is found in {sysconfdir}/makepkg.conf.
 | 
			
		||||
Individual options can be overridden (or added to) on a per user basis in
 | 
			
		||||
~/.makepkg.conf.
 | 
			
		||||
Individual options can be overridden (or added to) on a per-user basis in
 | 
			
		||||
$XDG_CONFIG_HOME/pacman/makepkg.conf or ~/.makepkg.conf, with the former
 | 
			
		||||
taking priority.
 | 
			
		||||
 | 
			
		||||
The default file is fairly well commented, so it may be easiest to simply
 | 
			
		||||
follow directions given there for customization.
 | 
			
		||||
@@ -38,25 +36,31 @@ Options
 | 
			
		||||
**DLAGENTS=(**\'protocol::/path/to/command [options]' ...**)**::
 | 
			
		||||
	Sets the download agents used to fetch source files specified with a URL in
 | 
			
		||||
	the linkman:PKGBUILD[5] file. Options can be specified for each command as
 | 
			
		||||
	well, and any protocol can have a download agent. Several examples are provided
 | 
			
		||||
	in the default makepkg.conf.
 | 
			
		||||
	well, and any protocol can have a download agent.  Any spaces in option
 | 
			
		||||
	arguments are required to be escaped to avoid being split.  Several
 | 
			
		||||
	examples are provided in the default makepkg.conf.
 | 
			
		||||
	+
 | 
			
		||||
	If present, `%u` will be replaced with the download URL. Otherwise, the
 | 
			
		||||
	download URL will be placed on the end of the command. If present, `%o` will
 | 
			
		||||
	be replaced with the local filename, plus a ``.part'' extension, which allows
 | 
			
		||||
	be replaced with the local file name, plus a ``.part'' extension, which allows
 | 
			
		||||
	makepkg to handle resuming file downloads.
 | 
			
		||||
 | 
			
		||||
**VCSCLIENTS=(**\'protocol::package' ...**)**::
 | 
			
		||||
	Sets the packages required to fetch version controlled source files. When
 | 
			
		||||
	required, makepkg will check that these packages are installed or are included
 | 
			
		||||
	in the `depends` or `makedepends` arrays in the PKGBUILD.
 | 
			
		||||
 | 
			
		||||
**CARCH=**"carch"::
 | 
			
		||||
	Specifies your computer architecture; possible values include such things
 | 
			
		||||
	as ``i686'', ``x86_64'', ``ppc'', etc. This should be automatically set on
 | 
			
		||||
	installation.
 | 
			
		||||
 | 
			
		||||
**CHOST=**"chost"::
 | 
			
		||||
	A string such as ``i686-pc-linux-gnu'', do not touch unless you know what
 | 
			
		||||
	A string such as ``i686-pc-linux-gnu''; do not touch this unless you know what
 | 
			
		||||
	you are doing. This can be commented out by most users if desired.
 | 
			
		||||
 | 
			
		||||
**CPPFLAGS=**"cppflags"::
 | 
			
		||||
	Flags used for the C preprocessor; see CFLAGS for more info.
 | 
			
		||||
	Flags used for the C preprocessor; see CFLAGS for more information.
 | 
			
		||||
 | 
			
		||||
**CFLAGS=**"cflags"::
 | 
			
		||||
	Flags used for the C compiler. This is a key part to the use of makepkg.
 | 
			
		||||
@@ -74,27 +78,24 @@ Options
 | 
			
		||||
	available linker flags.
 | 
			
		||||
 | 
			
		||||
**MAKEFLAGS=**"makeflags"::
 | 
			
		||||
	This is often used to set the number of jobs used, for example, `-j2`.
 | 
			
		||||
	This is often used to set the number of jobs used; for example, `-j2`.
 | 
			
		||||
	Other flags that make accepts can also be passed.
 | 
			
		||||
 | 
			
		||||
**DEBUG_CFLAGS=**"debug_cflags"::
 | 
			
		||||
	Additional compiler flags appended to CFLAGS for use in debugging. Usually
 | 
			
		||||
	Additional compiler flags appended to `CFLAGS` for use in debugging. Usually
 | 
			
		||||
	this would include: ``-g''. Read gcc(1) for more details on the wide
 | 
			
		||||
	variety of compiler flags available.
 | 
			
		||||
 | 
			
		||||
**DEBUG_CXXFLAGS=**"debug_cxxflags"::
 | 
			
		||||
	Debug flags used for the C++ compiler; see DEBUG_CFLAGS for more info.
 | 
			
		||||
 | 
			
		||||
**BUILDENV=(**fakeroot !distcc color !ccache check !sign**)**::
 | 
			
		||||
	This array contains options that affect the build environment, the defaults
 | 
			
		||||
**BUILDENV=(**!distcc !color !ccache check !sign**)**::
 | 
			
		||||
	This array contains options that affect the build environment; the defaults
 | 
			
		||||
	are shown here. All options should always be left in the array; to enable
 | 
			
		||||
	or disable an option simply remove or place an ``!'' at the front of the
 | 
			
		||||
	or disable an option, simply remove or add an ``!'' at the front of the
 | 
			
		||||
	option. If an option is specified multiple times, the final value takes
 | 
			
		||||
	precedence. Each option works as follows:
 | 
			
		||||
 | 
			
		||||
	*fakeroot*;;
 | 
			
		||||
		Allow building packages as a non-root user. This is highly recommended.
 | 
			
		||||
 | 
			
		||||
	*distcc*;;
 | 
			
		||||
		Use the distributed C/C++/ObjC compiler to spread compilation among
 | 
			
		||||
		multiple machines. If this is enabled, `DISTCC_HOSTS` must be specified
 | 
			
		||||
@@ -112,13 +113,13 @@ Options
 | 
			
		||||
	*check*;;
 | 
			
		||||
		Run the check() function if present in the PKGBUILD. This can be
 | 
			
		||||
		enabled or disabled for individual packages through the use of
 | 
			
		||||
		makepkg's '\--check' and '\--nocheck' options respectively.
 | 
			
		||||
		makepkg's '\--check' and '\--nocheck' options, respectively.
 | 
			
		||||
 | 
			
		||||
	*sign*;;
 | 
			
		||||
		Generate a PGP signature file using GnuPG. This will execute `gpg
 | 
			
		||||
		--detach-sign --use-agent` on the built package to generate a detached
 | 
			
		||||
		signature file, using the GPG agent if it is available. The signature
 | 
			
		||||
		file will be the entire filename of the package with a ``.sig''
 | 
			
		||||
		Generate a PGP signature file using GnuPG. This will execute 'gpg
 | 
			
		||||
		\--detach-sign \--use-agent' on the built package to generate a detached
 | 
			
		||||
		signature file, using the GPG agent, if it is available. The signature
 | 
			
		||||
		file will be the entire file name of the package with a ``.sig''
 | 
			
		||||
		extension.
 | 
			
		||||
 | 
			
		||||
**DISTCC_HOSTS=**"host1 ..."::
 | 
			
		||||
@@ -126,23 +127,22 @@ Options
 | 
			
		||||
	running in the DistCC cluster. In addition, you will want to modify your
 | 
			
		||||
	`MAKEFLAGS`.
 | 
			
		||||
 | 
			
		||||
**BUILDDIR=**"/path/to/folder"::
 | 
			
		||||
	If this value is not set, packages will by default be built in
 | 
			
		||||
	subdirectories of the directory that makepkg is called from.  This
 | 
			
		||||
	option allows setting the build location to another folder.
 | 
			
		||||
**BUILDDIR=**"/path/to/directory"::
 | 
			
		||||
	If this value is not set, packages will, by default, be built in
 | 
			
		||||
	subdirectories of the directory that makepkg is called from. This
 | 
			
		||||
	option allows setting the build location to another directory.
 | 
			
		||||
	Incorrect use of `$startdir` in a PKGBUILD may cause building with
 | 
			
		||||
	this option to fail.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
**GPGKEY=**""::
 | 
			
		||||
	Specify a key to use for gpg signing instead of the default key in the
 | 
			
		||||
	Specify a key to use for GPG signing instead of the default key in the
 | 
			
		||||
	keyring. Can be overridden with makepkg's '\--key' option.
 | 
			
		||||
 | 
			
		||||
**OPTIONS=(**strip docs libtool staticlibs emptydirs zipman purge !upx**)**::
 | 
			
		||||
	This array contains options that affect the default packaging. They are
 | 
			
		||||
**OPTIONS=(**!strip docs libtool staticlibs emptydirs !zipman !purge !debug**)**::
 | 
			
		||||
	This array contains options that affect default packaging. They are
 | 
			
		||||
	equivalent to options that can be placed in the PKGBUILD; the defaults are
 | 
			
		||||
	shown here. All options should always be left in the array; to enable or
 | 
			
		||||
	disable an option simply remove or place an ``!'' at the front of the
 | 
			
		||||
	disable an option, simply remove or add an ``!'' at the front of the
 | 
			
		||||
	option. If an option is specified multiple times, the final value takes
 | 
			
		||||
	precedence. Each option works as follows:
 | 
			
		||||
 | 
			
		||||
@@ -162,7 +162,7 @@ Options
 | 
			
		||||
 | 
			
		||||
	*staticlibs*;;
 | 
			
		||||
		Leave static library (.a) files in packages. Specify `!staticlibs` to
 | 
			
		||||
		remove them.
 | 
			
		||||
		remove them, if they have a shared counterpart.
 | 
			
		||||
 | 
			
		||||
	*emptydirs*;;
 | 
			
		||||
		Leave empty directories in packages.
 | 
			
		||||
@@ -175,10 +175,6 @@ Options
 | 
			
		||||
		Remove files specified by the `PURGE_TARGETS` variable from the
 | 
			
		||||
		package.
 | 
			
		||||
 | 
			
		||||
	*upx*;;
 | 
			
		||||
		Compress binary executable files using UPX.  Additional options
 | 
			
		||||
		can be passed to UPX by specifying the `UPXFLAGS` variable.
 | 
			
		||||
 | 
			
		||||
	*debug*;;
 | 
			
		||||
		Add the user-specified debug flags as specified in DEBUG_CFLAGS and
 | 
			
		||||
		DEBUG_CXXFLAGS to their counterpart buildflags. Creates a separate
 | 
			
		||||
@@ -187,62 +183,68 @@ Options
 | 
			
		||||
**INTEGRITY_CHECK=(**check1 ...**)**::
 | 
			
		||||
	File integrity checks to use. Multiple checks may be specified; this
 | 
			
		||||
	affects both generation and checking. The current valid options are:
 | 
			
		||||
	`md5`, `sha1`, `sha256`, `sha384`, and `sha512`.
 | 
			
		||||
	`md5`, `sha1`, `sha224`, `sha256`, `sha384`, and `sha512`.
 | 
			
		||||
 | 
			
		||||
**STRIP_BINARIES=**"--strip-all"::
 | 
			
		||||
	Options to be used when stripping binaries. See linkman:strip[1]
 | 
			
		||||
	for details.
 | 
			
		||||
 | 
			
		||||
**STRIP_SHARED=**"--strip-unneeded"::
 | 
			
		||||
	Options to be used when stripping shared libraries. See linkman:strip[1]
 | 
			
		||||
	for details.
 | 
			
		||||
	Options to be used when stripping shared libraries or PIE executables.
 | 
			
		||||
	See linkman:strip[1] for details.
 | 
			
		||||
 | 
			
		||||
**STRIP_STATIC=**"--strip-debug"::
 | 
			
		||||
	Options to be used when stripping static libraries. See  linkman:strip[1]
 | 
			
		||||
	Options to be used when stripping static libraries. See linkman:strip[1]
 | 
			
		||||
	for details.
 | 
			
		||||
 | 
			
		||||
**MAN_DIRS=(**{usr{,/local}{,/share},opt/*}/{man,info} ...**)**::
 | 
			
		||||
	If `zipman` is specified in the OPTIONS array, this variable will
 | 
			
		||||
	If `zipman` is specified in the `OPTIONS` array, this variable will
 | 
			
		||||
	instruct makepkg where to look to compress manual (man and info)
 | 
			
		||||
	pages. If you build packages that are located in opt/, you may need
 | 
			
		||||
	to add the directory to this array. *NOTE:* Do not add the leading
 | 
			
		||||
	slash to the directory name.
 | 
			
		||||
 | 
			
		||||
**DOC_DIRS=(**usr/{,share/}{doc,gtk-doc} ...**)**::
 | 
			
		||||
	If `!docs` is specified in the OPTIONS array, this variable will
 | 
			
		||||
	If `!docs` is specified in the `OPTIONS` array, this variable will
 | 
			
		||||
	instruct makepkg where to look to remove docs. If you build packages
 | 
			
		||||
	that are located in opt/, you may need to add the directory to this
 | 
			
		||||
	array. *NOTE:* Do not add the leading slash to the directory name.
 | 
			
		||||
 | 
			
		||||
**PURGE_TARGETS=(**usr/{,share}/info/dir .podlist *.pod...**)**::
 | 
			
		||||
	If `purge` is specified in the OPTIONS array, this variable will
 | 
			
		||||
	If `purge` is specified in the `OPTIONS` array, this variable will
 | 
			
		||||
	instruct makepkg which files to remove from the package. This is
 | 
			
		||||
	useful for index files that are added by multiple packages.
 | 
			
		||||
 | 
			
		||||
**PKGDEST=**"/path/to/folder"::
 | 
			
		||||
	If this value is not set, packages will by default be placed in the
 | 
			
		||||
**DBGSRCDIR=**"/usr/src/debug"::
 | 
			
		||||
	If `strip` and `debug` are specified in the `OPTIONS` array, this variable
 | 
			
		||||
	will instruct makepkg where to place source files for installed binaries.
 | 
			
		||||
	The binaries will be modified to link this directory for the debugger
 | 
			
		||||
	search path.
 | 
			
		||||
 | 
			
		||||
**PKGDEST=**"/path/to/directory"::
 | 
			
		||||
	If this value is not set, packages will, by default, be placed in the
 | 
			
		||||
	current directory (location of the linkman:PKGBUILD[5]). Many people
 | 
			
		||||
	like to keep all their packages in one place so this option allows
 | 
			
		||||
	this behavior. A common location is ``/home/packages''.
 | 
			
		||||
	for this behavior. A common location is ``/home/packages''.
 | 
			
		||||
 | 
			
		||||
**SRCDEST=**"/path/to/folder"::
 | 
			
		||||
**SRCDEST=**"/path/to/directory"::
 | 
			
		||||
	If this value is not set, downloaded source files will only be stored
 | 
			
		||||
	in the current directory. Many people like to keep all source files in
 | 
			
		||||
	a central location for easy cleanup, so this path can be set here.
 | 
			
		||||
 | 
			
		||||
**SRCPKGDEST=**"/path/to/folder"::
 | 
			
		||||
**SRCPKGDEST=**"/path/to/directory"::
 | 
			
		||||
	If this value is not set, source package files will be stored in
 | 
			
		||||
	in the current directory. Many people like to keep all source package files
 | 
			
		||||
	in a central location for easy cleanup, so this path can be set here.
 | 
			
		||||
 | 
			
		||||
**LOGDEST=**"/path/to/folder"::
 | 
			
		||||
**LOGDEST=**"/path/to/directory"::
 | 
			
		||||
	If this value is not set, log files are written to the current
 | 
			
		||||
	directory. This centralizes the log location, facilitating cleanup
 | 
			
		||||
	and compression.
 | 
			
		||||
 | 
			
		||||
**PACKAGER=**"John Doe <john@example.com>"::
 | 
			
		||||
	This value is used when querying a package to see who was the builder.
 | 
			
		||||
	It is recommended you change this to your name and email address.
 | 
			
		||||
	It is recommended to change this to your name and email address.
 | 
			
		||||
 | 
			
		||||
**COMPRESSGZ=**"(gzip -c -f -n)"::
 | 
			
		||||
**COMPRESSBZ2=**"(bzip2 -c -f)"::
 | 
			
		||||
@@ -254,13 +256,14 @@ Options
 | 
			
		||||
	packages in the named format.
 | 
			
		||||
 | 
			
		||||
**PKGEXT=**".pkg.tar.gz", **SRCEXT=**".src.tar.gz"::
 | 
			
		||||
	Sets the compression used when making compiled or source packages. The
 | 
			
		||||
	current valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`,
 | 
			
		||||
	`.tar.lzo`, `.tar.lrz` and `.tar.Z`.
 | 
			
		||||
	Sets the compression used when making compiled or source packages.
 | 
			
		||||
	Valid suffixes are `.tar`, `.tar.gz`, `.tar.bz2`, `.tar.xz`,
 | 
			
		||||
	`.tar.lzo`, `.tar.lrz`, and `.tar.Z`.
 | 
			
		||||
	Do not touch these unless you know what you are doing.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:makepkg[8], linkman:pacman[8], linkman:PKGBUILD[5]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
pacman-key(8)
 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +27,7 @@ Invoking pacman-key consists of supplying an operation with any potential
 | 
			
		||||
options and targets to operate on. Depending on the operation, a 'target' may
 | 
			
		||||
be a valid key identifier, filename, or directory.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Operations
 | 
			
		||||
----------
 | 
			
		||||
*-a, \--add*::
 | 
			
		||||
@@ -101,10 +99,11 @@ Operations
 | 
			
		||||
*-v, \--verify*::
 | 
			
		||||
	Verify the file(s) specified by the signature(s).
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*\--config* <file>::
 | 
			
		||||
	Use an alternate config file instead of the +{sysconfdir}/pacman.conf+
 | 
			
		||||
	Use an alternate configuration file instead of the +{sysconfdir}/pacman.conf+
 | 
			
		||||
	default.
 | 
			
		||||
 | 
			
		||||
*\--gpgdir* <dir>::
 | 
			
		||||
@@ -143,4 +142,4 @@ See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman[8], linkman:pacman.conf[5]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
pacman(8)
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
@@ -13,38 +10,39 @@ Synopsis
 | 
			
		||||
--------
 | 
			
		||||
'pacman' <operation> [options] [targets]
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
-----------
 | 
			
		||||
Pacman is a package management utility that tracks installed packages on a Linux
 | 
			
		||||
system. It features dependency support, package groups, install and uninstall
 | 
			
		||||
hooks, and the ability to sync your local machine with a remote ftp server to
 | 
			
		||||
scripts, and the ability to sync your local machine with a remote repository to
 | 
			
		||||
automatically upgrade packages. Pacman packages are a zipped tar format.
 | 
			
		||||
 | 
			
		||||
Since version 3.0.0, pacman has been the frontend to linkman:libalpm[3], the
 | 
			
		||||
Since version 3.0.0, pacman has been the front-end to linkman:libalpm[3], the
 | 
			
		||||
``Arch Linux Package Management'' library. This library allows alternative
 | 
			
		||||
front ends to be written (for instance, a GUI front end).
 | 
			
		||||
front-ends to be written (for instance, a GUI front-end).
 | 
			
		||||
 | 
			
		||||
Invoking pacman involves specifying an operation with any potential options and
 | 
			
		||||
targets to operate on. A 'target' is usually a package name, filename, URL, or
 | 
			
		||||
targets to operate on. A 'target' is usually a package name, file name, URL, or
 | 
			
		||||
a search string. Targets can be provided as command line arguments.
 | 
			
		||||
Additionally, if stdin is not from a terminal and a single dash (-) is passed
 | 
			
		||||
Additionally, if stdin is not from a terminal and a single hyphen (-) is passed
 | 
			
		||||
as an argument, targets will be read from stdin.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Operations
 | 
			
		||||
----------
 | 
			
		||||
*-D, \--database*::
 | 
			
		||||
	Modify the package database. This operation allows you to modify certain
 | 
			
		||||
	attributes of the installed packages in pacman's database. At the
 | 
			
		||||
	moment, you can only change the install reason using '\--asdeps' and
 | 
			
		||||
	'\--asexplicit' options.
 | 
			
		||||
	Operate on the package database. This operation allows you to modify
 | 
			
		||||
	certain attributes of the installed packages in pacman's database. It
 | 
			
		||||
	also allows you to check the databases for internal consistency.
 | 
			
		||||
	See <<DO,Database Options>> below.
 | 
			
		||||
 | 
			
		||||
*-Q, \--query*::
 | 
			
		||||
	Query the package database. This operation allows you to view installed
 | 
			
		||||
	packages and their files, as well as meta-information about individual
 | 
			
		||||
	packages (dependencies, conflicts, install date, build date, size). This
 | 
			
		||||
	can be run against the local package database or can be used on
 | 
			
		||||
	individual '.tar.gz' packages. In the first case, if no package names
 | 
			
		||||
	individual package files. In the first case, if no package names
 | 
			
		||||
	are provided in the command line, all installed packages will be
 | 
			
		||||
	queried. Additionally, various filters can be applied on the package
 | 
			
		||||
	list. See <<QO,Query Options>> below.
 | 
			
		||||
@@ -58,19 +56,19 @@ Operations
 | 
			
		||||
	See <<RO,Remove Options>> below.
 | 
			
		||||
 | 
			
		||||
*-S, \--sync*::
 | 
			
		||||
	Synchronize packages. Packages are installed directly from the ftp
 | 
			
		||||
	servers, including all dependencies required to run the packages. For
 | 
			
		||||
	Synchronize packages. Packages are installed directly from the remote
 | 
			
		||||
	repositories, including all dependencies required to run the packages. For
 | 
			
		||||
	example, `pacman -S qt` will download and install qt and all the
 | 
			
		||||
	packages it depends on. If a package name exists in more than one repo, the
 | 
			
		||||
	repo can be explicitly specified to clarify the package to install:
 | 
			
		||||
	`pacman -S testing/qt`. You can also specify version requirements:
 | 
			
		||||
	`pacman -S "bash>=3.2"`. (Quotes are needed, otherwise your shell
 | 
			
		||||
	interprets ">" as redirection to file.)
 | 
			
		||||
	packages it depends on. If a package name exists in more than one
 | 
			
		||||
	repository, the repository can be explicitly specified to clarify the
 | 
			
		||||
	package to install: `pacman -S testing/qt`. You can also specify version
 | 
			
		||||
	requirements: `pacman -S "bash>=3.2"`. Quotes are needed, otherwise the
 | 
			
		||||
	shell interprets ">" as redirection to a file.
 | 
			
		||||
+
 | 
			
		||||
In addition to packages, groups can be specified as well. For example, if
 | 
			
		||||
gnome is a defined package group, then `pacman -S gnome` will provide a
 | 
			
		||||
prompt allowing you to select which packages to install from a numbered list.
 | 
			
		||||
The package selection is specified using a space and/or comma separated list of
 | 
			
		||||
The package selection is specified using a space- and/or comma-separated list of
 | 
			
		||||
package numbers. Sequential packages may be selected by specifying the first
 | 
			
		||||
and last package numbers separated by a hyphen (`-`). Excluding packages is
 | 
			
		||||
achieved by prefixing a number or range of numbers with a caret (`^`).
 | 
			
		||||
@@ -81,7 +79,7 @@ provide the same functionality as foo will be searched for. If any package is
 | 
			
		||||
found, it will be installed. A selection prompt is provided if multiple packages
 | 
			
		||||
providing foo are found.
 | 
			
		||||
+
 | 
			
		||||
You can also use `pacman -Su` to upgrade all packages that are out of date. See
 | 
			
		||||
You can also use `pacman -Su` to upgrade all packages that are out-of-date. See
 | 
			
		||||
<<SO,Sync Options>> below. When upgrading, pacman performs version comparison
 | 
			
		||||
to determine which packages need upgrading. This behavior operates as follows:
 | 
			
		||||
 | 
			
		||||
@@ -91,7 +89,7 @@ to determine which packages need upgrading. This behavior operates as follows:
 | 
			
		||||
    1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
 | 
			
		||||
+
 | 
			
		||||
Additionally, version strings can have an 'epoch' value defined that will
 | 
			
		||||
overrule any version comparison (unless the epoch values are equal). This is
 | 
			
		||||
overrule any version comparison, unless the epoch values are equal. This is
 | 
			
		||||
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
 | 
			
		||||
greater than `1:3.6-1`.
 | 
			
		||||
 | 
			
		||||
@@ -104,35 +102,43 @@ greater than `1:3.6-1`.
 | 
			
		||||
 | 
			
		||||
*-U, \--upgrade*::
 | 
			
		||||
	Upgrade or add package(s) to the system and install the required
 | 
			
		||||
	dependencies from sync repos. Either a URL or file path can be
 | 
			
		||||
	dependencies from sync repositories. Either a URL or file path can be
 | 
			
		||||
	specified. This is a ``remove-then-add'' process. See <<UO,Upgrade
 | 
			
		||||
	Options>> below; also see <<HCF,Handling Config Files>> for an explanation
 | 
			
		||||
	on how pacman takes care of config files.
 | 
			
		||||
	on how pacman takes care of configuration files.
 | 
			
		||||
 | 
			
		||||
*-F, \--files*::
 | 
			
		||||
	Query the files database. This operation allows you to look for packages
 | 
			
		||||
	owning certain files or display files owned by certain packages. Only
 | 
			
		||||
	packages that are part of your sync databases are searched. See
 | 
			
		||||
	<<FO,File Options>> below.
 | 
			
		||||
 | 
			
		||||
*-V, \--version*::
 | 
			
		||||
	Display version and exit.
 | 
			
		||||
 | 
			
		||||
*-h, \--help*::
 | 
			
		||||
	Display syntax for the given operation. If no operation was supplied
 | 
			
		||||
	Display syntax for the given operation. If no operation was supplied,
 | 
			
		||||
	then the general syntax is shown.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*-b, \--dbpath* <path>::
 | 
			
		||||
	Specify an alternative database location (a typical default is
 | 
			
		||||
	+{localstatedir}/lib/pacman+). This should not be used unless you know what you are
 | 
			
		||||
	doing. *NOTE*: if specified, this is an absolute path and the root path is
 | 
			
		||||
	Specify an alternative database location (the default is
 | 
			
		||||
	+{localstatedir}/lib/pacman+). This should not be used unless you know what
 | 
			
		||||
	you are doing.
 | 
			
		||||
	*NOTE*: If specified, this is an absolute path, and the root path is
 | 
			
		||||
	not automatically prepended.
 | 
			
		||||
 | 
			
		||||
*-r, \--root* <path>::
 | 
			
		||||
	Specify an alternative installation root (default is `/`). This should
 | 
			
		||||
	not be used as a way to install software into `/usr/local` instead of
 | 
			
		||||
	`/usr`. This option is used if you want to install a package on a
 | 
			
		||||
	temporary mounted partition that is "owned" by another system.
 | 
			
		||||
	*NOTE*: if database path or logfile are not specified on either the
 | 
			
		||||
	`/usr`.
 | 
			
		||||
	*NOTE*: If database path or log file are not specified on either the
 | 
			
		||||
	command line or in linkman:pacman.conf[5], their default location will
 | 
			
		||||
	be inside this root path.
 | 
			
		||||
	*NOTE*: This option is not suitable for performing operations on a mounted
 | 
			
		||||
	guest system. See '\--sysroot' instead.
 | 
			
		||||
 | 
			
		||||
*-v, \--verbose*::
 | 
			
		||||
	Output paths such as as the Root, Conf File, DB Path, Cache Dirs, etc.
 | 
			
		||||
@@ -141,15 +147,16 @@ Options
 | 
			
		||||
	Specify an alternate architecture.
 | 
			
		||||
 | 
			
		||||
*\--cachedir* <dir>::
 | 
			
		||||
	Specify an alternative package cache location (a typical default is
 | 
			
		||||
	+{localstatedir}/cache/pacman/pkg+). Multiple cache directories can be specified,
 | 
			
		||||
	and they are tried in the order they are passed to pacman. *NOTE*: this
 | 
			
		||||
	is an absolute path, the root path is not automatically prepended.
 | 
			
		||||
	Specify an alternative package cache location (the default is
 | 
			
		||||
	+{localstatedir}/cache/pacman/pkg+). Multiple cache directories can be
 | 
			
		||||
	specified, and they are tried in the order they are passed to pacman.
 | 
			
		||||
	*NOTE*: This is an absolute path, and the root path is not automatically
 | 
			
		||||
	prepended.
 | 
			
		||||
 | 
			
		||||
*\--color* <when>::
 | 
			
		||||
	Specify when to enable coloring, can be 'always', 'never' or 'auto'.  Always
 | 
			
		||||
	forces colours on, never forces colours off, and auto only automatically enables
 | 
			
		||||
	colours when outputting onto a tty.
 | 
			
		||||
	Specify when to enable coloring. Valid options are 'always', 'never', or
 | 
			
		||||
	'auto'. 'always' forces colors on; 'never' forces colors off; and 'auto' only
 | 
			
		||||
	automatically enables colors when outputting onto a tty.
 | 
			
		||||
 | 
			
		||||
*\--config* <file>::
 | 
			
		||||
	Specify an alternate configuration file.
 | 
			
		||||
@@ -159,12 +166,19 @@ Options
 | 
			
		||||
	to be used.
 | 
			
		||||
 | 
			
		||||
*\--gpgdir* <dir>::
 | 
			
		||||
	Specify a directory of files used by GnuPG to verify package signatures (a
 | 
			
		||||
	typical default is +{sysconfdir}/pacman.d/gnupg+). This directory should contain
 | 
			
		||||
	Specify a directory of files used by GnuPG to verify package signatures
 | 
			
		||||
	(the default is +{sysconfdir}/pacman.d/gnupg+). This directory should contain
 | 
			
		||||
	two files: `pubring.gpg` and `trustdb.gpg`. `pubring.gpg` holds the public keys
 | 
			
		||||
	of all packagers. `trustdb.gpg` contains a so-called trust database, which
 | 
			
		||||
	specifies that the keys are authentic and trusted. *NOTE*: this is an absolute
 | 
			
		||||
	path, the root path is not automatically prepended.
 | 
			
		||||
	specifies that the keys are authentic and trusted. *NOTE*: This is an absolute
 | 
			
		||||
	path, and the root path is not automatically prepended.
 | 
			
		||||
 | 
			
		||||
*\--hookdir* <dir>::
 | 
			
		||||
	Specify a alternative directory containing hook files (the default is
 | 
			
		||||
	+{sysconfdir}/pacman.d/hooks+). Multiple hook directories can be specified
 | 
			
		||||
	with hooks in later directories taking precedence over hooks in earlier
 | 
			
		||||
	directories. *NOTE*: This is an absolute path, and the root path is not
 | 
			
		||||
	automatically prepended.
 | 
			
		||||
 | 
			
		||||
*\--logfile* <file>::
 | 
			
		||||
	Specify an alternate log file. This is an absolute path, regardless of
 | 
			
		||||
@@ -174,6 +188,20 @@ Options
 | 
			
		||||
	Bypass any and all ``Are you sure?'' messages. It's not a good idea to do
 | 
			
		||||
	this unless you want to run pacman from a script.
 | 
			
		||||
 | 
			
		||||
*\--confirm*::
 | 
			
		||||
	Cancels the effects of a previous '\--noconfirm'.
 | 
			
		||||
 | 
			
		||||
*\--disable-download-timeout*::
 | 
			
		||||
	Disable defaults for low speed limit and timeout on downloads. Use this
 | 
			
		||||
	if you have issues downloading files with proxy and/or security gateway.
 | 
			
		||||
 | 
			
		||||
*\--sysroot* <dir>::
 | 
			
		||||
	Specify an alternative system root.  Pacman will chroot and chdir into the
 | 
			
		||||
	system root prior to running. This allows mounted guest systems to be
 | 
			
		||||
	properly operated on. Any other paths given will be interpreted as relative
 | 
			
		||||
	to the system root. Requires root privileges.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Transaction Options (apply to '-S', '-R' and '-U')
 | 
			
		||||
--------------------------------------------------
 | 
			
		||||
*-d, \--nodeps*::
 | 
			
		||||
@@ -182,8 +210,14 @@ Transaction Options (apply to '-S', '-R' and '-U')
 | 
			
		||||
	dependencies are installed and there are no package conflicts in the
 | 
			
		||||
	system. Specify this option twice to skip all dependency checks.
 | 
			
		||||
 | 
			
		||||
*\--assume-installed* <package=version>::
 | 
			
		||||
	Add a virtual package "package" with version "version" to the transaction
 | 
			
		||||
	to satisfy dependencies. This allows to disable specific dependency checks
 | 
			
		||||
	without affecting all dependency checks. To disable all dependency
 | 
			
		||||
	checking, see the '\--nodeps' option.
 | 
			
		||||
 | 
			
		||||
*\--dbonly*::
 | 
			
		||||
	Adds/Removes the database entry only, leaves all files in place.
 | 
			
		||||
	Adds/removes the database entry only, leaving all files in place.
 | 
			
		||||
 | 
			
		||||
*\--noprogressbar*::
 | 
			
		||||
	Do not show a progress bar when downloading files. This can be useful
 | 
			
		||||
@@ -197,27 +231,20 @@ Transaction Options (apply to '-S', '-R' and '-U')
 | 
			
		||||
	Only print the targets instead of performing the actual operation (sync,
 | 
			
		||||
	remove or upgrade). Use '\--print-format' to specify how targets are
 | 
			
		||||
	displayed. The default format string is "%l", which displays URLs with
 | 
			
		||||
	'-S', filenames with '-U' and pkgname-pkgver with '-R'.
 | 
			
		||||
	'-S', file names with '-U', and pkgname-pkgver with '-R'.
 | 
			
		||||
 | 
			
		||||
*\--print-format* <format>::
 | 
			
		||||
	Specify a printf-like format to control the output of the '\--print'
 | 
			
		||||
	operation. The possible attributes are: %n for pkgname, %v for pkgver,
 | 
			
		||||
	%l for location, %r for repo and %s for size.
 | 
			
		||||
	operation. The possible attributes are: "%n" for pkgname, "%v" for pkgver,
 | 
			
		||||
	"%l" for location, "%r" for repository, and "%s" for size. Implies '\--print'.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Upgrade Options (apply to '-S' and '-U')[[UO]]
 | 
			
		||||
--------------------------------------------
 | 
			
		||||
*\--force*::
 | 
			
		||||
	Bypass file conflict checks and overwrite conflicting files. If the
 | 
			
		||||
	package that is about to be installed contains files that are already
 | 
			
		||||
	installed, this option will cause all those files to be overwritten.
 | 
			
		||||
	Using '--force' will not allow overwriting a directory with a file or
 | 
			
		||||
	installing packages with conflicting files and directories.
 | 
			
		||||
	This option should be used with care, ideally not at all.
 | 
			
		||||
 | 
			
		||||
----------------------------------------------
 | 
			
		||||
*\--asdeps*::
 | 
			
		||||
	Install packages non-explicitly; in other words, fake their install reason
 | 
			
		||||
	to be installed as a dependency. This is useful for makepkg and other
 | 
			
		||||
	build from source tools that need to install dependencies before building
 | 
			
		||||
	build-from-source tools that need to install dependencies before building
 | 
			
		||||
	the package.
 | 
			
		||||
 | 
			
		||||
*\--asexplicit*::
 | 
			
		||||
@@ -232,16 +259,28 @@ Upgrade Options (apply to '-S' and '-U')[[UO]]
 | 
			
		||||
	with a comma.
 | 
			
		||||
 | 
			
		||||
*\--ignoregroup* <group>::
 | 
			
		||||
	Directs pacman to ignore upgrades of all packages in 'group' even if
 | 
			
		||||
	Directs pacman to ignore upgrades of all packages in 'group', even if
 | 
			
		||||
	there is one available. Multiple groups can be specified by
 | 
			
		||||
	separating them with a comma.
 | 
			
		||||
 | 
			
		||||
*\--needed*::
 | 
			
		||||
	Do not reinstall the targets that are already up to date.
 | 
			
		||||
	Do not reinstall the targets that are already up-to-date.
 | 
			
		||||
 | 
			
		||||
*\--overwrite* <glob>::
 | 
			
		||||
	Bypass file conflict checks and overwrite conflicting files. If the
 | 
			
		||||
	package that is about to be installed contains files that are already
 | 
			
		||||
	installed and match 'glob', this option will cause all those files to be
 | 
			
		||||
	overwritten.  Using '\--overwrite' will not allow overwriting a directory
 | 
			
		||||
	with a file or installing packages with conflicting files and directories.
 | 
			
		||||
	Multiple patterns can be specified by separating them with a comma. May be
 | 
			
		||||
	specified multiple times.  Patterns can be negated, such that files
 | 
			
		||||
	matching them will not be overwritten, by prefixing them with an
 | 
			
		||||
	exclamation mark. Subsequent matches will override previous ones. A leading
 | 
			
		||||
	literal exclamation mark or backslash needs to be escaped.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Query Options[[QO]]
 | 
			
		||||
-------------------
 | 
			
		||||
Query Options (apply to '-Q')[[QO]]
 | 
			
		||||
-----------------------------------
 | 
			
		||||
*-c, \--changelog*::
 | 
			
		||||
	View the ChangeLog of a package if it exists.
 | 
			
		||||
 | 
			
		||||
@@ -266,11 +305,11 @@ Query Options[[QO]]
 | 
			
		||||
	'\--info' or '-i' flags will also display the list of backup files and
 | 
			
		||||
	their modification states.
 | 
			
		||||
 | 
			
		||||
*-k \--check*::
 | 
			
		||||
*-k, \--check*::
 | 
			
		||||
	Check that all files owned by the given package(s) are present on the
 | 
			
		||||
	system. If packages are not specified or filter flags are not provided,
 | 
			
		||||
	check all installed packages.  Specifying this option twice will perform
 | 
			
		||||
	more detailed file checking (including permissions, file sizes and
 | 
			
		||||
	check all installed packages. Specifying this option twice will perform
 | 
			
		||||
	more detailed file checking (including permissions, file sizes, and
 | 
			
		||||
	modification times) for packages that contain the needed mtree file.
 | 
			
		||||
 | 
			
		||||
*-l, \--list*::
 | 
			
		||||
@@ -279,16 +318,16 @@ Query Options[[QO]]
 | 
			
		||||
 | 
			
		||||
*-m, \--foreign*::
 | 
			
		||||
	Restrict or filter output to packages that were not found in the sync
 | 
			
		||||
	database(s).  Typically these are packages that were downloaded manually
 | 
			
		||||
	database(s). Typically these are packages that were downloaded manually
 | 
			
		||||
	and installed with '\--upgrade'.
 | 
			
		||||
 | 
			
		||||
*-n, \--native*::
 | 
			
		||||
	Restrict or filter output to packages that are found in the sync
 | 
			
		||||
	database(s).  This is the inverse filter of '\--foreign'.
 | 
			
		||||
	database(s). This is the inverse filter of '\--foreign'.
 | 
			
		||||
 | 
			
		||||
*-o, \--owns* <file>::
 | 
			
		||||
	Search for packages that own the specified file(s). The path can be
 | 
			
		||||
	relative or absolute and one or more files can be specified.
 | 
			
		||||
	relative or absolute, and one or more files can be specified.
 | 
			
		||||
 | 
			
		||||
*-p, \--file*::
 | 
			
		||||
	Signifies that the package supplied on the command line is a file and
 | 
			
		||||
@@ -296,8 +335,8 @@ Query Options[[QO]]
 | 
			
		||||
	This is useful in combination with '\--info' and '\--list'.
 | 
			
		||||
 | 
			
		||||
*-q, \--quiet*::
 | 
			
		||||
	Show less information for certain query operations. (This is useful when
 | 
			
		||||
	pacman's output is processed in a script.) Search will only show package
 | 
			
		||||
	Show less information for certain query operations. This is useful when
 | 
			
		||||
	pacman's output is processed in a script. Search will only show package
 | 
			
		||||
	names and not version, group, and description information; owns will
 | 
			
		||||
	only show package names instead of "file is owned by pkg" messages; group
 | 
			
		||||
	will only show package names and omit group names; list will only show
 | 
			
		||||
@@ -311,33 +350,35 @@ Query Options[[QO]]
 | 
			
		||||
	with descriptions matching ALL of those terms are returned.
 | 
			
		||||
 | 
			
		||||
*-t, \--unrequired*::
 | 
			
		||||
	Restrict or filter output to packages not required by any currently
 | 
			
		||||
	installed package.
 | 
			
		||||
	Restrict or filter output to print only packages neither required nor
 | 
			
		||||
	optionally required by any currently installed package. Specify this
 | 
			
		||||
	option twice to include packages which are optionally, but not directly,
 | 
			
		||||
	required by another package.
 | 
			
		||||
 | 
			
		||||
*-u, \--upgrades*::
 | 
			
		||||
	Restrict or filter output to packages that are out of date on the local
 | 
			
		||||
	system. (Only package versions are used to find outdated packages,
 | 
			
		||||
	replacements are not checked here.) This option works best if the sync
 | 
			
		||||
	Restrict or filter output to packages that are out-of-date on the local
 | 
			
		||||
	system. Only package versions are used to find outdated packages;
 | 
			
		||||
	replacements are not checked here. This option works best if the sync
 | 
			
		||||
	database is refreshed using '-Sy'.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Remove Options[[RO]]
 | 
			
		||||
--------------------
 | 
			
		||||
Remove Options (apply to '-R')[[RO]]
 | 
			
		||||
------------------------------------
 | 
			
		||||
*-c, \--cascade*::
 | 
			
		||||
	Remove all target packages, as well as all packages that depend on one
 | 
			
		||||
	or more target packages. This operation is recursive, and must be used
 | 
			
		||||
	with care since it can remove many potentially needed packages.
 | 
			
		||||
	or more target packages. This operation is recursive and must be used
 | 
			
		||||
	with care, since it can remove many potentially needed packages.
 | 
			
		||||
 | 
			
		||||
*-n, \--nosave*::
 | 
			
		||||
	Instructs pacman to ignore file backup designations. Normally, when a
 | 
			
		||||
	file is removed from the system the database is checked to see if the
 | 
			
		||||
	file is removed from the system, the database is checked to see if the
 | 
			
		||||
	file should be renamed with a '.pacsave' extension.
 | 
			
		||||
 | 
			
		||||
*-s, \--recursive*::
 | 
			
		||||
	Remove each target specified including all of their dependencies, provided
 | 
			
		||||
	that (A) they are not required by other packages; and (B) they were not
 | 
			
		||||
	explicitly installed by the user. This operation is recursive and analogous
 | 
			
		||||
	to a backwards '\--sync' operation, and helps keep a clean system without
 | 
			
		||||
	to a backwards '\--sync' operation, and it helps keep a clean system without
 | 
			
		||||
	orphans. If you want to omit condition (B), pass this option twice.
 | 
			
		||||
 | 
			
		||||
*-u, \--unneeded*::
 | 
			
		||||
@@ -346,13 +387,13 @@ Remove Options[[RO]]
 | 
			
		||||
	to avoid breaking any dependencies.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Sync Options[[SO]]
 | 
			
		||||
------------------
 | 
			
		||||
Sync Options (apply to '-S')[[SO]]
 | 
			
		||||
----------------------------------
 | 
			
		||||
*-c, \--clean*::
 | 
			
		||||
	Remove packages that are no longer installed from the cache as well as
 | 
			
		||||
	currently unused sync databases to free up disk space. When pacman
 | 
			
		||||
	downloads packages, it saves them in a cache directory. In addition,
 | 
			
		||||
	databases are saved for every sync DB you download from, and are not
 | 
			
		||||
	databases are saved for every sync DB you download from and are not
 | 
			
		||||
	deleted even if they are removed from the configuration file
 | 
			
		||||
	linkman:pacman.conf[5]. Use one '\--clean' switch to only remove
 | 
			
		||||
	packages that are no longer installed; use two to remove all files
 | 
			
		||||
@@ -377,9 +418,9 @@ linkman:pacman.conf[5].
 | 
			
		||||
	can be specified on the command line.
 | 
			
		||||
 | 
			
		||||
*-q, \--quiet*::
 | 
			
		||||
	Show less information for certain sync operations. (This is useful when
 | 
			
		||||
	pacman's output is processed in a script.) Search will only show package
 | 
			
		||||
	names and not repo, version, group, and description information; list
 | 
			
		||||
	Show less information for certain sync operations. This is useful when
 | 
			
		||||
	pacman's output is processed in a script. Search will only show package
 | 
			
		||||
	names and not repository, version, group, and description information; list
 | 
			
		||||
	will only show package names and omit databases and versions; group will
 | 
			
		||||
	only show package names and omit group names.
 | 
			
		||||
 | 
			
		||||
@@ -390,38 +431,89 @@ linkman:pacman.conf[5].
 | 
			
		||||
	be returned.
 | 
			
		||||
 | 
			
		||||
*-u, \--sysupgrade*::
 | 
			
		||||
	Upgrades all packages that are out of date. Each currently-installed
 | 
			
		||||
	Upgrades all packages that are out-of-date. Each currently-installed
 | 
			
		||||
	package will be examined and upgraded if a newer package exists. A
 | 
			
		||||
	report of all packages to upgrade will be presented and  the operation
 | 
			
		||||
	report of all packages to upgrade will be presented, and the operation
 | 
			
		||||
	will not proceed without user confirmation. Dependencies are
 | 
			
		||||
	automatically resolved at this level and will be installed/upgraded if
 | 
			
		||||
	necessary.
 | 
			
		||||
+
 | 
			
		||||
Pass this option twice to enable package downgrade; in this case pacman will
 | 
			
		||||
select sync packages whose version does not match with the local version.  This
 | 
			
		||||
can be useful when the user switches from a testing repo to a stable one.
 | 
			
		||||
Pass this option twice to enable package downgrades; in this case, pacman will
 | 
			
		||||
select sync packages whose versions do not match with the local versions. This
 | 
			
		||||
can be useful when the user switches from a testing repository to a stable one.
 | 
			
		||||
+
 | 
			
		||||
Additional targets can also be specified manually, so that '-Su foo' will do a
 | 
			
		||||
system upgrade and install/upgrade the foo package in the same operation.
 | 
			
		||||
system upgrade and install/upgrade the "foo" package in the same operation.
 | 
			
		||||
 | 
			
		||||
*-w, \--downloadonly*::
 | 
			
		||||
	Retrieve all packages from the server, but do not install/upgrade anything.
 | 
			
		||||
 | 
			
		||||
*-y, \--refresh*::
 | 
			
		||||
	Download a fresh copy of the master package list from the server(s)
 | 
			
		||||
	Download a fresh copy of the master package database from the server(s)
 | 
			
		||||
	defined in linkman:pacman.conf[5]. This should typically be used each time
 | 
			
		||||
	you use	'\--sysupgrade' or '-u'. Passing two '\--refresh' or '-y' flags
 | 
			
		||||
	will force a refresh of all package lists even if they appear to be up
 | 
			
		||||
	to date.
 | 
			
		||||
	will force a refresh of all package databases, even if they appear to be
 | 
			
		||||
	up-to-date.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Database Options (apply to '-D')[[QO]]
 | 
			
		||||
--------------------------------------
 | 
			
		||||
*\--asdeps* <package>::
 | 
			
		||||
	Mark a package as non-explicitly installed; in other words, set their install
 | 
			
		||||
	reason to be installed as a dependency.
 | 
			
		||||
 | 
			
		||||
*\--asexplicit* <package>::
 | 
			
		||||
	Mark a package as explicitly installed; in other words, set their install
 | 
			
		||||
	reason to be explicitly installed. This is useful it you want to keep a
 | 
			
		||||
	package installed even when it was initially installed as a dependency
 | 
			
		||||
	of another package.
 | 
			
		||||
 | 
			
		||||
*-k, \--check*::
 | 
			
		||||
	Check the local package database is internally consistent. This will
 | 
			
		||||
	check all required files are present and that installed packages have
 | 
			
		||||
	the required dependencies, do not conflict and that multiple packages
 | 
			
		||||
	do not own the same file. Specifying this option twice will perform
 | 
			
		||||
	a check on the sync databases to ensure all specified dependencies
 | 
			
		||||
	are available.
 | 
			
		||||
 | 
			
		||||
*-q, \--quiet*::
 | 
			
		||||
	Suppress messages on successful completion of database operations.
 | 
			
		||||
 | 
			
		||||
File Options (apply to '-F')[[FO]]
 | 
			
		||||
----------------------------------
 | 
			
		||||
*-y, --refresh*::
 | 
			
		||||
	Download fresh package databases from the server. Use twice to force a
 | 
			
		||||
	refresh even if databases are up to date.
 | 
			
		||||
 | 
			
		||||
*-l, \--list*::
 | 
			
		||||
	List the files owned by the queried package.
 | 
			
		||||
 | 
			
		||||
*-s, \--search*::
 | 
			
		||||
	Search package file names for matching strings.
 | 
			
		||||
 | 
			
		||||
*-x, --regex*::
 | 
			
		||||
	Treat arguments to '--search' as regular expressions.
 | 
			
		||||
 | 
			
		||||
*-o, \--owns*::
 | 
			
		||||
	Search for packages that own a particular file.
 | 
			
		||||
 | 
			
		||||
*-q, \--quiet*::
 | 
			
		||||
	Show less information for certain file operations. This is useful when
 | 
			
		||||
	pacman's output is processed in a script, however, you may want to use
 | 
			
		||||
	'--machinereadable' instead.
 | 
			
		||||
 | 
			
		||||
*--machinereadable*::
 | 
			
		||||
	Use a machine readable output format for '--list', '--search' and
 | 
			
		||||
	'--owns'. The format is 'repository\0pkgname\0pkgver\0path\n' with '\0'
 | 
			
		||||
	being the NULL character and '\n' a linefeed.
 | 
			
		||||
 | 
			
		||||
Handling Config Files[[HCF]]
 | 
			
		||||
----------------------------
 | 
			
		||||
Pacman uses the same logic as rpm to determine action against files that are
 | 
			
		||||
designated to be backed up. During an upgrade, 3 md5 hashes are used for each
 | 
			
		||||
backup file to determine the required action: one for the original file
 | 
			
		||||
installed, one for the new file that's about to be installed, and one for the
 | 
			
		||||
actual file existing on the filesystem. After comparing these 3 hashes, the
 | 
			
		||||
Pacman uses the same logic as 'rpm' to determine action against files that are
 | 
			
		||||
designated to be backed up. During an upgrade, three MD5 hashes are used for
 | 
			
		||||
each backup file to determine the required action: one for the original file
 | 
			
		||||
installed, one for the new file that is about to be installed, and one for the
 | 
			
		||||
actual file existing on the file system. After comparing these three hashes, the
 | 
			
		||||
follow scenarios can result:
 | 
			
		||||
 | 
			
		||||
original=X, current=X, new=X::
 | 
			
		||||
@@ -429,13 +521,13 @@ original=X, current=X, new=X::
 | 
			
		||||
	new file.
 | 
			
		||||
 | 
			
		||||
original=X, current=X, new=Y::
 | 
			
		||||
	The current file is the same as the original but the new one differs.
 | 
			
		||||
	The current file is the same as the original, but the new one differs.
 | 
			
		||||
	Since the user did not ever modify the file, and the new one may contain
 | 
			
		||||
	improvements or bugfixes, install the new file.
 | 
			
		||||
	improvements or bug fixes, install the new file.
 | 
			
		||||
 | 
			
		||||
original=X, current=Y, new=X::
 | 
			
		||||
	Both package versions contain the exact same file, but the one on the
 | 
			
		||||
	filesystem has  been  modified. Leave the current file in place.
 | 
			
		||||
	file system has been modified. Leave the current file in place.
 | 
			
		||||
 | 
			
		||||
original=X, current=Y, new=Y::
 | 
			
		||||
	The new file is identical to the current file. Install the new file.
 | 
			
		||||
@@ -445,6 +537,12 @@ original=X, current=Y, new=Z::
 | 
			
		||||
	extension and warn the user. The user must then manually merge any
 | 
			
		||||
	necessary changes into the original file.
 | 
			
		||||
 | 
			
		||||
original=NULL, current=Y, new=Z::
 | 
			
		||||
	The package was not previously installed, and the file already exists on the
 | 
			
		||||
	file system. Install the new file with a '.pacnew' extension and warn the
 | 
			
		||||
	user. The user must then manually merge any necessary changes into the
 | 
			
		||||
	original file.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Examples
 | 
			
		||||
--------
 | 
			
		||||
@@ -465,6 +563,7 @@ pacman -Syu gpm::
 | 
			
		||||
	Update package list, upgrade all packages, and then install gpm if it
 | 
			
		||||
	wasn't already installed.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Configuration
 | 
			
		||||
-------------
 | 
			
		||||
See linkman:pacman.conf[5] for more details on configuring pacman using the
 | 
			
		||||
@@ -473,6 +572,7 @@ See linkman:pacman.conf[5] for more details on configuring pacman using the
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman.conf[5], linkman:makepkg[8], linkman:libalpm[3]
 | 
			
		||||
linkman:alpm-hooks[5], linkman:libalpm[3], linkman:makepkg[8],
 | 
			
		||||
linkman:pacman.conf[5]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
pacman.conf(5)
 | 
			
		||||
==============
 | 
			
		||||
 | 
			
		||||
@@ -22,6 +19,9 @@ Each section defines a package repository that pacman can use when searching
 | 
			
		||||
for packages in '\--sync' mode. The exception to this is the options section,
 | 
			
		||||
which defines global options.
 | 
			
		||||
 | 
			
		||||
Comments are only supported by beginning a line with the hash (#) symbol.
 | 
			
		||||
Comments cannot begin in the middle of a line.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Example
 | 
			
		||||
-------
 | 
			
		||||
@@ -45,33 +45,43 @@ NOTE: Each directive must be in CamelCase. If the case isn't respected, the
 | 
			
		||||
directive won't be recognized. For example. noupgrade or NOUPGRADE will not
 | 
			
		||||
work.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*RootDir =* path/to/root::
 | 
			
		||||
*RootDir =* /path/to/root/dir::
 | 
			
		||||
	Set the default root directory for pacman to install to. This option is
 | 
			
		||||
	used if you want to install a package on a temporary mounted partition
 | 
			
		||||
	which is "owned" by another system, or for a chroot install.
 | 
			
		||||
	*NOTE*: If database path or logfile are not specified on either the
 | 
			
		||||
	*NOTE*: If database path or log file are not specified on either the
 | 
			
		||||
	command line or in linkman:pacman.conf[5], their default location will
 | 
			
		||||
	be inside this root path.
 | 
			
		||||
 | 
			
		||||
*DBPath =* path/to/db/dir::
 | 
			
		||||
	Overrides the default location of the toplevel database directory.  A
 | 
			
		||||
	typical default is +{localstatedir}/lib/pacman/+. Most users will not need to set
 | 
			
		||||
*DBPath =* /path/to/db/dir::
 | 
			
		||||
	Overrides the default location of the toplevel database directory. The
 | 
			
		||||
	default is +{localstatedir}/lib/pacman/+. Most users will not need to set
 | 
			
		||||
	this option. *NOTE*: if specified, this is an absolute path and the root
 | 
			
		||||
	path is not automatically prepended.
 | 
			
		||||
 | 
			
		||||
*CacheDir =* path/to/cache/dir::
 | 
			
		||||
	Overrides the default location of the package cache directory. A typical
 | 
			
		||||
*CacheDir =* /path/to/cache/dir::
 | 
			
		||||
	Overrides the default location of the package cache directory. The
 | 
			
		||||
	default is +{localstatedir}/cache/pacman/pkg/+. Multiple cache directories can be
 | 
			
		||||
	specified, and they are tried in the order they are listed in the config
 | 
			
		||||
	file. If a file is not found in any cache directory, it will be downloaded
 | 
			
		||||
	to the first cache directory with write access. *NOTE*: this is an absolute
 | 
			
		||||
	path, the root path is not automatically prepended.
 | 
			
		||||
 | 
			
		||||
*GPGDir =* path/to/gpg/dir::
 | 
			
		||||
*HookDir =* /path/to/hook/dir::
 | 
			
		||||
	Add directories to search for alpm hooks in addition to the system hook
 | 
			
		||||
	directory (+{datarootdir}/libalpm/hooks/+).  The default is
 | 
			
		||||
	+{sysconfdir}/pacman.d/hooks+.  Multiple directories can be specified with
 | 
			
		||||
	hooks in later directories taking precedence over hooks in earlier
 | 
			
		||||
	directories.  *NOTE*: this is an absolute path, the root path is not
 | 
			
		||||
	automatically prepended.  For more information on the alpm hooks, see
 | 
			
		||||
	linkman:alpm-hooks[5].
 | 
			
		||||
 | 
			
		||||
*GPGDir =* /path/to/gpg/dir::
 | 
			
		||||
	Overrides the default location of the directory containing configuration
 | 
			
		||||
	files for GnuPG. A typical default is +{sysconfdir}/pacman.d/gnupg/+.
 | 
			
		||||
	files for GnuPG. The default is +{sysconfdir}/pacman.d/gnupg/+.
 | 
			
		||||
	This directory should contain two files: `pubring.gpg` and `trustdb.gpg`.
 | 
			
		||||
	`pubring.gpg` holds the public keys of all packagers. `trustdb.gpg`
 | 
			
		||||
	contains a so-called trust database, which specifies that the keys are
 | 
			
		||||
@@ -79,8 +89,8 @@ Options
 | 
			
		||||
	*NOTE*: this is an absolute path, the root path is not automatically
 | 
			
		||||
	prepended.
 | 
			
		||||
 | 
			
		||||
*LogFile =* /path/to/file::
 | 
			
		||||
	Overrides the default location of the pacman log file. A typical default
 | 
			
		||||
*LogFile =* /path/to/log/file::
 | 
			
		||||
	Overrides the default location of the pacman log file. The default
 | 
			
		||||
	is +{localstatedir}/log/pacman.log+. This is an absolute path and the root directory
 | 
			
		||||
	is not prepended.
 | 
			
		||||
 | 
			
		||||
@@ -98,16 +108,16 @@ Options
 | 
			
		||||
	group when performing a '\--sysupgrade'. Shell-style glob patterns are
 | 
			
		||||
	allowed.
 | 
			
		||||
 | 
			
		||||
*Include =* path::
 | 
			
		||||
	Include another config file. This file can include repositories or
 | 
			
		||||
*Include =* /path/to/config/file::
 | 
			
		||||
	Include another configuration file. This file can include repositories or
 | 
			
		||||
	general configuration options. Wildcards in the specified paths will get
 | 
			
		||||
	expanded based on linkman:glob[7] rules.
 | 
			
		||||
 | 
			
		||||
*Architecture =* auto | i686 | x86_64 | ...::
 | 
			
		||||
	If set, pacman will only allow installation of packages of the given
 | 
			
		||||
	architecture (e.g. 'i686', 'x86_64', etc). The special value 'auto' will
 | 
			
		||||
	use the system architecture, provided by in ``uname -m''.  If unset, no
 | 
			
		||||
	architecture checks are made. *NOTE*: packages with the special
 | 
			
		||||
	use the system architecture, provided via ``uname -m''. If unset, no
 | 
			
		||||
	architecture checks are made. *NOTE*: Packages with the special
 | 
			
		||||
	architecture 'any' can always be installed, as they are meant to be
 | 
			
		||||
	architecture independent.
 | 
			
		||||
 | 
			
		||||
@@ -119,7 +129,7 @@ Options
 | 
			
		||||
	properly.
 | 
			
		||||
	+
 | 
			
		||||
	This option is useful for users who experience problems with built-in
 | 
			
		||||
	http/ftp support, or need the more advanced proxy support that comes with
 | 
			
		||||
	HTTP/FTP support, or need the more advanced proxy support that comes with
 | 
			
		||||
	utilities like wget.
 | 
			
		||||
 | 
			
		||||
*NoUpgrade =* file ...::
 | 
			
		||||
@@ -128,7 +138,10 @@ Options
 | 
			
		||||
	'.pacnew' extension.
 | 
			
		||||
	These files refer to files in the package archive, so do not include the
 | 
			
		||||
	leading slash (the RootDir) when specifying them. Shell-style glob patterns
 | 
			
		||||
	are allowed.
 | 
			
		||||
	are allowed. It is possible to invert matches by prepending a file with
 | 
			
		||||
	an exclamation mark. Inverted files will result in previously blacklisted
 | 
			
		||||
	files being whitelisted again. Subsequent matches will override previous
 | 
			
		||||
	ones. A leading literal exclamation mark or backslash needs to be escaped.
 | 
			
		||||
 | 
			
		||||
*NoExtract =* file ...::
 | 
			
		||||
	All files listed with a `NoExtract` directive will never be extracted from
 | 
			
		||||
@@ -138,7 +151,10 @@ Options
 | 
			
		||||
	from the 'apache' package.
 | 
			
		||||
	These files refer to files in the package archive, so do not include the
 | 
			
		||||
	leading slash (the RootDir) when specifying them. Shell-style glob patterns
 | 
			
		||||
	are allowed.
 | 
			
		||||
	are allowed. It is possible to invert matches by prepending a file with
 | 
			
		||||
	an exclamation mark. Inverted files will result in previously blacklisted
 | 
			
		||||
	files being whitelisted again. Subsequent matches will override previous
 | 
			
		||||
	ones. A leading literal exclamation mark or backslash needs to be escaped.
 | 
			
		||||
 | 
			
		||||
*CleanMethod =* KeepInstalled &| KeepCurrent::
 | 
			
		||||
	If set to `KeepInstalled` (the default), the '-Sc' operation will clean
 | 
			
		||||
@@ -183,6 +199,7 @@ Options
 | 
			
		||||
	and completed percentage of the entire download list rather
 | 
			
		||||
	than the percent of each individual download target. The progress
 | 
			
		||||
	bar is still based solely on the current file download.
 | 
			
		||||
	This option won't work if XferCommand is used.
 | 
			
		||||
 | 
			
		||||
*CheckSpace*::
 | 
			
		||||
	Performs an approximate check for adequate available disk space before
 | 
			
		||||
@@ -192,14 +209,20 @@ Options
 | 
			
		||||
	Displays name, version and size of target packages formatted
 | 
			
		||||
	as a table for upgrade, sync and remove operations.
 | 
			
		||||
 | 
			
		||||
*DisableDownloadTimeout*::
 | 
			
		||||
	Disable defaults for low speed limit and timeout on downloads. Use this
 | 
			
		||||
	if you have issues downloading files with proxy and/or security gateway.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Repository Sections
 | 
			
		||||
-------------------
 | 
			
		||||
Each repository section defines a section name and at least one location where
 | 
			
		||||
the packages can be found. The section name is defined by the string within
 | 
			
		||||
square brackets (the two above are 'current'  and  'custom'). Locations are
 | 
			
		||||
defined with the 'Server' directive and follow a URL naming structure. If you
 | 
			
		||||
want to use a local directory, you can specify the full path with a ``file://''
 | 
			
		||||
prefix, as shown above.
 | 
			
		||||
square brackets (the two above are 'core'  and  'custom'). Repository names
 | 
			
		||||
must be unique and the name 'local' is reserved for the database of installed
 | 
			
		||||
packages. Locations are defined with the 'Server' directive and follow a URL
 | 
			
		||||
naming structure. If you want to use a local directory, you can specify the
 | 
			
		||||
full path with a ``file://'' prefix, as shown above.
 | 
			
		||||
 | 
			
		||||
A common way to define DB locations utilizes the 'Include' directive. For each
 | 
			
		||||
repository defined in the configuration file, a single 'Include' directive can
 | 
			
		||||
@@ -237,6 +260,27 @@ even be used for different architectures.
 | 
			
		||||
	Set the signature verification level for this repository. For more
 | 
			
		||||
	information, see <<SC,Package and Database Signature Checking>> below.
 | 
			
		||||
 | 
			
		||||
*Usage =* ...::
 | 
			
		||||
	Set the usage level for this repository. This option takes a list of tokens
 | 
			
		||||
	which must be at least one of the following:
 | 
			
		||||
		*Sync*;;
 | 
			
		||||
			Enables refreshes for this repository.
 | 
			
		||||
		*Search*;;
 | 
			
		||||
			Enables searching for this repository.
 | 
			
		||||
		*Install*;;
 | 
			
		||||
			Enables installation of packages from this repository during a '\--sync'
 | 
			
		||||
			operation.
 | 
			
		||||
		*Upgrade*;;
 | 
			
		||||
			Allows this repository to be a valid source of packages when performing
 | 
			
		||||
			a '\--sysupgrade'.
 | 
			
		||||
		*All*;;
 | 
			
		||||
			Enables all of the above features for the repository. This is the default
 | 
			
		||||
			if not specified.
 | 
			
		||||
+
 | 
			
		||||
Note that an enabled repository can be operated on explicitly, regardless of the Usage
 | 
			
		||||
level set.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Package and Database Signature Checking[[SC]]
 | 
			
		||||
---------------------------------------------
 | 
			
		||||
The 'SigLevel' directive is valid in both the `[options]` and repository
 | 
			
		||||
@@ -300,6 +344,7 @@ The built-in default is the following:
 | 
			
		||||
SigLevel = Optional TrustedOnly
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Using Your Own Repository
 | 
			
		||||
-------------------------
 | 
			
		||||
If you have numerous custom packages of your own, it is often easier to generate
 | 
			
		||||
@@ -326,4 +371,4 @@ See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman[8], linkman:libalpm[3]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,66 +0,0 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
pactree(8)
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
Name
 | 
			
		||||
----
 | 
			
		||||
pactree - package dependency tree viewer
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
'pactree' [options] package
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
-----------
 | 
			
		||||
Pactree produces a dependency tree for a package.
 | 
			
		||||
 | 
			
		||||
By default a tree like output is generated, but with the -g option a graphviz
 | 
			
		||||
description is generated.
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*-a, \--ascii*::
 | 
			
		||||
	Use ascii characters for tree formatting. By default, pactree will use unicode
 | 
			
		||||
	line drawing characters if it is able to detect that the locale supports them.
 | 
			
		||||
 | 
			
		||||
*-b, \--dbpath*::
 | 
			
		||||
	Specify an alternative database location.
 | 
			
		||||
 | 
			
		||||
*-c, \--color*::
 | 
			
		||||
	Colorize output.
 | 
			
		||||
 | 
			
		||||
*-d, \--depth <num>*::
 | 
			
		||||
	Limits the number of levels of dependency to show. A zero means
 | 
			
		||||
	show the named package only, one shows the packages that are directly
 | 
			
		||||
	required.
 | 
			
		||||
 | 
			
		||||
*-g, \--graph*::
 | 
			
		||||
	Generate graphviz description. If this option is given, the -c and -l
 | 
			
		||||
	options are ignored.
 | 
			
		||||
 | 
			
		||||
*-h, \--help*::
 | 
			
		||||
	Output syntax and command line options.
 | 
			
		||||
 | 
			
		||||
*-l, \--linear*::
 | 
			
		||||
	Prints package names at the start of each line, one per line.
 | 
			
		||||
 | 
			
		||||
*-r, \--reverse*::
 | 
			
		||||
	Show packages that depend on the named package.
 | 
			
		||||
 | 
			
		||||
*-s, \--sync*::
 | 
			
		||||
	Read package data from sync databases instead of local database.
 | 
			
		||||
 | 
			
		||||
*-u, \--unique*::
 | 
			
		||||
	List dependent packages once. Implies --linear.
 | 
			
		||||
 | 
			
		||||
*\--config <file>*::
 | 
			
		||||
	Specify an alternate pacman configuration file.
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman[8], linkman:pacman.conf[5], linkman:makepkg[8]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
pkgdelta(8)
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
@@ -25,6 +22,7 @@ significantly.
 | 
			
		||||
 | 
			
		||||
'pkgdelta' requires linkman:xdelta3[1] to do its job.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*--max-delta-size <ratio>*::
 | 
			
		||||
@@ -35,19 +33,21 @@ Options
 | 
			
		||||
 | 
			
		||||
*--min-pkg-size <size>*::
 | 
			
		||||
	Minimal size of the package file in bytes to be considered for delta creation.
 | 
			
		||||
	Default value: 1048576 bytes = 1MiB. This may be any absolute size in bytes, or
 | 
			
		||||
	a human readable value such as `4 MiB` or `3.5MB`.
 | 
			
		||||
	Default value: 1048576 bytes = 1 MiB. This may be any absolute size in bytes or
 | 
			
		||||
	a human-readable value such as `4MiB` or `3.5MB`.
 | 
			
		||||
 | 
			
		||||
*-q, \--quiet*::
 | 
			
		||||
	Be quiet. Do not output anything but warnings and errors.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Examples
 | 
			
		||||
--------
 | 
			
		||||
 | 
			
		||||
  $ pkgdelta libreoffice-3.3.2-1-x86_64.pkg.tar.xz libreoffice-3.3.2-2-x86_64.pkg.tar.xz
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman[8], linkman:xdelta3[1]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
repo-add(8)
 | 
			
		||||
==========
 | 
			
		||||
 | 
			
		||||
@@ -8,6 +5,7 @@ Name
 | 
			
		||||
----
 | 
			
		||||
repo-add - package database maintenance utility
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
'repo-add' [options] <path-to-db> <package|delta> [<package|delta> ...]
 | 
			
		||||
@@ -25,20 +23,23 @@ They also handle package deltas produced by linkman:pkgdelta[8].
 | 
			
		||||
delta file. Multiple packages and/or deltas to add can be specified on the
 | 
			
		||||
command line.
 | 
			
		||||
 | 
			
		||||
If a matching ``.sig'' file is found alongside a package file, the signature
 | 
			
		||||
will automatically be embedded into the database.
 | 
			
		||||
 | 
			
		||||
'repo-remove' will update a package database by removing the package name or
 | 
			
		||||
delta specified on the command line. Multiple packages and/or delta to remove
 | 
			
		||||
can be specified on the command line.
 | 
			
		||||
 | 
			
		||||
A package database is a tar file, optionally compressed. Valid extensions are
 | 
			
		||||
``.db'' or ``.files'' followed by an archive extension of ``.tar'',
 | 
			
		||||
``.tar.gz'', ``.tar.bz2'', ``.tar.xz'', or ``.tar.Z''. The file does not need
 | 
			
		||||
to exist, but all parent directories must exist.
 | 
			
		||||
``.db'' followed by an archive extension of ``.tar'', ``.tar.gz'', ``.tar.bz2'',
 | 
			
		||||
``.tar.xz'', or ``.tar.Z''. The file does not need to exist, but all parent
 | 
			
		||||
directories must exist.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Common Options
 | 
			
		||||
--------------
 | 
			
		||||
*-q, \--quiet*::
 | 
			
		||||
	Force this program to keep quiet and run silent except for warning and
 | 
			
		||||
	Force this program to keep quiet and run silently except for warning and
 | 
			
		||||
	error messages.
 | 
			
		||||
 | 
			
		||||
*-s, \--sign*::
 | 
			
		||||
@@ -58,7 +59,8 @@ Common Options
 | 
			
		||||
	proceed.
 | 
			
		||||
 | 
			
		||||
*\--nocolor*::
 | 
			
		||||
	Remove color from repo-add and repo-remove output.
 | 
			
		||||
	Remove color from 'repo-add' and 'repo-remove' output.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
repo-add Options
 | 
			
		||||
----------------
 | 
			
		||||
@@ -66,17 +68,27 @@ repo-add Options
 | 
			
		||||
	Automatically generate and add a delta file between the old entry and the
 | 
			
		||||
	new one, if the old package file is found next to the new one.
 | 
			
		||||
 | 
			
		||||
*-f, \--files*::
 | 
			
		||||
	Tells repo-add also to create and include a list of the files in the
 | 
			
		||||
	specified packages. This is useful for creating databases listing all files
 | 
			
		||||
	in a given sync repository for tools that may use this information.
 | 
			
		||||
 | 
			
		||||
*-n, \--new*::
 | 
			
		||||
	Only add packages that are not already in the database.  Warnings will be
 | 
			
		||||
	printed upon detection of existing packages, but they will not be re-added.
 | 
			
		||||
 | 
			
		||||
*-R, \--remove*::
 | 
			
		||||
	Remove old package files from the disk when updating their entry in the
 | 
			
		||||
	database.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Example
 | 
			
		||||
-------
 | 
			
		||||
'repo-add' foo.db.tar.xz <pkg1> [<pkg2> ...]
 | 
			
		||||
 | 
			
		||||
This creates two separate databases; a smaller database ``foo.db.tar.xz'' used by
 | 
			
		||||
pacman and a large database containing package file lists ``foo.files.tar.xz'' for
 | 
			
		||||
use by other utilities. While pacman can use the large database (if renamed with a
 | 
			
		||||
db.tar* extension), there is currently no additional benefit for the larger download.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:makepkg[8], linkman:pacman[8], linkman:pkgdelta[8]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -8,9 +8,9 @@ please try to follow as much as you can.
 | 
			
		||||
NOTE: Some of this is paraphrased from the kernel documentation's
 | 
			
		||||
"SubmittingPatches" file.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Getting the most recent source
 | 
			
		||||
------------------------------
 | 
			
		||||
 | 
			
		||||
Patches need to be submitted in GIT format and are best if they are against the
 | 
			
		||||
latest version of the code. There are several helpful tutorials for getting
 | 
			
		||||
started with GIT if you have not worked with it before.
 | 
			
		||||
@@ -27,7 +27,7 @@ Creating your patch
 | 
			
		||||
-------------------
 | 
			
		||||
 | 
			
		||||
--
 | 
			
		||||
* use `git commit -s` for creating a commit of your changes.
 | 
			
		||||
* Use `git commit -s` for creating a commit of your changes.
 | 
			
		||||
 | 
			
		||||
The -s allows you to credit yourself by adding a "Signed Off By" line to
 | 
			
		||||
indicate who has "signed" the patch - who has approved it.
 | 
			
		||||
@@ -46,7 +46,11 @@ was actually done, and allows better feedback.
 | 
			
		||||
* Use `git format-patch` to create patches.
 | 
			
		||||
 | 
			
		||||
Your commit message will be shown above the patch by default when you will use
 | 
			
		||||
`git-format-patch`, including the signoff line.
 | 
			
		||||
`git format-patch`, including the signoff line.  Sets of multiple patches that
 | 
			
		||||
need extra explanation beyond the commit messages may include additional notes
 | 
			
		||||
in a cover letter.  Individual patches may include additional notes between the
 | 
			
		||||
"---" following the commit message and the beginning of the diff.
 | 
			
		||||
 | 
			
		||||
--
 | 
			
		||||
 | 
			
		||||
Submitting your patch
 | 
			
		||||
@@ -56,7 +60,7 @@ Submitting your patch
 | 
			
		||||
* Send the patch to the pacman-dev mailing list
 | 
			
		||||
 | 
			
		||||
The mailing list is the primary queue for review and acceptance.  Here you
 | 
			
		||||
will get feedback, and let me know the details of your patch.
 | 
			
		||||
will get feedback, and let the reviewers know the details of your patch.
 | 
			
		||||
 | 
			
		||||
* No MIME, no links, no compression, no attachments.  Just plain text.
 | 
			
		||||
 | 
			
		||||
@@ -65,8 +69,10 @@ reasons for this.  First, it makes them easier to read with any mail reader,
 | 
			
		||||
it allows easier review "at a glance", and most importantly, it allows people
 | 
			
		||||
to comment on exact lines of the patch in reply emails.
 | 
			
		||||
 | 
			
		||||
`git send-email` allows you to send git formatted patches in plain text easily
 | 
			
		||||
and is the preferred method for submission to the mailing list.
 | 
			
		||||
`git send-email` allows you to send Git-formatted patches in plain text easily
 | 
			
		||||
and is the preferred method for submission to the mailing list.  Mail clients,
 | 
			
		||||
including Gmail's web interface, have a tendency to break patches by wrapping
 | 
			
		||||
lines and/or adjusting whitespace and should be avoided.
 | 
			
		||||
 | 
			
		||||
--
 | 
			
		||||
 | 
			
		||||
@@ -86,13 +92,10 @@ looked at it yet.
 | 
			
		||||
* Respond to feedback
 | 
			
		||||
 | 
			
		||||
When you do get feedback, it usually merits a response, whether this be a
 | 
			
		||||
resubmit of the patch with corrections or a follow-up email asking for
 | 
			
		||||
clarifications. When neither of these occurs, don't expect your patch to see
 | 
			
		||||
resubmission of the patch with corrections or a follow-up email asking for
 | 
			
		||||
clarifications. When neither of these occurs, don't expect your patch to get
 | 
			
		||||
further review. The all-volunteer staff don't have time to fix up patches that
 | 
			
		||||
aren't their own.
 | 
			
		||||
aren't their own.  When resubmitting patches, update the subject line to reflect
 | 
			
		||||
the version number ('[PATCHv2]'), and send it as a reply to the original thread.
 | 
			
		||||
 | 
			
		||||
--
 | 
			
		||||
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
@@ -2,19 +2,17 @@ Pacman - Translating
 | 
			
		||||
====================
 | 
			
		||||
 | 
			
		||||
This document is here to guide you in helping translate pacman messages,
 | 
			
		||||
libalpm messages, and the manpages for the entire pacman package.
 | 
			
		||||
libalpm messages, and the manual pages for the entire pacman package.
 | 
			
		||||
 | 
			
		||||
We are currently using http://www.transifex.net/[Transifex] as the translation
 | 
			
		||||
We are currently using http://www.transifex.com/[Transifex] as the translation
 | 
			
		||||
platform for pacman and libalpm. You will need to sign up for an account there
 | 
			
		||||
and then register with a translation team on the
 | 
			
		||||
http://www.transifex.net/projects/p/archlinux-pacman/[pacman project page].
 | 
			
		||||
http://www.transifex.com/projects/p/archlinux-pacman/[pacman project page].
 | 
			
		||||
 | 
			
		||||
NOTE: This may be old information due to our switch to Transifex, but the
 | 
			
		||||
gettext website is a very useful guide to read before embarking on translation
 | 
			
		||||
work, as it describes many of the commands in more detail than I will here:
 | 
			
		||||
https://www.gnu.org/software/gettext/manual/html_node/gettext.html[].  In
 | 
			
		||||
addition, this site presents a small tutorial that I found useful:
 | 
			
		||||
http://oriya.sarovar.org/docs/gettext/[].
 | 
			
		||||
https://www.gnu.org/software/gettext/manual/html_node/gettext.html[].
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Translating Messages
 | 
			
		||||
@@ -23,21 +21,22 @@ Translating Messages
 | 
			
		||||
Overview
 | 
			
		||||
~~~~~~~~
 | 
			
		||||
 | 
			
		||||
There are two separate message catalogs in pacman- one for the backend
 | 
			
		||||
(libalpm) and one for the frontend (pacman and scripts). These correspond to
 | 
			
		||||
There are two separate message catalogs in pacman: one for the back-end
 | 
			
		||||
(libalpm) and one for the front-end (pacman and scripts). These correspond to
 | 
			
		||||
the `lib/libalpm/po` and `po` directories in the pacman source, respectively.
 | 
			
		||||
 | 
			
		||||
Translation message files are a specially formatted text file containing the
 | 
			
		||||
original message and the corresponding translation. These po files can then
 | 
			
		||||
either be hand edited, or modified with a tool such as poedit, gtranslator or
 | 
			
		||||
either be hand-edited, or modified with a tool such as poedit, gtranslator or
 | 
			
		||||
kbabel. Using a translation tool tends to make the job easier.
 | 
			
		||||
 | 
			
		||||
Please read up on Transifex usage using the
 | 
			
		||||
http://help.transifex.net/[Transifex Help] if you are not familiar.
 | 
			
		||||
http://docs.transifex.com/[Transifex Help] if you are not familiar.
 | 
			
		||||
 | 
			
		||||
Here is an example set of commands if you have a source code checkout and are
 | 
			
		||||
not worried about any local translations being overwritten. The .tx/ directory
 | 
			
		||||
is checked into the git repository so is preconfigured with the two project
 | 
			
		||||
Transifex provides a command-line client to help with translations.  Here is
 | 
			
		||||
an example set of commands if you have a source code checkout and are not
 | 
			
		||||
worried about any local translations being overwritten. The .tx/ directory is
 | 
			
		||||
checked into the git repository so is preconfigured with the two project
 | 
			
		||||
resources (See `tx status` output for a quick overview).
 | 
			
		||||
 | 
			
		||||
	tx pull -f
 | 
			
		||||
@@ -47,8 +46,8 @@ resources (See `tx status` output for a quick overview).
 | 
			
		||||
 | 
			
		||||
Or to just push one of the two available resources:
 | 
			
		||||
 | 
			
		||||
	tx push -r archlinux-pacman.pacman-pot -t -l fi
 | 
			
		||||
	tx push -r archlinux-pacman.libalpm-pot -t -l fi
 | 
			
		||||
	tx push -r archlinux-pacman.pacman-pot -t -l <mylang>
 | 
			
		||||
	tx push -r archlinux-pacman.libalpm-pot -t -l <mylang>
 | 
			
		||||
 | 
			
		||||
See the <<Notes,Notes>> section for additional hints on translating.
 | 
			
		||||
 | 
			
		||||
@@ -61,8 +60,8 @@ mailing list asking for translations. This email will have a prefix of
 | 
			
		||||
*[translation]* for anyone looking to set up an email filter.
 | 
			
		||||
 | 
			
		||||
At this time, the latest `.po` language files will be made available at the
 | 
			
		||||
Transifex project page.  Each language will have two files available (backend
 | 
			
		||||
and frontend). Translators interested in helping are encouraged to use the
 | 
			
		||||
Transifex project page.  Each language will have two files available (back-end
 | 
			
		||||
and front-end). Translators interested in helping are encouraged to use the
 | 
			
		||||
features of Transifex to let others know they are currently translating their
 | 
			
		||||
language.
 | 
			
		||||
 | 
			
		||||
@@ -99,7 +98,7 @@ Next, update your specific language's translation file:
 | 
			
		||||
 | 
			
		||||
At this point, you can do the translation. To submit your changes, either email
 | 
			
		||||
the new `.po` file to the mailing-list with *[translation]* in the subject, or
 | 
			
		||||
submit a GIT-formatted patch (please do not include any `.pot` file changes).
 | 
			
		||||
submit a Git-formatted patch (please do not include any `.pot` file changes).
 | 
			
		||||
 | 
			
		||||
As a shortcut, all translation files (including `.pot` files) can be updated
 | 
			
		||||
with the following command:
 | 
			
		||||
@@ -130,7 +129,7 @@ Notes[[Notes]]
 | 
			
		||||
~~~~~~~~~~~~~~
 | 
			
		||||
 | 
			
		||||
msgid and msgstr 'variables' can be on as many lines as necessary. Line breaks
 | 
			
		||||
are ignored- if you need a literal line break, use an `\n` in your string. The
 | 
			
		||||
are ignored; if you need a literal line break, use an `\n` in your string. The
 | 
			
		||||
following two translations are equivalent:
 | 
			
		||||
 | 
			
		||||
	msgstr "This is a test translation"
 | 
			
		||||
@@ -138,7 +137,7 @@ following two translations are equivalent:
 | 
			
		||||
	msgstr ""
 | 
			
		||||
	"This is a test translation"
 | 
			
		||||
 | 
			
		||||
If you want to test the translation (for example, the frontend one):
 | 
			
		||||
If you want to test the translation (for example, the front-end one):
 | 
			
		||||
 | 
			
		||||
	rm *.gmo stamp-po
 | 
			
		||||
	make
 | 
			
		||||
@@ -147,18 +146,8 @@ If you want to test the translation (for example, the frontend one):
 | 
			
		||||
 | 
			
		||||
Translating Manpages
 | 
			
		||||
--------------------
 | 
			
		||||
 | 
			
		||||
There are currently no efforts underway to include translated manpages in the
 | 
			
		||||
pacman codebase. However, this is not to say translations are unwelcome. If
 | 
			
		||||
someone has experience with i18n manpages and how to best include them with our
 | 
			
		||||
There are currently no efforts underway to include translated manual pages in
 | 
			
		||||
the pacman codebase. However, this is not to say translations are unwelcome. If
 | 
			
		||||
someone has experience with i18n man pages and how to best include them with our
 | 
			
		||||
source, please contact the pacman-dev mailing list at
 | 
			
		||||
mailto:pacman-dev@archlinux.org[].
 | 
			
		||||
 | 
			
		||||
Some community efforts have been made to translate manpages, and these can be
 | 
			
		||||
found in the link:https://aur.archlinux.org[AUR] (Arch User Repository). Please
 | 
			
		||||
check there first before undergoing a translation effort to ensure you are not
 | 
			
		||||
duplicating efforts.
 | 
			
		||||
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
@@ -1,6 +1,3 @@
 | 
			
		||||
/////
 | 
			
		||||
vim:set ts=4 sw=4 syntax=asciidoc noet spell spelllang=en_us:
 | 
			
		||||
/////
 | 
			
		||||
vercmp(8)
 | 
			
		||||
=========
 | 
			
		||||
 | 
			
		||||
@@ -11,7 +8,7 @@ vercmp - version comparison utility
 | 
			
		||||
 | 
			
		||||
Synopsis
 | 
			
		||||
--------
 | 
			
		||||
'vercmp' <version1> <version2>
 | 
			
		||||
'vercmp' [-h] [--help] <version1> <version2>
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Description
 | 
			
		||||
@@ -31,7 +28,7 @@ Version comparison operates as follows:
 | 
			
		||||
    1 < 1.0 < 1.1 < 1.1.1 < 1.2 < 2.0 < 3.0.0
 | 
			
		||||
 | 
			
		||||
Additionally, version strings can have an 'epoch' value defined that will
 | 
			
		||||
overrule any version comparison (unless the epoch values are equal). This is
 | 
			
		||||
overrule any version comparison, unless the epoch values are equal. This is
 | 
			
		||||
specified in an `epoch:version-rel` format. For example, `2:1.0-1` is always
 | 
			
		||||
greater than `1:3.6-1`.
 | 
			
		||||
 | 
			
		||||
@@ -44,8 +41,10 @@ mainly for supporting versioned dependencies that do not include the 'pkgrel'.
 | 
			
		||||
Options
 | 
			
		||||
-------
 | 
			
		||||
*-h, \--help*::
 | 
			
		||||
	Display syntax for the given operation. If no operation was supplied
 | 
			
		||||
	then the general syntax is shown.
 | 
			
		||||
 | 
			
		||||
	Display summary of the available return codes. Must be the first option
 | 
			
		||||
	specified.
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
Examples
 | 
			
		||||
--------
 | 
			
		||||
@@ -65,12 +64,9 @@ Examples
 | 
			
		||||
  $ vercmp 4.34 1:001
 | 
			
		||||
  -1
 | 
			
		||||
 | 
			
		||||
Configuration
 | 
			
		||||
-------------
 | 
			
		||||
There is none.
 | 
			
		||||
 | 
			
		||||
See Also
 | 
			
		||||
--------
 | 
			
		||||
linkman:pacman[8], linkman:makepkg[8], linkman:libalpm[3]
 | 
			
		||||
 | 
			
		||||
include::footer.txt[]
 | 
			
		||||
include::footer.asciidoc[]
 | 
			
		||||
@@ -25,5 +25,3 @@ SED_PROCESS = \
 | 
			
		||||
 | 
			
		||||
%.conf: %.conf.in Makefile
 | 
			
		||||
	$(SED_PROCESS)
 | 
			
		||||
 | 
			
		||||
# vim:set ts=2 sw=2 noet:
 | 
			
		||||
 
 | 
			
		||||
@@ -1,3 +1,4 @@
 | 
			
		||||
#!/hint/bash
 | 
			
		||||
#
 | 
			
		||||
# @sysconfdir@/makepkg.conf
 | 
			
		||||
#
 | 
			
		||||
@@ -8,9 +9,10 @@
 | 
			
		||||
#
 | 
			
		||||
#-- The download utilities that makepkg should use to acquire sources
 | 
			
		||||
#  Format: 'protocol::agent'
 | 
			
		||||
DLAGENTS=('ftp::/usr/bin/curl -qfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
 | 
			
		||||
          'http::/usr/bin/curl -qb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
 | 
			
		||||
          'https::/usr/bin/curl -qb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
 | 
			
		||||
DLAGENTS=('file::/usr/bin/curl -gqC - -o %o %u'
 | 
			
		||||
          'ftp::/usr/bin/curl -gqfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o %u'
 | 
			
		||||
          'http::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
 | 
			
		||||
          'https::/usr/bin/curl -gqb "" -fLC - --retry 3 --retry-delay 3 -o %o %u'
 | 
			
		||||
          'rsync::/usr/bin/rsync --no-motd -z %u %o'
 | 
			
		||||
          'scp::/usr/bin/scp -C %u %o')
 | 
			
		||||
 | 
			
		||||
@@ -19,6 +21,13 @@ DLAGENTS=('ftp::/usr/bin/curl -qfC - --ftp-pasv --retry 3 --retry-delay 3 -o %o
 | 
			
		||||
# /usr/bin/lftpget -c
 | 
			
		||||
# /usr/bin/wget
 | 
			
		||||
 | 
			
		||||
#-- The package required by makepkg to download VCS sources
 | 
			
		||||
#  Format: 'protocol::package'
 | 
			
		||||
VCSCLIENTS=('bzr::bzr'
 | 
			
		||||
            'git::git'
 | 
			
		||||
            'hg::mercurial'
 | 
			
		||||
            'svn::subversion')
 | 
			
		||||
 | 
			
		||||
#########################################################################
 | 
			
		||||
# ARCHITECTURE, COMPILE FLAGS
 | 
			
		||||
#########################################################################
 | 
			
		||||
@@ -41,17 +50,16 @@ CHOST="@CHOST@"
 | 
			
		||||
# BUILD ENVIRONMENT
 | 
			
		||||
#########################################################################
 | 
			
		||||
#
 | 
			
		||||
# Defaults: BUILDENV=(fakeroot !distcc color !ccache check !sign)
 | 
			
		||||
# Defaults: BUILDENV=(!distcc !color !ccache check !sign)
 | 
			
		||||
#  A negated environment option will do the opposite of the comments below.
 | 
			
		||||
#
 | 
			
		||||
#-- fakeroot: Allow building packages as a non-root user
 | 
			
		||||
#-- distcc:   Use the Distributed C/C++/ObjC compiler
 | 
			
		||||
#-- color:    Colorize output messages
 | 
			
		||||
#-- ccache:   Use ccache to cache compilation
 | 
			
		||||
#-- check:    Run the check() function if present in the PKGBUILD
 | 
			
		||||
#-- sign:     Generate PGP signature file
 | 
			
		||||
#
 | 
			
		||||
BUILDENV=(fakeroot !distcc color !ccache check !sign)
 | 
			
		||||
BUILDENV=(!distcc color !ccache check !sign)
 | 
			
		||||
#
 | 
			
		||||
#-- If using DistCC, your MAKEFLAGS will also need modification. In addition,
 | 
			
		||||
#-- specify a space-delimited list of hosts running in the DistCC cluster.
 | 
			
		||||
@@ -65,7 +73,7 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
 | 
			
		||||
#   These are default values for the options=() settings
 | 
			
		||||
#########################################################################
 | 
			
		||||
#
 | 
			
		||||
# Default: OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
 | 
			
		||||
# Default: OPTIONS=(!strip docs libtool staticlibs emptydirs !zipman !purge !debug)
 | 
			
		||||
#  A negated option will do the opposite of the comments below.
 | 
			
		||||
#
 | 
			
		||||
#-- strip:      Strip symbols from binaries/libraries
 | 
			
		||||
@@ -75,12 +83,11 @@ BUILDENV=(fakeroot !distcc color !ccache check !sign)
 | 
			
		||||
#-- emptydirs:  Leave empty directories in packages
 | 
			
		||||
#-- zipman:     Compress manual (man and info) pages in MAN_DIRS with gzip
 | 
			
		||||
#-- purge:      Remove files specified by PURGE_TARGETS
 | 
			
		||||
#-- upx:        Compress binary executable files using UPX
 | 
			
		||||
#-- debug:      Add debugging flags as specified in DEBUG_* variables
 | 
			
		||||
#
 | 
			
		||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !upx !debug)
 | 
			
		||||
OPTIONS=(strip docs libtool staticlibs emptydirs zipman purge !debug)
 | 
			
		||||
 | 
			
		||||
#-- File integrity checks to use. Valid: md5, sha1, sha256, sha384, sha512
 | 
			
		||||
#-- File integrity checks to use. Valid: md5, sha1, sha224, sha256, sha384, sha512
 | 
			
		||||
INTEGRITY_CHECK=(md5)
 | 
			
		||||
#-- Options to be used when stripping binaries. See `man strip' for details.
 | 
			
		||||
STRIP_BINARIES="@STRIP_BINARIES@"
 | 
			
		||||
@@ -94,6 +101,8 @@ MAN_DIRS=({usr{,/local}{,/share},opt/*}/{man,info})
 | 
			
		||||
DOC_DIRS=(usr/{,local/}{,share/}{doc,gtk-doc} opt/*/{doc,gtk-doc})
 | 
			
		||||
#-- Files to be removed from all packages (if purge is specified)
 | 
			
		||||
PURGE_TARGETS=(usr/{,share}/info/dir .packlist *.pod)
 | 
			
		||||
#-- Directory to store source code in for debug packages
 | 
			
		||||
DBGSRCDIR="/usr/src/debug"
 | 
			
		||||
 | 
			
		||||
#########################################################################
 | 
			
		||||
# PACKAGE OUTPUT
 | 
			
		||||
@@ -134,5 +143,3 @@ COMPRESSZ=(compress -c -f)
 | 
			
		||||
#
 | 
			
		||||
PKGEXT='@PKGEXT@'
 | 
			
		||||
SRCEXT='@SRCEXT@'
 | 
			
		||||
 | 
			
		||||
# vim: set ft=sh ts=2 sw=2 et:
 | 
			
		||||
 
 | 
			
		||||
@@ -14,8 +14,9 @@
 | 
			
		||||
#CacheDir    = @localstatedir@/cache/pacman/pkg/
 | 
			
		||||
#LogFile     = @localstatedir@/log/pacman.log
 | 
			
		||||
#GPGDir      = @sysconfdir@/pacman.d/gnupg/
 | 
			
		||||
#HookDir     = @sysconfdir@/pacman.d/hooks/
 | 
			
		||||
HoldPkg     = pacman glibc
 | 
			
		||||
#XferCommand = /usr/bin/curl -C - -f %u > %o
 | 
			
		||||
#XferCommand = /usr/bin/curl -L -C - -f -o %o %u
 | 
			
		||||
#XferCommand = /usr/bin/wget --passive-ftp -c -O %o %u
 | 
			
		||||
#CleanMethod = KeepInstalled
 | 
			
		||||
#UseDelta    = 0.7
 | 
			
		||||
 
 | 
			
		||||
@@ -7,6 +7,7 @@ include_HEADERS = alpm_list.h alpm.h
 | 
			
		||||
 | 
			
		||||
AM_CPPFLAGS = \
 | 
			
		||||
	-imacros $(top_builddir)/config.h \
 | 
			
		||||
	-DSYSHOOKDIR=\"@datarootdir@/libalpm/hooks/\" \
 | 
			
		||||
	-DLOCALEDIR=\"@localedir@\"
 | 
			
		||||
 | 
			
		||||
AM_CFLAGS = -pedantic -D_GNU_SOURCE $(WARNING_CFLAGS)
 | 
			
		||||
@@ -18,9 +19,6 @@ else
 | 
			
		||||
AM_CFLAGS += -fvisibility=internal
 | 
			
		||||
endif
 | 
			
		||||
endif
 | 
			
		||||
if ENABLE_GNU89_INLINE_CC
 | 
			
		||||
AM_CFLAGS += -fgnu89-inline
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
pkgconfigdir = $(libdir)/pkgconfig
 | 
			
		||||
pkgconfig_DATA = libalpm.pc
 | 
			
		||||
@@ -30,6 +28,7 @@ libalpm_la_SOURCES = \
 | 
			
		||||
	alpm.h alpm.c \
 | 
			
		||||
	alpm_list.h alpm_list.c \
 | 
			
		||||
	backup.h backup.c \
 | 
			
		||||
	base64.h base64.c \
 | 
			
		||||
	be_local.c \
 | 
			
		||||
	be_package.c \
 | 
			
		||||
	be_sync.c \
 | 
			
		||||
@@ -44,6 +43,8 @@ libalpm_la_SOURCES = \
 | 
			
		||||
	graph.h graph.c \
 | 
			
		||||
	group.h group.c \
 | 
			
		||||
	handle.h handle.c \
 | 
			
		||||
	hook.h hook.c \
 | 
			
		||||
	ini.h ini.c \
 | 
			
		||||
	libarchive-compat.h \
 | 
			
		||||
	log.h log.c \
 | 
			
		||||
	package.h package.c \
 | 
			
		||||
@@ -57,17 +58,6 @@ libalpm_la_SOURCES = \
 | 
			
		||||
	util-common.h util-common.c \
 | 
			
		||||
	version.c
 | 
			
		||||
 | 
			
		||||
if !HAVE_LIBSSL
 | 
			
		||||
libalpm_la_SOURCES += \
 | 
			
		||||
	md5.h md5.c \
 | 
			
		||||
	sha2.h sha2.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
if HAVE_LIBGPGME
 | 
			
		||||
libalpm_la_SOURCES += \
 | 
			
		||||
	base64.h base64.c
 | 
			
		||||
endif
 | 
			
		||||
 | 
			
		||||
libalpm_la_LDFLAGS = -no-undefined -version-info $(LIB_VERSION_INFO)
 | 
			
		||||
 | 
			
		||||
libalpm_la_CFLAGS = \
 | 
			
		||||
@@ -75,13 +65,13 @@ libalpm_la_CFLAGS = \
 | 
			
		||||
	$(GPGME_CFLAGS) \
 | 
			
		||||
	$(LIBARCHIVE_CFLAGS) \
 | 
			
		||||
	$(LIBCURL_CFLAGS) \
 | 
			
		||||
	$(LIBSSL_CFLAGS)
 | 
			
		||||
	$(LIBSSL_CFLAGS) \
 | 
			
		||||
	$(NETTLE_CFLAGS)
 | 
			
		||||
 | 
			
		||||
libalpm_la_LIBADD = \
 | 
			
		||||
	$(LTLIBINTL) \
 | 
			
		||||
	$(GPGME_LIBS) \
 | 
			
		||||
	$(LIBARCHIVE_LIBS) \
 | 
			
		||||
	$(LIBCURL_LIBS) \
 | 
			
		||||
	$(LIBSSL_LIBS)
 | 
			
		||||
 | 
			
		||||
# vim:set ts=2 sw=2 noet:
 | 
			
		||||
	$(LIBSSL_LIBS) \
 | 
			
		||||
	$(NETTLE_LIBS)
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  add.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -57,6 +57,8 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
 | 
			
		||||
	/* Sanity checks */
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	ASSERT(pkg != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
	ASSERT(pkg->origin != ALPM_PKG_FROM_LOCALDB,
 | 
			
		||||
			RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
	ASSERT(handle == pkg->handle, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
	trans = handle->trans;
 | 
			
		||||
	ASSERT(trans != NULL, RET_ERR(handle, ALPM_ERR_TRANS_NULL, -1));
 | 
			
		||||
@@ -88,7 +90,7 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_WARNING, _("%s-%s is up to date -- reinstalling\n"),
 | 
			
		||||
						localpkgname, localpkgver);
 | 
			
		||||
			}
 | 
			
		||||
		} else if(cmp < 0) {
 | 
			
		||||
		} else if(cmp < 0 && !(trans->flags & ALPM_TRANS_FLAG_DOWNLOADONLY)) {
 | 
			
		||||
			/* local version is newer */
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING, _("downgrading package %s (%s => %s)\n"),
 | 
			
		||||
					localpkgname, localpkgver, pkgver);
 | 
			
		||||
@@ -105,26 +107,42 @@ int SYMEXPORT alpm_add_pkg(alpm_handle_t *handle, alpm_pkg_t *pkg)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int perform_extraction(alpm_handle_t *handle, struct archive *archive,
 | 
			
		||||
		struct archive_entry *entry, const char *filename, const char *origname)
 | 
			
		||||
		struct archive_entry *entry, const char *filename)
 | 
			
		||||
{
 | 
			
		||||
	int ret;
 | 
			
		||||
	struct archive *archive_writer;
 | 
			
		||||
	const int archive_flags = ARCHIVE_EXTRACT_OWNER |
 | 
			
		||||
	                          ARCHIVE_EXTRACT_PERM |
 | 
			
		||||
	                          ARCHIVE_EXTRACT_TIME;
 | 
			
		||||
	                          ARCHIVE_EXTRACT_TIME |
 | 
			
		||||
	                          ARCHIVE_EXTRACT_UNLINK |
 | 
			
		||||
	                          ARCHIVE_EXTRACT_SECURE_SYMLINKS;
 | 
			
		||||
 | 
			
		||||
	archive_entry_set_pathname(entry, filename);
 | 
			
		||||
 | 
			
		||||
	ret = archive_read_extract(archive, entry, archive_flags);
 | 
			
		||||
	archive_writer = archive_write_disk_new();
 | 
			
		||||
	if (archive_writer == NULL) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR, _("cannot allocate disk archive object"));
 | 
			
		||||
		alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
				"error: cannot allocate disk archive object");
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	archive_write_disk_set_options(archive_writer, archive_flags);
 | 
			
		||||
 | 
			
		||||
	ret = archive_read_extract2(archive, entry, archive_writer);
 | 
			
		||||
 | 
			
		||||
	archive_write_free(archive_writer);
 | 
			
		||||
 | 
			
		||||
	if(ret == ARCHIVE_WARN && archive_errno(archive) != ENOSPC) {
 | 
			
		||||
		/* operation succeeded but a "non-critical" error was encountered */
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_WARNING, _("warning given when extracting %s (%s)\n"),
 | 
			
		||||
				origname, archive_error_string(archive));
 | 
			
		||||
				filename, archive_error_string(archive));
 | 
			
		||||
	} else if(ret != ARCHIVE_OK) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR, _("could not extract %s (%s)\n"),
 | 
			
		||||
				origname, archive_error_string(archive));
 | 
			
		||||
				filename, archive_error_string(archive));
 | 
			
		||||
		alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
				"error: could not extract %s (%s)\n",
 | 
			
		||||
				origname, archive_error_string(archive));
 | 
			
		||||
				filename, archive_error_string(archive));
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
@@ -142,53 +160,66 @@ static int try_rename(alpm_handle_t *handle, const char *src, const char *dest)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
 | 
			
		||||
		struct archive_entry *entry, alpm_pkg_t *newpkg, alpm_pkg_t *oldpkg)
 | 
			
		||||
static int extract_db_file(alpm_handle_t *handle, struct archive *archive,
 | 
			
		||||
		struct archive_entry *entry, alpm_pkg_t *newpkg, const char *entryname)
 | 
			
		||||
{
 | 
			
		||||
	const char *entryname;
 | 
			
		||||
	mode_t entrymode;
 | 
			
		||||
	char filename[PATH_MAX]; /* the actual file we're extracting */
 | 
			
		||||
	int needbackup = 0, notouch = 0;
 | 
			
		||||
	const char *hash_orig = NULL;
 | 
			
		||||
	char *entryname_orig = NULL;
 | 
			
		||||
	int errors = 0;
 | 
			
		||||
 | 
			
		||||
	entryname = archive_entry_pathname(entry);
 | 
			
		||||
	entrymode = archive_entry_mode(entry);
 | 
			
		||||
 | 
			
		||||
	const char *dbfile = NULL;
 | 
			
		||||
	if(strcmp(entryname, ".INSTALL") == 0) {
 | 
			
		||||
		/* the install script goes inside the db */
 | 
			
		||||
		snprintf(filename, PATH_MAX, "%s%s-%s/install",
 | 
			
		||||
				_alpm_db_path(handle->db_local), newpkg->name, newpkg->version);
 | 
			
		||||
		archive_entry_set_perm(entry, 0644);
 | 
			
		||||
		dbfile = "install";
 | 
			
		||||
	} else if(strcmp(entryname, ".CHANGELOG") == 0) {
 | 
			
		||||
		/* the changelog goes inside the db */
 | 
			
		||||
		snprintf(filename, PATH_MAX, "%s%s-%s/changelog",
 | 
			
		||||
				_alpm_db_path(handle->db_local), newpkg->name, newpkg->version);
 | 
			
		||||
		archive_entry_set_perm(entry, 0644);
 | 
			
		||||
		dbfile = "changelog";
 | 
			
		||||
	} else if(strcmp(entryname, ".MTREE") == 0) {
 | 
			
		||||
		/* the mtree file goes inside the db */
 | 
			
		||||
		snprintf(filename, PATH_MAX, "%s%s-%s/mtree",
 | 
			
		||||
				_alpm_db_path(handle->db_local), newpkg->name, newpkg->version);
 | 
			
		||||
		archive_entry_set_perm(entry, 0644);
 | 
			
		||||
		dbfile = "mtree";
 | 
			
		||||
	} else if(*entryname == '.') {
 | 
			
		||||
		/* for now, ignore all files starting with '.' that haven't
 | 
			
		||||
		 * already been handled (for future possibilities) */
 | 
			
		||||
		/* reserve all files starting with '.' for future possibilities */
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "skipping extraction of '%s'\n", entryname);
 | 
			
		||||
		archive_read_data_skip(archive);
 | 
			
		||||
		return 0;
 | 
			
		||||
	} else {
 | 
			
		||||
		/* build the new entryname relative to handle->root */
 | 
			
		||||
		snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
 | 
			
		||||
	}
 | 
			
		||||
	archive_entry_set_perm(entry, 0644);
 | 
			
		||||
	snprintf(filename, PATH_MAX, "%s%s-%s/%s",
 | 
			
		||||
			_alpm_db_path(handle->db_local), newpkg->name, newpkg->version, dbfile);
 | 
			
		||||
	return perform_extraction(handle, archive, entry, filename);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
 | 
			
		||||
		struct archive_entry *entry, alpm_pkg_t *newpkg, alpm_pkg_t *oldpkg)
 | 
			
		||||
{
 | 
			
		||||
	const char *entryname = archive_entry_pathname(entry);
 | 
			
		||||
	mode_t entrymode = archive_entry_mode(entry);
 | 
			
		||||
	alpm_backup_t *backup = _alpm_needbackup(entryname, newpkg);
 | 
			
		||||
	char filename[PATH_MAX]; /* the actual file we're extracting */
 | 
			
		||||
	int needbackup = 0, notouch = 0;
 | 
			
		||||
	const char *hash_orig = NULL;
 | 
			
		||||
	int isnewfile = 0, errors = 0;
 | 
			
		||||
	struct stat lsbuf;
 | 
			
		||||
	size_t filename_len;
 | 
			
		||||
 | 
			
		||||
	if(*entryname == '.') {
 | 
			
		||||
		return extract_db_file(handle, archive, entry, newpkg, entryname);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if (!alpm_filelist_contains(&newpkg->files, entryname)) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
				_("file not found in file list for package %s. skipping extraction of %s\n"),
 | 
			
		||||
				newpkg->name, entryname);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* build the new entryname relative to handle->root */
 | 
			
		||||
	filename_len = snprintf(filename, PATH_MAX, "%s%s", handle->root, entryname);
 | 
			
		||||
	if(filename_len >= PATH_MAX) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("unable to extract %s%s: path too long"), handle->root, entryname);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* if a file is in NoExtract then we never extract it */
 | 
			
		||||
	if(alpm_list_find(handle->noextract, entryname, _alpm_fnmatch)) {
 | 
			
		||||
	if(_alpm_fnmatch_patterns(handle->noextract, entryname) == 0) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoExtract,"
 | 
			
		||||
				" skipping extraction of %s\n",
 | 
			
		||||
				entryname, filename);
 | 
			
		||||
		alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
				"note: %s is in NoExtract, skipping extraction\n", entryname);
 | 
			
		||||
		archive_read_data_skip(archive);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
@@ -197,266 +228,182 @@ static int extract_single_file(alpm_handle_t *handle, struct archive *archive,
 | 
			
		||||
	 * to get 'right'. Here are the possibilities, with the filesystem
 | 
			
		||||
	 * on the left and the package on the top:
 | 
			
		||||
	 * (F=file, N=node, S=symlink, D=dir)
 | 
			
		||||
	 *               |  F/N  |  S  |  D
 | 
			
		||||
	 *  non-existent |   1   |  2  |  3
 | 
			
		||||
	 *  F/N          |   4   |  5  |  6
 | 
			
		||||
	 *  S            |   7   |  8  |  9
 | 
			
		||||
	 *  D            |   10  |  11 |  12
 | 
			
		||||
	 *               |  F/N  |   D
 | 
			
		||||
	 *  non-existent |   1   |   2
 | 
			
		||||
	 *  F/N          |   3   |   4
 | 
			
		||||
	 *  D            |   5   |   6
 | 
			
		||||
	 *
 | 
			
		||||
	 *  1,2,3- extract, no magic necessary. lstat (_alpm_lstat) will fail here.
 | 
			
		||||
	 *  4,5,6,7,8- conflict checks should have caught this. either overwrite
 | 
			
		||||
	 *  1,2- extract, no magic necessary. lstat (llstat) will fail here.
 | 
			
		||||
	 *  3,4- conflict checks should have caught this. either overwrite
 | 
			
		||||
	 *      or backup the file.
 | 
			
		||||
	 *  9- follow the symlink, hopefully it is a directory, check it.
 | 
			
		||||
	 *  10- file replacing directory- don't allow it.
 | 
			
		||||
	 *  11- don't extract symlink- a dir exists here. we don't want links to
 | 
			
		||||
	 *      links, etc.
 | 
			
		||||
	 *  12- skip extraction, dir already exists.
 | 
			
		||||
	 *  5- file replacing directory- don't allow it.
 | 
			
		||||
	 *  6- skip extraction, dir already exists.
 | 
			
		||||
	 */
 | 
			
		||||
 | 
			
		||||
	/* do both a lstat and a stat, so we can see what symlinks point to */
 | 
			
		||||
	struct stat lsbuf, sbuf;
 | 
			
		||||
	if(_alpm_lstat(filename, &lsbuf) != 0 || stat(filename, &sbuf) != 0) {
 | 
			
		||||
		/* cases 1,2,3: couldn't stat an existing file, skip all backup checks */
 | 
			
		||||
	} else {
 | 
			
		||||
		if(S_ISDIR(lsbuf.st_mode)) {
 | 
			
		||||
			if(S_ISDIR(entrymode)) {
 | 
			
		||||
				/* case 12: existing dir, ignore it */
 | 
			
		||||
				if(lsbuf.st_mode != entrymode) {
 | 
			
		||||
					/* if filesystem perms are different than pkg perms, warn user */
 | 
			
		||||
					mode_t mask = 07777;
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_WARNING, _("directory permissions differ on %s\n"
 | 
			
		||||
								"filesystem: %o  package: %o\n"), filename, lsbuf.st_mode & mask,
 | 
			
		||||
							entrymode & mask);
 | 
			
		||||
					alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
							"warning: directory permissions differ on %s\n"
 | 
			
		||||
							"filesystem: %o  package: %o\n", filename, lsbuf.st_mode & mask,
 | 
			
		||||
							entrymode & mask);
 | 
			
		||||
				}
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
 | 
			
		||||
						filename);
 | 
			
		||||
				archive_read_data_skip(archive);
 | 
			
		||||
				return 0;
 | 
			
		||||
			} else {
 | 
			
		||||
				/* case 10/11: trying to overwrite dir with file/symlink, don't allow it */
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
 | 
			
		||||
						filename);
 | 
			
		||||
				archive_read_data_skip(archive);
 | 
			
		||||
				return 1;
 | 
			
		||||
			}
 | 
			
		||||
		} else if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(entrymode)) {
 | 
			
		||||
			/* case 9: existing symlink, dir in package */
 | 
			
		||||
			if(S_ISDIR(sbuf.st_mode)) {
 | 
			
		||||
				/* the symlink on FS is to a directory, so we'll use it */
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping symlink overwrite of %s\n",
 | 
			
		||||
						filename);
 | 
			
		||||
				archive_read_data_skip(archive);
 | 
			
		||||
				return 0;
 | 
			
		||||
			} else {
 | 
			
		||||
				/* this is BAD. symlink was not to a directory */
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("extract: symlink %s does not point to dir\n"),
 | 
			
		||||
						filename);
 | 
			
		||||
				archive_read_data_skip(archive);
 | 
			
		||||
				return 1;
 | 
			
		||||
			}
 | 
			
		||||
		} else if(S_ISREG(lsbuf.st_mode) && S_ISDIR(entrymode)) {
 | 
			
		||||
			/* case 6: trying to overwrite file with dir */
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
 | 
			
		||||
					filename);
 | 
			
		||||
		} else if(S_ISREG(entrymode)) {
 | 
			
		||||
			/* case 4,7: */
 | 
			
		||||
			/* if file is in NoUpgrade, don't touch it */
 | 
			
		||||
			if(alpm_list_find(handle->noupgrade, entryname, _alpm_fnmatch)) {
 | 
			
		||||
				notouch = 1;
 | 
			
		||||
			} else {
 | 
			
		||||
				alpm_backup_t *backup;
 | 
			
		||||
				/* go to the backup array and see if our conflict is there */
 | 
			
		||||
				/* check newpkg first, so that adding backup files is retroactive */
 | 
			
		||||
				backup = _alpm_needbackup(entryname, newpkg);
 | 
			
		||||
				if(backup) {
 | 
			
		||||
					/* if we force hash_orig to be non-NULL retroactive backup works */
 | 
			
		||||
					hash_orig = "";
 | 
			
		||||
					needbackup = 1;
 | 
			
		||||
				}
 | 
			
		||||
	isnewfile = llstat(filename, &lsbuf) != 0;
 | 
			
		||||
	if(isnewfile) {
 | 
			
		||||
		/* cases 1,2: file doesn't exist, skip all backup checks */
 | 
			
		||||
	} else if(S_ISDIR(lsbuf.st_mode) && S_ISDIR(entrymode)) {
 | 
			
		||||
#if 0
 | 
			
		||||
		uid_t entryuid = archive_entry_uid(entry);
 | 
			
		||||
		gid_t entrygid = archive_entry_gid(entry);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
				/* check oldpkg for a backup entry, store the hash if available */
 | 
			
		||||
				if(oldpkg) {
 | 
			
		||||
					backup = _alpm_needbackup(entryname, oldpkg);
 | 
			
		||||
					if(backup) {
 | 
			
		||||
						hash_orig = backup->hash;
 | 
			
		||||
						needbackup = 1;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
		/* case 6: existing dir, ignore it */
 | 
			
		||||
		if(lsbuf.st_mode != entrymode) {
 | 
			
		||||
			/* if filesystem perms are different than pkg perms, warn user */
 | 
			
		||||
			mode_t mask = 07777;
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING, _("directory permissions differ on %s\n"
 | 
			
		||||
					"filesystem: %o  package: %o\n"), filename, lsbuf.st_mode & mask,
 | 
			
		||||
					entrymode & mask);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"warning: directory permissions differ on %s\n"
 | 
			
		||||
					"filesystem: %o  package: %o\n", filename, lsbuf.st_mode & mask,
 | 
			
		||||
					entrymode & mask);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
		/* Disable this warning until our user management in packages has improved.
 | 
			
		||||
		   Currently many packages have to create users in post_install and chown the
 | 
			
		||||
		   directories. These all resulted in "false-positive" warnings. */
 | 
			
		||||
 | 
			
		||||
		if((entryuid != lsbuf.st_uid) || (entrygid != lsbuf.st_gid)) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING, _("directory ownership differs on %s\n"
 | 
			
		||||
					"filesystem: %u:%u  package: %u:%u\n"), filename,
 | 
			
		||||
					lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"warning: directory ownership differs on %s\n"
 | 
			
		||||
					"filesystem: %u:%u  package: %u:%u\n", filename,
 | 
			
		||||
					lsbuf.st_uid, lsbuf.st_gid, entryuid, entrygid);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "extract: skipping dir extraction of %s\n",
 | 
			
		||||
				filename);
 | 
			
		||||
		archive_read_data_skip(archive);
 | 
			
		||||
		return 0;
 | 
			
		||||
	} else if(S_ISDIR(lsbuf.st_mode)) {
 | 
			
		||||
		/* case 5: trying to overwrite dir with file, don't allow it */
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR, _("extract: not overwriting dir with file %s\n"),
 | 
			
		||||
				filename);
 | 
			
		||||
		archive_read_data_skip(archive);
 | 
			
		||||
		return 1;
 | 
			
		||||
	} else if(S_ISDIR(entrymode)) {
 | 
			
		||||
		/* case 4: trying to overwrite file with dir */
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "extract: overwriting file with dir %s\n",
 | 
			
		||||
				filename);
 | 
			
		||||
	} else {
 | 
			
		||||
		/* case 3: trying to overwrite file with file */
 | 
			
		||||
		/* if file is in NoUpgrade, don't touch it */
 | 
			
		||||
		if(_alpm_fnmatch_patterns(handle->noupgrade, entryname) == 0) {
 | 
			
		||||
			notouch = 1;
 | 
			
		||||
		} else {
 | 
			
		||||
			alpm_backup_t *oldbackup;
 | 
			
		||||
			if(oldpkg && (oldbackup = _alpm_needbackup(entryname, oldpkg))) {
 | 
			
		||||
				hash_orig = oldbackup->hash;
 | 
			
		||||
				needbackup = 1;
 | 
			
		||||
			} else if(backup) {
 | 
			
		||||
				/* allow adding backup files retroactively */
 | 
			
		||||
				needbackup = 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		/* else if(S_ISLNK(entrymode)) */
 | 
			
		||||
		/* case 5,8: don't need to do anything special */
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* we need access to the original entryname later after calls to
 | 
			
		||||
	 * archive_entry_set_pathname(), so we need to dupe it and free() later */
 | 
			
		||||
	STRDUP(entryname_orig, entryname, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
	if(notouch || needbackup) {
 | 
			
		||||
		if(filename_len + strlen(".pacnew") >= PATH_MAX) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
					_("unable to extract %s.pacnew: path too long"), filename);
 | 
			
		||||
			return 1;
 | 
			
		||||
		}
 | 
			
		||||
		strcpy(filename + filename_len, ".pacnew");
 | 
			
		||||
		isnewfile = (llstat(filename, &lsbuf) != 0 && errno == ENOENT);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(needbackup) {
 | 
			
		||||
		char *checkfile;
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "extracting %s\n", filename);
 | 
			
		||||
	if(perform_extraction(handle, archive, entry, filename)) {
 | 
			
		||||
		errors++;
 | 
			
		||||
		return errors;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(backup) {
 | 
			
		||||
		FREE(backup->hash);
 | 
			
		||||
		backup->hash = alpm_compute_md5sum(filename);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(notouch) {
 | 
			
		||||
		alpm_event_pacnew_created_t event = {
 | 
			
		||||
			.type = ALPM_EVENT_PACNEW_CREATED,
 | 
			
		||||
			.from_noupgrade = 1,
 | 
			
		||||
			.oldpkg = oldpkg,
 | 
			
		||||
			.newpkg = newpkg,
 | 
			
		||||
			.file = filename
 | 
			
		||||
		};
 | 
			
		||||
		/* "remove" the .pacnew suffix */
 | 
			
		||||
		filename[filename_len] = '\0';
 | 
			
		||||
		EVENT(handle, &event);
 | 
			
		||||
		alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
				"warning: %s installed as %s.pacnew\n", filename, filename);
 | 
			
		||||
	} else if(needbackup) {
 | 
			
		||||
		char *hash_local = NULL, *hash_pkg = NULL;
 | 
			
		||||
		size_t len;
 | 
			
		||||
		char origfile[PATH_MAX] = "";
 | 
			
		||||
 | 
			
		||||
		len = strlen(filename) + 10;
 | 
			
		||||
		MALLOC(checkfile, len,
 | 
			
		||||
				errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
 | 
			
		||||
		snprintf(checkfile, len, "%s.paccheck", filename);
 | 
			
		||||
		strncat(origfile, filename, filename_len);
 | 
			
		||||
 | 
			
		||||
		if(perform_extraction(handle, archive, entry, checkfile, entryname_orig)) {
 | 
			
		||||
			errors++;
 | 
			
		||||
			goto needbackup_cleanup;
 | 
			
		||||
		}
 | 
			
		||||
		hash_local = alpm_compute_md5sum(origfile);
 | 
			
		||||
		hash_pkg = backup ? backup->hash : alpm_compute_md5sum(filename);
 | 
			
		||||
 | 
			
		||||
		hash_local = alpm_compute_md5sum(filename);
 | 
			
		||||
		hash_pkg = alpm_compute_md5sum(checkfile);
 | 
			
		||||
 | 
			
		||||
		/* update the md5 hash in newpkg's backup (it will be the new original) */
 | 
			
		||||
		alpm_list_t *i;
 | 
			
		||||
		for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) {
 | 
			
		||||
			alpm_backup_t *backup = i->data;
 | 
			
		||||
			char *newhash;
 | 
			
		||||
			if(!backup->name || strcmp(backup->name, entryname_orig) != 0) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			STRDUP(newhash, hash_pkg, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
			FREE(backup->hash);
 | 
			
		||||
			backup->hash = newhash;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "checking hashes for %s\n", entryname_orig);
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "checking hashes for %s\n", origfile);
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "current:  %s\n", hash_local);
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "new:      %s\n", hash_pkg);
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "original: %s\n", hash_orig);
 | 
			
		||||
 | 
			
		||||
		if(!oldpkg) {
 | 
			
		||||
			if(hash_local && hash_pkg && strcmp(hash_local, hash_pkg) != 0) {
 | 
			
		||||
				/* looks like we have a local file that has a different hash as the
 | 
			
		||||
				 * file in the package, move it to a .pacorig */
 | 
			
		||||
				char *newpath;
 | 
			
		||||
				size_t newlen = strlen(filename) + 9;
 | 
			
		||||
				MALLOC(newpath, newlen,
 | 
			
		||||
						errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
 | 
			
		||||
				snprintf(newpath, newlen, "%s.pacorig", filename);
 | 
			
		||||
 | 
			
		||||
				/* move the existing file to the "pacorig" */
 | 
			
		||||
				if(try_rename(handle, filename, newpath)) {
 | 
			
		||||
						errors++;
 | 
			
		||||
					errors++;
 | 
			
		||||
				} else {
 | 
			
		||||
					/* rename the file we extracted to the real name */
 | 
			
		||||
					if(try_rename(handle, checkfile, filename)) {
 | 
			
		||||
						errors++;
 | 
			
		||||
					} else {
 | 
			
		||||
						_alpm_log(handle, ALPM_LOG_WARNING, _("%s saved as %s\n"), filename, newpath);
 | 
			
		||||
						alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
								"warning: %s saved as %s\n", filename, newpath);
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
				free(newpath);
 | 
			
		||||
			} else {
 | 
			
		||||
				/* local file is identical to pkg one, so just remove pkg one */
 | 
			
		||||
				unlink(checkfile);
 | 
			
		||||
		if(hash_local && hash_pkg && strcmp(hash_local, hash_pkg) == 0) {
 | 
			
		||||
			/* local and new files are the same, updating anyway to get
 | 
			
		||||
			 * correct timestamps */
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "action: installing new file: %s\n",
 | 
			
		||||
					origfile);
 | 
			
		||||
			if(try_rename(handle, filename, origfile)) {
 | 
			
		||||
				errors++;
 | 
			
		||||
			}
 | 
			
		||||
		} else if(hash_orig) {
 | 
			
		||||
			/* the fun part */
 | 
			
		||||
 | 
			
		||||
			if(hash_local && strcmp(hash_orig, hash_local) == 0) {
 | 
			
		||||
				/* installed file has NOT been changed by user */
 | 
			
		||||
				if(hash_pkg && strcmp(hash_orig, hash_pkg) != 0) {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG, "action: installing new file: %s\n",
 | 
			
		||||
							entryname_orig);
 | 
			
		||||
 | 
			
		||||
					if(try_rename(handle, checkfile, filename)) {
 | 
			
		||||
						errors++;
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					/* no sense in installing the same file twice, install
 | 
			
		||||
					 * ONLY if the original and package hashes differ */
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG, "action: leaving existing file in place\n");
 | 
			
		||||
					unlink(checkfile);
 | 
			
		||||
				}
 | 
			
		||||
			} else if(hash_pkg && strcmp(hash_orig, hash_pkg) == 0) {
 | 
			
		||||
				/* originally installed file and new file are the same - this
 | 
			
		||||
				 * implies the case above failed - i.e. the file was changed by a
 | 
			
		||||
				 * user */
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "action: leaving existing file in place\n");
 | 
			
		||||
				unlink(checkfile);
 | 
			
		||||
			} else if(hash_local && hash_pkg && strcmp(hash_local, hash_pkg) == 0) {
 | 
			
		||||
				/* this would be magical.  The above two cases failed, but the
 | 
			
		||||
				 * user changes just so happened to make the new file exactly the
 | 
			
		||||
				 * same as the one in the package... skip it */
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "action: leaving existing file in place\n");
 | 
			
		||||
				unlink(checkfile);
 | 
			
		||||
			} else {
 | 
			
		||||
				char *newpath;
 | 
			
		||||
				size_t newlen = strlen(filename) + 8;
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "action: keeping current file and installing"
 | 
			
		||||
						" new one with .pacnew ending\n");
 | 
			
		||||
				MALLOC(newpath, newlen,
 | 
			
		||||
						errors++; handle->pm_errno = ALPM_ERR_MEMORY; goto needbackup_cleanup);
 | 
			
		||||
				snprintf(newpath, newlen, "%s.pacnew", filename);
 | 
			
		||||
				if(try_rename(handle, checkfile, newpath)) {
 | 
			
		||||
					errors++;
 | 
			
		||||
				} else {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_WARNING, _("%s installed as %s\n"),
 | 
			
		||||
							filename, newpath);
 | 
			
		||||
					alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
							"warning: %s installed as %s\n", filename, newpath);
 | 
			
		||||
				}
 | 
			
		||||
				free(newpath);
 | 
			
		||||
		} else if(hash_orig && hash_pkg && strcmp(hash_orig, hash_pkg) == 0) {
 | 
			
		||||
			/* original and new files are the same, leave the local version alone,
 | 
			
		||||
			 * including any user changes */
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"action: leaving existing file in place\n");
 | 
			
		||||
			if(isnewfile) {
 | 
			
		||||
				unlink(filename);
 | 
			
		||||
			}
 | 
			
		||||
		} else if(hash_orig && hash_local && strcmp(hash_orig, hash_local) == 0) {
 | 
			
		||||
			/* installed file has NOT been changed by user,
 | 
			
		||||
			 * update to the new version */
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "action: installing new file: %s\n",
 | 
			
		||||
					origfile);
 | 
			
		||||
			if(try_rename(handle, filename, origfile)) {
 | 
			
		||||
				errors++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
needbackup_cleanup:
 | 
			
		||||
		free(checkfile);
 | 
			
		||||
		free(hash_local);
 | 
			
		||||
		free(hash_pkg);
 | 
			
		||||
	} else {
 | 
			
		||||
		/* we didn't need a backup */
 | 
			
		||||
		if(notouch) {
 | 
			
		||||
			/* change the path to a .pacnew extension */
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "%s is in NoUpgrade -- skipping\n", filename);
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING, _("extracting %s as %s.pacnew\n"), filename, filename);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"warning: extracting %s as %s.pacnew\n", filename, filename);
 | 
			
		||||
			strncat(filename, ".pacnew", PATH_MAX - strlen(filename));
 | 
			
		||||
		} else {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "extracting %s\n", filename);
 | 
			
		||||
			/* none of the three files matched another,  leave the unpacked
 | 
			
		||||
			 * file alongside the local file */
 | 
			
		||||
			alpm_event_pacnew_created_t event = {
 | 
			
		||||
				.type = ALPM_EVENT_PACNEW_CREATED,
 | 
			
		||||
				.from_noupgrade = 0,
 | 
			
		||||
				.oldpkg = oldpkg,
 | 
			
		||||
				.newpkg = newpkg,
 | 
			
		||||
				.file = origfile
 | 
			
		||||
			};
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"action: keeping current file and installing"
 | 
			
		||||
					" new one with .pacnew ending\n");
 | 
			
		||||
			EVENT(handle, &event);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"warning: %s installed as %s\n", origfile, filename);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(handle->trans->flags & ALPM_TRANS_FLAG_FORCE) {
 | 
			
		||||
			/* if FORCE was used, unlink() each file (whether it's there
 | 
			
		||||
			 * or not) before extracting. This prevents the old "Text file busy"
 | 
			
		||||
			 * error that crops up if forcing a glibc or pacman upgrade. */
 | 
			
		||||
			unlink(filename);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(perform_extraction(handle, archive, entry, filename, entryname_orig)) {
 | 
			
		||||
			/* error */
 | 
			
		||||
			free(entryname_orig);
 | 
			
		||||
			errors++;
 | 
			
		||||
			return errors;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* calculate an hash if this is in newpkg's backup */
 | 
			
		||||
		alpm_list_t *i;
 | 
			
		||||
		for(i = alpm_pkg_get_backup(newpkg); i; i = i->next) {
 | 
			
		||||
			alpm_backup_t *backup = i->data;
 | 
			
		||||
			char *newhash;
 | 
			
		||||
			if(!backup->name || strcmp(backup->name, entryname_orig) != 0) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "appending backup entry for %s\n", entryname_orig);
 | 
			
		||||
			newhash = alpm_compute_md5sum(filename);
 | 
			
		||||
			FREE(backup->hash);
 | 
			
		||||
			backup->hash = newhash;
 | 
			
		||||
		free(hash_local);
 | 
			
		||||
		if(!backup) {
 | 
			
		||||
			free(hash_pkg);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	free(entryname_orig);
 | 
			
		||||
	return errors;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -468,46 +415,45 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 | 
			
		||||
	alpm_pkg_t *oldpkg = NULL;
 | 
			
		||||
	alpm_db_t *db = handle->db_local;
 | 
			
		||||
	alpm_trans_t *trans = handle->trans;
 | 
			
		||||
	alpm_progress_t event = ALPM_PROGRESS_ADD_START;
 | 
			
		||||
	alpm_event_t done = ALPM_EVENT_ADD_DONE, start = ALPM_EVENT_ADD_START;
 | 
			
		||||
	alpm_progress_t progress = ALPM_PROGRESS_ADD_START;
 | 
			
		||||
	alpm_event_package_operation_t event;
 | 
			
		||||
	const char *log_msg = "adding";
 | 
			
		||||
	const char *pkgfile;
 | 
			
		||||
	struct archive *archive;
 | 
			
		||||
	struct archive_entry *entry;
 | 
			
		||||
	int fd, cwdfd;
 | 
			
		||||
	struct stat buf;
 | 
			
		||||
 | 
			
		||||
	ASSERT(trans != NULL, return -1);
 | 
			
		||||
 | 
			
		||||
	/* see if this is an upgrade. if so, remove the old package first */
 | 
			
		||||
	alpm_pkg_t *local = _alpm_db_get_pkgfromcache(db, newpkg->name);
 | 
			
		||||
	if(local) {
 | 
			
		||||
		int cmp = _alpm_pkg_compare_versions(newpkg, local);
 | 
			
		||||
	if((oldpkg = newpkg->oldpkg)) {
 | 
			
		||||
		int cmp = _alpm_pkg_compare_versions(newpkg, oldpkg);
 | 
			
		||||
		if(cmp < 0) {
 | 
			
		||||
			log_msg = "downgrading";
 | 
			
		||||
			event = ALPM_PROGRESS_DOWNGRADE_START;
 | 
			
		||||
			start = ALPM_EVENT_DOWNGRADE_START;
 | 
			
		||||
			done = ALPM_EVENT_DOWNGRADE_DONE;
 | 
			
		||||
			progress = ALPM_PROGRESS_DOWNGRADE_START;
 | 
			
		||||
			event.operation = ALPM_PACKAGE_DOWNGRADE;
 | 
			
		||||
		} else if(cmp == 0) {
 | 
			
		||||
			log_msg = "reinstalling";
 | 
			
		||||
			event = ALPM_PROGRESS_REINSTALL_START;
 | 
			
		||||
			start = ALPM_EVENT_REINSTALL_START;
 | 
			
		||||
			done = ALPM_EVENT_REINSTALL_DONE;
 | 
			
		||||
			progress = ALPM_PROGRESS_REINSTALL_START;
 | 
			
		||||
			event.operation = ALPM_PACKAGE_REINSTALL;
 | 
			
		||||
		} else {
 | 
			
		||||
			log_msg = "upgrading";
 | 
			
		||||
			event = ALPM_PROGRESS_UPGRADE_START;
 | 
			
		||||
			start = ALPM_EVENT_UPGRADE_START;
 | 
			
		||||
			done = ALPM_EVENT_UPGRADE_DONE;
 | 
			
		||||
			progress = ALPM_PROGRESS_UPGRADE_START;
 | 
			
		||||
			event.operation = ALPM_PACKAGE_UPGRADE;
 | 
			
		||||
		}
 | 
			
		||||
		is_upgrade = 1;
 | 
			
		||||
 | 
			
		||||
		/* we'll need to save some record for backup checks later */
 | 
			
		||||
		if(_alpm_pkg_dup(local, &oldpkg) == -1) {
 | 
			
		||||
			ret = -1;
 | 
			
		||||
			goto cleanup;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* copy over the install reason */
 | 
			
		||||
		newpkg->reason = alpm_pkg_get_reason(local);
 | 
			
		||||
		newpkg->reason = alpm_pkg_get_reason(oldpkg);
 | 
			
		||||
	} else {
 | 
			
		||||
		event.operation = ALPM_PACKAGE_INSTALL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	EVENT(handle, start, newpkg, local);
 | 
			
		||||
	event.type = ALPM_EVENT_PACKAGE_OPERATION_START;
 | 
			
		||||
	event.oldpkg = oldpkg;
 | 
			
		||||
	event.newpkg = newpkg;
 | 
			
		||||
	EVENT(handle, &event);
 | 
			
		||||
 | 
			
		||||
	pkgfile = newpkg->origin_data.file;
 | 
			
		||||
 | 
			
		||||
@@ -538,8 +484,8 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* prepare directory for database entries so permission are correct after
 | 
			
		||||
	   changelog/install script installation (FS#12263) */
 | 
			
		||||
	/* prepare directory for database entries so permissions are correct after
 | 
			
		||||
	   changelog/install script installation */
 | 
			
		||||
	if(_alpm_local_db_prepare(db, newpkg)) {
 | 
			
		||||
		alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
				"error: could not create database entry %s-%s\n",
 | 
			
		||||
@@ -549,39 +495,47 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(!(trans->flags & ALPM_TRANS_FLAG_DBONLY)) {
 | 
			
		||||
		struct archive *archive;
 | 
			
		||||
		struct archive_entry *entry;
 | 
			
		||||
		struct stat buf;
 | 
			
		||||
		int fd, cwdfd;
 | 
			
		||||
	fd = _alpm_open_archive(db->handle, pkgfile, &buf,
 | 
			
		||||
			&archive, ALPM_ERR_PKG_OPEN);
 | 
			
		||||
	if(fd < 0) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* save the cwd so we can restore it later */
 | 
			
		||||
	OPEN(cwdfd, ".", O_RDONLY | O_CLOEXEC);
 | 
			
		||||
	if(cwdfd < 0) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n"));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* libarchive requires this for extracting hard links */
 | 
			
		||||
	if(chdir(handle->root) != 0) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
 | 
			
		||||
				handle->root, strerror(errno));
 | 
			
		||||
		_alpm_archive_read_free(archive);
 | 
			
		||||
		if(cwdfd >= 0) {
 | 
			
		||||
			close(cwdfd);
 | 
			
		||||
		}
 | 
			
		||||
		close(fd);
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(trans->flags & ALPM_TRANS_FLAG_DBONLY) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "extracting db files\n");
 | 
			
		||||
		while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
 | 
			
		||||
			const char *entryname = archive_entry_pathname(entry);
 | 
			
		||||
			if(entryname[0] == '.') {
 | 
			
		||||
				errors += extract_db_file(handle, archive, entry, newpkg, entryname);
 | 
			
		||||
			} else {
 | 
			
		||||
				archive_read_data_skip(archive);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "extracting files\n");
 | 
			
		||||
 | 
			
		||||
		fd = _alpm_open_archive(db->handle, pkgfile, &buf,
 | 
			
		||||
				&archive, ALPM_ERR_PKG_OPEN);
 | 
			
		||||
		if(fd < 0) {
 | 
			
		||||
			ret = -1;
 | 
			
		||||
			goto cleanup;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* save the cwd so we can restore it later */
 | 
			
		||||
		OPEN(cwdfd, ".", O_RDONLY);
 | 
			
		||||
		if(cwdfd < 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("could not get current working directory\n"));
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* libarchive requires this for extracting hard links */
 | 
			
		||||
		if(chdir(handle->root) != 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("could not change directory to %s (%s)\n"),
 | 
			
		||||
					handle->root, strerror(errno));
 | 
			
		||||
			_alpm_archive_read_free(archive);
 | 
			
		||||
			CLOSE(fd);
 | 
			
		||||
			ret = -1;
 | 
			
		||||
			goto cleanup;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* call PROGRESS once with 0 percent, as we sort-of skip that here */
 | 
			
		||||
		PROGRESS(handle, event, newpkg->name, 0, pkg_count, pkg_current);
 | 
			
		||||
		PROGRESS(handle, progress, newpkg->name, 0, pkg_count, pkg_current);
 | 
			
		||||
 | 
			
		||||
		for(i = 0; archive_read_next_header(archive, &entry) == ARCHIVE_OK; i++) {
 | 
			
		||||
			int percent;
 | 
			
		||||
@@ -599,38 +553,39 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 | 
			
		||||
				percent = 0;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			PROGRESS(handle, event, newpkg->name, percent, pkg_count, pkg_current);
 | 
			
		||||
			PROGRESS(handle, progress, newpkg->name, percent, pkg_count, pkg_current);
 | 
			
		||||
 | 
			
		||||
			/* extract the next file from the archive */
 | 
			
		||||
			errors += extract_single_file(handle, archive, entry, newpkg, oldpkg);
 | 
			
		||||
		}
 | 
			
		||||
		_alpm_archive_read_free(archive);
 | 
			
		||||
		CLOSE(fd);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		/* restore the old cwd if we have it */
 | 
			
		||||
		if(cwdfd >= 0) {
 | 
			
		||||
			if(fchdir(cwdfd) != 0) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
						_("could not restore working directory (%s)\n"), strerror(errno));
 | 
			
		||||
			}
 | 
			
		||||
			CLOSE(cwdfd);
 | 
			
		||||
	_alpm_archive_read_free(archive);
 | 
			
		||||
	close(fd);
 | 
			
		||||
 | 
			
		||||
	/* restore the old cwd if we have it */
 | 
			
		||||
	if(cwdfd >= 0) {
 | 
			
		||||
		if(fchdir(cwdfd) != 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
					_("could not restore working directory (%s)\n"), strerror(errno));
 | 
			
		||||
		}
 | 
			
		||||
		close(cwdfd);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
		if(errors) {
 | 
			
		||||
			ret = -1;
 | 
			
		||||
			if(is_upgrade) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("problem occurred while upgrading %s\n"),
 | 
			
		||||
						newpkg->name);
 | 
			
		||||
				alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
						"error: problem occurred while upgrading %s\n",
 | 
			
		||||
						newpkg->name);
 | 
			
		||||
			} else {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("problem occurred while installing %s\n"),
 | 
			
		||||
						newpkg->name);
 | 
			
		||||
				alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
						"error: problem occurred while installing %s\n",
 | 
			
		||||
						newpkg->name);
 | 
			
		||||
			}
 | 
			
		||||
	if(errors) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		if(is_upgrade) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("problem occurred while upgrading %s\n"),
 | 
			
		||||
					newpkg->name);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"error: problem occurred while upgrading %s\n",
 | 
			
		||||
					newpkg->name);
 | 
			
		||||
		} else {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("problem occurred while installing %s\n"),
 | 
			
		||||
					newpkg->name);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"error: problem occurred while installing %s\n",
 | 
			
		||||
					newpkg->name);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -656,9 +611,31 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 | 
			
		||||
				newpkg->name);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	PROGRESS(handle, event, newpkg->name, 100, pkg_count, pkg_current);
 | 
			
		||||
	PROGRESS(handle, progress, newpkg->name, 100, pkg_count, pkg_current);
 | 
			
		||||
 | 
			
		||||
	/* run the post-install script if it exists  */
 | 
			
		||||
	switch(event.operation) {
 | 
			
		||||
		case ALPM_PACKAGE_INSTALL:
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX, "installed %s (%s)\n",
 | 
			
		||||
					newpkg->name, newpkg->version);
 | 
			
		||||
			break;
 | 
			
		||||
		case ALPM_PACKAGE_DOWNGRADE:
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX, "downgraded %s (%s -> %s)\n",
 | 
			
		||||
					newpkg->name, oldpkg->version, newpkg->version);
 | 
			
		||||
			break;
 | 
			
		||||
		case ALPM_PACKAGE_REINSTALL:
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX, "reinstalled %s (%s)\n",
 | 
			
		||||
					newpkg->name, newpkg->version);
 | 
			
		||||
			break;
 | 
			
		||||
		case ALPM_PACKAGE_UPGRADE:
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX, "upgraded %s (%s -> %s)\n",
 | 
			
		||||
					newpkg->name, oldpkg->version, newpkg->version);
 | 
			
		||||
			break;
 | 
			
		||||
		default:
 | 
			
		||||
			/* we should never reach here */
 | 
			
		||||
			break;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* run the post-install script if it exists */
 | 
			
		||||
	if(alpm_pkg_has_scriptlet(newpkg)
 | 
			
		||||
			&& !(trans->flags & ALPM_TRANS_FLAG_NOSCRIPTLET)) {
 | 
			
		||||
		char *scriptlet = _alpm_local_db_pkgpath(db, newpkg, "install");
 | 
			
		||||
@@ -669,10 +646,10 @@ static int commit_single_pkg(alpm_handle_t *handle, alpm_pkg_t *newpkg,
 | 
			
		||||
		free(scriptlet);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	EVENT(handle, done, newpkg, oldpkg);
 | 
			
		||||
	event.type = ALPM_EVENT_PACKAGE_OPERATION_DONE;
 | 
			
		||||
	EVENT(handle, &event);
 | 
			
		||||
 | 
			
		||||
cleanup:
 | 
			
		||||
	_alpm_pkg_free(oldpkg);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -717,5 +694,3 @@ int _alpm_upgrade_packages(alpm_handle_t *handle)
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  add.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_ADD_H
 | 
			
		||||
#define _ALPM_ADD_H
 | 
			
		||||
#ifndef ALPM_ADD_H
 | 
			
		||||
#define ALPM_ADD_H
 | 
			
		||||
 | 
			
		||||
#include "db.h"
 | 
			
		||||
#include "alpm_list.h"
 | 
			
		||||
@@ -26,6 +26,4 @@
 | 
			
		||||
 | 
			
		||||
int _alpm_upgrade_packages(alpm_handle_t *handle);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_ADD_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_ADD_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  alpm.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
 | 
			
		||||
@@ -50,12 +50,12 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
 | 
			
		||||
{
 | 
			
		||||
	alpm_errno_t myerr;
 | 
			
		||||
	const char *lf = "db.lck";
 | 
			
		||||
	char *hookdir;
 | 
			
		||||
	size_t lockfilelen;
 | 
			
		||||
	alpm_handle_t *myhandle = _alpm_handle_new();
 | 
			
		||||
 | 
			
		||||
	if(myhandle == NULL) {
 | 
			
		||||
		myerr = ALPM_ERR_MEMORY;
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
		goto nomem;
 | 
			
		||||
	}
 | 
			
		||||
	if((myerr = _alpm_set_directory_option(root, &(myhandle->root), 1))) {
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
@@ -64,8 +64,18 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* to concatenate myhandle->root (ends with a slash) with SYSHOOKDIR (starts
 | 
			
		||||
	 * with a slash) correctly, we skip SYSHOOKDIR[0]; the regular +1 therefore
 | 
			
		||||
	 * disappears from the allocation */
 | 
			
		||||
	MALLOC(hookdir, strlen(myhandle->root) + strlen(SYSHOOKDIR), goto nomem);
 | 
			
		||||
	sprintf(hookdir, "%s%s", myhandle->root, SYSHOOKDIR + 1);
 | 
			
		||||
	myhandle->hookdirs = alpm_list_add(NULL, hookdir);
 | 
			
		||||
 | 
			
		||||
	/* set default database extension */
 | 
			
		||||
	STRDUP(myhandle->dbext, ".db", goto nomem);
 | 
			
		||||
 | 
			
		||||
	lockfilelen = strlen(myhandle->dbpath) + strlen(lf) + 1;
 | 
			
		||||
	myhandle->lockfile = calloc(lockfilelen, sizeof(char));
 | 
			
		||||
	MALLOC(myhandle->lockfile, lockfilelen, goto nomem);
 | 
			
		||||
	snprintf(myhandle->lockfile, lockfilelen, "%s%s", myhandle->dbpath, lf);
 | 
			
		||||
 | 
			
		||||
	if(_alpm_db_register_local(myhandle) == NULL) {
 | 
			
		||||
@@ -79,9 +89,11 @@ alpm_handle_t SYMEXPORT *alpm_initialize(const char *root, const char *dbpath,
 | 
			
		||||
 | 
			
		||||
	return myhandle;
 | 
			
		||||
 | 
			
		||||
nomem:
 | 
			
		||||
	myerr = ALPM_ERR_MEMORY;
 | 
			
		||||
cleanup:
 | 
			
		||||
	_alpm_handle_free(myhandle);
 | 
			
		||||
	if(err && myerr) {
 | 
			
		||||
	if(err) {
 | 
			
		||||
		*err = myerr;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
@@ -140,7 +152,7 @@ const char SYMEXPORT *alpm_version(void)
 | 
			
		||||
/** Get the capabilities of the library.
 | 
			
		||||
 * @return a bitmask of the capabilities
 | 
			
		||||
 * */
 | 
			
		||||
enum alpm_caps SYMEXPORT alpm_capabilities(void)
 | 
			
		||||
int SYMEXPORT alpm_capabilities(void)
 | 
			
		||||
{
 | 
			
		||||
	return 0
 | 
			
		||||
#ifdef ENABLE_NLS
 | 
			
		||||
@@ -154,5 +166,3 @@ enum alpm_caps SYMEXPORT alpm_capabilities(void)
 | 
			
		||||
#endif
 | 
			
		||||
		| 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 * alpm.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
 | 
			
		||||
@@ -20,8 +20,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_H
 | 
			
		||||
#define _ALPM_H
 | 
			
		||||
#ifndef ALPM_H
 | 
			
		||||
#define ALPM_H
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
@@ -41,6 +41,95 @@ extern "C" {
 | 
			
		||||
 * Arch Linux Package Management library
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Opaque Structures
 | 
			
		||||
 */
 | 
			
		||||
typedef struct __alpm_handle_t alpm_handle_t;
 | 
			
		||||
typedef struct __alpm_db_t alpm_db_t;
 | 
			
		||||
typedef struct __alpm_pkg_t alpm_pkg_t;
 | 
			
		||||
typedef struct __alpm_trans_t alpm_trans_t;
 | 
			
		||||
 | 
			
		||||
/** @addtogroup alpm_api_errors Error Codes
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
typedef enum _alpm_errno_t {
 | 
			
		||||
	ALPM_ERR_OK = 0,
 | 
			
		||||
	ALPM_ERR_MEMORY,
 | 
			
		||||
	ALPM_ERR_SYSTEM,
 | 
			
		||||
	ALPM_ERR_BADPERMS,
 | 
			
		||||
	ALPM_ERR_NOT_A_FILE,
 | 
			
		||||
	ALPM_ERR_NOT_A_DIR,
 | 
			
		||||
	ALPM_ERR_WRONG_ARGS,
 | 
			
		||||
	ALPM_ERR_DISK_SPACE,
 | 
			
		||||
	/* Interface */
 | 
			
		||||
	ALPM_ERR_HANDLE_NULL,
 | 
			
		||||
	ALPM_ERR_HANDLE_NOT_NULL,
 | 
			
		||||
	ALPM_ERR_HANDLE_LOCK,
 | 
			
		||||
	/* Databases */
 | 
			
		||||
	ALPM_ERR_DB_OPEN,
 | 
			
		||||
	ALPM_ERR_DB_CREATE,
 | 
			
		||||
	ALPM_ERR_DB_NULL,
 | 
			
		||||
	ALPM_ERR_DB_NOT_NULL,
 | 
			
		||||
	ALPM_ERR_DB_NOT_FOUND,
 | 
			
		||||
	ALPM_ERR_DB_INVALID,
 | 
			
		||||
	ALPM_ERR_DB_INVALID_SIG,
 | 
			
		||||
	ALPM_ERR_DB_VERSION,
 | 
			
		||||
	ALPM_ERR_DB_WRITE,
 | 
			
		||||
	ALPM_ERR_DB_REMOVE,
 | 
			
		||||
	/* Servers */
 | 
			
		||||
	ALPM_ERR_SERVER_BAD_URL,
 | 
			
		||||
	ALPM_ERR_SERVER_NONE,
 | 
			
		||||
	/* Transactions */
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_NULL,
 | 
			
		||||
	ALPM_ERR_TRANS_NULL,
 | 
			
		||||
	ALPM_ERR_TRANS_DUP_TARGET,
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_INITIALIZED,
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_PREPARED,
 | 
			
		||||
	ALPM_ERR_TRANS_ABORT,
 | 
			
		||||
	ALPM_ERR_TRANS_TYPE,
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_LOCKED,
 | 
			
		||||
	ALPM_ERR_TRANS_HOOK_FAILED,
 | 
			
		||||
	/* Packages */
 | 
			
		||||
	ALPM_ERR_PKG_NOT_FOUND,
 | 
			
		||||
	ALPM_ERR_PKG_IGNORED,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_CHECKSUM,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_SIG,
 | 
			
		||||
	ALPM_ERR_PKG_MISSING_SIG,
 | 
			
		||||
	ALPM_ERR_PKG_OPEN,
 | 
			
		||||
	ALPM_ERR_PKG_CANT_REMOVE,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_NAME,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_ARCH,
 | 
			
		||||
	ALPM_ERR_PKG_REPO_NOT_FOUND,
 | 
			
		||||
	/* Signatures */
 | 
			
		||||
	ALPM_ERR_SIG_MISSING,
 | 
			
		||||
	ALPM_ERR_SIG_INVALID,
 | 
			
		||||
	/* Deltas */
 | 
			
		||||
	ALPM_ERR_DLT_INVALID,
 | 
			
		||||
	ALPM_ERR_DLT_PATCHFAILED,
 | 
			
		||||
	/* Dependencies */
 | 
			
		||||
	ALPM_ERR_UNSATISFIED_DEPS,
 | 
			
		||||
	ALPM_ERR_CONFLICTING_DEPS,
 | 
			
		||||
	ALPM_ERR_FILE_CONFLICTS,
 | 
			
		||||
	/* Misc */
 | 
			
		||||
	ALPM_ERR_RETRIEVE,
 | 
			
		||||
	ALPM_ERR_INVALID_REGEX,
 | 
			
		||||
	/* External library errors */
 | 
			
		||||
	ALPM_ERR_LIBARCHIVE,
 | 
			
		||||
	ALPM_ERR_LIBCURL,
 | 
			
		||||
	ALPM_ERR_EXTERNAL_DOWNLOAD,
 | 
			
		||||
	ALPM_ERR_GPGME
 | 
			
		||||
} alpm_errno_t;
 | 
			
		||||
 | 
			
		||||
/** Returns the current error code from the handle. */
 | 
			
		||||
alpm_errno_t alpm_errno(alpm_handle_t *handle);
 | 
			
		||||
 | 
			
		||||
/** Returns the string corresponding to an error number. */
 | 
			
		||||
const char *alpm_strerror(alpm_errno_t err);
 | 
			
		||||
 | 
			
		||||
/* End of alpm_api_errors */
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @addtogroup alpm_api Public API
 | 
			
		||||
 * The libalpm Public API
 | 
			
		||||
 * @{
 | 
			
		||||
@@ -79,17 +168,17 @@ typedef enum _alpm_pkgvalidation_t {
 | 
			
		||||
 | 
			
		||||
/** Types of version constraints in dependency specs. */
 | 
			
		||||
typedef enum _alpm_depmod_t {
 | 
			
		||||
  /** No version constraint */
 | 
			
		||||
	/** No version constraint */
 | 
			
		||||
	ALPM_DEP_MOD_ANY = 1,
 | 
			
		||||
  /** Test version equality (package=x.y.z) */
 | 
			
		||||
	/** Test version equality (package=x.y.z) */
 | 
			
		||||
	ALPM_DEP_MOD_EQ,
 | 
			
		||||
  /** Test for at least a version (package>=x.y.z) */
 | 
			
		||||
	/** Test for at least a version (package>=x.y.z) */
 | 
			
		||||
	ALPM_DEP_MOD_GE,
 | 
			
		||||
  /** Test for at most a version (package<=x.y.z) */
 | 
			
		||||
	/** Test for at most a version (package<=x.y.z) */
 | 
			
		||||
	ALPM_DEP_MOD_LE,
 | 
			
		||||
  /** Test for greater than some version (package>x.y.z) */
 | 
			
		||||
	/** Test for greater than some version (package>x.y.z) */
 | 
			
		||||
	ALPM_DEP_MOD_GT,
 | 
			
		||||
  /** Test for less than some version (package<x.y.z) */
 | 
			
		||||
	/** Test for less than some version (package<x.y.z) */
 | 
			
		||||
	ALPM_DEP_MOD_LT
 | 
			
		||||
} alpm_depmod_t;
 | 
			
		||||
 | 
			
		||||
@@ -115,10 +204,7 @@ typedef enum _alpm_siglevel_t {
 | 
			
		||||
	ALPM_SIG_DATABASE_MARGINAL_OK = (1 << 12),
 | 
			
		||||
	ALPM_SIG_DATABASE_UNKNOWN_OK = (1 << 13),
 | 
			
		||||
 | 
			
		||||
	ALPM_SIG_PACKAGE_SET = (1 << 27),
 | 
			
		||||
	ALPM_SIG_PACKAGE_TRUST_SET = (1 << 28),
 | 
			
		||||
 | 
			
		||||
	ALPM_SIG_USE_DEFAULT = (1 << 31)
 | 
			
		||||
	ALPM_SIG_USE_DEFAULT = (1 << 30)
 | 
			
		||||
} alpm_siglevel_t;
 | 
			
		||||
 | 
			
		||||
/** PGP signature verification status return codes */
 | 
			
		||||
@@ -143,11 +229,6 @@ typedef enum _alpm_sigvalidity_t {
 | 
			
		||||
 * Structures
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef struct __alpm_handle_t alpm_handle_t;
 | 
			
		||||
typedef struct __alpm_db_t alpm_db_t;
 | 
			
		||||
typedef struct __alpm_pkg_t alpm_pkg_t;
 | 
			
		||||
typedef struct __alpm_trans_t alpm_trans_t;
 | 
			
		||||
 | 
			
		||||
/** Dependency */
 | 
			
		||||
typedef struct _alpm_depend_t {
 | 
			
		||||
	char *name;
 | 
			
		||||
@@ -217,7 +298,6 @@ typedef struct _alpm_file_t {
 | 
			
		||||
typedef struct _alpm_filelist_t {
 | 
			
		||||
	size_t count;
 | 
			
		||||
	alpm_file_t *files;
 | 
			
		||||
	char **resolved_path;
 | 
			
		||||
} alpm_filelist_t;
 | 
			
		||||
 | 
			
		||||
/** Local package or package file backup entry */
 | 
			
		||||
@@ -251,13 +331,23 @@ typedef struct _alpm_sigresult_t {
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Signature list. Contains the number of signatures found and a pointer to an
 | 
			
		||||
 * array of results.  The array is of size count.
 | 
			
		||||
 * array of results. The array is of size count.
 | 
			
		||||
 */
 | 
			
		||||
typedef struct _alpm_siglist_t {
 | 
			
		||||
	size_t count;
 | 
			
		||||
	alpm_sigresult_t *results;
 | 
			
		||||
} alpm_siglist_t;
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Hooks
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
typedef enum _alpm_hook_when_t {
 | 
			
		||||
	ALPM_HOOK_PRE_TRANSACTION = 1,
 | 
			
		||||
	ALPM_HOOK_POST_TRANSACTION
 | 
			
		||||
} alpm_hook_when_t;
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Logging facilities
 | 
			
		||||
 */
 | 
			
		||||
@@ -276,10 +366,9 @@ int alpm_logaction(alpm_handle_t *handle, const char *prefix,
 | 
			
		||||
		const char *fmt, ...) __attribute__((format(printf, 3, 4)));
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Events.
 | 
			
		||||
 * NULL parameters are passed to in all events unless specified otherwise.
 | 
			
		||||
 * Type of events.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum _alpm_event_t {
 | 
			
		||||
typedef enum _alpm_event_type_t {
 | 
			
		||||
	/** Dependencies will be computed for a package. */
 | 
			
		||||
	ALPM_EVENT_CHECKDEPS_START = 1,
 | 
			
		||||
	/** Dependencies were computed for a package. */
 | 
			
		||||
@@ -296,49 +385,16 @@ typedef enum _alpm_event_t {
 | 
			
		||||
	ALPM_EVENT_INTERCONFLICTS_START,
 | 
			
		||||
	/** Inter-conflicts were checked for target package. */
 | 
			
		||||
	ALPM_EVENT_INTERCONFLICTS_DONE,
 | 
			
		||||
	/** Package will be installed.
 | 
			
		||||
	 * A pointer to the target package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_ADD_START,
 | 
			
		||||
	/** Package was installed.
 | 
			
		||||
	 * A pointer to the new package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_ADD_DONE,
 | 
			
		||||
	/** Package will be removed.
 | 
			
		||||
	 * A pointer to the target package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_REMOVE_START,
 | 
			
		||||
	/** Package was removed.
 | 
			
		||||
	 * A pointer to the removed package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_REMOVE_DONE,
 | 
			
		||||
	/** Package will be upgraded.
 | 
			
		||||
	 * A pointer to the upgraded package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_UPGRADE_START,
 | 
			
		||||
	/** Package was upgraded.
 | 
			
		||||
	 * A pointer to the new package, and a pointer to the old package is passed
 | 
			
		||||
	 * to the callback, respectively.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_UPGRADE_DONE,
 | 
			
		||||
	/** Package will be downgraded.
 | 
			
		||||
	 * A pointer to the downgraded package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_DOWNGRADE_START,
 | 
			
		||||
	/** Package was downgraded.
 | 
			
		||||
	 * A pointer to the new package, and a pointer to the old package is passed
 | 
			
		||||
	 * to the callback, respectively.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_DOWNGRADE_DONE,
 | 
			
		||||
	/** Package will be reinstalled.
 | 
			
		||||
	 * A pointer to the reinstalled package is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_REINSTALL_START,
 | 
			
		||||
	/** Package was reinstalled.
 | 
			
		||||
	 * A pointer to the new package, and a pointer to the old package is passed
 | 
			
		||||
	 * to the callback, respectively.
 | 
			
		||||
	 */
 | 
			
		||||
	ALPM_EVENT_REINSTALL_DONE,
 | 
			
		||||
	/** Processing the package transaction is starting. */
 | 
			
		||||
	ALPM_EVENT_TRANSACTION_START,
 | 
			
		||||
	/** Processing the package transaction is finished. */
 | 
			
		||||
	ALPM_EVENT_TRANSACTION_DONE,
 | 
			
		||||
	/** Package will be installed/upgraded/downgraded/re-installed/removed; See
 | 
			
		||||
	 * alpm_event_package_operation_t for arguments. */
 | 
			
		||||
	ALPM_EVENT_PACKAGE_OPERATION_START,
 | 
			
		||||
	/** Package was installed/upgraded/downgraded/re-installed/removed; See
 | 
			
		||||
	 * alpm_event_package_operation_t for arguments. */
 | 
			
		||||
	ALPM_EVENT_PACKAGE_OPERATION_DONE,
 | 
			
		||||
	/** Target package's integrity will be checked. */
 | 
			
		||||
	ALPM_EVENT_INTEGRITY_START,
 | 
			
		||||
	/** Target package's integrity was checked. */
 | 
			
		||||
@@ -355,31 +411,40 @@ typedef enum _alpm_event_t {
 | 
			
		||||
	ALPM_EVENT_DELTA_PATCHES_START,
 | 
			
		||||
	/** Deltas were applied to packages. */
 | 
			
		||||
	ALPM_EVENT_DELTA_PATCHES_DONE,
 | 
			
		||||
	/** Delta patch will be applied to target package.
 | 
			
		||||
	 * The filename of the package and the filename of the patch is passed to the
 | 
			
		||||
	 * callback.
 | 
			
		||||
	 */
 | 
			
		||||
	/** Delta patch will be applied to target package; See
 | 
			
		||||
	 * alpm_event_delta_patch_t for arguments.. */
 | 
			
		||||
	ALPM_EVENT_DELTA_PATCH_START,
 | 
			
		||||
	/** Delta patch was applied to target package. */
 | 
			
		||||
	ALPM_EVENT_DELTA_PATCH_DONE,
 | 
			
		||||
	/** Delta patch failed to apply to target package. */
 | 
			
		||||
	ALPM_EVENT_DELTA_PATCH_FAILED,
 | 
			
		||||
	/** Scriptlet has printed information.
 | 
			
		||||
	 * A line of text is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	/** Scriptlet has printed information; See alpm_event_scriptlet_info_t for
 | 
			
		||||
	 * arguments. */
 | 
			
		||||
	ALPM_EVENT_SCRIPTLET_INFO,
 | 
			
		||||
	/** Files will be downloaded from a repository.
 | 
			
		||||
	 * The repository's tree name is passed to the callback.
 | 
			
		||||
	 */
 | 
			
		||||
	/** Files will be downloaded from a repository. */
 | 
			
		||||
	ALPM_EVENT_RETRIEVE_START,
 | 
			
		||||
	/** Disk space usage will be computed for a package */
 | 
			
		||||
	/** Files were downloaded from a repository. */
 | 
			
		||||
	ALPM_EVENT_RETRIEVE_DONE,
 | 
			
		||||
	/** Not all files were successfully downloaded from a repository. */
 | 
			
		||||
	ALPM_EVENT_RETRIEVE_FAILED,
 | 
			
		||||
	/** A file will be downloaded from a repository; See alpm_event_pkgdownload_t
 | 
			
		||||
	 * for arguments */
 | 
			
		||||
	ALPM_EVENT_PKGDOWNLOAD_START,
 | 
			
		||||
	/** A file was downloaded from a repository; See alpm_event_pkgdownload_t
 | 
			
		||||
	 * for arguments */
 | 
			
		||||
	ALPM_EVENT_PKGDOWNLOAD_DONE,
 | 
			
		||||
	/** A file failed to be downloaded from a repository; See
 | 
			
		||||
	 * alpm_event_pkgdownload_t for arguments */
 | 
			
		||||
	ALPM_EVENT_PKGDOWNLOAD_FAILED,
 | 
			
		||||
	/** Disk space usage will be computed for a package. */
 | 
			
		||||
	ALPM_EVENT_DISKSPACE_START,
 | 
			
		||||
	/** Disk space usage was computed for a package */
 | 
			
		||||
	/** Disk space usage was computed for a package. */
 | 
			
		||||
	ALPM_EVENT_DISKSPACE_DONE,
 | 
			
		||||
	/** An optdepend for another package is being removed
 | 
			
		||||
	 * The requiring package and its dependency are passed to the callback */
 | 
			
		||||
	ALPM_EVENT_OPTDEP_REQUIRED,
 | 
			
		||||
	/** A configured repository database is missing */
 | 
			
		||||
	/** An optdepend for another package is being removed; See
 | 
			
		||||
	 * alpm_event_optdep_removal_t for arguments. */
 | 
			
		||||
	ALPM_EVENT_OPTDEP_REMOVAL,
 | 
			
		||||
	/** A configured repository database is missing; See
 | 
			
		||||
	 * alpm_event_database_missing_t for arguments. */
 | 
			
		||||
	ALPM_EVENT_DATABASE_MISSING,
 | 
			
		||||
	/** Checking keys used to create signatures are in keyring. */
 | 
			
		||||
	ALPM_EVENT_KEYRING_START,
 | 
			
		||||
@@ -388,31 +453,267 @@ typedef enum _alpm_event_t {
 | 
			
		||||
	/** Downloading missing keys into keyring. */
 | 
			
		||||
	ALPM_EVENT_KEY_DOWNLOAD_START,
 | 
			
		||||
	/** Key downloading is finished. */
 | 
			
		||||
	ALPM_EVENT_KEY_DOWNLOAD_DONE
 | 
			
		||||
	ALPM_EVENT_KEY_DOWNLOAD_DONE,
 | 
			
		||||
	/** A .pacnew file was created; See alpm_event_pacnew_created_t for arguments. */
 | 
			
		||||
	ALPM_EVENT_PACNEW_CREATED,
 | 
			
		||||
	/** A .pacsave file was created; See alpm_event_pacsave_created_t for
 | 
			
		||||
	 * arguments */
 | 
			
		||||
	ALPM_EVENT_PACSAVE_CREATED,
 | 
			
		||||
	/** Processing hooks will be started. */
 | 
			
		||||
	ALPM_EVENT_HOOK_START,
 | 
			
		||||
	/** Processing hooks is finished. */
 | 
			
		||||
	ALPM_EVENT_HOOK_DONE,
 | 
			
		||||
	/** A hook is starting */
 | 
			
		||||
	ALPM_EVENT_HOOK_RUN_START,
 | 
			
		||||
	/** A hook has finished running */
 | 
			
		||||
	ALPM_EVENT_HOOK_RUN_DONE
 | 
			
		||||
} alpm_event_type_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_any_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
} alpm_event_any_t;
 | 
			
		||||
 | 
			
		||||
typedef enum _alpm_package_operation_t {
 | 
			
		||||
	/** Package (to be) installed. (No oldpkg) */
 | 
			
		||||
	ALPM_PACKAGE_INSTALL = 1,
 | 
			
		||||
	/** Package (to be) upgraded */
 | 
			
		||||
	ALPM_PACKAGE_UPGRADE,
 | 
			
		||||
	/** Package (to be) re-installed. */
 | 
			
		||||
	ALPM_PACKAGE_REINSTALL,
 | 
			
		||||
	/** Package (to be) downgraded. */
 | 
			
		||||
	ALPM_PACKAGE_DOWNGRADE,
 | 
			
		||||
	/** Package (to be) removed. (No newpkg) */
 | 
			
		||||
	ALPM_PACKAGE_REMOVE
 | 
			
		||||
} alpm_package_operation_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_package_operation_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Type of operation. */
 | 
			
		||||
	alpm_package_operation_t operation;
 | 
			
		||||
	/** Old package. */
 | 
			
		||||
	alpm_pkg_t *oldpkg;
 | 
			
		||||
	/** New package. */
 | 
			
		||||
	alpm_pkg_t *newpkg;
 | 
			
		||||
} alpm_event_package_operation_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_optdep_removal_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Package with the optdep. */
 | 
			
		||||
	alpm_pkg_t *pkg;
 | 
			
		||||
	/** Optdep being removed. */
 | 
			
		||||
	alpm_depend_t *optdep;
 | 
			
		||||
} alpm_event_optdep_removal_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_delta_patch_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Delta info */
 | 
			
		||||
	alpm_delta_t *delta;
 | 
			
		||||
} alpm_event_delta_patch_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_scriptlet_info_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Line of scriptlet output. */
 | 
			
		||||
	const char *line;
 | 
			
		||||
} alpm_event_scriptlet_info_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_database_missing_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Name of the database. */
 | 
			
		||||
	const char *dbname;
 | 
			
		||||
} alpm_event_database_missing_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_pkgdownload_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Name of the file */
 | 
			
		||||
	const char *file;
 | 
			
		||||
} alpm_event_pkgdownload_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_pacnew_created_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Whether the creation was result of a NoUpgrade or not */
 | 
			
		||||
	int from_noupgrade;
 | 
			
		||||
	/** Old package. */
 | 
			
		||||
	alpm_pkg_t *oldpkg;
 | 
			
		||||
	/** New Package. */
 | 
			
		||||
	alpm_pkg_t *newpkg;
 | 
			
		||||
	/** Filename of the file without the .pacnew suffix */
 | 
			
		||||
	const char *file;
 | 
			
		||||
} alpm_event_pacnew_created_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_pacsave_created_t {
 | 
			
		||||
	/** Type of event. */
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Old package. */
 | 
			
		||||
	alpm_pkg_t *oldpkg;
 | 
			
		||||
	/** Filename of the file without the .pacsave suffix. */
 | 
			
		||||
	const char *file;
 | 
			
		||||
} alpm_event_pacsave_created_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_hook_t {
 | 
			
		||||
	/** Type of event.*/
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Type of hooks. */
 | 
			
		||||
	alpm_hook_when_t when;
 | 
			
		||||
} alpm_event_hook_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_event_hook_run_t {
 | 
			
		||||
	/** Type of event.*/
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	/** Name of hook */
 | 
			
		||||
	const char *name;
 | 
			
		||||
	/** Description of hook to be outputted */
 | 
			
		||||
	const char *desc;
 | 
			
		||||
	/** position of hook being run */
 | 
			
		||||
	size_t position;
 | 
			
		||||
	/** total hooks being run */
 | 
			
		||||
	size_t total;
 | 
			
		||||
} alpm_event_hook_run_t;
 | 
			
		||||
 | 
			
		||||
/** Events.
 | 
			
		||||
 * This is an union passed to the callback, that allows the frontend to know
 | 
			
		||||
 * which type of event was triggered (via type). It is then possible to
 | 
			
		||||
 * typecast the pointer to the right structure, or use the union field, in order
 | 
			
		||||
 * to access event-specific data. */
 | 
			
		||||
typedef union _alpm_event_t {
 | 
			
		||||
	alpm_event_type_t type;
 | 
			
		||||
	alpm_event_any_t any;
 | 
			
		||||
	alpm_event_package_operation_t package_operation;
 | 
			
		||||
	alpm_event_optdep_removal_t optdep_removal;
 | 
			
		||||
	alpm_event_delta_patch_t delta_patch;
 | 
			
		||||
	alpm_event_scriptlet_info_t scriptlet_info;
 | 
			
		||||
	alpm_event_database_missing_t database_missing;
 | 
			
		||||
	alpm_event_pkgdownload_t pkgdownload;
 | 
			
		||||
	alpm_event_pacnew_created_t pacnew_created;
 | 
			
		||||
	alpm_event_pacsave_created_t pacsave_created;
 | 
			
		||||
	alpm_event_hook_t hook;
 | 
			
		||||
	alpm_event_hook_run_t hook_run;
 | 
			
		||||
} alpm_event_t;
 | 
			
		||||
 | 
			
		||||
/** Event callback */
 | 
			
		||||
typedef void (*alpm_cb_event)(alpm_event_t, void *, void *);
 | 
			
		||||
/** Event callback. */
 | 
			
		||||
typedef void (*alpm_cb_event)(alpm_event_t *);
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Questions.
 | 
			
		||||
 * Type of questions.
 | 
			
		||||
 * Unlike the events or progress enumerations, this enum has bitmask values
 | 
			
		||||
 * so a frontend can use a bitmask map to supply preselected answers to the
 | 
			
		||||
 * different types of questions.
 | 
			
		||||
 */
 | 
			
		||||
typedef enum _alpm_question_t {
 | 
			
		||||
	ALPM_QUESTION_INSTALL_IGNOREPKG = 1,
 | 
			
		||||
typedef enum _alpm_question_type_t {
 | 
			
		||||
	ALPM_QUESTION_INSTALL_IGNOREPKG = (1 << 0),
 | 
			
		||||
	ALPM_QUESTION_REPLACE_PKG = (1 << 1),
 | 
			
		||||
	ALPM_QUESTION_CONFLICT_PKG = (1 << 2),
 | 
			
		||||
	ALPM_QUESTION_CORRUPTED_PKG = (1 << 3),
 | 
			
		||||
	ALPM_QUESTION_LOCAL_NEWER = (1 << 4),
 | 
			
		||||
	ALPM_QUESTION_REMOVE_PKGS = (1 << 5),
 | 
			
		||||
	ALPM_QUESTION_SELECT_PROVIDER = (1 << 6),
 | 
			
		||||
	ALPM_QUESTION_IMPORT_KEY = (1 << 7)
 | 
			
		||||
	ALPM_QUESTION_REMOVE_PKGS = (1 << 4),
 | 
			
		||||
	ALPM_QUESTION_SELECT_PROVIDER = (1 << 5),
 | 
			
		||||
	ALPM_QUESTION_IMPORT_KEY = (1 << 6)
 | 
			
		||||
} alpm_question_type_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_any_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer. */
 | 
			
		||||
	int answer;
 | 
			
		||||
} alpm_question_any_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_install_ignorepkg_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: whether or not to install pkg anyway. */
 | 
			
		||||
	int install;
 | 
			
		||||
	/* Package in IgnorePkg/IgnoreGroup. */
 | 
			
		||||
	alpm_pkg_t *pkg;
 | 
			
		||||
} alpm_question_install_ignorepkg_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_replace_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: whether or not to replace oldpkg with newpkg. */
 | 
			
		||||
	int replace;
 | 
			
		||||
	/* Package to be replaced. */
 | 
			
		||||
	alpm_pkg_t *oldpkg;
 | 
			
		||||
	/* Package to replace with. */
 | 
			
		||||
	alpm_pkg_t *newpkg;
 | 
			
		||||
	/* DB of newpkg */
 | 
			
		||||
	alpm_db_t *newdb;
 | 
			
		||||
} alpm_question_replace_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_conflict_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: whether or not to remove conflict->package2. */
 | 
			
		||||
	int remove;
 | 
			
		||||
	/** Conflict info. */
 | 
			
		||||
	alpm_conflict_t *conflict;
 | 
			
		||||
} alpm_question_conflict_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_corrupted_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: whether or not to remove filepath. */
 | 
			
		||||
	int remove;
 | 
			
		||||
	/** Filename to remove */
 | 
			
		||||
	const char *filepath;
 | 
			
		||||
	/** Error code indicating the reason for package invalidity */
 | 
			
		||||
	alpm_errno_t reason;
 | 
			
		||||
} alpm_question_corrupted_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_remove_pkgs_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: whether or not to skip packages. */
 | 
			
		||||
	int skip;
 | 
			
		||||
	/** List of alpm_pkg_t* with unresolved dependencies. */
 | 
			
		||||
	alpm_list_t *packages;
 | 
			
		||||
} alpm_question_remove_pkgs_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_select_provider_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: which provider to use (index from providers). */
 | 
			
		||||
	int use_index;
 | 
			
		||||
	/** List of alpm_pkg_t* as possible providers. */
 | 
			
		||||
	alpm_list_t *providers;
 | 
			
		||||
	/** What providers provide for. */
 | 
			
		||||
	alpm_depend_t *depend;
 | 
			
		||||
} alpm_question_select_provider_t;
 | 
			
		||||
 | 
			
		||||
typedef struct _alpm_question_import_key_t {
 | 
			
		||||
	/** Type of question. */
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	/** Answer: whether or not to import key. */
 | 
			
		||||
	int import;
 | 
			
		||||
	/** The key to import. */
 | 
			
		||||
	alpm_pgpkey_t *key;
 | 
			
		||||
} alpm_question_import_key_t;
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Questions.
 | 
			
		||||
 * This is an union passed to the callback, that allows the frontend to know
 | 
			
		||||
 * which type of question was triggered (via type). It is then possible to
 | 
			
		||||
 * typecast the pointer to the right structure, or use the union field, in order
 | 
			
		||||
 * to access question-specific data. */
 | 
			
		||||
typedef union _alpm_question_t {
 | 
			
		||||
	alpm_question_type_t type;
 | 
			
		||||
	alpm_question_any_t any;
 | 
			
		||||
	alpm_question_install_ignorepkg_t install_ignorepkg;
 | 
			
		||||
	alpm_question_replace_t replace;
 | 
			
		||||
	alpm_question_conflict_t conflict;
 | 
			
		||||
	alpm_question_corrupted_t corrupted;
 | 
			
		||||
	alpm_question_remove_pkgs_t remove_pkgs;
 | 
			
		||||
	alpm_question_select_provider_t select_provider;
 | 
			
		||||
	alpm_question_import_key_t import_key;
 | 
			
		||||
} alpm_question_t;
 | 
			
		||||
 | 
			
		||||
/** Question callback */
 | 
			
		||||
typedef void (*alpm_cb_question)(alpm_question_t, void *, void *, void *, int *);
 | 
			
		||||
typedef void (*alpm_cb_question)(alpm_question_t *);
 | 
			
		||||
 | 
			
		||||
/** Progress */
 | 
			
		||||
typedef enum _alpm_progress_t {
 | 
			
		||||
@@ -520,6 +821,20 @@ int alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir);
 | 
			
		||||
int alpm_option_remove_cachedir(alpm_handle_t *handle, const char *cachedir);
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @name Accessors to the list of package hook directories.
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_option_get_hookdirs(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_hookdirs(alpm_handle_t *handle, alpm_list_t *hookdirs);
 | 
			
		||||
int alpm_option_add_hookdir(alpm_handle_t *handle, const char *hookdir);
 | 
			
		||||
int alpm_option_remove_hookdir(alpm_handle_t *handle, const char *hookdir);
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
alpm_list_t *alpm_option_get_overwrite_files(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_overwrite_files(alpm_handle_t *handle, alpm_list_t *globs);
 | 
			
		||||
int alpm_option_add_overwrite_file(alpm_handle_t *handle, const char *glob);
 | 
			
		||||
int alpm_option_remove_overwrite_file(alpm_handle_t *handle, const char *glob);
 | 
			
		||||
 | 
			
		||||
/** Returns the logfile name. */
 | 
			
		||||
const char *alpm_option_get_logfile(alpm_handle_t *handle);
 | 
			
		||||
/** Sets the logfile name. */
 | 
			
		||||
@@ -541,9 +856,10 @@ int alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog);
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_option_get_noupgrades(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg);
 | 
			
		||||
int alpm_option_add_noupgrade(alpm_handle_t *handle, const char *path);
 | 
			
		||||
int alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade);
 | 
			
		||||
int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg);
 | 
			
		||||
int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *path);
 | 
			
		||||
int alpm_option_match_noupgrade(alpm_handle_t *handle, const char *path);
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @name Accessors to the list of no-extract files.
 | 
			
		||||
@@ -553,9 +869,10 @@ int alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg);
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_option_get_noextracts(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_add_noextract(alpm_handle_t *handle, const char *pkg);
 | 
			
		||||
int alpm_option_add_noextract(alpm_handle_t *handle, const char *path);
 | 
			
		||||
int alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract);
 | 
			
		||||
int alpm_option_remove_noextract(alpm_handle_t *handle, const char *pkg);
 | 
			
		||||
int alpm_option_remove_noextract(alpm_handle_t *handle, const char *path);
 | 
			
		||||
int alpm_option_match_noextract(alpm_handle_t *handle, const char *path);
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @name Accessors to the list of ignored packages.
 | 
			
		||||
@@ -580,6 +897,17 @@ int alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps)
 | 
			
		||||
int alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp);
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @name Accessors to the list of ignored dependencies.
 | 
			
		||||
 * These functions modify the list of dependencies that
 | 
			
		||||
 * should be ignored by a sysupgrade.
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_option_get_assumeinstalled(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_add_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep);
 | 
			
		||||
int alpm_option_set_assumeinstalled(alpm_handle_t *handle, alpm_list_t *deps);
 | 
			
		||||
int alpm_option_remove_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep);
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** Returns the targeted architecture. */
 | 
			
		||||
const char *alpm_option_get_arch(alpm_handle_t *handle);
 | 
			
		||||
/** Sets the targeted architecture. */
 | 
			
		||||
@@ -591,14 +919,19 @@ int alpm_option_set_deltaratio(alpm_handle_t *handle, double ratio);
 | 
			
		||||
int alpm_option_get_checkspace(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace);
 | 
			
		||||
 | 
			
		||||
alpm_siglevel_t alpm_option_get_default_siglevel(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_default_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
 | 
			
		||||
const char *alpm_option_get_dbext(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext);
 | 
			
		||||
 | 
			
		||||
alpm_siglevel_t alpm_option_get_local_file_siglevel(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
 | 
			
		||||
int alpm_option_get_default_siglevel(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_default_siglevel(alpm_handle_t *handle, int level);
 | 
			
		||||
 | 
			
		||||
alpm_siglevel_t alpm_option_get_remote_file_siglevel(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, alpm_siglevel_t level);
 | 
			
		||||
int alpm_option_get_local_file_siglevel(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_local_file_siglevel(alpm_handle_t *handle, int level);
 | 
			
		||||
 | 
			
		||||
int alpm_option_get_remote_file_siglevel(alpm_handle_t *handle);
 | 
			
		||||
int alpm_option_set_remote_file_siglevel(alpm_handle_t *handle, int level);
 | 
			
		||||
 | 
			
		||||
int alpm_option_set_disable_dl_timeout(alpm_handle_t *handle, unsigned short disable_dl_timeout);
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
@@ -631,7 +964,7 @@ alpm_list_t *alpm_get_syncdbs(alpm_handle_t *handle);
 | 
			
		||||
 * @return an alpm_db_t* on success (the value), NULL on error
 | 
			
		||||
 */
 | 
			
		||||
alpm_db_t *alpm_register_syncdb(alpm_handle_t *handle, const char *treename,
 | 
			
		||||
		alpm_siglevel_t level);
 | 
			
		||||
		int level);
 | 
			
		||||
 | 
			
		||||
/** Unregister all package databases.
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
@@ -657,7 +990,7 @@ const char *alpm_db_get_name(const alpm_db_t *db);
 | 
			
		||||
 * @param db pointer to the package database
 | 
			
		||||
 * @return the signature verification level
 | 
			
		||||
 */
 | 
			
		||||
alpm_siglevel_t alpm_db_get_siglevel(alpm_db_t *db);
 | 
			
		||||
int alpm_db_get_siglevel(alpm_db_t *db);
 | 
			
		||||
 | 
			
		||||
/** Check the validity of a database.
 | 
			
		||||
 * This is most useful for sync databases and verifying signature status.
 | 
			
		||||
@@ -711,6 +1044,28 @@ alpm_list_t *alpm_db_get_groupcache(alpm_db_t *db);
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
 | 
			
		||||
 | 
			
		||||
typedef enum _alpm_db_usage_ {
 | 
			
		||||
	ALPM_DB_USAGE_SYNC = 1,
 | 
			
		||||
	ALPM_DB_USAGE_SEARCH = (1 << 1),
 | 
			
		||||
	ALPM_DB_USAGE_INSTALL = (1 << 2),
 | 
			
		||||
	ALPM_DB_USAGE_UPGRADE = (1 << 3),
 | 
			
		||||
	ALPM_DB_USAGE_ALL = (1 << 4) - 1,
 | 
			
		||||
} alpm_db_usage_t;
 | 
			
		||||
 | 
			
		||||
/** Sets the usage of a database.
 | 
			
		||||
 * @param db pointer to the package database to set the status for
 | 
			
		||||
 * @param usage a bitmask of alpm_db_usage_t values
 | 
			
		||||
 * @return 0 on success, or -1 on error
 | 
			
		||||
 */
 | 
			
		||||
int alpm_db_set_usage(alpm_db_t *db, int usage);
 | 
			
		||||
 | 
			
		||||
/** Gets the usage of a database.
 | 
			
		||||
 * @param db pointer to the package database to get the status of
 | 
			
		||||
 * @param usage pointer to an alpm_db_usage_t to store db's status
 | 
			
		||||
 * @return 0 on success, or -1 on error
 | 
			
		||||
 */
 | 
			
		||||
int alpm_db_get_usage(alpm_db_t *db, int *usage);
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @addtogroup alpm_api_packages Package Functions
 | 
			
		||||
@@ -733,7 +1088,7 @@ alpm_list_t *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
 | 
			
		||||
 * @return 0 on success, -1 on error (pm_errno is set accordingly)
 | 
			
		||||
 */
 | 
			
		||||
int alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
 | 
			
		||||
		alpm_siglevel_t level, alpm_pkg_t **pkg);
 | 
			
		||||
		int level, alpm_pkg_t **pkg);
 | 
			
		||||
 | 
			
		||||
/** Find a package in a list by name.
 | 
			
		||||
 * @param haystack a list of alpm_pkg_t
 | 
			
		||||
@@ -773,6 +1128,15 @@ alpm_list_t *alpm_pkg_compute_requiredby(alpm_pkg_t *pkg);
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_pkg_compute_optionalfor(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Test if a package should be ignored.
 | 
			
		||||
 * Checks if the package is ignored via IgnorePkg, or if the package is
 | 
			
		||||
 * in a group ignored via IgnoreGroup.
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
 * @param pkg the package to test
 | 
			
		||||
 * @return 1 if the package should be ignored, 0 otherwise
 | 
			
		||||
 */
 | 
			
		||||
int alpm_pkg_should_ignore(alpm_handle_t *handle, alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** @name Package Property Accessors
 | 
			
		||||
 * Any pointer returned by these functions points to internal structures
 | 
			
		||||
 * allocated by libalpm. They should not be freed nor modified in any
 | 
			
		||||
@@ -786,6 +1150,12 @@ alpm_list_t *alpm_pkg_compute_optionalfor(alpm_pkg_t *pkg);
 | 
			
		||||
 */
 | 
			
		||||
const char *alpm_pkg_get_filename(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Returns the package base name.
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return a reference to an internal string
 | 
			
		||||
 */
 | 
			
		||||
const char *alpm_pkg_get_base(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Returns the package name.
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return a reference to an internal string
 | 
			
		||||
@@ -898,6 +1268,18 @@ alpm_list_t *alpm_pkg_get_depends(alpm_pkg_t *pkg);
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_pkg_get_optdepends(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Returns a list of package check dependencies
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return a reference to an internal list of alpm_depend_t structures.
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_pkg_get_checkdepends(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Returns a list of package make dependencies
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return a reference to an internal list of alpm_depend_t structures.
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *alpm_pkg_get_makedepends(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Returns the list of packages conflicting with pkg.
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return a reference to an internal list of alpm_depend_t structures.
 | 
			
		||||
@@ -932,9 +1314,6 @@ alpm_list_t *alpm_pkg_get_replaces(alpm_pkg_t *pkg);
 | 
			
		||||
alpm_filelist_t *alpm_pkg_get_files(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/** Returns the list of files backed up when installing pkg.
 | 
			
		||||
 * The elements of the returned list have the form
 | 
			
		||||
 * "<filename>\t<md5sum>", where the given md5sum is that of
 | 
			
		||||
 * the file as provided by the package.
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return a reference to a list of alpm_backup_t objects
 | 
			
		||||
 */
 | 
			
		||||
@@ -958,7 +1337,7 @@ const char *alpm_pkg_get_base64_sig(alpm_pkg_t *pkg);
 | 
			
		||||
 * @param pkg a pointer to package
 | 
			
		||||
 * @return an enum member giving the validation method
 | 
			
		||||
 */
 | 
			
		||||
alpm_pkgvalidation_t alpm_pkg_get_validation(alpm_pkg_t *pkg);
 | 
			
		||||
int alpm_pkg_get_validation(alpm_pkg_t *pkg);
 | 
			
		||||
 | 
			
		||||
/* End of alpm_pkg_t accessors */
 | 
			
		||||
/* @} */
 | 
			
		||||
@@ -1043,7 +1422,7 @@ int alpm_pkg_set_reason(alpm_pkg_t *pkg, alpm_pkgreason_t reason);
 | 
			
		||||
 * @param path the path to search for in the package
 | 
			
		||||
 * @return a pointer to the matching file or NULL if not found
 | 
			
		||||
 */
 | 
			
		||||
char *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path);
 | 
			
		||||
alpm_file_t *alpm_filelist_contains(alpm_filelist_t *filelist, const char *path);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Signatures
 | 
			
		||||
@@ -1055,6 +1434,12 @@ int alpm_db_check_pgp_signature(alpm_db_t *db, alpm_siglist_t *siglist);
 | 
			
		||||
 | 
			
		||||
int alpm_siglist_cleanup(alpm_siglist_t *siglist);
 | 
			
		||||
 | 
			
		||||
int alpm_decode_signature(const char *base64_data,
 | 
			
		||||
		unsigned char **data, size_t *data_len);
 | 
			
		||||
 | 
			
		||||
int alpm_extract_keyid(alpm_handle_t *handle, const char *identifier,
 | 
			
		||||
		const unsigned char *sig, const size_t len, alpm_list_t **keys);
 | 
			
		||||
 | 
			
		||||
/*
 | 
			
		||||
 * Groups
 | 
			
		||||
 */
 | 
			
		||||
@@ -1114,7 +1499,7 @@ typedef enum _alpm_transflag_t {
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
 * @return the bitfield of transaction flags
 | 
			
		||||
 */
 | 
			
		||||
alpm_transflag_t alpm_trans_get_flags(alpm_handle_t *handle);
 | 
			
		||||
int alpm_trans_get_flags(alpm_handle_t *handle);
 | 
			
		||||
 | 
			
		||||
/** Returns a list of packages added by the transaction.
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
@@ -1130,10 +1515,10 @@ alpm_list_t *alpm_trans_get_remove(alpm_handle_t *handle);
 | 
			
		||||
 | 
			
		||||
/** Initialize the transaction.
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
 * @param flags flags of the transaction (like nodeps, etc)
 | 
			
		||||
 * @param flags flags of the transaction (like nodeps, etc; see alpm_transflag_t)
 | 
			
		||||
 * @return 0 on success, -1 on error (pm_errno is set accordingly)
 | 
			
		||||
 */
 | 
			
		||||
int alpm_trans_init(alpm_handle_t *handle, alpm_transflag_t flags);
 | 
			
		||||
int alpm_trans_init(alpm_handle_t *handle, int flags);
 | 
			
		||||
 | 
			
		||||
/** Prepare a transaction.
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
@@ -1212,6 +1597,17 @@ alpm_list_t *alpm_checkconflicts(alpm_handle_t *handle, alpm_list_t *pkglist);
 | 
			
		||||
 */
 | 
			
		||||
char *alpm_dep_compute_string(const alpm_depend_t *dep);
 | 
			
		||||
 | 
			
		||||
/** Return a newly allocated dependency information parsed from a string
 | 
			
		||||
 * @param depstring a formatted string, e.g. "glibc=2.12"
 | 
			
		||||
 * @return a dependency info structure
 | 
			
		||||
 */
 | 
			
		||||
alpm_depend_t *alpm_dep_from_string(const char *depstring);
 | 
			
		||||
 | 
			
		||||
/** Free a dependency info structure
 | 
			
		||||
 * @param dep struct to free
 | 
			
		||||
 */
 | 
			
		||||
void alpm_dep_free(alpm_depend_t *dep);
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
@@ -1224,87 +1620,10 @@ char *alpm_dep_compute_string(const alpm_depend_t *dep);
 | 
			
		||||
char *alpm_compute_md5sum(const char *filename);
 | 
			
		||||
char *alpm_compute_sha256sum(const char *filename);
 | 
			
		||||
 | 
			
		||||
/** @addtogroup alpm_api_errors Error Codes
 | 
			
		||||
 * @{
 | 
			
		||||
 */
 | 
			
		||||
typedef enum _alpm_errno_t {
 | 
			
		||||
	ALPM_ERR_MEMORY = 1,
 | 
			
		||||
	ALPM_ERR_SYSTEM,
 | 
			
		||||
	ALPM_ERR_BADPERMS,
 | 
			
		||||
	ALPM_ERR_NOT_A_FILE,
 | 
			
		||||
	ALPM_ERR_NOT_A_DIR,
 | 
			
		||||
	ALPM_ERR_WRONG_ARGS,
 | 
			
		||||
	ALPM_ERR_DISK_SPACE,
 | 
			
		||||
	/* Interface */
 | 
			
		||||
	ALPM_ERR_HANDLE_NULL,
 | 
			
		||||
	ALPM_ERR_HANDLE_NOT_NULL,
 | 
			
		||||
	ALPM_ERR_HANDLE_LOCK,
 | 
			
		||||
	/* Databases */
 | 
			
		||||
	ALPM_ERR_DB_OPEN,
 | 
			
		||||
	ALPM_ERR_DB_CREATE,
 | 
			
		||||
	ALPM_ERR_DB_NULL,
 | 
			
		||||
	ALPM_ERR_DB_NOT_NULL,
 | 
			
		||||
	ALPM_ERR_DB_NOT_FOUND,
 | 
			
		||||
	ALPM_ERR_DB_INVALID,
 | 
			
		||||
	ALPM_ERR_DB_INVALID_SIG,
 | 
			
		||||
	ALPM_ERR_DB_VERSION,
 | 
			
		||||
	ALPM_ERR_DB_WRITE,
 | 
			
		||||
	ALPM_ERR_DB_REMOVE,
 | 
			
		||||
	/* Servers */
 | 
			
		||||
	ALPM_ERR_SERVER_BAD_URL,
 | 
			
		||||
	ALPM_ERR_SERVER_NONE,
 | 
			
		||||
	/* Transactions */
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_NULL,
 | 
			
		||||
	ALPM_ERR_TRANS_NULL,
 | 
			
		||||
	ALPM_ERR_TRANS_DUP_TARGET,
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_INITIALIZED,
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_PREPARED,
 | 
			
		||||
	ALPM_ERR_TRANS_ABORT,
 | 
			
		||||
	ALPM_ERR_TRANS_TYPE,
 | 
			
		||||
	ALPM_ERR_TRANS_NOT_LOCKED,
 | 
			
		||||
	/* Packages */
 | 
			
		||||
	ALPM_ERR_PKG_NOT_FOUND,
 | 
			
		||||
	ALPM_ERR_PKG_IGNORED,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_CHECKSUM,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_SIG,
 | 
			
		||||
	ALPM_ERR_PKG_OPEN,
 | 
			
		||||
	ALPM_ERR_PKG_CANT_REMOVE,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_NAME,
 | 
			
		||||
	ALPM_ERR_PKG_INVALID_ARCH,
 | 
			
		||||
	ALPM_ERR_PKG_REPO_NOT_FOUND,
 | 
			
		||||
	/* Signatures */
 | 
			
		||||
	ALPM_ERR_SIG_MISSING,
 | 
			
		||||
	ALPM_ERR_SIG_INVALID,
 | 
			
		||||
	/* Deltas */
 | 
			
		||||
	ALPM_ERR_DLT_INVALID,
 | 
			
		||||
	ALPM_ERR_DLT_PATCHFAILED,
 | 
			
		||||
	/* Dependencies */
 | 
			
		||||
	ALPM_ERR_UNSATISFIED_DEPS,
 | 
			
		||||
	ALPM_ERR_CONFLICTING_DEPS,
 | 
			
		||||
	ALPM_ERR_FILE_CONFLICTS,
 | 
			
		||||
	/* Misc */
 | 
			
		||||
	ALPM_ERR_RETRIEVE,
 | 
			
		||||
	ALPM_ERR_INVALID_REGEX,
 | 
			
		||||
	/* External library errors */
 | 
			
		||||
	ALPM_ERR_LIBARCHIVE,
 | 
			
		||||
	ALPM_ERR_LIBCURL,
 | 
			
		||||
	ALPM_ERR_EXTERNAL_DOWNLOAD,
 | 
			
		||||
	ALPM_ERR_GPGME
 | 
			
		||||
} alpm_errno_t;
 | 
			
		||||
 | 
			
		||||
/** Returns the current error code from the handle. */
 | 
			
		||||
alpm_errno_t alpm_errno(alpm_handle_t *handle);
 | 
			
		||||
 | 
			
		||||
/** Returns the string corresponding to an error number. */
 | 
			
		||||
const char *alpm_strerror(alpm_errno_t err);
 | 
			
		||||
 | 
			
		||||
/* End of alpm_api_errors */
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
alpm_handle_t *alpm_initialize(const char *root, const char *dbpath,
 | 
			
		||||
		alpm_errno_t *err);
 | 
			
		||||
int alpm_release(alpm_handle_t *handle);
 | 
			
		||||
int alpm_unlock(alpm_handle_t *handle);
 | 
			
		||||
 | 
			
		||||
enum alpm_caps {
 | 
			
		||||
	ALPM_CAPABILITY_NLS = (1 << 0),
 | 
			
		||||
@@ -1313,7 +1632,12 @@ enum alpm_caps {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
const char *alpm_version(void);
 | 
			
		||||
enum alpm_caps alpm_capabilities(void);
 | 
			
		||||
/* Return a bitfield of capabilities using values from 'enum alpm_caps' */
 | 
			
		||||
int alpm_capabilities(void);
 | 
			
		||||
 | 
			
		||||
void alpm_fileconflict_free(alpm_fileconflict_t *conflict);
 | 
			
		||||
void alpm_depmissing_free(alpm_depmissing_t *miss);
 | 
			
		||||
void alpm_conflict_free(alpm_conflict_t *conflict);
 | 
			
		||||
 | 
			
		||||
/* End of alpm_api */
 | 
			
		||||
/** @} */
 | 
			
		||||
@@ -1321,6 +1645,4 @@ enum alpm_caps alpm_capabilities(void);
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* _ALPM_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  alpm_list.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -21,6 +21,10 @@
 | 
			
		||||
#include <stdlib.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
/* Note: alpm_list.{c,h} are intended to be standalone files. Do not include
 | 
			
		||||
 * any other libalpm headers.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
/* libalpm */
 | 
			
		||||
#include "alpm_list.h"
 | 
			
		||||
 | 
			
		||||
@@ -66,11 +70,13 @@ void SYMEXPORT alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *it = list;
 | 
			
		||||
 | 
			
		||||
	while(it) {
 | 
			
		||||
		if(fn && it->data) {
 | 
			
		||||
			fn(it->data);
 | 
			
		||||
	if(fn) {
 | 
			
		||||
		while(it) {
 | 
			
		||||
			if(it->data) {
 | 
			
		||||
				fn(it->data);
 | 
			
		||||
			}
 | 
			
		||||
			it = it->next;
 | 
			
		||||
		}
 | 
			
		||||
		it = it->next;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -87,28 +93,62 @@ void SYMEXPORT alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn)
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_list_add(alpm_list_t *list, void *data)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *ptr, *lp;
 | 
			
		||||
	alpm_list_append(&list, data);
 | 
			
		||||
	return list;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Add a new item to the end of the list.
 | 
			
		||||
 *
 | 
			
		||||
 * @param list the list to add to
 | 
			
		||||
 * @param data the new item to be added to the list
 | 
			
		||||
 *
 | 
			
		||||
 * @return the newly added item
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_list_append(alpm_list_t **list, void *data)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *ptr;
 | 
			
		||||
 | 
			
		||||
	ptr = malloc(sizeof(alpm_list_t));
 | 
			
		||||
	if(ptr == NULL) {
 | 
			
		||||
		return list;
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ptr->data = data;
 | 
			
		||||
	ptr->next = NULL;
 | 
			
		||||
 | 
			
		||||
	/* Special case: the input list is empty */
 | 
			
		||||
	if(list == NULL) {
 | 
			
		||||
	if(*list == NULL) {
 | 
			
		||||
		*list = ptr;
 | 
			
		||||
		ptr->prev = ptr;
 | 
			
		||||
		return ptr;
 | 
			
		||||
	} else {
 | 
			
		||||
		alpm_list_t *lp = alpm_list_last(*list);
 | 
			
		||||
		lp->next = ptr;
 | 
			
		||||
		ptr->prev = lp;
 | 
			
		||||
		(*list)->prev = ptr;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	lp = alpm_list_last(list);
 | 
			
		||||
	lp->next = ptr;
 | 
			
		||||
	ptr->prev = lp;
 | 
			
		||||
	list->prev = ptr;
 | 
			
		||||
	return ptr;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
	return list;
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Duplicate and append a string to a list.
 | 
			
		||||
 *
 | 
			
		||||
 * @param list the list to append to
 | 
			
		||||
 * @param data the string to duplicate and append
 | 
			
		||||
 *
 | 
			
		||||
 * @return the newly added item
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_list_append_strdup(alpm_list_t **list, const char *data)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *ret;
 | 
			
		||||
	char *dup;
 | 
			
		||||
	if((dup = strdup(data)) && (ret = alpm_list_append(list, dup))) {
 | 
			
		||||
		return ret;
 | 
			
		||||
	} else {
 | 
			
		||||
		free(dup);
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -421,7 +461,10 @@ alpm_list_t SYMEXPORT *alpm_list_remove_dupes(const alpm_list_t *list)
 | 
			
		||||
	alpm_list_t *newlist = NULL;
 | 
			
		||||
	while(lp) {
 | 
			
		||||
		if(!alpm_list_find_ptr(newlist, lp->data)) {
 | 
			
		||||
			newlist = alpm_list_add(newlist, lp->data);
 | 
			
		||||
			if(alpm_list_append(&newlist, lp->data) == NULL) {
 | 
			
		||||
				alpm_list_free(newlist);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		lp = lp->next;
 | 
			
		||||
	}
 | 
			
		||||
@@ -440,7 +483,10 @@ alpm_list_t SYMEXPORT *alpm_list_strdup(const alpm_list_t *list)
 | 
			
		||||
	const alpm_list_t *lp = list;
 | 
			
		||||
	alpm_list_t *newlist = NULL;
 | 
			
		||||
	while(lp) {
 | 
			
		||||
		newlist = alpm_list_add(newlist, strdup(lp->data));
 | 
			
		||||
		if(alpm_list_append_strdup(&newlist, lp->data) == NULL) {
 | 
			
		||||
			FREELIST(newlist);
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
		lp = lp->next;
 | 
			
		||||
	}
 | 
			
		||||
	return newlist;
 | 
			
		||||
@@ -458,7 +504,10 @@ alpm_list_t SYMEXPORT *alpm_list_copy(const alpm_list_t *list)
 | 
			
		||||
	const alpm_list_t *lp = list;
 | 
			
		||||
	alpm_list_t *newlist = NULL;
 | 
			
		||||
	while(lp) {
 | 
			
		||||
		newlist = alpm_list_add(newlist, lp->data);
 | 
			
		||||
		if(alpm_list_append(&newlist, lp->data) == NULL) {
 | 
			
		||||
			alpm_list_free(newlist);
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
		lp = lp->next;
 | 
			
		||||
	}
 | 
			
		||||
	return newlist;
 | 
			
		||||
@@ -483,8 +532,15 @@ alpm_list_t SYMEXPORT *alpm_list_copy_data(const alpm_list_t *list,
 | 
			
		||||
		void *newdata = malloc(size);
 | 
			
		||||
		if(newdata) {
 | 
			
		||||
			memcpy(newdata, lp->data, size);
 | 
			
		||||
			newlist = alpm_list_add(newlist, newdata);
 | 
			
		||||
			if(alpm_list_append(&newlist, newdata) == NULL) {
 | 
			
		||||
				free(newdata);
 | 
			
		||||
				FREELIST(newlist);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
			lp = lp->next;
 | 
			
		||||
		} else {
 | 
			
		||||
			FREELIST(newlist);
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return newlist;
 | 
			
		||||
@@ -512,7 +568,10 @@ alpm_list_t SYMEXPORT *alpm_list_reverse(alpm_list_t *list)
 | 
			
		||||
	list->prev = NULL;
 | 
			
		||||
 | 
			
		||||
	while(lp) {
 | 
			
		||||
		newlist = alpm_list_add(newlist, lp->data);
 | 
			
		||||
		if(alpm_list_append(&newlist, lp->data) == NULL) {
 | 
			
		||||
			alpm_list_free(newlist);
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
		lp = lp->prev;
 | 
			
		||||
	}
 | 
			
		||||
	list->prev = backup; /* restore tail pointer */
 | 
			
		||||
@@ -783,5 +842,3 @@ void SYMEXPORT *alpm_list_to_array(const alpm_list_t *list, size_t n,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  alpm_list.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,11 +17,15 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_LIST_H
 | 
			
		||||
#define _ALPM_LIST_H
 | 
			
		||||
#ifndef ALPM_LIST_H
 | 
			
		||||
#define ALPM_LIST_H
 | 
			
		||||
 | 
			
		||||
#include <stdlib.h> /* size_t */
 | 
			
		||||
 | 
			
		||||
/* Note: alpm_list.{c,h} are intended to be standalone files. Do not include
 | 
			
		||||
 * any other libalpm headers.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
extern "C" {
 | 
			
		||||
#endif
 | 
			
		||||
@@ -53,6 +57,8 @@ void alpm_list_free_inner(alpm_list_t *list, alpm_list_fn_free fn);
 | 
			
		||||
 | 
			
		||||
/* item mutators */
 | 
			
		||||
alpm_list_t *alpm_list_add(alpm_list_t *list, void *data);
 | 
			
		||||
alpm_list_t *alpm_list_append(alpm_list_t **list, void *data);
 | 
			
		||||
alpm_list_t *alpm_list_append_strdup(alpm_list_t **list, const char *data);
 | 
			
		||||
alpm_list_t *alpm_list_add_sorted(alpm_list_t *list, void *data, alpm_list_fn_cmp fn);
 | 
			
		||||
alpm_list_t *alpm_list_join(alpm_list_t *first, alpm_list_t *second);
 | 
			
		||||
alpm_list_t *alpm_list_mmerge(alpm_list_t *left, alpm_list_t *right, alpm_list_fn_cmp fn);
 | 
			
		||||
@@ -85,6 +91,4 @@ void *alpm_list_to_array(const alpm_list_t *list, size_t n, size_t size);
 | 
			
		||||
#ifdef __cplusplus
 | 
			
		||||
}
 | 
			
		||||
#endif
 | 
			
		||||
#endif /* _ALPM_LIST_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_LIST_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  backup.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
 | 
			
		||||
@@ -47,8 +47,8 @@ int _alpm_split_backup(const char *string, alpm_backup_t **backup)
 | 
			
		||||
	*ptr = '\0';
 | 
			
		||||
	ptr++;
 | 
			
		||||
	/* now str points to the filename and ptr points to the hash */
 | 
			
		||||
	STRDUP((*backup)->name, str, return -1);
 | 
			
		||||
	STRDUP((*backup)->hash, ptr, return -1);
 | 
			
		||||
	STRDUP((*backup)->name, str, FREE(str); return -1);
 | 
			
		||||
	STRDUP((*backup)->hash, ptr, FREE((*backup)->name); FREE(str); return -1);
 | 
			
		||||
	FREE(str);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -77,9 +77,10 @@ alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg)
 | 
			
		||||
 | 
			
		||||
void _alpm_backup_free(alpm_backup_t *backup)
 | 
			
		||||
{
 | 
			
		||||
	free(backup->name);
 | 
			
		||||
	free(backup->hash);
 | 
			
		||||
	free(backup);
 | 
			
		||||
	ASSERT(backup != NULL, return);
 | 
			
		||||
	FREE(backup->name);
 | 
			
		||||
	FREE(backup->hash);
 | 
			
		||||
	FREE(backup);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
 | 
			
		||||
@@ -87,10 +88,13 @@ alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup)
 | 
			
		||||
	alpm_backup_t *newbackup;
 | 
			
		||||
	CALLOC(newbackup, 1, sizeof(alpm_backup_t), return NULL);
 | 
			
		||||
 | 
			
		||||
	STRDUP(newbackup->name, backup->name, return NULL);
 | 
			
		||||
	STRDUP(newbackup->hash, backup->hash, return NULL);
 | 
			
		||||
	STRDUP(newbackup->name, backup->name, goto error);
 | 
			
		||||
	STRDUP(newbackup->hash, backup->hash, goto error);
 | 
			
		||||
 | 
			
		||||
	return newbackup;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
error:
 | 
			
		||||
	free(newbackup->name);
 | 
			
		||||
	free(newbackup);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  backup.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_BACKUP_H
 | 
			
		||||
#define _ALPM_BACKUP_H
 | 
			
		||||
#ifndef ALPM_BACKUP_H
 | 
			
		||||
#define ALPM_BACKUP_H
 | 
			
		||||
 | 
			
		||||
#include "alpm_list.h"
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
@@ -28,6 +28,4 @@ alpm_backup_t *_alpm_needbackup(const char *file, alpm_pkg_t *pkg);
 | 
			
		||||
void _alpm_backup_free(alpm_backup_t *backup);
 | 
			
		||||
alpm_backup_t *_alpm_backup_dup(const alpm_backup_t *backup);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_BACKUP_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_BACKUP_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -36,6 +36,7 @@
 | 
			
		||||
 | 
			
		||||
#include "base64.h"
 | 
			
		||||
 | 
			
		||||
#if 0
 | 
			
		||||
static const unsigned char base64_enc_map[64] =
 | 
			
		||||
{
 | 
			
		||||
    'A', 'B', 'C', 'D', 'E', 'F', 'G', 'H', 'I', 'J',
 | 
			
		||||
@@ -46,6 +47,7 @@ static const unsigned char base64_enc_map[64] =
 | 
			
		||||
    'y', 'z', '0', '1', '2', '3', '4', '5', '6', '7',
 | 
			
		||||
    '8', '9', '+', '/'
 | 
			
		||||
};
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
static const unsigned char base64_dec_map[128] =
 | 
			
		||||
{
 | 
			
		||||
 
 | 
			
		||||
@@ -22,8 +22,8 @@
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _BASE64_H
 | 
			
		||||
#define _BASE64_H
 | 
			
		||||
#ifndef BASE64_H
 | 
			
		||||
#define BASE64_H
 | 
			
		||||
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  be_local.c : backend for the local database
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -44,9 +44,12 @@
 | 
			
		||||
#include "deps.h"
 | 
			
		||||
#include "filelist.h"
 | 
			
		||||
 | 
			
		||||
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
 | 
			
		||||
/* local database format version */
 | 
			
		||||
size_t ALPM_LOCAL_DB_VERSION = 9;
 | 
			
		||||
 | 
			
		||||
#define LAZY_LOAD(info, errret) \
 | 
			
		||||
static int local_db_read(alpm_pkg_t *info, int inforeq);
 | 
			
		||||
 | 
			
		||||
#define LAZY_LOAD(info) \
 | 
			
		||||
	do { \
 | 
			
		||||
		if(!(pkg->infolevel & info)) { \
 | 
			
		||||
			local_db_read(pkg, info); \
 | 
			
		||||
@@ -60,117 +63,123 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
 | 
			
		||||
 * initialized.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
static const char *_cache_get_base(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->base;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *_cache_get_desc(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->desc;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *_cache_get_url(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->url;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_time_t _cache_get_builddate(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, 0);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->builddate;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_time_t _cache_get_installdate(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, 0);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->installdate;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *_cache_get_packager(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->packager;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static const char *_cache_get_arch(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->arch;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static off_t _cache_get_isize(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, -1);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->isize;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_pkgreason_t _cache_get_reason(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, -1);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->reason;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_pkgvalidation_t _cache_get_validation(alpm_pkg_t *pkg)
 | 
			
		||||
static int _cache_get_validation(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, -1);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->validation;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_licenses(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->licenses;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_groups(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->groups;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _cache_has_scriptlet(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_SCRIPTLET, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_SCRIPTLET);
 | 
			
		||||
	return pkg->scriptlet;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_depends(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->depends;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_optdepends(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->optdepends;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_conflicts(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->conflicts;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_provides(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->provides;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_replaces(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_DESC);
 | 
			
		||||
	return pkg->replaces;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_filelist_t *_cache_get_files(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_FILES, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_FILES);
 | 
			
		||||
	return &(pkg->files);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_cache_get_backup(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	LAZY_LOAD(INFRQ_FILES, NULL);
 | 
			
		||||
	LAZY_LOAD(INFRQ_FILES);
 | 
			
		||||
	return pkg->backup;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -294,6 +303,7 @@ static int _cache_force_load(alpm_pkg_t *pkg)
 | 
			
		||||
 * logic.
 | 
			
		||||
 */
 | 
			
		||||
static struct pkg_operations local_pkg_ops = {
 | 
			
		||||
	.get_base        = _cache_get_base,
 | 
			
		||||
	.get_desc        = _cache_get_desc,
 | 
			
		||||
	.get_url         = _cache_get_url,
 | 
			
		||||
	.get_builddate   = _cache_get_builddate,
 | 
			
		||||
@@ -366,12 +376,48 @@ static int is_dir(const char *path, struct dirent *entry)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int local_db_add_version(alpm_db_t UNUSED *db, const char *dbpath)
 | 
			
		||||
{
 | 
			
		||||
	char dbverpath[PATH_MAX];
 | 
			
		||||
	FILE *dbverfile;
 | 
			
		||||
 | 
			
		||||
	snprintf(dbverpath, PATH_MAX, "%sALPM_DB_VERSION", dbpath);
 | 
			
		||||
 | 
			
		||||
	dbverfile = fopen(dbverpath, "w");
 | 
			
		||||
 | 
			
		||||
	if(dbverfile == NULL) {
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	fprintf(dbverfile, "%zu\n", ALPM_LOCAL_DB_VERSION);
 | 
			
		||||
	fclose(dbverfile);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int local_db_create(alpm_db_t *db, const char *dbpath)
 | 
			
		||||
{
 | 
			
		||||
	if(mkdir(dbpath, 0755) != 0) {
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not create directory %s: %s\n"),
 | 
			
		||||
				dbpath, strerror(errno));
 | 
			
		||||
		RET_ERR(db->handle, ALPM_ERR_DB_CREATE, -1);
 | 
			
		||||
	}
 | 
			
		||||
	if(local_db_add_version(db, dbpath) != 0) {
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int local_db_validate(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	struct dirent *ent = NULL;
 | 
			
		||||
	const char *dbpath;
 | 
			
		||||
	DIR *dbdir;
 | 
			
		||||
	int ret = -1;
 | 
			
		||||
	char dbverpath[PATH_MAX];
 | 
			
		||||
	FILE *dbverfile;
 | 
			
		||||
	int t;
 | 
			
		||||
	size_t version;
 | 
			
		||||
 | 
			
		||||
	if(db->status & DB_STATUS_VALID) {
 | 
			
		||||
		return 0;
 | 
			
		||||
@@ -384,15 +430,23 @@ static int local_db_validate(alpm_db_t *db)
 | 
			
		||||
	if(dbpath == NULL) {
 | 
			
		||||
		RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	dbdir = opendir(dbpath);
 | 
			
		||||
	if(dbdir == NULL) {
 | 
			
		||||
		if(errno == ENOENT) {
 | 
			
		||||
			/* database dir doesn't exist yet */
 | 
			
		||||
			db->status |= DB_STATUS_VALID;
 | 
			
		||||
			db->status &= ~DB_STATUS_INVALID;
 | 
			
		||||
			db->status &= ~DB_STATUS_EXISTS;
 | 
			
		||||
			db->status |= DB_STATUS_MISSING;
 | 
			
		||||
			return 0;
 | 
			
		||||
			/* local database dir doesn't exist yet - create it */
 | 
			
		||||
			if(local_db_create(db, dbpath) == 0) {
 | 
			
		||||
				db->status |= DB_STATUS_VALID;
 | 
			
		||||
				db->status &= ~DB_STATUS_INVALID;
 | 
			
		||||
				db->status |= DB_STATUS_EXISTS;
 | 
			
		||||
				db->status &= ~DB_STATUS_MISSING;
 | 
			
		||||
				return 0;
 | 
			
		||||
			} else {
 | 
			
		||||
				db->status &= ~DB_STATUS_EXISTS;
 | 
			
		||||
				db->status |= DB_STATUS_MISSING;
 | 
			
		||||
				/* pm_errno is set by local_db_create */
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
 | 
			
		||||
		}
 | 
			
		||||
@@ -400,43 +454,54 @@ static int local_db_validate(alpm_db_t *db)
 | 
			
		||||
	db->status |= DB_STATUS_EXISTS;
 | 
			
		||||
	db->status &= ~DB_STATUS_MISSING;
 | 
			
		||||
 | 
			
		||||
	while((ent = readdir(dbdir)) != NULL) {
 | 
			
		||||
		const char *name = ent->d_name;
 | 
			
		||||
		char path[PATH_MAX];
 | 
			
		||||
	snprintf(dbverpath, PATH_MAX, "%sALPM_DB_VERSION", dbpath);
 | 
			
		||||
 | 
			
		||||
		if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		if(!is_dir(dbpath, ent)) {
 | 
			
		||||
			continue;
 | 
			
		||||
	if((dbverfile = fopen(dbverpath, "r")) == NULL) {
 | 
			
		||||
		/* create dbverfile if local database is empty - otherwise version error */
 | 
			
		||||
		while((ent = readdir(dbdir)) != NULL) {
 | 
			
		||||
			const char *name = ent->d_name;
 | 
			
		||||
			if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
 | 
			
		||||
				continue;
 | 
			
		||||
			} else {
 | 
			
		||||
				goto version_error;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		snprintf(path, PATH_MAX, "%s%s/depends", dbpath, name);
 | 
			
		||||
		if(access(path, F_OK) == 0) {
 | 
			
		||||
			/* we found a depends file- bail */
 | 
			
		||||
			db->status &= ~DB_STATUS_VALID;
 | 
			
		||||
			db->status |= DB_STATUS_INVALID;
 | 
			
		||||
			db->handle->pm_errno = ALPM_ERR_DB_VERSION;
 | 
			
		||||
			goto done;
 | 
			
		||||
		if(local_db_add_version(db, dbpath) != 0) {
 | 
			
		||||
			goto version_error;
 | 
			
		||||
		}
 | 
			
		||||
		goto version_latest;
 | 
			
		||||
	}
 | 
			
		||||
	/* we found no depends file after full scan */
 | 
			
		||||
 | 
			
		||||
	t = fscanf(dbverfile, "%zu", &version);
 | 
			
		||||
	fclose(dbverfile);
 | 
			
		||||
 | 
			
		||||
	if(t != 1) {
 | 
			
		||||
		goto version_error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(version != ALPM_LOCAL_DB_VERSION) {
 | 
			
		||||
		goto version_error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
version_latest:
 | 
			
		||||
	closedir(dbdir);
 | 
			
		||||
	db->status |= DB_STATUS_VALID;
 | 
			
		||||
	db->status &= ~DB_STATUS_INVALID;
 | 
			
		||||
	ret = 0;
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
done:
 | 
			
		||||
	if(dbdir) {
 | 
			
		||||
		closedir(dbdir);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
version_error:
 | 
			
		||||
	closedir(dbdir);
 | 
			
		||||
	db->status &= ~DB_STATUS_VALID;
 | 
			
		||||
	db->status |= DB_STATUS_INVALID;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_DB_VERSION;
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int local_db_populate(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	size_t est_count;
 | 
			
		||||
	int count = 0;
 | 
			
		||||
	size_t count = 0;
 | 
			
		||||
	struct stat buf;
 | 
			
		||||
	struct dirent *ent = NULL;
 | 
			
		||||
	const char *dbpath;
 | 
			
		||||
@@ -445,7 +510,9 @@ static int local_db_populate(alpm_db_t *db)
 | 
			
		||||
	if(db->status & DB_STATUS_INVALID) {
 | 
			
		||||
		RET_ERR(db->handle, ALPM_ERR_DB_INVALID, -1);
 | 
			
		||||
	}
 | 
			
		||||
	/* note: DB_STATUS_MISSING is not fatal for local database */
 | 
			
		||||
	if(db->status & DB_STATUS_MISSING) {
 | 
			
		||||
		RET_ERR(db->handle, ALPM_ERR_DB_NOT_FOUND, -1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	dbpath = _alpm_db_path(db);
 | 
			
		||||
	if(dbpath == NULL) {
 | 
			
		||||
@@ -455,12 +522,6 @@ static int local_db_populate(alpm_db_t *db)
 | 
			
		||||
 | 
			
		||||
	dbdir = opendir(dbpath);
 | 
			
		||||
	if(dbdir == NULL) {
 | 
			
		||||
		if(errno == ENOENT) {
 | 
			
		||||
			/* no database existing yet is not an error */
 | 
			
		||||
			db->status &= ~DB_STATUS_EXISTS;
 | 
			
		||||
			db->status |= DB_STATUS_MISSING;
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
		RET_ERR(db->handle, ALPM_ERR_DB_OPEN, -1);
 | 
			
		||||
	}
 | 
			
		||||
	if(fstat(dirfd(dbdir), &buf) != 0) {
 | 
			
		||||
@@ -540,18 +601,21 @@ static int local_db_populate(alpm_db_t *db)
 | 
			
		||||
		/* add to the collection */
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
 | 
			
		||||
				pkg->name, db->treename);
 | 
			
		||||
		db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
 | 
			
		||||
		if(_alpm_pkghash_add(&db->pkgcache, pkg) == NULL) {
 | 
			
		||||
			_alpm_pkg_free(pkg);
 | 
			
		||||
			RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
 | 
			
		||||
		}
 | 
			
		||||
		count++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	closedir(dbdir);
 | 
			
		||||
	if(count > 0) {
 | 
			
		||||
		db->pkgcache->list = alpm_list_msort(db->pkgcache->list, (size_t)count, _alpm_pkg_cmp);
 | 
			
		||||
		db->pkgcache->list = alpm_list_msort(db->pkgcache->list, count, _alpm_pkg_cmp);
 | 
			
		||||
	}
 | 
			
		||||
	_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %d packages to package cache for db '%s'\n",
 | 
			
		||||
	_alpm_log(db->handle, ALPM_LOG_DEBUG, "added %zu packages to package cache for db '%s'\n",
 | 
			
		||||
			count, db->treename);
 | 
			
		||||
 | 
			
		||||
	return count;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Note: the return value must be freed by the caller */
 | 
			
		||||
@@ -572,7 +636,7 @@ char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info,
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#define READ_NEXT() do { \
 | 
			
		||||
	if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) goto error; \
 | 
			
		||||
	if(safe_fgets(line, sizeof(line), fp) == NULL && !feof(fp)) goto error; \
 | 
			
		||||
	_alpm_strip_newline(line, 0); \
 | 
			
		||||
} while(0)
 | 
			
		||||
 | 
			
		||||
@@ -583,7 +647,7 @@ char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info,
 | 
			
		||||
 | 
			
		||||
#define READ_AND_STORE_ALL(f) do { \
 | 
			
		||||
	char *linedup; \
 | 
			
		||||
	if(fgets(line, sizeof(line), fp) == NULL) {\
 | 
			
		||||
	if(safe_fgets(line, sizeof(line), fp) == NULL) {\
 | 
			
		||||
		if(!feof(fp)) goto error; else break; \
 | 
			
		||||
	} \
 | 
			
		||||
	if(_alpm_strip_newline(line, 0) == 0) break; \
 | 
			
		||||
@@ -592,14 +656,14 @@ char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info,
 | 
			
		||||
} while(1) /* note the while(1) and not (0) */
 | 
			
		||||
 | 
			
		||||
#define READ_AND_SPLITDEP(f) do { \
 | 
			
		||||
	if(fgets(line, sizeof(line), fp) == NULL) {\
 | 
			
		||||
	if(safe_fgets(line, sizeof(line), fp) == NULL) {\
 | 
			
		||||
		if(!feof(fp)) goto error; else break; \
 | 
			
		||||
	} \
 | 
			
		||||
	if(_alpm_strip_newline(line, 0) == 0) break; \
 | 
			
		||||
	f = alpm_list_add(f, _alpm_splitdep(line)); \
 | 
			
		||||
	f = alpm_list_add(f, alpm_dep_from_string(line)); \
 | 
			
		||||
} while(1) /* note the while(1) and not (0) */
 | 
			
		||||
 | 
			
		||||
static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
 | 
			
		||||
static int local_db_read(alpm_pkg_t *info, int inforeq)
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp = NULL;
 | 
			
		||||
	char line[1024];
 | 
			
		||||
@@ -638,7 +702,7 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
 | 
			
		||||
		}
 | 
			
		||||
		free(path);
 | 
			
		||||
		while(!feof(fp)) {
 | 
			
		||||
			if(fgets(line, sizeof(line), fp) == NULL && !feof(fp)) {
 | 
			
		||||
			if(safe_fgets(line, sizeof(line), fp) == NULL && !feof(fp)) {
 | 
			
		||||
				goto error;
 | 
			
		||||
			}
 | 
			
		||||
			if(_alpm_strip_newline(line, 0) == 0) {
 | 
			
		||||
@@ -657,6 +721,8 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
 | 
			
		||||
					_alpm_log(db->handle, ALPM_LOG_ERROR, _("%s database is inconsistent: version "
 | 
			
		||||
								"mismatch on package %s\n"), db->treename, info->name);
 | 
			
		||||
				}
 | 
			
		||||
			} else if(strcmp(line, "%BASE%") == 0) {
 | 
			
		||||
				READ_AND_STORE(info->base);
 | 
			
		||||
			} else if(strcmp(line, "%DESC%") == 0) {
 | 
			
		||||
				READ_AND_STORE(info->desc);
 | 
			
		||||
			} else if(strcmp(line, "%GROUPS%") == 0) {
 | 
			
		||||
@@ -727,53 +793,52 @@ static int local_db_read(alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
 | 
			
		||||
			goto error;
 | 
			
		||||
		}
 | 
			
		||||
		free(path);
 | 
			
		||||
		while(fgets(line, sizeof(line), fp)) {
 | 
			
		||||
		while(safe_fgets(line, sizeof(line), fp)) {
 | 
			
		||||
			_alpm_strip_newline(line, 0);
 | 
			
		||||
			if(strcmp(line, "%FILES%") == 0) {
 | 
			
		||||
				size_t files_count = 0, files_size = 0, len;
 | 
			
		||||
				alpm_file_t *files = NULL;
 | 
			
		||||
 | 
			
		||||
				while(fgets(line, sizeof(line), fp) &&
 | 
			
		||||
				while(safe_fgets(line, sizeof(line), fp) &&
 | 
			
		||||
						(len = _alpm_strip_newline(line, 0))) {
 | 
			
		||||
					if(files_count >= files_size) {
 | 
			
		||||
						size_t old_size = files_size;
 | 
			
		||||
						if(files_size == 0) {
 | 
			
		||||
							files_size = 8;
 | 
			
		||||
						} else {
 | 
			
		||||
							files_size *= 2;
 | 
			
		||||
						}
 | 
			
		||||
						files = realloc(files, sizeof(alpm_file_t) * files_size);
 | 
			
		||||
						if(!files) {
 | 
			
		||||
							_alpm_alloc_fail(sizeof(alpm_file_t) * files_size);
 | 
			
		||||
							goto error;
 | 
			
		||||
						}
 | 
			
		||||
						/* ensure all new memory is zeroed out, in both the initial
 | 
			
		||||
						 * allocation and later reallocs */
 | 
			
		||||
						memset(files + old_size, 0,
 | 
			
		||||
								sizeof(alpm_file_t) * (files_size - old_size));
 | 
			
		||||
					if(!_alpm_greedy_grow((void **)&files, &files_size,
 | 
			
		||||
								(files_count ? (files_count + 1) * sizeof(alpm_file_t) : 8 * sizeof(alpm_file_t)))) {
 | 
			
		||||
						goto nomem;
 | 
			
		||||
					}
 | 
			
		||||
					/* since we know the length of the file string already,
 | 
			
		||||
					 * we can do malloc + memcpy rather than strdup */
 | 
			
		||||
					len += 1;
 | 
			
		||||
					files[files_count].name = malloc(len);
 | 
			
		||||
					if(files[files_count].name == NULL) {
 | 
			
		||||
						_alpm_alloc_fail(len);
 | 
			
		||||
						goto error;
 | 
			
		||||
					}
 | 
			
		||||
					MALLOC(files[files_count].name, len, goto nomem);
 | 
			
		||||
					memcpy(files[files_count].name, line, len);
 | 
			
		||||
					files_count++;
 | 
			
		||||
				}
 | 
			
		||||
				/* attempt to hand back any memory we don't need */
 | 
			
		||||
				files = realloc(files, sizeof(alpm_file_t) * files_count);
 | 
			
		||||
				/* make sure the list is sorted */
 | 
			
		||||
				qsort(files, files_count, sizeof(alpm_file_t), _alpm_files_cmp);
 | 
			
		||||
				if(files_count > 0) {
 | 
			
		||||
					alpm_file_t *newfiles;
 | 
			
		||||
 | 
			
		||||
					newfiles = realloc(files, sizeof(alpm_file_t) * files_count);
 | 
			
		||||
					if(newfiles != NULL) {
 | 
			
		||||
						files = newfiles;
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					FREE(files);
 | 
			
		||||
				}
 | 
			
		||||
				info->files.count = files_count;
 | 
			
		||||
				info->files.files = files;
 | 
			
		||||
				_alpm_filelist_sort(&info->files);
 | 
			
		||||
				continue;
 | 
			
		||||
nomem:
 | 
			
		||||
				while(files_count > 0) {
 | 
			
		||||
					FREE(files[--files_count].name);
 | 
			
		||||
				}
 | 
			
		||||
				FREE(files);
 | 
			
		||||
				goto error;
 | 
			
		||||
			} else if(strcmp(line, "%BACKUP%") == 0) {
 | 
			
		||||
				while(fgets(line, sizeof(line), fp) && _alpm_strip_newline(line, 0)) {
 | 
			
		||||
				while(safe_fgets(line, sizeof(line), fp) && _alpm_strip_newline(line, 0)) {
 | 
			
		||||
					alpm_backup_t *backup;
 | 
			
		||||
					CALLOC(backup, 1, sizeof(alpm_backup_t), goto error);
 | 
			
		||||
					if(_alpm_split_backup(line, &backup)) {
 | 
			
		||||
						FREE(backup);
 | 
			
		||||
						goto error;
 | 
			
		||||
					}
 | 
			
		||||
					info->backup = alpm_list_add(info->backup, backup);
 | 
			
		||||
@@ -846,7 +911,7 @@ static void write_deps(FILE *fp, const char *header, alpm_list_t *deplist)
 | 
			
		||||
	fputc('\n', fp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq)
 | 
			
		||||
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq)
 | 
			
		||||
{
 | 
			
		||||
	FILE *fp = NULL;
 | 
			
		||||
	mode_t oldmask;
 | 
			
		||||
@@ -877,6 +942,10 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
 | 
			
		||||
		free(path);
 | 
			
		||||
		fprintf(fp, "%%NAME%%\n%s\n\n"
 | 
			
		||||
						"%%VERSION%%\n%s\n\n", info->name, info->version);
 | 
			
		||||
		if(info->base) {
 | 
			
		||||
			fprintf(fp, "%%BASE%%\n"
 | 
			
		||||
							"%s\n\n", info->base);
 | 
			
		||||
		}
 | 
			
		||||
		if(info->desc) {
 | 
			
		||||
			fprintf(fp, "%%DESC%%\n"
 | 
			
		||||
							"%s\n\n", info->desc);
 | 
			
		||||
@@ -990,16 +1059,11 @@ int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq
 | 
			
		||||
		fp = NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* INSTALL */
 | 
			
		||||
	/* nothing needed here (script is automatically extracted) */
 | 
			
		||||
	/* INSTALL and MTREE */
 | 
			
		||||
	/* nothing needed here (automatically extracted) */
 | 
			
		||||
 | 
			
		||||
cleanup:
 | 
			
		||||
	umask(oldmask);
 | 
			
		||||
 | 
			
		||||
	if(fp) {
 | 
			
		||||
		fclose(fp);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return retval;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -1091,6 +1155,7 @@ alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle)
 | 
			
		||||
	}
 | 
			
		||||
	db->ops = &local_db_ops;
 | 
			
		||||
	db->handle = handle;
 | 
			
		||||
	db->usage = ALPM_DB_USAGE_ALL;
 | 
			
		||||
 | 
			
		||||
	if(local_db_validate(db)) {
 | 
			
		||||
		/* pm_errno set in local_db_validate() */
 | 
			
		||||
@@ -1101,5 +1166,3 @@ alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle)
 | 
			
		||||
	handle->db_local = db;
 | 
			
		||||
	return db;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  be_package.c : backend for packages
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -24,6 +24,7 @@
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
 | 
			
		||||
/* libarchive */
 | 
			
		||||
#include <archive.h>
 | 
			
		||||
@@ -39,6 +40,7 @@
 | 
			
		||||
#include "package.h"
 | 
			
		||||
#include "deps.h"
 | 
			
		||||
#include "filelist.h"
 | 
			
		||||
#include "util.h"
 | 
			
		||||
 | 
			
		||||
struct package_changelog {
 | 
			
		||||
	struct archive *archive;
 | 
			
		||||
@@ -76,7 +78,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
 | 
			
		||||
			if(!changelog) {
 | 
			
		||||
				pkg->handle->pm_errno = ALPM_ERR_MEMORY;
 | 
			
		||||
				_alpm_archive_read_free(archive);
 | 
			
		||||
				CLOSE(fd);
 | 
			
		||||
				close(fd);
 | 
			
		||||
				return NULL;
 | 
			
		||||
			}
 | 
			
		||||
			changelog->archive = archive;
 | 
			
		||||
@@ -86,7 +88,7 @@ static void *_package_changelog_open(alpm_pkg_t *pkg)
 | 
			
		||||
	}
 | 
			
		||||
	/* we didn't find a changelog */
 | 
			
		||||
	_alpm_archive_read_free(archive);
 | 
			
		||||
	CLOSE(fd);
 | 
			
		||||
	close(fd);
 | 
			
		||||
	errno = ENOENT;
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
@@ -126,7 +128,7 @@ static int _package_changelog_close(const alpm_pkg_t UNUSED *pkg, void *fp)
 | 
			
		||||
	int ret;
 | 
			
		||||
	struct package_changelog *changelog = fp;
 | 
			
		||||
	ret = _alpm_archive_read_free(changelog->archive);
 | 
			
		||||
	CLOSE(changelog->fd);
 | 
			
		||||
	close(changelog->fd);
 | 
			
		||||
	free(changelog);
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
@@ -192,9 +194,11 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
 | 
			
		||||
				STRDUP(newpkg->name, ptr, return -1);
 | 
			
		||||
				newpkg->name_hash = _alpm_hash_sdbm(newpkg->name);
 | 
			
		||||
			} else if(strcmp(key, "pkgbase") == 0) {
 | 
			
		||||
				/* not used atm */
 | 
			
		||||
				STRDUP(newpkg->base, ptr, return -1);
 | 
			
		||||
			} else if(strcmp(key, "pkgver") == 0) {
 | 
			
		||||
				STRDUP(newpkg->version, ptr, return -1);
 | 
			
		||||
			} else if(strcmp(key, "basever") == 0) {
 | 
			
		||||
				/* not used atm */
 | 
			
		||||
			} else if(strcmp(key, "pkgdesc") == 0) {
 | 
			
		||||
				STRDUP(newpkg->desc, ptr, return -1);
 | 
			
		||||
			} else if(strcmp(key, "group") == 0) {
 | 
			
		||||
@@ -213,24 +217,30 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
 | 
			
		||||
				/* size in the raw package is uncompressed (installed) size */
 | 
			
		||||
				newpkg->isize = _alpm_strtoofft(ptr);
 | 
			
		||||
			} else if(strcmp(key, "depend") == 0) {
 | 
			
		||||
				alpm_depend_t *dep = _alpm_splitdep(ptr);
 | 
			
		||||
				alpm_depend_t *dep = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->depends = alpm_list_add(newpkg->depends, dep);
 | 
			
		||||
			} else if(strcmp(key, "optdepend") == 0) {
 | 
			
		||||
				alpm_depend_t *optdep = _alpm_splitdep(ptr);
 | 
			
		||||
				alpm_depend_t *optdep = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->optdepends = alpm_list_add(newpkg->optdepends, optdep);
 | 
			
		||||
			} else if(strcmp(key, "makedepend") == 0) {
 | 
			
		||||
				alpm_depend_t *makedep = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->makedepends = alpm_list_add(newpkg->makedepends, makedep);
 | 
			
		||||
			} else if(strcmp(key, "checkdepend") == 0) {
 | 
			
		||||
				alpm_depend_t *checkdep = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->checkdepends = alpm_list_add(newpkg->checkdepends, checkdep);
 | 
			
		||||
			} else if(strcmp(key, "conflict") == 0) {
 | 
			
		||||
				alpm_depend_t *conflict = _alpm_splitdep(ptr);
 | 
			
		||||
				alpm_depend_t *conflict = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->conflicts = alpm_list_add(newpkg->conflicts, conflict);
 | 
			
		||||
			} else if(strcmp(key, "replaces") == 0) {
 | 
			
		||||
				alpm_depend_t *replace = _alpm_splitdep(ptr);
 | 
			
		||||
				alpm_depend_t *replace = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->replaces = alpm_list_add(newpkg->replaces, replace);
 | 
			
		||||
			} else if(strcmp(key, "provides") == 0) {
 | 
			
		||||
				alpm_depend_t *provide = _alpm_splitdep(ptr);
 | 
			
		||||
				alpm_depend_t *provide = alpm_dep_from_string(ptr);
 | 
			
		||||
				newpkg->provides = alpm_list_add(newpkg->provides, provide);
 | 
			
		||||
			} else if(strcmp(key, "backup") == 0) {
 | 
			
		||||
				alpm_backup_t *backup;
 | 
			
		||||
				CALLOC(backup, 1, sizeof(alpm_backup_t), return -1);
 | 
			
		||||
				STRDUP(backup->name, ptr, return -1);
 | 
			
		||||
				STRDUP(backup->name, ptr, FREE(backup); return -1);
 | 
			
		||||
				newpkg->backup = alpm_list_add(newpkg->backup, backup);
 | 
			
		||||
			} else if(strcmp(key, "force") == 0) {
 | 
			
		||||
				/* deprecated, skip it */
 | 
			
		||||
@@ -262,11 +272,11 @@ static int parse_descfile(alpm_handle_t *handle, struct archive *a, alpm_pkg_t *
 | 
			
		||||
 * @return 0 if package is fully valid, -1 and pm_errno otherwise
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_pkg_validate_internal(alpm_handle_t *handle,
 | 
			
		||||
		const char *pkgfile, alpm_pkg_t *syncpkg, alpm_siglevel_t level,
 | 
			
		||||
		alpm_siglist_t **sigdata, alpm_pkgvalidation_t *validation)
 | 
			
		||||
		const char *pkgfile, alpm_pkg_t *syncpkg, int level,
 | 
			
		||||
		alpm_siglist_t **sigdata, int *validation)
 | 
			
		||||
{
 | 
			
		||||
	int has_sig;
 | 
			
		||||
	handle->pm_errno = 0;
 | 
			
		||||
	handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
 | 
			
		||||
	if(pkgfile == NULL || strlen(pkgfile) == 0) {
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1);
 | 
			
		||||
@@ -323,9 +333,13 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* even if we don't have a sig, run the check code if level tells us to */
 | 
			
		||||
	if(has_sig || level & ALPM_SIG_PACKAGE) {
 | 
			
		||||
	if(level & ALPM_SIG_PACKAGE) {
 | 
			
		||||
		const char *sig = syncpkg ? syncpkg->base64_sig : NULL;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "sig data: %s\n", sig ? sig : "<from .sig>");
 | 
			
		||||
		if(!has_sig && !(level & ALPM_SIG_PACKAGE_OPTIONAL)) {
 | 
			
		||||
			handle->pm_errno = ALPM_ERR_PKG_MISSING_SIG;
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
		if(_alpm_check_pgp_helper(handle, pkgfile, sig,
 | 
			
		||||
					level & ALPM_SIG_PACKAGE_OPTIONAL, level & ALPM_SIG_PACKAGE_MARGINAL_OK,
 | 
			
		||||
					level & ALPM_SIG_PACKAGE_UNKNOWN_OK, sigdata)) {
 | 
			
		||||
@@ -344,6 +358,193 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Handle the existence of simple paths for _alpm_load_pkg_internal()
 | 
			
		||||
 * @param pkg package to change
 | 
			
		||||
 * @param path path to examine
 | 
			
		||||
 * @return 0 if path doesn't match any rule, 1 if it has been handled
 | 
			
		||||
 */
 | 
			
		||||
static int handle_simple_path(alpm_pkg_t *pkg, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	if(strcmp(path, ".INSTALL") == 0) {
 | 
			
		||||
		pkg->scriptlet = 1;
 | 
			
		||||
		return 1;
 | 
			
		||||
	} else if(*path == '.') {
 | 
			
		||||
		/* for now, ignore all files starting with '.' that haven't
 | 
			
		||||
		 * already been handled (for future possibilities) */
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Add a file to the files list for pkg.
 | 
			
		||||
 *
 | 
			
		||||
 * @param pkg package to add the file to
 | 
			
		||||
 * @param files_size size of pkg->files.files
 | 
			
		||||
 * @param entry archive entry of the file to add to the list
 | 
			
		||||
 * @param path path of the file to be added
 | 
			
		||||
 * @return <0 on error, 0 on success
 | 
			
		||||
 */
 | 
			
		||||
static int add_entry_to_files_list(alpm_filelist_t *filelist,
 | 
			
		||||
		size_t *files_size, struct archive_entry *entry, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	const size_t files_count = filelist->count;
 | 
			
		||||
	alpm_file_t *current_file;
 | 
			
		||||
	mode_t type;
 | 
			
		||||
	size_t pathlen;
 | 
			
		||||
 | 
			
		||||
	if(!_alpm_greedy_grow((void **)&filelist->files,
 | 
			
		||||
				files_size, (files_count + 1) * sizeof(alpm_file_t))) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	type = archive_entry_filetype(entry);
 | 
			
		||||
 | 
			
		||||
	pathlen = strlen(path);
 | 
			
		||||
 | 
			
		||||
	current_file = filelist->files + files_count;
 | 
			
		||||
 | 
			
		||||
	/* mtree paths don't contain a tailing slash, those we get from
 | 
			
		||||
	 * the archive directly do (expensive way)
 | 
			
		||||
	 * Other code relies on it to detect directories so add it here.*/
 | 
			
		||||
	if(type == AE_IFDIR && path[pathlen - 1] != '/') {
 | 
			
		||||
		/* 2 = 1 for / + 1 for \0 */
 | 
			
		||||
		char *newpath;
 | 
			
		||||
		MALLOC(newpath, pathlen + 2, return -1);
 | 
			
		||||
		strcpy(newpath, path);
 | 
			
		||||
		newpath[pathlen] = '/';
 | 
			
		||||
		newpath[pathlen + 1] = '\0';
 | 
			
		||||
		current_file->name = newpath;
 | 
			
		||||
	} else {
 | 
			
		||||
		STRDUP(current_file->name, path, return -1);
 | 
			
		||||
	}
 | 
			
		||||
	current_file->size = archive_entry_size(entry);
 | 
			
		||||
	current_file->mode = archive_entry_mode(entry);
 | 
			
		||||
	filelist->count++;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Generate a new file list from an mtree file and add it to the package.
 | 
			
		||||
 * An existing file list will be free()d first.
 | 
			
		||||
 *
 | 
			
		||||
 * archive should point to an archive struct which is already at the
 | 
			
		||||
 * position of the mtree's header.
 | 
			
		||||
 *
 | 
			
		||||
 * @param handle
 | 
			
		||||
 * @param pkg package to add the file list to
 | 
			
		||||
 * @param archive archive containing the mtree
 | 
			
		||||
 * @return 0 on success, <0 on error
 | 
			
		||||
 */
 | 
			
		||||
static int build_filelist_from_mtree(alpm_handle_t *handle, alpm_pkg_t *pkg, struct archive *archive)
 | 
			
		||||
{
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	size_t i;
 | 
			
		||||
	size_t mtree_maxsize = 0;
 | 
			
		||||
	size_t mtree_cursize = 0;
 | 
			
		||||
	size_t files_size = 0; /* we clean up the existing array so this is fine */
 | 
			
		||||
	char *mtree_data = NULL;
 | 
			
		||||
	struct archive *mtree;
 | 
			
		||||
	struct archive_entry *mtree_entry = NULL;
 | 
			
		||||
	alpm_filelist_t filelist;
 | 
			
		||||
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
			"found mtree for package %s, getting file list\n", pkg->filename);
 | 
			
		||||
 | 
			
		||||
	memset(&filelist, 0, sizeof(alpm_filelist_t));
 | 
			
		||||
 | 
			
		||||
	/* create a new archive to parse the mtree and load it from archive into memory */
 | 
			
		||||
	/* TODO: split this into a function */
 | 
			
		||||
	if((mtree = archive_read_new()) == NULL) {
 | 
			
		||||
		handle->pm_errno = ALPM_ERR_LIBARCHIVE;
 | 
			
		||||
		goto error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_alpm_archive_read_support_filter_all(mtree);
 | 
			
		||||
	archive_read_support_format_mtree(mtree);
 | 
			
		||||
 | 
			
		||||
	/* TODO: split this into a function */
 | 
			
		||||
	while(1) {
 | 
			
		||||
		ssize_t size;
 | 
			
		||||
 | 
			
		||||
		if(!_alpm_greedy_grow((void **)&mtree_data, &mtree_maxsize, mtree_cursize + ALPM_BUFFER_SIZE)) {
 | 
			
		||||
			goto error;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		size = archive_read_data(archive, mtree_data + mtree_cursize, ALPM_BUFFER_SIZE);
 | 
			
		||||
 | 
			
		||||
		if(size < 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, _("error while reading package %s: %s\n"),
 | 
			
		||||
					pkg->filename, archive_error_string(archive));
 | 
			
		||||
			handle->pm_errno = ALPM_ERR_LIBARCHIVE;
 | 
			
		||||
			goto error;
 | 
			
		||||
		}
 | 
			
		||||
		if(size == 0) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		mtree_cursize += size;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(archive_read_open_memory(mtree, mtree_data, mtree_cursize)) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
				_("error while reading mtree of package %s: %s\n"),
 | 
			
		||||
				pkg->filename, archive_error_string(mtree));
 | 
			
		||||
		handle->pm_errno = ALPM_ERR_LIBARCHIVE;
 | 
			
		||||
		goto error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	while((ret = archive_read_next_header(mtree, &mtree_entry)) == ARCHIVE_OK) {
 | 
			
		||||
		const char *path = archive_entry_pathname(mtree_entry);
 | 
			
		||||
 | 
			
		||||
		/* strip leading "./" from path entries */
 | 
			
		||||
		if(path[0] == '.' && path[1] == '/') {
 | 
			
		||||
			path += 2;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(handle_simple_path(pkg, path)) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(add_entry_to_files_list(&filelist, &files_size, mtree_entry, path) < 0) {
 | 
			
		||||
			goto error;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(ret != ARCHIVE_EOF && ret != ARCHIVE_OK) { /* An error occurred */
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, _("error while reading mtree of package %s: %s\n"),
 | 
			
		||||
				pkg->filename, archive_error_string(mtree));
 | 
			
		||||
		handle->pm_errno = ALPM_ERR_LIBARCHIVE;
 | 
			
		||||
		goto error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* throw away any files we loaded directly from the archive */
 | 
			
		||||
	for(i = 0; i < pkg->files.count; i++) {
 | 
			
		||||
		free(pkg->files.files[i].name);
 | 
			
		||||
	}
 | 
			
		||||
	free(pkg->files.files);
 | 
			
		||||
 | 
			
		||||
	/* copy over new filelist */
 | 
			
		||||
	memcpy(&pkg->files, &filelist, sizeof(alpm_filelist_t));
 | 
			
		||||
 | 
			
		||||
	free(mtree_data);
 | 
			
		||||
	_alpm_archive_read_free(mtree);
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "finished mtree reading for %s\n", pkg->filename);
 | 
			
		||||
	return 0;
 | 
			
		||||
error:
 | 
			
		||||
	/* throw away any files we loaded from the mtree */
 | 
			
		||||
	for(i = 0; i < filelist.count; i++) {
 | 
			
		||||
		free(filelist.files[i].name);
 | 
			
		||||
	}
 | 
			
		||||
	free(filelist.files);
 | 
			
		||||
 | 
			
		||||
	free(mtree_data);
 | 
			
		||||
	_alpm_archive_read_free(mtree);
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * Load a package and create the corresponding alpm_pkg_t struct.
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
@@ -354,7 +555,9 @@ int _alpm_pkg_validate_internal(alpm_handle_t *handle,
 | 
			
		||||
alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
 | 
			
		||||
		const char *pkgfile, int full)
 | 
			
		||||
{
 | 
			
		||||
	int ret, fd, config = 0;
 | 
			
		||||
	int ret, fd;
 | 
			
		||||
	int config = 0;
 | 
			
		||||
	int hit_mtree = 0;
 | 
			
		||||
	struct archive *archive;
 | 
			
		||||
	struct archive_entry *entry;
 | 
			
		||||
	alpm_pkg_t *newpkg;
 | 
			
		||||
@@ -409,42 +612,25 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("missing package version in %s\n"), pkgfile);
 | 
			
		||||
				goto pkg_invalid;
 | 
			
		||||
			}
 | 
			
		||||
			if(strchr(newpkg->version, '-') == NULL) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("invalid package version in %s\n"), pkgfile);
 | 
			
		||||
				goto pkg_invalid;
 | 
			
		||||
			}
 | 
			
		||||
			config = 1;
 | 
			
		||||
			continue;
 | 
			
		||||
		} else if(strcmp(entry_name,  ".INSTALL") == 0) {
 | 
			
		||||
			newpkg->scriptlet = 1;
 | 
			
		||||
		} else if(*entry_name == '.') {
 | 
			
		||||
			/* for now, ignore all files starting with '.' that haven't
 | 
			
		||||
			 * already been handled (for future possibilities) */
 | 
			
		||||
		} else if(full) {
 | 
			
		||||
			const size_t files_count = newpkg->files.count;
 | 
			
		||||
			alpm_file_t *current_file;
 | 
			
		||||
			/* Keep track of all files for filelist generation */
 | 
			
		||||
			if(files_count >= files_size) {
 | 
			
		||||
				size_t old_size = files_size;
 | 
			
		||||
				alpm_file_t *newfiles;
 | 
			
		||||
				if(files_size == 0) {
 | 
			
		||||
					files_size = 4;
 | 
			
		||||
				} else {
 | 
			
		||||
					files_size *= 2;
 | 
			
		||||
				}
 | 
			
		||||
				newfiles = realloc(newpkg->files.files,
 | 
			
		||||
						sizeof(alpm_file_t) * files_size);
 | 
			
		||||
				if(!newfiles) {
 | 
			
		||||
					_alpm_alloc_fail(sizeof(alpm_file_t) * files_size);
 | 
			
		||||
					goto error;
 | 
			
		||||
				}
 | 
			
		||||
				/* ensure all new memory is zeroed out, in both the initial
 | 
			
		||||
				 * allocation and later reallocs */
 | 
			
		||||
				memset(newfiles + old_size, 0,
 | 
			
		||||
						sizeof(alpm_file_t) * (files_size - old_size));
 | 
			
		||||
				newpkg->files.files = newfiles;
 | 
			
		||||
		} else if(full && strcmp(entry_name, ".MTREE") == 0) {
 | 
			
		||||
			/* building the file list: cheap way
 | 
			
		||||
			 * get the filelist from the mtree file rather than scanning
 | 
			
		||||
			 * the whole archive  */
 | 
			
		||||
			hit_mtree = build_filelist_from_mtree(handle, newpkg, archive) == 0;
 | 
			
		||||
			continue;
 | 
			
		||||
		} else if(handle_simple_path(newpkg, entry_name)) {
 | 
			
		||||
			continue;
 | 
			
		||||
		} else if(full && !hit_mtree) {
 | 
			
		||||
			/* building the file list: expensive way */
 | 
			
		||||
			if(add_entry_to_files_list(&newpkg->files, &files_size, entry, entry_name) < 0) {
 | 
			
		||||
				goto error;
 | 
			
		||||
			}
 | 
			
		||||
			current_file = newpkg->files.files + files_count;
 | 
			
		||||
			STRDUP(current_file->name, entry_name, goto error);
 | 
			
		||||
			current_file->size = archive_entry_size(entry);
 | 
			
		||||
			current_file->mode = archive_entry_mode(entry);
 | 
			
		||||
			newpkg->files.count++;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(archive_read_data_skip(archive)) {
 | 
			
		||||
@@ -455,7 +641,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* if we are not doing a full read, see if we have all we need */
 | 
			
		||||
		if(!full && config) {
 | 
			
		||||
		if((!full || hit_mtree) && config) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -473,7 +659,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_alpm_archive_read_free(archive);
 | 
			
		||||
	CLOSE(fd);
 | 
			
		||||
	close(fd);
 | 
			
		||||
 | 
			
		||||
	/* internal fields for package struct */
 | 
			
		||||
	newpkg->origin = ALPM_PKG_FROM_FILE;
 | 
			
		||||
@@ -492,8 +678,7 @@ alpm_pkg_t *_alpm_pkg_load_internal(alpm_handle_t *handle,
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"sorting package filelist for %s\n", pkgfile);
 | 
			
		||||
 | 
			
		||||
			qsort(newpkg->files.files, newpkg->files.count,
 | 
			
		||||
					sizeof(alpm_file_t), _alpm_files_cmp);
 | 
			
		||||
			_alpm_filelist_sort(&newpkg->files);
 | 
			
		||||
		}
 | 
			
		||||
		newpkg->infolevel |= INFRQ_FILES;
 | 
			
		||||
	}
 | 
			
		||||
@@ -506,28 +691,31 @@ error:
 | 
			
		||||
	_alpm_pkg_free(newpkg);
 | 
			
		||||
	_alpm_archive_read_free(archive);
 | 
			
		||||
	if(fd >= 0) {
 | 
			
		||||
		CLOSE(fd);
 | 
			
		||||
		close(fd);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* adopted limit from repo-add */
 | 
			
		||||
#define MAX_SIGFILE_SIZE 16384
 | 
			
		||||
 | 
			
		||||
static int read_sigfile(const char *sigpath, unsigned char **sig)
 | 
			
		||||
{
 | 
			
		||||
	struct stat st;
 | 
			
		||||
	FILE *fp;
 | 
			
		||||
 | 
			
		||||
	if(stat(sigpath, &st) != 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	MALLOC(*sig, st.st_size, return -1);
 | 
			
		||||
 | 
			
		||||
	if((fp = fopen(sigpath, "rb")) == NULL) {
 | 
			
		||||
		free(*sig);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(fstat(fileno(fp), &st) != 0 || st.st_size > MAX_SIGFILE_SIZE) {
 | 
			
		||||
		fclose(fp);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	MALLOC(*sig, st.st_size, fclose(fp); return -1);
 | 
			
		||||
 | 
			
		||||
	if(fread(*sig, st.st_size, 1, fp) != 1) {
 | 
			
		||||
		free(*sig);
 | 
			
		||||
		fclose(fp);
 | 
			
		||||
@@ -539,9 +727,9 @@ static int read_sigfile(const char *sigpath, unsigned char **sig)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int full,
 | 
			
		||||
		alpm_siglevel_t level, alpm_pkg_t **pkg)
 | 
			
		||||
		int level, alpm_pkg_t **pkg)
 | 
			
		||||
{
 | 
			
		||||
	alpm_pkgvalidation_t validation = 0;
 | 
			
		||||
	int validation = 0;
 | 
			
		||||
	char *sigpath;
 | 
			
		||||
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
@@ -562,7 +750,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(_alpm_extract_keyid(handle, filename, sig, len, &keys) == 0) {
 | 
			
		||||
			if(alpm_extract_keyid(handle, filename, sig, len, &keys) == 0) {
 | 
			
		||||
				alpm_list_t *k;
 | 
			
		||||
				for(k = keys; k; k = k->next) {
 | 
			
		||||
					char *key = k->data;
 | 
			
		||||
@@ -579,6 +767,7 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
 | 
			
		||||
 | 
			
		||||
			if(fail) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("required key missing from keyring\n"));
 | 
			
		||||
				free(sigpath);
 | 
			
		||||
				return -1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -599,5 +788,3 @@ int SYMEXPORT alpm_pkg_load(alpm_handle_t *handle, const char *filename, int ful
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  be_sync.c : backend for sync databases
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -22,6 +22,7 @@
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
#include <sys/stat.h>
 | 
			
		||||
#include <fcntl.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <unistd.h>
 | 
			
		||||
 | 
			
		||||
/* libarchive */
 | 
			
		||||
@@ -39,6 +40,7 @@
 | 
			
		||||
#include "delta.h"
 | 
			
		||||
#include "deps.h"
 | 
			
		||||
#include "dload.h"
 | 
			
		||||
#include "filelist.h"
 | 
			
		||||
 | 
			
		||||
static char *get_sync_dir(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
@@ -69,7 +71,7 @@ static char *get_sync_dir(alpm_handle_t *handle)
 | 
			
		||||
 | 
			
		||||
static int sync_db_validate(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	alpm_siglevel_t level;
 | 
			
		||||
	int siglevel;
 | 
			
		||||
	const char *dbpath;
 | 
			
		||||
 | 
			
		||||
	if(db->status & DB_STATUS_VALID || db->status & DB_STATUS_MISSING) {
 | 
			
		||||
@@ -88,9 +90,13 @@ static int sync_db_validate(alpm_db_t *db)
 | 
			
		||||
 | 
			
		||||
	/* we can skip any validation if the database doesn't exist */
 | 
			
		||||
	if(_alpm_access(db->handle, NULL, dbpath, R_OK) != 0 && errno == ENOENT) {
 | 
			
		||||
		alpm_event_database_missing_t event = {
 | 
			
		||||
			.type = ALPM_EVENT_DATABASE_MISSING,
 | 
			
		||||
			.dbname = db->treename
 | 
			
		||||
		};
 | 
			
		||||
		db->status &= ~DB_STATUS_EXISTS;
 | 
			
		||||
		db->status |= DB_STATUS_MISSING;
 | 
			
		||||
		EVENT(db->handle, ALPM_EVENT_DATABASE_MISSING, db->treename, NULL);
 | 
			
		||||
		EVENT(db->handle, &event);
 | 
			
		||||
		goto valid;
 | 
			
		||||
	}
 | 
			
		||||
	db->status |= DB_STATUS_EXISTS;
 | 
			
		||||
@@ -98,20 +104,20 @@ static int sync_db_validate(alpm_db_t *db)
 | 
			
		||||
 | 
			
		||||
	/* this takes into account the default verification level if UNKNOWN
 | 
			
		||||
	 * was assigned to this db */
 | 
			
		||||
	level = alpm_db_get_siglevel(db);
 | 
			
		||||
	siglevel = alpm_db_get_siglevel(db);
 | 
			
		||||
 | 
			
		||||
	if(level & ALPM_SIG_DATABASE) {
 | 
			
		||||
	if(siglevel & ALPM_SIG_DATABASE) {
 | 
			
		||||
		int retry, ret;
 | 
			
		||||
		do {
 | 
			
		||||
			retry = 0;
 | 
			
		||||
			alpm_siglist_t *siglist;
 | 
			
		||||
			ret = _alpm_check_pgp_helper(db->handle, dbpath, NULL,
 | 
			
		||||
					level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
 | 
			
		||||
					level & ALPM_SIG_DATABASE_UNKNOWN_OK, &siglist);
 | 
			
		||||
					siglevel & ALPM_SIG_DATABASE_OPTIONAL, siglevel & ALPM_SIG_DATABASE_MARGINAL_OK,
 | 
			
		||||
					siglevel & ALPM_SIG_DATABASE_UNKNOWN_OK, &siglist);
 | 
			
		||||
			if(ret) {
 | 
			
		||||
				retry = _alpm_process_siglist(db->handle, db->treename, siglist,
 | 
			
		||||
						level & ALPM_SIG_DATABASE_OPTIONAL, level & ALPM_SIG_DATABASE_MARGINAL_OK,
 | 
			
		||||
						level & ALPM_SIG_DATABASE_UNKNOWN_OK);
 | 
			
		||||
						siglevel & ALPM_SIG_DATABASE_OPTIONAL, siglevel & ALPM_SIG_DATABASE_MARGINAL_OK,
 | 
			
		||||
						siglevel & ALPM_SIG_DATABASE_UNKNOWN_OK);
 | 
			
		||||
			}
 | 
			
		||||
			alpm_siglist_cleanup(siglist);
 | 
			
		||||
			free(siglist);
 | 
			
		||||
@@ -169,28 +175,39 @@ valid:
 | 
			
		||||
int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	char *syncpath;
 | 
			
		||||
	const char *dbext;
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	int updated = 0;
 | 
			
		||||
	int ret = -1;
 | 
			
		||||
	mode_t oldmask;
 | 
			
		||||
	alpm_handle_t *handle;
 | 
			
		||||
	alpm_siglevel_t level;
 | 
			
		||||
	int siglevel;
 | 
			
		||||
 | 
			
		||||
	/* Sanity checks */
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	handle = db->handle;
 | 
			
		||||
	handle->pm_errno = 0;
 | 
			
		||||
	handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	ASSERT(db != handle->db_local, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
	ASSERT(db->servers != NULL, RET_ERR(handle, ALPM_ERR_SERVER_NONE, -1));
 | 
			
		||||
 | 
			
		||||
	if(!(db->usage & ALPM_DB_USAGE_SYNC)) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	syncpath = get_sync_dir(handle);
 | 
			
		||||
	if(!syncpath) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* force update of invalid databases to fix potential mismatched database/signature */
 | 
			
		||||
	if(db->status & DB_STATUS_INVALID) {
 | 
			
		||||
		force = 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* make sure we have a sane umask */
 | 
			
		||||
	oldmask = umask(0022);
 | 
			
		||||
 | 
			
		||||
	level = alpm_db_get_siglevel(db);
 | 
			
		||||
	siglevel = alpm_db_get_siglevel(db);
 | 
			
		||||
 | 
			
		||||
	/* attempt to grab a lock */
 | 
			
		||||
	if(_alpm_handle_lock(handle)) {
 | 
			
		||||
@@ -199,8 +216,10 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_HANDLE_LOCK, -1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	dbext = db->handle->dbext;
 | 
			
		||||
 | 
			
		||||
	for(i = db->servers; i; i = i->next) {
 | 
			
		||||
		const char *server = i->data;
 | 
			
		||||
		const char *server = i->data, *final_db_url = NULL;
 | 
			
		||||
		struct dload_payload payload;
 | 
			
		||||
		size_t len;
 | 
			
		||||
		int sig_ret = 0;
 | 
			
		||||
@@ -211,18 +230,24 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 | 
			
		||||
		payload.max_size = 25 * 1024 * 1024;
 | 
			
		||||
 | 
			
		||||
		/* print server + filename into a buffer */
 | 
			
		||||
		len = strlen(server) + strlen(db->treename) + 5;
 | 
			
		||||
		/* TODO fix leak syncpath and umask unset */
 | 
			
		||||
		MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
		snprintf(payload.fileurl, len, "%s/%s.db", server, db->treename);
 | 
			
		||||
		len = strlen(server) + strlen(db->treename) + strlen(dbext) + 2;
 | 
			
		||||
		MALLOC(payload.fileurl, len,
 | 
			
		||||
			{
 | 
			
		||||
				free(syncpath);
 | 
			
		||||
				umask(oldmask);
 | 
			
		||||
				RET_ERR(handle, ALPM_ERR_MEMORY, -1);
 | 
			
		||||
			}
 | 
			
		||||
		);
 | 
			
		||||
		snprintf(payload.fileurl, len, "%s/%s%s", server, db->treename, dbext);
 | 
			
		||||
		payload.handle = handle;
 | 
			
		||||
		payload.force = force;
 | 
			
		||||
		payload.unlink_on_fail = 1;
 | 
			
		||||
 | 
			
		||||
		ret = _alpm_download(&payload, syncpath, NULL, NULL);
 | 
			
		||||
		ret = _alpm_download(&payload, syncpath, NULL, &final_db_url);
 | 
			
		||||
		_alpm_dload_payload_reset(&payload);
 | 
			
		||||
		updated = (updated || ret == 0);
 | 
			
		||||
 | 
			
		||||
		if(ret == 0 && (level & ALPM_SIG_DATABASE)) {
 | 
			
		||||
		if(ret != -1 && updated && (siglevel & ALPM_SIG_DATABASE)) {
 | 
			
		||||
			/* an existing sig file is no good at this point */
 | 
			
		||||
			char *sigpath = _alpm_sigpath(handle, _alpm_db_path(db));
 | 
			
		||||
			if(!sigpath) {
 | 
			
		||||
@@ -232,15 +257,42 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 | 
			
		||||
			unlink(sigpath);
 | 
			
		||||
			free(sigpath);
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
			/* check if the final URL from internal downloader looks reasonable */
 | 
			
		||||
			if(final_db_url != NULL) {
 | 
			
		||||
				if(strlen(final_db_url) < 3
 | 
			
		||||
						|| strcmp(final_db_url + strlen(final_db_url) - strlen(dbext),
 | 
			
		||||
								dbext) != 0) {
 | 
			
		||||
					final_db_url = NULL;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* if we downloaded a DB, we want the .sig from the same server */
 | 
			
		||||
			/* print server + filename into a buffer (leave space for .sig) */
 | 
			
		||||
			len = strlen(server) + strlen(db->treename) + 9;
 | 
			
		||||
			/* TODO fix leak syncpath and umask unset */
 | 
			
		||||
			MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
			snprintf(payload.fileurl, len, "%s/%s.db.sig", server, db->treename);
 | 
			
		||||
			if(final_db_url != NULL) {
 | 
			
		||||
				/* print final_db_url into a buffer (leave space for .sig) */
 | 
			
		||||
				len = strlen(final_db_url) + 5;
 | 
			
		||||
			} else {
 | 
			
		||||
				/* print server + filename into a buffer (leave space for separator and .sig) */
 | 
			
		||||
				len = strlen(server) + strlen(db->treename) + strlen(dbext) + 6;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			MALLOC(payload.fileurl, len,
 | 
			
		||||
				{
 | 
			
		||||
					free(syncpath);
 | 
			
		||||
					umask(oldmask);
 | 
			
		||||
					RET_ERR(handle, ALPM_ERR_MEMORY, -1);
 | 
			
		||||
				}
 | 
			
		||||
			);
 | 
			
		||||
 | 
			
		||||
			if(final_db_url != NULL) {
 | 
			
		||||
				snprintf(payload.fileurl, len, "%s.sig", final_db_url);
 | 
			
		||||
			} else {
 | 
			
		||||
				snprintf(payload.fileurl, len, "%s/%s%s.sig", server, db->treename, dbext);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			payload.handle = handle;
 | 
			
		||||
			payload.force = 1;
 | 
			
		||||
			payload.errors_ok = (level & ALPM_SIG_DATABASE_OPTIONAL);
 | 
			
		||||
			payload.errors_ok = (siglevel & ALPM_SIG_DATABASE_OPTIONAL);
 | 
			
		||||
 | 
			
		||||
			/* set hard upper limit of 16KiB */
 | 
			
		||||
			payload.max_size = 16 * 1024;
 | 
			
		||||
@@ -256,37 +308,32 @@ int SYMEXPORT alpm_db_update(int force, alpm_db_t *db)
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(ret == 1) {
 | 
			
		||||
		/* files match, do nothing */
 | 
			
		||||
		handle->pm_errno = 0;
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	} else if(ret == -1) {
 | 
			
		||||
	if(updated) {
 | 
			
		||||
		/* Cache needs to be rebuilt */
 | 
			
		||||
		_alpm_db_free_pkgcache(db);
 | 
			
		||||
 | 
			
		||||
		/* clear all status flags regarding validity/existence */
 | 
			
		||||
		db->status &= ~DB_STATUS_VALID;
 | 
			
		||||
		db->status &= ~DB_STATUS_INVALID;
 | 
			
		||||
		db->status &= ~DB_STATUS_EXISTS;
 | 
			
		||||
		db->status &= ~DB_STATUS_MISSING;
 | 
			
		||||
 | 
			
		||||
		/* if the download failed skip validation to preserve the download error */
 | 
			
		||||
		if(ret != -1 && sync_db_validate(db) != 0) {
 | 
			
		||||
			/* pm_errno should be set */
 | 
			
		||||
			ret = -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(ret == -1) {
 | 
			
		||||
		/* pm_errno was set by the download code */
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG, "failed to sync db: %s\n",
 | 
			
		||||
				alpm_strerror(handle->pm_errno));
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	} else {
 | 
			
		||||
		handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* Cache needs to be rebuilt */
 | 
			
		||||
	_alpm_db_free_pkgcache(db);
 | 
			
		||||
 | 
			
		||||
	/* clear all status flags regarding validity/existence */
 | 
			
		||||
	db->status &= ~DB_STATUS_VALID;
 | 
			
		||||
	db->status &= ~DB_STATUS_INVALID;
 | 
			
		||||
	db->status &= ~DB_STATUS_EXISTS;
 | 
			
		||||
	db->status &= ~DB_STATUS_MISSING;
 | 
			
		||||
 | 
			
		||||
	if(sync_db_validate(db)) {
 | 
			
		||||
		/* pm_errno should be set */
 | 
			
		||||
		ret = -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
cleanup:
 | 
			
		||||
 | 
			
		||||
	if(_alpm_handle_unlock(handle)) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_WARNING, _("could not remove lock file %s\n"),
 | 
			
		||||
				handle->lockfile);
 | 
			
		||||
	}
 | 
			
		||||
	_alpm_handle_unlock(handle);
 | 
			
		||||
	free(syncpath);
 | 
			
		||||
	umask(oldmask);
 | 
			
		||||
	return ret;
 | 
			
		||||
@@ -296,7 +343,7 @@ cleanup:
 | 
			
		||||
static int sync_db_read(alpm_db_t *db, struct archive *archive,
 | 
			
		||||
		struct archive_entry *entry, alpm_pkg_t **likely_pkg);
 | 
			
		||||
 | 
			
		||||
static alpm_pkgvalidation_t _sync_get_validation(alpm_pkg_t *pkg)
 | 
			
		||||
static int _sync_get_validation(alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	if(pkg->validation) {
 | 
			
		||||
		return pkg->validation;
 | 
			
		||||
@@ -366,7 +413,10 @@ static alpm_pkg_t *load_pkg_for_entry(alpm_db_t *db, const char *entryname,
 | 
			
		||||
		/* add to the collection */
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_FUNCTION, "adding '%s' to package cache for db '%s'\n",
 | 
			
		||||
				pkg->name, db->treename);
 | 
			
		||||
		db->pkgcache = _alpm_pkghash_add(db->pkgcache, pkg);
 | 
			
		||||
		if(_alpm_pkghash_add(&db->pkgcache, pkg) == NULL) {
 | 
			
		||||
			_alpm_pkg_free(pkg);
 | 
			
		||||
			RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL);
 | 
			
		||||
		}
 | 
			
		||||
	} else {
 | 
			
		||||
		free(pkgname);
 | 
			
		||||
		free(pkgver);
 | 
			
		||||
@@ -408,14 +458,17 @@ static size_t estimate_package_count(struct stat *st, struct archive *archive)
 | 
			
		||||
			/* assume it is at least somewhat compressed */
 | 
			
		||||
			per_package = 500;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return (size_t)((st->st_size / per_package) + 1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int sync_db_populate(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	const char *dbpath;
 | 
			
		||||
	size_t est_count;
 | 
			
		||||
	int count, fd;
 | 
			
		||||
	size_t est_count, count;
 | 
			
		||||
	int fd;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	int archive_ret;
 | 
			
		||||
	struct stat buf;
 | 
			
		||||
	struct archive *archive;
 | 
			
		||||
	struct archive_entry *entry;
 | 
			
		||||
@@ -436,47 +489,61 @@ static int sync_db_populate(alpm_db_t *db)
 | 
			
		||||
	fd = _alpm_open_archive(db->handle, dbpath, &buf,
 | 
			
		||||
			&archive, ALPM_ERR_DB_OPEN);
 | 
			
		||||
	if(fd < 0) {
 | 
			
		||||
		db->status &= ~DB_STATUS_VALID;
 | 
			
		||||
		db->status |= DB_STATUS_INVALID;
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	est_count = estimate_package_count(&buf, archive);
 | 
			
		||||
 | 
			
		||||
	/* currently only .files dbs contain file lists - make flexible when required*/
 | 
			
		||||
	if(strcmp(db->handle->dbext, ".files") == 0) {
 | 
			
		||||
		/* files databases are about four times larger on average */
 | 
			
		||||
		est_count /= 4;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	db->pkgcache = _alpm_pkghash_create(est_count);
 | 
			
		||||
	if(db->pkgcache == NULL) {
 | 
			
		||||
		db->handle->pm_errno = ALPM_ERR_MEMORY;
 | 
			
		||||
		count = -1;
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	while(archive_read_next_header(archive, &entry) == ARCHIVE_OK) {
 | 
			
		||||
	while((archive_ret = archive_read_next_header(archive, &entry)) == ARCHIVE_OK) {
 | 
			
		||||
		mode_t mode = archive_entry_mode(entry);
 | 
			
		||||
		if(S_ISDIR(mode)) {
 | 
			
		||||
			continue;
 | 
			
		||||
		} else {
 | 
			
		||||
		if(!S_ISDIR(mode)) {
 | 
			
		||||
			/* we have desc, depends or deltas - parse it */
 | 
			
		||||
			if(sync_db_read(db, archive, entry, &pkg) != 0) {
 | 
			
		||||
				_alpm_log(db->handle, ALPM_LOG_ERROR,
 | 
			
		||||
						_("could not parse package description file '%s' from db '%s'\n"),
 | 
			
		||||
						archive_entry_pathname(entry), db->treename);
 | 
			
		||||
				continue;
 | 
			
		||||
				ret = -1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	if(archive_ret != ARCHIVE_EOF) {
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_ERROR, _("could not read db '%s' (%s)\n"),
 | 
			
		||||
				db->treename, archive_error_string(archive));
 | 
			
		||||
		_alpm_db_free_pkgcache(db);
 | 
			
		||||
		db->handle->pm_errno = ALPM_ERR_LIBARCHIVE;
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	count = alpm_list_count(db->pkgcache->list);
 | 
			
		||||
	if(count > 0) {
 | 
			
		||||
		db->pkgcache->list = alpm_list_msort(db->pkgcache->list,
 | 
			
		||||
				(size_t)count, _alpm_pkg_cmp);
 | 
			
		||||
				count, _alpm_pkg_cmp);
 | 
			
		||||
	}
 | 
			
		||||
	_alpm_log(db->handle, ALPM_LOG_DEBUG,
 | 
			
		||||
			"added %d packages to package cache for db '%s'\n",
 | 
			
		||||
			"added %zu packages to package cache for db '%s'\n",
 | 
			
		||||
			count, db->treename);
 | 
			
		||||
 | 
			
		||||
cleanup:
 | 
			
		||||
	_alpm_archive_read_free(archive);
 | 
			
		||||
	if(fd >= 0) {
 | 
			
		||||
		CLOSE(fd);
 | 
			
		||||
		close(fd);
 | 
			
		||||
	}
 | 
			
		||||
	return count;
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* This function validates %FILENAME%. filename must be between 3 and
 | 
			
		||||
@@ -528,7 +595,7 @@ static int _alpm_validate_filename(alpm_db_t *db, const char *pkgname,
 | 
			
		||||
#define READ_AND_SPLITDEP(f) do { \
 | 
			
		||||
	if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) goto error; \
 | 
			
		||||
	if(_alpm_strip_newline(buf.line, buf.real_line_size) == 0) break; \
 | 
			
		||||
	f = alpm_list_add(f, _alpm_splitdep(line)); \
 | 
			
		||||
	f = alpm_list_add(f, alpm_dep_from_string(line)); \
 | 
			
		||||
} while(1) /* note the while(1) and not (0) */
 | 
			
		||||
 | 
			
		||||
static int sync_db_read(alpm_db_t *db, struct archive *archive,
 | 
			
		||||
@@ -556,12 +623,21 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
 | 
			
		||||
 | 
			
		||||
	if(pkg == NULL) {
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_DEBUG,
 | 
			
		||||
				"entry %s could not be loaded into %s sync database",
 | 
			
		||||
				"entry %s could not be loaded into %s sync database\n",
 | 
			
		||||
				entryname, db->treename);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(filename == NULL) {
 | 
			
		||||
		/* A file exists outside of a subdirectory. This isn't a read error, so return
 | 
			
		||||
		 * success and try to continue on. */
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_WARNING, _("unknown database file: %s\n"),
 | 
			
		||||
				entryname);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(strcmp(filename, "desc") == 0 || strcmp(filename, "depends") == 0
 | 
			
		||||
			|| strcmp(filename, "files") == 0
 | 
			
		||||
			|| (strcmp(filename, "deltas") == 0 && db->handle->deltaratio > 0.0) ) {
 | 
			
		||||
		int ret;
 | 
			
		||||
		while((ret = _alpm_archive_fgets(archive, &buf)) == ARCHIVE_OK) {
 | 
			
		||||
@@ -588,6 +664,8 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
 | 
			
		||||
				if(_alpm_validate_filename(db, pkg->name, pkg->filename) < 0) {
 | 
			
		||||
					return -1;
 | 
			
		||||
				}
 | 
			
		||||
			} else if(strcmp(line, "%BASE%") == 0) {
 | 
			
		||||
				READ_AND_STORE(pkg->base);
 | 
			
		||||
			} else if(strcmp(line, "%DESC%") == 0) {
 | 
			
		||||
				READ_AND_STORE(pkg->desc);
 | 
			
		||||
			} else if(strcmp(line, "%GROUPS%") == 0) {
 | 
			
		||||
@@ -645,6 +723,36 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
 | 
			
		||||
					pkg->deltas = alpm_list_add(pkg->deltas,
 | 
			
		||||
							_alpm_delta_parse(db->handle, line));
 | 
			
		||||
				}
 | 
			
		||||
			} else if(strcmp(line, "%FILES%") == 0) {
 | 
			
		||||
				/* TODO: this could lazy load if there is future demand */
 | 
			
		||||
				size_t files_count = 0, files_size = 0;
 | 
			
		||||
				alpm_file_t *files = NULL;
 | 
			
		||||
 | 
			
		||||
				while(1) {
 | 
			
		||||
					if(_alpm_archive_fgets(archive, &buf) != ARCHIVE_OK) {
 | 
			
		||||
						goto error;
 | 
			
		||||
					}
 | 
			
		||||
					line = buf.line;
 | 
			
		||||
					if(_alpm_strip_newline(line, buf.real_line_size) == 0) {
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
 | 
			
		||||
					if(!_alpm_greedy_grow((void **)&files, &files_size,
 | 
			
		||||
								(files_count ? (files_count + 1) * sizeof(alpm_file_t) : 8 * sizeof(alpm_file_t)))) {
 | 
			
		||||
						goto error;
 | 
			
		||||
					}
 | 
			
		||||
					STRDUP(files[files_count].name, line, goto error);
 | 
			
		||||
					files_count++;
 | 
			
		||||
				}
 | 
			
		||||
				/* attempt to hand back any memory we don't need */
 | 
			
		||||
				if(files_count > 0) {
 | 
			
		||||
					files = realloc(files, sizeof(alpm_file_t) * files_count);
 | 
			
		||||
				} else {
 | 
			
		||||
					FREE(files);
 | 
			
		||||
				}
 | 
			
		||||
				pkg->files.count = files_count;
 | 
			
		||||
				pkg->files.files = files;
 | 
			
		||||
				_alpm_filelist_sort(&pkg->files);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if(ret != ARCHIVE_EOF) {
 | 
			
		||||
@@ -653,8 +761,6 @@ static int sync_db_read(alpm_db_t *db, struct archive *archive,
 | 
			
		||||
		*likely_pkg = pkg;
 | 
			
		||||
	} else if(strcmp(filename, "deltas") == 0) {
 | 
			
		||||
		/* skip reading delta files if UseDelta is unset */
 | 
			
		||||
	} else if(strcmp(filename, "files") == 0) {
 | 
			
		||||
		/* currently do nothing with this file */
 | 
			
		||||
	} else {
 | 
			
		||||
		/* unknown database file */
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_DEBUG, "unknown database file: %s\n", filename);
 | 
			
		||||
@@ -674,14 +780,14 @@ struct db_operations sync_db_ops = {
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
 | 
			
		||||
		alpm_siglevel_t level)
 | 
			
		||||
		int level)
 | 
			
		||||
{
 | 
			
		||||
	alpm_db_t *db;
 | 
			
		||||
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "registering sync database '%s'\n", treename);
 | 
			
		||||
 | 
			
		||||
#ifndef HAVE_LIBGPGME
 | 
			
		||||
	if((level &= ~ALPM_SIG_PACKAGE_SET) != 0 && level != ALPM_SIG_USE_DEFAULT) {
 | 
			
		||||
	if(level != 0 && level != ALPM_SIG_USE_DEFAULT) {
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL);
 | 
			
		||||
	}
 | 
			
		||||
#endif
 | 
			
		||||
@@ -699,5 +805,3 @@ alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
 | 
			
		||||
	handle->dbs_sync = alpm_list_add(handle->dbs_sync, db);
 | 
			
		||||
	return db;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  conflict.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2006 by David Kimpe <dnaku@frugalware.org>
 | 
			
		||||
@@ -48,22 +48,27 @@ static alpm_conflict_t *conflict_new(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2,
 | 
			
		||||
{
 | 
			
		||||
	alpm_conflict_t *conflict;
 | 
			
		||||
 | 
			
		||||
	MALLOC(conflict, sizeof(alpm_conflict_t), return NULL);
 | 
			
		||||
	CALLOC(conflict, 1, sizeof(alpm_conflict_t), return NULL);
 | 
			
		||||
 | 
			
		||||
	conflict->package1_hash = pkg1->name_hash;
 | 
			
		||||
	conflict->package2_hash = pkg2->name_hash;
 | 
			
		||||
	STRDUP(conflict->package1, pkg1->name, return NULL);
 | 
			
		||||
	STRDUP(conflict->package2, pkg2->name, return NULL);
 | 
			
		||||
	STRDUP(conflict->package1, pkg1->name, goto error);
 | 
			
		||||
	STRDUP(conflict->package2, pkg2->name, goto error);
 | 
			
		||||
	conflict->reason = reason;
 | 
			
		||||
 | 
			
		||||
	return conflict;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	alpm_conflict_free(conflict);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Free a conflict and its members.
 | 
			
		||||
 */
 | 
			
		||||
void _alpm_conflict_free(alpm_conflict_t *conflict)
 | 
			
		||||
void SYMEXPORT alpm_conflict_free(alpm_conflict_t *conflict)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(conflict != NULL, return);
 | 
			
		||||
	FREE(conflict->package2);
 | 
			
		||||
	FREE(conflict->package1);
 | 
			
		||||
	FREE(conflict);
 | 
			
		||||
@@ -79,11 +84,15 @@ alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict)
 | 
			
		||||
 | 
			
		||||
	newconflict->package1_hash = conflict->package1_hash;
 | 
			
		||||
	newconflict->package2_hash = conflict->package2_hash;
 | 
			
		||||
	STRDUP(newconflict->package1, conflict->package1, return NULL);
 | 
			
		||||
	STRDUP(newconflict->package2, conflict->package2, return NULL);
 | 
			
		||||
	STRDUP(newconflict->package1, conflict->package1, goto error);
 | 
			
		||||
	STRDUP(newconflict->package2, conflict->package2, goto error);
 | 
			
		||||
	newconflict->reason = conflict->reason;
 | 
			
		||||
 | 
			
		||||
	return newconflict;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	alpm_conflict_free(newconflict);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -135,7 +144,7 @@ static int add_conflict(alpm_handle_t *handle, alpm_list_t **baddeps,
 | 
			
		||||
				pkg1->name, pkg2->name, conflict_str);
 | 
			
		||||
		free(conflict_str);
 | 
			
		||||
	} else {
 | 
			
		||||
		_alpm_conflict_free(conflict);
 | 
			
		||||
		alpm_conflict_free(conflict);
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -265,16 +274,19 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
 | 
			
		||||
		alpm_pkg_t *pkg1, alpm_pkg_t *pkg2)
 | 
			
		||||
{
 | 
			
		||||
	alpm_fileconflict_t *conflict;
 | 
			
		||||
	MALLOC(conflict, sizeof(alpm_fileconflict_t), goto error);
 | 
			
		||||
	CALLOC(conflict, 1, sizeof(alpm_fileconflict_t), goto error);
 | 
			
		||||
 | 
			
		||||
	STRDUP(conflict->target, pkg1->name, goto error);
 | 
			
		||||
	STRDUP(conflict->file, filestr, goto error);
 | 
			
		||||
	if(pkg2) {
 | 
			
		||||
		conflict->type = ALPM_FILECONFLICT_TARGET;
 | 
			
		||||
		STRDUP(conflict->ctarget, pkg2->name, goto error);
 | 
			
		||||
	} else {
 | 
			
		||||
	if(!pkg2) {
 | 
			
		||||
		conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
 | 
			
		||||
		STRDUP(conflict->ctarget, "", goto error);
 | 
			
		||||
	} else if(pkg2->origin == ALPM_PKG_FROM_LOCALDB) {
 | 
			
		||||
		conflict->type = ALPM_FILECONFLICT_FILESYSTEM;
 | 
			
		||||
		STRDUP(conflict->ctarget, pkg2->name, goto error);
 | 
			
		||||
	} else {
 | 
			
		||||
		conflict->type = ALPM_FILECONFLICT_TARGET;
 | 
			
		||||
		STRDUP(conflict->ctarget, pkg2->name, goto error);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	conflicts = alpm_list_add(conflicts, conflict);
 | 
			
		||||
@@ -284,14 +296,16 @@ static alpm_list_t *add_fileconflict(alpm_handle_t *handle,
 | 
			
		||||
	return conflicts;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	alpm_fileconflict_free(conflict);
 | 
			
		||||
	RET_ERR(handle, ALPM_ERR_MEMORY, conflicts);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Frees a conflict and its members.
 | 
			
		||||
 */
 | 
			
		||||
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
 | 
			
		||||
void SYMEXPORT alpm_fileconflict_free(alpm_fileconflict_t *conflict)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(conflict != NULL, return);
 | 
			
		||||
	FREE(conflict->ctarget);
 | 
			
		||||
	FREE(conflict->file);
 | 
			
		||||
	FREE(conflict->target);
 | 
			
		||||
@@ -299,97 +313,99 @@ void _alpm_fileconflict_free(alpm_fileconflict_t *conflict)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Recursively checks if a package owns all subdirectories and files in
 | 
			
		||||
 * a directory.
 | 
			
		||||
 * @brief Recursively checks if a set of packages own all subdirectories and
 | 
			
		||||
 * files in a directory.
 | 
			
		||||
 *
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
 * @param dirpath path of the directory to check
 | 
			
		||||
 * @param pkg package being checked against
 | 
			
		||||
 * @param pkgs packages being checked against
 | 
			
		||||
 *
 | 
			
		||||
 * @return 1 if a package owns all subdirectories and files or a directory
 | 
			
		||||
 * cannot be opened, 0 otherwise
 | 
			
		||||
 * @return 1 if a package owns all subdirectories and files, 0 otherwise
 | 
			
		||||
 */
 | 
			
		||||
static int dir_belongsto_pkg(alpm_handle_t *handle, const char *dirpath,
 | 
			
		||||
		alpm_pkg_t *pkg)
 | 
			
		||||
static int dir_belongsto_pkgs(alpm_handle_t *handle, const char *dirpath,
 | 
			
		||||
		alpm_list_t *pkgs)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	struct stat sbuf;
 | 
			
		||||
	char path[PATH_MAX];
 | 
			
		||||
	char abspath[PATH_MAX];
 | 
			
		||||
	char path[PATH_MAX], full_path[PATH_MAX];
 | 
			
		||||
	DIR *dir;
 | 
			
		||||
	struct dirent *ent = NULL;
 | 
			
		||||
	const char *root = handle->root;
 | 
			
		||||
 | 
			
		||||
	/* check directory is actually in package - used for subdirectory checks */
 | 
			
		||||
	_alpm_filelist_resolve(handle, alpm_pkg_get_files(pkg));
 | 
			
		||||
	if(!alpm_filelist_contains(alpm_pkg_get_files(pkg), dirpath)) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
				"directory %s not in package %s\n", dirpath, pkg->name);
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* TODO: this is an overly strict check but currently pacman will not
 | 
			
		||||
	 * overwrite a directory with a file (case 10/11 in add.c). Adjusting that
 | 
			
		||||
	 * is not simple as even if the directory is being unowned by a conflicting
 | 
			
		||||
	 * package, pacman does not sort this to ensure all required directory
 | 
			
		||||
	 * "removals" happen before installation of file/symlink */
 | 
			
		||||
 | 
			
		||||
	/* check that no other _installed_ package owns the directory */
 | 
			
		||||
	for(i = _alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
 | 
			
		||||
		if(pkg == i->data) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		_alpm_filelist_resolve(handle, alpm_pkg_get_files(i->data));
 | 
			
		||||
		if(alpm_filelist_contains(alpm_pkg_get_files(i->data), dirpath)) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"file %s also in package %s\n", dirpath,
 | 
			
		||||
					((alpm_pkg_t*)i->data)->name);
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* check all files in directory are owned by the package */
 | 
			
		||||
	snprintf(abspath, PATH_MAX, "%s%s", root, dirpath);
 | 
			
		||||
	dir = opendir(abspath);
 | 
			
		||||
	snprintf(full_path, PATH_MAX, "%s%s", handle->root, dirpath);
 | 
			
		||||
	dir = opendir(full_path);
 | 
			
		||||
	if(dir == NULL) {
 | 
			
		||||
		return 1;
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	while((ent = readdir(dir)) != NULL) {
 | 
			
		||||
		const char *name = ent->d_name;
 | 
			
		||||
		int owned = 0, is_dir = 0;
 | 
			
		||||
		alpm_list_t *i;
 | 
			
		||||
		struct stat sbuf;
 | 
			
		||||
 | 
			
		||||
		if(strcmp(name, ".") == 0 || strcmp(name, "..") == 0) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		snprintf(path, PATH_MAX, "%s%s", dirpath, name);
 | 
			
		||||
		snprintf(abspath, PATH_MAX, "%s%s", root, path);
 | 
			
		||||
		if(stat(abspath, &sbuf) != 0) {
 | 
			
		||||
			continue;
 | 
			
		||||
 | 
			
		||||
		snprintf(full_path, PATH_MAX, "%s%s%s", handle->root, dirpath, name);
 | 
			
		||||
 | 
			
		||||
		if(lstat(full_path, &sbuf) != 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "could not stat %s\n", full_path);
 | 
			
		||||
			closedir(dir);
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
		if(S_ISDIR(sbuf.st_mode)) {
 | 
			
		||||
			if(dir_belongsto_pkg(handle, path, pkg)) {
 | 
			
		||||
				continue;
 | 
			
		||||
			} else {
 | 
			
		||||
				closedir(dir);
 | 
			
		||||
				return 0;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			_alpm_filelist_resolve(handle, alpm_pkg_get_files(pkg));
 | 
			
		||||
			if(alpm_filelist_contains(alpm_pkg_get_files(pkg), path)) {
 | 
			
		||||
				continue;
 | 
			
		||||
			} else {
 | 
			
		||||
				closedir(dir);
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
						"unowned file %s found in directory\n", path);
 | 
			
		||||
				return 0;
 | 
			
		||||
		is_dir = S_ISDIR(sbuf.st_mode);
 | 
			
		||||
 | 
			
		||||
		snprintf(path, PATH_MAX, "%s%s%s", dirpath, name, is_dir ? "/" : "");
 | 
			
		||||
 | 
			
		||||
		for(i = pkgs; i && !owned; i = i->next) {
 | 
			
		||||
			if(alpm_filelist_contains(alpm_pkg_get_files(i->data), path)) {
 | 
			
		||||
				owned = 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(owned && is_dir) {
 | 
			
		||||
			owned = dir_belongsto_pkgs(handle, path, pkgs);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(!owned) {
 | 
			
		||||
			closedir(dir);
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"unowned file %s found in directory\n", path);
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	closedir(dir);
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *alpm_db_find_file_owners(alpm_db_t* db, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i, *owners = NULL;
 | 
			
		||||
	for(i = alpm_db_get_pkgcache(db); i; i = i->next) {
 | 
			
		||||
		if(alpm_filelist_contains(alpm_pkg_get_files(i->data), path)) {
 | 
			
		||||
			owners = alpm_list_add(owners, i->data);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return owners;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_pkg_t *_alpm_find_file_owner(alpm_handle_t *handle, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	for(i = alpm_db_get_pkgcache(handle->db_local); i; i = i->next) {
 | 
			
		||||
		if(alpm_filelist_contains(alpm_pkg_get_files(i->data), path)) {
 | 
			
		||||
			return i->data;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_can_overwrite_file(alpm_handle_t *handle, const char *path, const char *rootedpath)
 | 
			
		||||
{
 | 
			
		||||
	return handle->trans->flags & ALPM_TRANS_FLAG_FORCE
 | 
			
		||||
		|| _alpm_fnmatch_patterns(handle->overwrite_files, path) == 0
 | 
			
		||||
		|| _alpm_fnmatch_patterns(handle->overwrite_files, rootedpath) == 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Find file conflicts that may occur during the transaction.
 | 
			
		||||
 *
 | 
			
		||||
@@ -417,11 +433,6 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
 | 
			
		||||
	rootlen = strlen(handle->root);
 | 
			
		||||
 | 
			
		||||
	/* make sure all files to be installed have been resolved */
 | 
			
		||||
	for(i = upgrade; i; i = i->next) {
 | 
			
		||||
		_alpm_filelist_resolve(handle, alpm_pkg_get_files(i->data));
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* TODO this whole function needs a huge change, which hopefully will
 | 
			
		||||
	 * be possible with real transactions. Right now we only do half as much
 | 
			
		||||
	 * here as we do when we actually extract files in add.c with our 12
 | 
			
		||||
@@ -429,7 +440,7 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
	for(current = 0, i = upgrade; i; i = i->next, current++) {
 | 
			
		||||
		alpm_pkg_t *p1 = i->data;
 | 
			
		||||
		alpm_list_t *j;
 | 
			
		||||
		alpm_list_t *tmpfiles = NULL;
 | 
			
		||||
		alpm_list_t *newfiles = NULL;
 | 
			
		||||
		alpm_pkg_t *dbpkg;
 | 
			
		||||
 | 
			
		||||
		int percent = (current * 100) / numtargs;
 | 
			
		||||
@@ -458,8 +469,8 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
					/* can skip file-file conflicts when forced *
 | 
			
		||||
					 * checking presence in p2_files detects dir-file or file-dir
 | 
			
		||||
					 * conflicts as the path from p1 is returned */
 | 
			
		||||
					if((handle->trans->flags & ALPM_TRANS_FLAG_FORCE) &&
 | 
			
		||||
							alpm_filelist_contains(p2_files, filename)) {
 | 
			
		||||
					if(_alpm_can_overwrite_file(handle, filename, path)
 | 
			
		||||
							&& alpm_filelist_contains(p2_files, filename)) {
 | 
			
		||||
						_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"%s exists in both '%s' and '%s'\n", filename,
 | 
			
		||||
							p1->name, p2->name);
 | 
			
		||||
@@ -470,7 +481,9 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
 | 
			
		||||
					conflicts = add_fileconflict(handle, conflicts, path, p1, p2);
 | 
			
		||||
					if(handle->pm_errno == ALPM_ERR_MEMORY) {
 | 
			
		||||
						FREELIST(conflicts);
 | 
			
		||||
						alpm_list_free_inner(conflicts,
 | 
			
		||||
								(alpm_list_fn_free) alpm_conflict_free);
 | 
			
		||||
						alpm_list_free(conflicts);
 | 
			
		||||
						alpm_list_free(common_files);
 | 
			
		||||
						return NULL;
 | 
			
		||||
					}
 | 
			
		||||
@@ -491,19 +504,18 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
		 * be freed. */
 | 
			
		||||
		if(dbpkg) {
 | 
			
		||||
			/* older ver of package currently installed */
 | 
			
		||||
			_alpm_filelist_resolve(handle, alpm_pkg_get_files(dbpkg));
 | 
			
		||||
			tmpfiles = _alpm_filelist_difference(alpm_pkg_get_files(p1),
 | 
			
		||||
			newfiles = _alpm_filelist_difference(alpm_pkg_get_files(p1),
 | 
			
		||||
					alpm_pkg_get_files(dbpkg));
 | 
			
		||||
		} else {
 | 
			
		||||
			/* no version of package currently installed */
 | 
			
		||||
			alpm_filelist_t *fl = alpm_pkg_get_files(p1);
 | 
			
		||||
			size_t filenum;
 | 
			
		||||
			for(filenum = 0; filenum < fl->count; filenum++) {
 | 
			
		||||
				tmpfiles = alpm_list_add(tmpfiles, fl->resolved_path[filenum]);
 | 
			
		||||
				newfiles = alpm_list_add(newfiles, fl->files[filenum].name);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		for(j = tmpfiles; j; j = j->next) {
 | 
			
		||||
		for(j = newfiles; j; j = j->next) {
 | 
			
		||||
			const char *filestr = j->data;
 | 
			
		||||
			const char *relative_path;
 | 
			
		||||
			alpm_list_t *k;
 | 
			
		||||
@@ -512,106 +524,146 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
			struct stat lsbuf;
 | 
			
		||||
			char path[PATH_MAX];
 | 
			
		||||
			size_t pathlen;
 | 
			
		||||
			int pfile_isdir;
 | 
			
		||||
 | 
			
		||||
			pathlen = snprintf(path, PATH_MAX, "%s%s", handle->root, filestr);
 | 
			
		||||
			relative_path = path + rootlen;
 | 
			
		||||
 | 
			
		||||
			/* stat the file - if it exists, do some checks */
 | 
			
		||||
			if(_alpm_lstat(path, &lsbuf) != 0) {
 | 
			
		||||
			if(llstat(path, &lsbuf) != 0) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "checking possible conflict: %s\n", path);
 | 
			
		||||
 | 
			
		||||
			if(filestr[strlen(filestr) - 1] == '/') {
 | 
			
		||||
				struct stat sbuf;
 | 
			
		||||
			pfile_isdir = path[pathlen - 1] == '/';
 | 
			
		||||
			if(pfile_isdir) {
 | 
			
		||||
				if(S_ISDIR(lsbuf.st_mode)) {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG, "file is a directory, not a conflict\n");
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				stat(path, &sbuf);
 | 
			
		||||
				if(S_ISLNK(lsbuf.st_mode) && S_ISDIR(sbuf.st_mode)) {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"file is a symlink to a dir, hopefully not a conflict\n");
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				/* if we made it to here, we want all subsequent path comparisons to
 | 
			
		||||
				 * not include the trailing slash. This allows things like file ->
 | 
			
		||||
				 * directory replacements. */
 | 
			
		||||
				path[pathlen - 1] = '\0';
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			relative_path = path + rootlen;
 | 
			
		||||
				/* Check if the directory was a file in dbpkg */
 | 
			
		||||
				if(alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_path)) {
 | 
			
		||||
					size_t fslen = strlen(filestr);
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"replacing package file with a directory, not a conflict\n");
 | 
			
		||||
					resolved_conflict = 1;
 | 
			
		||||
 | 
			
		||||
					/* go ahead and skip any files inside filestr as they will
 | 
			
		||||
					 * necessarily be resolved by replacing the file with a dir
 | 
			
		||||
					 * NOTE: afterward, j will point to the last file inside filestr */
 | 
			
		||||
					for( ; j->next; j = j->next) {
 | 
			
		||||
						const char *filestr2 = j->next->data;
 | 
			
		||||
						if(strncmp(filestr, filestr2, fslen) != 0) {
 | 
			
		||||
							break;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* Check remove list (will we remove the conflicting local file?) */
 | 
			
		||||
			for(k = rem; k && !resolved_conflict; k = k->next) {
 | 
			
		||||
				alpm_pkg_t *rempkg = k->data;
 | 
			
		||||
				_alpm_filelist_resolve(handle, alpm_pkg_get_files(rempkg));
 | 
			
		||||
				if(rempkg && alpm_filelist_contains(alpm_pkg_get_files(rempkg),
 | 
			
		||||
							relative_path)) {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"local file will be removed, not a conflict\n");
 | 
			
		||||
					resolved_conflict = 1;
 | 
			
		||||
					if(pfile_isdir) {
 | 
			
		||||
						/* go ahead and skip any files inside filestr as they will
 | 
			
		||||
						 * necessarily be resolved by replacing the file with a dir
 | 
			
		||||
						 * NOTE: afterward, j will point to the last file inside filestr */
 | 
			
		||||
						size_t fslen = strlen(filestr);
 | 
			
		||||
						for( ; j->next; j = j->next) {
 | 
			
		||||
							const char *filestr2 = j->next->data;
 | 
			
		||||
							if(strncmp(filestr, filestr2, fslen) != 0) {
 | 
			
		||||
								break;
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* Look at all the targets to see if file has changed hands */
 | 
			
		||||
			for(k = upgrade; k && !resolved_conflict; k = k->next) {
 | 
			
		||||
				alpm_pkg_t *p2 = k->data;
 | 
			
		||||
				if(!p2 || strcmp(p1->name, p2->name) == 0) {
 | 
			
		||||
				alpm_pkg_t *localp2, *p2 = k->data;
 | 
			
		||||
				if(!p2 || p1 == p2) {
 | 
			
		||||
					/* skip p1; both p1 and p2 come directly from the upgrade list
 | 
			
		||||
					 * so they can be compared directly */
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
				alpm_pkg_t *localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name);
 | 
			
		||||
				localp2 = _alpm_db_get_pkgfromcache(handle->db_local, p2->name);
 | 
			
		||||
 | 
			
		||||
				/* localp2->files will be removed (target conflicts are handled by CHECK 1) */
 | 
			
		||||
				_alpm_filelist_resolve(handle, alpm_pkg_get_files(localp2));
 | 
			
		||||
				if(localp2 && alpm_filelist_contains(alpm_pkg_get_files(localp2), filestr)) {
 | 
			
		||||
				if(localp2 && alpm_filelist_contains(alpm_pkg_get_files(localp2), relative_path)) {
 | 
			
		||||
					size_t fslen = strlen(filestr);
 | 
			
		||||
 | 
			
		||||
					/* skip removal of file, but not add. this will prevent a second
 | 
			
		||||
					 * package from removing the file when it was already installed
 | 
			
		||||
					 * by its new owner (whether the file is in backup array or not */
 | 
			
		||||
					handle->trans->skip_remove =
 | 
			
		||||
						alpm_list_add(handle->trans->skip_remove, strdup(filestr));
 | 
			
		||||
						alpm_list_add(handle->trans->skip_remove, strdup(relative_path));
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"file changed packages, adding to remove skiplist\n");
 | 
			
		||||
					resolved_conflict = 1;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* check if all files of the dir belong to the installed pkg */
 | 
			
		||||
			if(!resolved_conflict && S_ISDIR(lsbuf.st_mode) && dbpkg) {
 | 
			
		||||
				char *dir = malloc(strlen(filestr) + 2);
 | 
			
		||||
				sprintf(dir, "%s/", filestr);
 | 
			
		||||
				if(alpm_filelist_contains(alpm_pkg_get_files(dbpkg), dir)) {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"checking if all files in %s belong to %s\n",
 | 
			
		||||
							dir, dbpkg->name);
 | 
			
		||||
					resolved_conflict = dir_belongsto_pkg(handle, dir, dbpkg);
 | 
			
		||||
				}
 | 
			
		||||
				free(dir);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* check if a component of the filepath was a link. canonicalize the path
 | 
			
		||||
			 * and look for it in the old package. note that the actual file under
 | 
			
		||||
			 * consideration cannot itself be a link, as it might be unowned- path
 | 
			
		||||
			 * components can be safely checked as all directories are "unowned". */
 | 
			
		||||
			if(!resolved_conflict && dbpkg && !S_ISLNK(lsbuf.st_mode)) {
 | 
			
		||||
				char rpath[PATH_MAX];
 | 
			
		||||
				if(realpath(path, rpath)) {
 | 
			
		||||
					const char *relative_rpath = rpath + rootlen;
 | 
			
		||||
					if(alpm_filelist_contains(alpm_pkg_get_files(dbpkg), relative_rpath)) {
 | 
			
		||||
						_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
								"package contained the resolved realpath\n");
 | 
			
		||||
						resolved_conflict = 1;
 | 
			
		||||
					if(filestr[fslen - 1] == '/') {
 | 
			
		||||
						/* replacing a file with a directory:
 | 
			
		||||
						 * go ahead and skip any files inside filestr as they will
 | 
			
		||||
						 * necessarily be resolved by replacing the file with a dir
 | 
			
		||||
						 * NOTE: afterward, j will point to the last file inside filestr */
 | 
			
		||||
						for( ; j->next; j = j->next) {
 | 
			
		||||
							const char *filestr2 = j->next->data;
 | 
			
		||||
							if(strncmp(filestr, filestr2, fslen) != 0) {
 | 
			
		||||
								break;
 | 
			
		||||
							}
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* check if all files of the dir belong to the installed pkg */
 | 
			
		||||
			if(!resolved_conflict && S_ISDIR(lsbuf.st_mode)) {
 | 
			
		||||
				alpm_list_t *owners;
 | 
			
		||||
				char *dir = malloc(strlen(relative_path) + 2);
 | 
			
		||||
				sprintf(dir, "%s/", relative_path);
 | 
			
		||||
 | 
			
		||||
				owners = alpm_db_find_file_owners(handle->db_local, dir);
 | 
			
		||||
				if(owners) {
 | 
			
		||||
					alpm_list_t *pkgs = NULL, *diff;
 | 
			
		||||
 | 
			
		||||
					if(dbpkg) {
 | 
			
		||||
						pkgs = alpm_list_add(pkgs, dbpkg);
 | 
			
		||||
					}
 | 
			
		||||
					pkgs = alpm_list_join(pkgs, alpm_list_copy(rem));
 | 
			
		||||
					if((diff = alpm_list_diff(owners, pkgs, _alpm_pkg_cmp))) {
 | 
			
		||||
						/* dir is owned by files we aren't removing */
 | 
			
		||||
						/* TODO: with better commit ordering, we may be able to check
 | 
			
		||||
						 * against upgrades as well */
 | 
			
		||||
						alpm_list_free(diff);
 | 
			
		||||
					} else {
 | 
			
		||||
						_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
								"checking if all files in %s belong to removed packages\n",
 | 
			
		||||
								dir);
 | 
			
		||||
						resolved_conflict = dir_belongsto_pkgs(handle, dir, owners);
 | 
			
		||||
					}
 | 
			
		||||
					alpm_list_free(pkgs);
 | 
			
		||||
					alpm_list_free(owners);
 | 
			
		||||
				}
 | 
			
		||||
				free(dir);
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* is the file unowned and in the backup list of the new package? */
 | 
			
		||||
			if(!resolved_conflict && _alpm_needbackup(filestr, p1)) {
 | 
			
		||||
			if(!resolved_conflict && _alpm_needbackup(relative_path, p1)) {
 | 
			
		||||
				alpm_list_t *local_pkgs = _alpm_db_get_pkgcache(handle->db_local);
 | 
			
		||||
				int found = 0;
 | 
			
		||||
				for(k = local_pkgs; k && !found; k = k->next) {
 | 
			
		||||
					_alpm_filelist_resolve(handle, alpm_pkg_get_files(k->data));
 | 
			
		||||
					if(alpm_filelist_contains(alpm_pkg_get_files(k->data), filestr)) {
 | 
			
		||||
					if(alpm_filelist_contains(alpm_pkg_get_files(k->data), relative_path)) {
 | 
			
		||||
							found = 1;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
@@ -623,28 +675,29 @@ alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			/* skip file-file conflicts when being forced */
 | 
			
		||||
			if((handle->trans->flags & ALPM_TRANS_FLAG_FORCE) &&
 | 
			
		||||
					!S_ISDIR(lsbuf.st_mode)) {
 | 
			
		||||
			if(!S_ISDIR(lsbuf.st_mode)
 | 
			
		||||
					&& _alpm_can_overwrite_file(handle, filestr, path)) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
							"conflict with file on filesystem being forced\n");
 | 
			
		||||
				resolved_conflict = 1;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(!resolved_conflict) {
 | 
			
		||||
				conflicts = add_fileconflict(handle, conflicts, path, p1, NULL);
 | 
			
		||||
				conflicts = add_fileconflict(handle, conflicts, path, p1,
 | 
			
		||||
						_alpm_find_file_owner(handle, relative_path));
 | 
			
		||||
				if(handle->pm_errno == ALPM_ERR_MEMORY) {
 | 
			
		||||
					FREELIST(conflicts);
 | 
			
		||||
					alpm_list_free(tmpfiles);
 | 
			
		||||
					alpm_list_free_inner(conflicts,
 | 
			
		||||
							(alpm_list_fn_free) alpm_conflict_free);
 | 
			
		||||
					alpm_list_free(conflicts);
 | 
			
		||||
					alpm_list_free(newfiles);
 | 
			
		||||
					return NULL;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		alpm_list_free(tmpfiles);
 | 
			
		||||
		alpm_list_free(newfiles);
 | 
			
		||||
	}
 | 
			
		||||
	PROGRESS(handle, ALPM_PROGRESS_CONFLICTS_START, "", 100,
 | 
			
		||||
			numtargs, current);
 | 
			
		||||
 | 
			
		||||
	return conflicts;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  conflict.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,22 +17,17 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_CONFLICT_H
 | 
			
		||||
#define _ALPM_CONFLICT_H
 | 
			
		||||
#ifndef ALPM_CONFLICT_H
 | 
			
		||||
#define ALPM_CONFLICT_H
 | 
			
		||||
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
#include "db.h"
 | 
			
		||||
#include "package.h"
 | 
			
		||||
 | 
			
		||||
alpm_conflict_t *_alpm_conflict_dup(const alpm_conflict_t *conflict);
 | 
			
		||||
void _alpm_conflict_free(alpm_conflict_t *conflict);
 | 
			
		||||
alpm_list_t *_alpm_innerconflicts(alpm_handle_t *handle, alpm_list_t *packages);
 | 
			
		||||
alpm_list_t *_alpm_outerconflicts(alpm_db_t *db, alpm_list_t *packages);
 | 
			
		||||
alpm_list_t *_alpm_db_find_fileconflicts(alpm_handle_t *handle,
 | 
			
		||||
		alpm_list_t *upgrade, alpm_list_t *remove);
 | 
			
		||||
 | 
			
		||||
void _alpm_fileconflict_free(alpm_fileconflict_t *conflict);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_CONFLICT_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_CONFLICT_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  db.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2005 by Christian Hamar <krics@linuxforum.hu>
 | 
			
		||||
@@ -44,16 +44,30 @@
 | 
			
		||||
 | 
			
		||||
/** Register a sync database of packages. */
 | 
			
		||||
alpm_db_t SYMEXPORT *alpm_register_syncdb(alpm_handle_t *handle,
 | 
			
		||||
		const char *treename, alpm_siglevel_t level)
 | 
			
		||||
		const char *treename, int siglevel)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
 | 
			
		||||
	/* Sanity checks */
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
	ASSERT(treename != NULL && strlen(treename) != 0,
 | 
			
		||||
			RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
 | 
			
		||||
	ASSERT(!strchr(treename, '/'), RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
 | 
			
		||||
	/* Do not register a database if a transaction is on-going */
 | 
			
		||||
	ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, NULL));
 | 
			
		||||
 | 
			
		||||
	return _alpm_db_register_sync(handle, treename, level);
 | 
			
		||||
	/* ensure database name is unique */
 | 
			
		||||
	if(strcmp(treename, "local") == 0) {
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_DB_NOT_NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
	for(i = handle->dbs_sync; i; i = i->next) {
 | 
			
		||||
		alpm_db_t *d = i->data;
 | 
			
		||||
		if(strcmp(treename, d->treename) == 0) {
 | 
			
		||||
			RET_ERR(handle, ALPM_ERR_DB_NOT_NULL, NULL);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return _alpm_db_register_sync(handle, treename, siglevel);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Helper function for alpm_db_unregister{_all} */
 | 
			
		||||
@@ -98,7 +112,7 @@ int SYMEXPORT alpm_db_unregister(alpm_db_t *db)
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	/* Do not unregister a database if a transaction is on-going */
 | 
			
		||||
	handle = db->handle;
 | 
			
		||||
	handle->pm_errno = 0;
 | 
			
		||||
	handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	ASSERT(handle->trans == NULL, RET_ERR(handle, ALPM_ERR_TRANS_NOT_NULL, -1));
 | 
			
		||||
 | 
			
		||||
	if(db == handle->db_local) {
 | 
			
		||||
@@ -165,7 +179,7 @@ int SYMEXPORT alpm_db_add_server(alpm_db_t *db, const char *url)
 | 
			
		||||
 | 
			
		||||
	/* Sanity checks */
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
 | 
			
		||||
	newurl = sanitize_url(url);
 | 
			
		||||
@@ -192,7 +206,7 @@ int SYMEXPORT alpm_db_remove_server(alpm_db_t *db, const char *url)
 | 
			
		||||
 | 
			
		||||
	/* Sanity checks */
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	ASSERT(url != NULL && strlen(url) != 0, RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
 | 
			
		||||
	newurl = sanitize_url(url);
 | 
			
		||||
@@ -221,7 +235,7 @@ const char SYMEXPORT *alpm_db_get_name(const alpm_db_t *db)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Get the signature verification level for a database. */
 | 
			
		||||
alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
 | 
			
		||||
int SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	if(db->siglevel & ALPM_SIG_USE_DEFAULT) {
 | 
			
		||||
@@ -235,7 +249,7 @@ alpm_siglevel_t SYMEXPORT alpm_db_get_siglevel(alpm_db_t *db)
 | 
			
		||||
int SYMEXPORT alpm_db_get_valid(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	return db->ops->validate(db);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -244,7 +258,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
 | 
			
		||||
{
 | 
			
		||||
	alpm_pkg_t *pkg;
 | 
			
		||||
	ASSERT(db != NULL, return NULL);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	ASSERT(name != NULL && strlen(name) != 0,
 | 
			
		||||
			RET_ERR(db->handle, ALPM_ERR_WRONG_ARGS, NULL));
 | 
			
		||||
 | 
			
		||||
@@ -259,7 +273,7 @@ alpm_pkg_t SYMEXPORT *alpm_db_get_pkg(alpm_db_t *db, const char *name)
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_db_get_pkgcache(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return NULL);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
	return _alpm_db_get_pkgcache(db);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -278,7 +292,7 @@ alpm_group_t SYMEXPORT *alpm_db_get_group(alpm_db_t *db, const char *name)
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return NULL);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
 | 
			
		||||
	return _alpm_db_get_groupcache(db);
 | 
			
		||||
}
 | 
			
		||||
@@ -287,11 +301,28 @@ alpm_list_t SYMEXPORT *alpm_db_get_groupcache(alpm_db_t *db)
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return NULL);
 | 
			
		||||
	db->handle->pm_errno = 0;
 | 
			
		||||
	db->handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
 | 
			
		||||
	return _alpm_db_search(db, needles);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Sets the usage bitmask for a repo */
 | 
			
		||||
int SYMEXPORT alpm_db_set_usage(alpm_db_t *db, int usage)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	db->usage = usage;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Gets the usage bitmask for a repo */
 | 
			
		||||
int SYMEXPORT alpm_db_get_usage(alpm_db_t *db, int *usage)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return -1);
 | 
			
		||||
	ASSERT(usage != NULL, return -1);
 | 
			
		||||
	*usage = db->usage;
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/** @} */
 | 
			
		||||
 | 
			
		||||
@@ -300,18 +331,20 @@ alpm_db_t *_alpm_db_new(const char *treename, int is_local)
 | 
			
		||||
	alpm_db_t *db;
 | 
			
		||||
 | 
			
		||||
	CALLOC(db, 1, sizeof(alpm_db_t), return NULL);
 | 
			
		||||
	STRDUP(db->treename, treename, return NULL);
 | 
			
		||||
	STRDUP(db->treename, treename, FREE(db); return NULL);
 | 
			
		||||
	if(is_local) {
 | 
			
		||||
		db->status |= DB_STATUS_LOCAL;
 | 
			
		||||
	} else {
 | 
			
		||||
		db->status &= ~DB_STATUS_LOCAL;
 | 
			
		||||
	}
 | 
			
		||||
	db->usage = ALPM_DB_USAGE_ALL;
 | 
			
		||||
 | 
			
		||||
	return db;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _alpm_db_free(alpm_db_t *db)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(db != NULL, return);
 | 
			
		||||
	/* cleanup pkgcache */
 | 
			
		||||
	_alpm_db_free_pkgcache(db);
 | 
			
		||||
	/* cleanup server list */
 | 
			
		||||
@@ -343,10 +376,12 @@ const char *_alpm_db_path(alpm_db_t *db)
 | 
			
		||||
			CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
			sprintf(db->_path, "%s%s/", dbpath, db->treename);
 | 
			
		||||
		} else {
 | 
			
		||||
			pathsize = strlen(dbpath) + 5 + strlen(db->treename) + 4;
 | 
			
		||||
			const char *dbext = db->handle->dbext;
 | 
			
		||||
 | 
			
		||||
			pathsize = strlen(dbpath) + 5 + strlen(db->treename) + strlen(dbext) + 1;
 | 
			
		||||
			CALLOC(db->_path, 1, pathsize, RET_ERR(db->handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
			/* all sync DBs now reside in the sync/ subdir of the dbpath */
 | 
			
		||||
			sprintf(db->_path, "%ssync/%s.db", dbpath, db->treename);
 | 
			
		||||
			sprintf(db->_path, "%ssync/%s%s", dbpath, db->treename, dbext);
 | 
			
		||||
		}
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_DEBUG, "database path for tree %s set to %s\n",
 | 
			
		||||
				db->treename, db->_path);
 | 
			
		||||
@@ -365,6 +400,11 @@ alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
 | 
			
		||||
{
 | 
			
		||||
	const alpm_list_t *i, *j, *k;
 | 
			
		||||
	alpm_list_t *ret = NULL;
 | 
			
		||||
 | 
			
		||||
	if(!(db->usage & ALPM_DB_USAGE_SEARCH)) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* copy the pkgcache- we will free the list var after each needle */
 | 
			
		||||
	alpm_list_t *list = alpm_list_copy(_alpm_db_get_pkgcache(db));
 | 
			
		||||
 | 
			
		||||
@@ -421,7 +461,8 @@ alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles)
 | 
			
		||||
 | 
			
		||||
			if(matched != NULL) {
 | 
			
		||||
				_alpm_log(db->handle, ALPM_LOG_DEBUG,
 | 
			
		||||
						"search target '%s' matched '%s'\n", targ, matched);
 | 
			
		||||
						"search target '%s' matched '%s' on package '%s'\n",
 | 
			
		||||
						targ, matched, name);
 | 
			
		||||
				ret = alpm_list_add(ret, pkg);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -504,7 +545,10 @@ alpm_pkghash_t *_alpm_db_get_pkgcache_hash(alpm_db_t *db)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(!(db->status & DB_STATUS_PKGCACHE)) {
 | 
			
		||||
		load_pkgcache(db);
 | 
			
		||||
		if(load_pkgcache(db)) {
 | 
			
		||||
			/* handle->error set in local/sync-db-populate */
 | 
			
		||||
			return NULL;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return db->pkgcache;
 | 
			
		||||
@@ -524,19 +568,31 @@ alpm_list_t *_alpm_db_get_pkgcache(alpm_db_t *db)
 | 
			
		||||
/* "duplicate" pkg then add it to pkgcache */
 | 
			
		||||
int _alpm_db_add_pkgincache(alpm_db_t *db, alpm_pkg_t *pkg)
 | 
			
		||||
{
 | 
			
		||||
	alpm_pkg_t *newpkg;
 | 
			
		||||
	alpm_pkg_t *newpkg = NULL;
 | 
			
		||||
 | 
			
		||||
	if(db == NULL || pkg == NULL || !(db->status & DB_STATUS_PKGCACHE)) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(_alpm_pkg_dup(pkg, &newpkg)) {
 | 
			
		||||
		/* we return memory on "non-fatal" error in _alpm_pkg_dup */
 | 
			
		||||
		_alpm_pkg_free(newpkg);
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding entry '%s' in '%s' cache\n",
 | 
			
		||||
						newpkg->name, db->treename);
 | 
			
		||||
	db->pkgcache = _alpm_pkghash_add_sorted(db->pkgcache, newpkg);
 | 
			
		||||
	if(newpkg->origin == ALPM_PKG_FROM_FILE) {
 | 
			
		||||
		free(newpkg->origin_data.file);
 | 
			
		||||
	}
 | 
			
		||||
	newpkg->origin = (db->status & DB_STATUS_LOCAL)
 | 
			
		||||
		? ALPM_PKG_FROM_LOCALDB
 | 
			
		||||
		: ALPM_PKG_FROM_SYNCDB;
 | 
			
		||||
	newpkg->origin_data.db = db;
 | 
			
		||||
	if(_alpm_pkghash_add_sorted(&db->pkgcache, newpkg) == NULL) {
 | 
			
		||||
		_alpm_pkg_free(newpkg);
 | 
			
		||||
		RET_ERR(db->handle, ALPM_ERR_MEMORY, -1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	free_groupcache(db);
 | 
			
		||||
 | 
			
		||||
@@ -670,5 +726,3 @@ alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target)
 | 
			
		||||
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  db.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
 | 
			
		||||
@@ -19,8 +19,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_DB_H
 | 
			
		||||
#define _ALPM_DB_H
 | 
			
		||||
#ifndef ALPM_DB_H
 | 
			
		||||
#define ALPM_DB_H
 | 
			
		||||
 | 
			
		||||
/* libarchive */
 | 
			
		||||
#include <archive.h>
 | 
			
		||||
@@ -32,14 +32,15 @@
 | 
			
		||||
 | 
			
		||||
/* Database entries */
 | 
			
		||||
typedef enum _alpm_dbinfrq_t {
 | 
			
		||||
	INFRQ_BASE = 1,
 | 
			
		||||
	INFRQ_BASE = (1 << 0),
 | 
			
		||||
	INFRQ_DESC = (1 << 1),
 | 
			
		||||
	INFRQ_FILES = (1 << 2),
 | 
			
		||||
	INFRQ_SCRIPTLET = (1 << 3),
 | 
			
		||||
	INFRQ_DSIZE = (1 << 4),
 | 
			
		||||
	/* ALL should be info stored in the package or database */
 | 
			
		||||
	INFRQ_ALL = 0x1F,
 | 
			
		||||
	INFRQ_ERROR = (1 << 31)
 | 
			
		||||
	INFRQ_ALL = INFRQ_BASE | INFRQ_DESC | INFRQ_FILES |
 | 
			
		||||
		INFRQ_SCRIPTLET | INFRQ_DSIZE,
 | 
			
		||||
	INFRQ_ERROR = (1 << 30)
 | 
			
		||||
} alpm_dbinfrq_t;
 | 
			
		||||
 | 
			
		||||
/** Database status. Bitflags. */
 | 
			
		||||
@@ -70,9 +71,14 @@ struct __alpm_db_t {
 | 
			
		||||
	alpm_list_t *grpcache;
 | 
			
		||||
	alpm_list_t *servers;
 | 
			
		||||
	struct db_operations *ops;
 | 
			
		||||
	/* flags determining validity, local, loaded caches, etc. */
 | 
			
		||||
	enum _alpm_dbstatus_t status;
 | 
			
		||||
	alpm_siglevel_t siglevel;
 | 
			
		||||
 | 
			
		||||
	/* bitfields for validity, local, loaded caches, etc. */
 | 
			
		||||
	/* From _alpm_dbstatus_t */
 | 
			
		||||
	int status;
 | 
			
		||||
	/* alpm_siglevel_t */
 | 
			
		||||
	int siglevel;
 | 
			
		||||
	/* alpm_db_usage_t */
 | 
			
		||||
	int usage;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
@@ -84,12 +90,12 @@ int _alpm_db_cmp(const void *d1, const void *d2);
 | 
			
		||||
alpm_list_t *_alpm_db_search(alpm_db_t *db, const alpm_list_t *needles);
 | 
			
		||||
alpm_db_t *_alpm_db_register_local(alpm_handle_t *handle);
 | 
			
		||||
alpm_db_t *_alpm_db_register_sync(alpm_handle_t *handle, const char *treename,
 | 
			
		||||
		alpm_siglevel_t level);
 | 
			
		||||
		int level);
 | 
			
		||||
void _alpm_db_unregister(alpm_db_t *db);
 | 
			
		||||
 | 
			
		||||
/* be_*.c, backend specific calls */
 | 
			
		||||
int _alpm_local_db_prepare(alpm_db_t *db, alpm_pkg_t *info);
 | 
			
		||||
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, alpm_dbinfrq_t inforeq);
 | 
			
		||||
int _alpm_local_db_write(alpm_db_t *db, alpm_pkg_t *info, int inforeq);
 | 
			
		||||
int _alpm_local_db_remove(alpm_db_t *db, alpm_pkg_t *info);
 | 
			
		||||
char *_alpm_local_db_pkgpath(alpm_db_t *db, alpm_pkg_t *info, const char *filename);
 | 
			
		||||
 | 
			
		||||
@@ -105,6 +111,4 @@ alpm_pkg_t *_alpm_db_get_pkgfromcache(alpm_db_t *db, const char *target);
 | 
			
		||||
alpm_list_t *_alpm_db_get_groupcache(alpm_db_t *db);
 | 
			
		||||
alpm_group_t *_alpm_db_get_groupfromcache(alpm_db_t *db, const char *target);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_DB_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_DB_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  delta.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -71,7 +71,7 @@ static alpm_list_t *graph_init(alpm_list_t *deltas, int reverse)
 | 
			
		||||
				v_i->children = alpm_list_add(v_i->children, v_j);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		v_i->childptr = v_i->children;
 | 
			
		||||
		v_i->iterator = v_i->children;
 | 
			
		||||
	}
 | 
			
		||||
	return vertices;
 | 
			
		||||
}
 | 
			
		||||
@@ -130,7 +130,7 @@ static void dijkstra(alpm_list_t *vertices)
 | 
			
		||||
		for(i = vertices; i; i = i->next) {
 | 
			
		||||
			alpm_graph_t *v_i = i->data;
 | 
			
		||||
 | 
			
		||||
			if(v_i->state == -1) {
 | 
			
		||||
			if(v_i->state == ALPM_GRAPH_STATE_PROCESSING) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
@@ -142,18 +142,18 @@ static void dijkstra(alpm_list_t *vertices)
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		v->state = -1;
 | 
			
		||||
		v->state = ALPM_GRAPH_STATE_PROCESSING;
 | 
			
		||||
 | 
			
		||||
		v->childptr = v->children;
 | 
			
		||||
		while(v->childptr) {
 | 
			
		||||
			alpm_graph_t *v_c = v->childptr->data;
 | 
			
		||||
		v->iterator = v->children;
 | 
			
		||||
		while(v->iterator) {
 | 
			
		||||
			alpm_graph_t *v_c = v->iterator->data;
 | 
			
		||||
			alpm_delta_t *d_c = v_c->data;
 | 
			
		||||
			if(v_c->weight > v->weight + d_c->download_size) {
 | 
			
		||||
				v_c->weight = v->weight + d_c->download_size;
 | 
			
		||||
				v_c->parent = v;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			v->childptr = (v->childptr)->next;
 | 
			
		||||
			v->iterator = (v->iterator)->next;
 | 
			
		||||
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -238,8 +238,7 @@ static alpm_list_t *find_unused(alpm_list_t *deltas, const char *to, off_t quota
 | 
			
		||||
	for(i = vertices; i; i = i->next) {
 | 
			
		||||
		alpm_graph_t *v = i->data;
 | 
			
		||||
		alpm_delta_t *vdelta = v->data;
 | 
			
		||||
		if(strcmp(vdelta->to, to) == 0)
 | 
			
		||||
		{
 | 
			
		||||
		if(strcmp(vdelta->to, to) == 0) {
 | 
			
		||||
			v->weight = vdelta->download_size;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -306,10 +305,10 @@ alpm_delta_t *_alpm_delta_parse(alpm_handle_t *handle, const char *line)
 | 
			
		||||
 | 
			
		||||
	/* start at index 1 -- match 0 is the entire match */
 | 
			
		||||
	len = pmatch[1].rm_eo - pmatch[1].rm_so;
 | 
			
		||||
	STRNDUP(delta->delta, &line[pmatch[1].rm_so], len, return NULL);
 | 
			
		||||
	STRNDUP(delta->delta, &line[pmatch[1].rm_so], len, goto error);
 | 
			
		||||
 | 
			
		||||
	len = pmatch[2].rm_eo - pmatch[2].rm_so;
 | 
			
		||||
	STRNDUP(delta->delta_md5, &line[pmatch[2].rm_so], len, return NULL);
 | 
			
		||||
	STRNDUP(delta->delta_md5, &line[pmatch[2].rm_so], len, goto error);
 | 
			
		||||
 | 
			
		||||
	len = pmatch[3].rm_eo - pmatch[3].rm_so;
 | 
			
		||||
	if(len < sizeof(filesize)) {
 | 
			
		||||
@@ -319,18 +318,23 @@ alpm_delta_t *_alpm_delta_parse(alpm_handle_t *handle, const char *line)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	len = pmatch[4].rm_eo - pmatch[4].rm_so;
 | 
			
		||||
	STRNDUP(delta->from, &line[pmatch[4].rm_so], len, return NULL);
 | 
			
		||||
	STRNDUP(delta->from, &line[pmatch[4].rm_so], len, goto error);
 | 
			
		||||
 | 
			
		||||
	len = pmatch[5].rm_eo - pmatch[5].rm_so;
 | 
			
		||||
	STRNDUP(delta->to, &line[pmatch[5].rm_so], len, return NULL);
 | 
			
		||||
	STRNDUP(delta->to, &line[pmatch[5].rm_so], len, goto error);
 | 
			
		||||
 | 
			
		||||
	return delta;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	_alpm_delta_free(delta);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
#undef NUM_MATCHES
 | 
			
		||||
 | 
			
		||||
void _alpm_delta_free(alpm_delta_t *delta)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(delta != NULL, return);
 | 
			
		||||
	FREE(delta->delta);
 | 
			
		||||
	FREE(delta->delta_md5);
 | 
			
		||||
	FREE(delta->from);
 | 
			
		||||
@@ -342,14 +346,16 @@ alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta)
 | 
			
		||||
{
 | 
			
		||||
	alpm_delta_t *newdelta;
 | 
			
		||||
	CALLOC(newdelta, 1, sizeof(alpm_delta_t), return NULL);
 | 
			
		||||
	STRDUP(newdelta->delta, delta->delta, return NULL);
 | 
			
		||||
	STRDUP(newdelta->delta_md5, delta->delta_md5, return NULL);
 | 
			
		||||
	STRDUP(newdelta->from, delta->from, return NULL);
 | 
			
		||||
	STRDUP(newdelta->to, delta->to, return NULL);
 | 
			
		||||
	STRDUP(newdelta->delta, delta->delta, goto error);
 | 
			
		||||
	STRDUP(newdelta->delta_md5, delta->delta_md5, goto error);
 | 
			
		||||
	STRDUP(newdelta->from, delta->from, goto error);
 | 
			
		||||
	STRDUP(newdelta->to, delta->to, goto error);
 | 
			
		||||
	newdelta->delta_size = delta->delta_size;
 | 
			
		||||
	newdelta->download_size = delta->download_size;
 | 
			
		||||
 | 
			
		||||
	return newdelta;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
error:
 | 
			
		||||
	_alpm_delta_free(newdelta);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  delta.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2007-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_DELTA_H
 | 
			
		||||
#define _ALPM_DELTA_H
 | 
			
		||||
#ifndef ALPM_DELTA_H
 | 
			
		||||
#define ALPM_DELTA_H
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h> /* off_t */
 | 
			
		||||
 | 
			
		||||
@@ -30,6 +30,4 @@ alpm_delta_t *_alpm_delta_dup(const alpm_delta_t *delta);
 | 
			
		||||
off_t _alpm_shortest_delta_path(alpm_handle_t *handle, alpm_list_t *deltas,
 | 
			
		||||
		const char *to, alpm_list_t **path);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_DELTA_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_DELTA_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  deps.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
 | 
			
		||||
@@ -35,8 +35,9 @@
 | 
			
		||||
#include "handle.h"
 | 
			
		||||
#include "trans.h"
 | 
			
		||||
 | 
			
		||||
void _alpm_dep_free(alpm_depend_t *dep)
 | 
			
		||||
void SYMEXPORT alpm_dep_free(alpm_depend_t *dep)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(dep != NULL, return);
 | 
			
		||||
	FREE(dep->name);
 | 
			
		||||
	FREE(dep->version);
 | 
			
		||||
	FREE(dep->desc);
 | 
			
		||||
@@ -48,25 +49,30 @@ static alpm_depmissing_t *depmiss_new(const char *target, alpm_depend_t *dep,
 | 
			
		||||
{
 | 
			
		||||
	alpm_depmissing_t *miss;
 | 
			
		||||
 | 
			
		||||
	MALLOC(miss, sizeof(alpm_depmissing_t), return NULL);
 | 
			
		||||
	CALLOC(miss, 1, sizeof(alpm_depmissing_t), return NULL);
 | 
			
		||||
 | 
			
		||||
	STRDUP(miss->target, target, return NULL);
 | 
			
		||||
	STRDUP(miss->target, target, goto error);
 | 
			
		||||
	miss->depend = _alpm_dep_dup(dep);
 | 
			
		||||
	STRDUP(miss->causingpkg, causingpkg, return NULL);
 | 
			
		||||
	STRDUP(miss->causingpkg, causingpkg, goto error);
 | 
			
		||||
 | 
			
		||||
	return miss;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	alpm_depmissing_free(miss);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
void _alpm_depmiss_free(alpm_depmissing_t *miss)
 | 
			
		||||
void SYMEXPORT alpm_depmissing_free(alpm_depmissing_t *miss)
 | 
			
		||||
{
 | 
			
		||||
	_alpm_dep_free(miss->depend);
 | 
			
		||||
	ASSERT(miss != NULL, return);
 | 
			
		||||
	alpm_dep_free(miss->depend);
 | 
			
		||||
	FREE(miss->target);
 | 
			
		||||
	FREE(miss->causingpkg);
 | 
			
		||||
	FREE(miss);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Does pkg1 depend on pkg2, ie. does pkg2 satisfy a dependency of pkg1? */
 | 
			
		||||
static int _alpm_dep_edge(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2)
 | 
			
		||||
/** Check if pkg2 satisfies a dependency of pkg1 */
 | 
			
		||||
static int _alpm_pkg_depends_on(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	for(i = alpm_pkg_get_depends(pkg1); i; i = i->next) {
 | 
			
		||||
@@ -77,15 +83,38 @@ static int _alpm_dep_edge(alpm_pkg_t *pkg1, alpm_pkg_t *pkg2)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
 | 
			
		||||
	for(i = pkgs; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = i->data;
 | 
			
		||||
		if(_alpm_depcmp(pkg, dep)) {
 | 
			
		||||
			return pkg;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Convert a list of alpm_pkg_t * to a graph structure,
 | 
			
		||||
 * with a edge for each dependency.
 | 
			
		||||
 * Returns a list of vertices (one vertex = one package)
 | 
			
		||||
 * (used by alpm_sortbydeps)
 | 
			
		||||
 */
 | 
			
		||||
static alpm_list_t *dep_graph_init(alpm_list_t *targets)
 | 
			
		||||
static alpm_list_t *dep_graph_init(alpm_handle_t *handle,
 | 
			
		||||
		alpm_list_t *targets, alpm_list_t *ignore)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i, *j;
 | 
			
		||||
	alpm_list_t *vertices = NULL;
 | 
			
		||||
	alpm_list_t *localpkgs = alpm_list_diff(
 | 
			
		||||
			alpm_db_get_pkgcache(handle->db_local), targets, _alpm_pkg_cmp);
 | 
			
		||||
 | 
			
		||||
	if(ignore) {
 | 
			
		||||
		alpm_list_t *oldlocal = localpkgs;
 | 
			
		||||
		localpkgs = alpm_list_diff(oldlocal, ignore, _alpm_pkg_cmp);
 | 
			
		||||
		alpm_list_free(oldlocal);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* We create the vertices */
 | 
			
		||||
	for(i = targets; i; i = i->next) {
 | 
			
		||||
		alpm_graph_t *vertex = _alpm_graph_new();
 | 
			
		||||
@@ -101,16 +130,70 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets)
 | 
			
		||||
		for(j = vertices; j; j = j->next) {
 | 
			
		||||
			alpm_graph_t *vertex_j = j->data;
 | 
			
		||||
			alpm_pkg_t *p_j = vertex_j->data;
 | 
			
		||||
			if(_alpm_dep_edge(p_i, p_j)) {
 | 
			
		||||
			if(_alpm_pkg_depends_on(p_i, p_j)) {
 | 
			
		||||
				vertex_i->children =
 | 
			
		||||
					alpm_list_add(vertex_i->children, vertex_j);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		vertex_i->childptr = vertex_i->children;
 | 
			
		||||
 | 
			
		||||
		/* lazily add local packages to the dep graph so they don't
 | 
			
		||||
		 * get resolved unnecessarily */
 | 
			
		||||
		j = localpkgs;
 | 
			
		||||
		while(j) {
 | 
			
		||||
			alpm_list_t *next = j->next;
 | 
			
		||||
			if(_alpm_pkg_depends_on(p_i, j->data)) {
 | 
			
		||||
				alpm_graph_t *vertex_j = _alpm_graph_new();
 | 
			
		||||
				vertex_j->data = (void *)j->data;
 | 
			
		||||
				vertices = alpm_list_add(vertices, vertex_j);
 | 
			
		||||
				vertex_i->children = alpm_list_add(vertex_i->children, vertex_j);
 | 
			
		||||
				localpkgs = alpm_list_remove_item(localpkgs, j);
 | 
			
		||||
				free(j);
 | 
			
		||||
			}
 | 
			
		||||
			j = next;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		vertex_i->iterator = vertex_i->children;
 | 
			
		||||
	}
 | 
			
		||||
	alpm_list_free(localpkgs);
 | 
			
		||||
	return vertices;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void _alpm_warn_dep_cycle(alpm_handle_t *handle, alpm_list_t *targets,
 | 
			
		||||
		alpm_graph_t *ancestor, alpm_graph_t *vertex, int reverse)
 | 
			
		||||
{
 | 
			
		||||
	/* vertex depends on and is required by ancestor */
 | 
			
		||||
	if(!alpm_list_find_ptr(targets, vertex->data)) {
 | 
			
		||||
		/* child is not part of the transaction, not a problem */
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* find the nearest ancestor that's part of the transaction */
 | 
			
		||||
	while(ancestor) {
 | 
			
		||||
		if(alpm_list_find_ptr(targets, ancestor->data)) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		ancestor = ancestor->parent;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(!ancestor || ancestor == vertex) {
 | 
			
		||||
		/* no transaction package in our ancestry or the package has
 | 
			
		||||
		 * a circular dependency with itself, not a problem */
 | 
			
		||||
	} else {
 | 
			
		||||
		alpm_pkg_t *ancestorpkg = ancestor->data;
 | 
			
		||||
		alpm_pkg_t *childpkg = vertex->data;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle detected:\n"));
 | 
			
		||||
		if(reverse) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
					_("%s will be removed after its %s dependency\n"),
 | 
			
		||||
					ancestorpkg->name, childpkg->name);
 | 
			
		||||
		} else {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
					_("%s will be installed before its %s dependency\n"),
 | 
			
		||||
					ancestorpkg->name, childpkg->name);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Re-order a list of target packages with respect to their dependencies.
 | 
			
		||||
 *
 | 
			
		||||
 * Example (reverse == 0):
 | 
			
		||||
@@ -120,17 +203,19 @@ static alpm_list_t *dep_graph_init(alpm_list_t *targets)
 | 
			
		||||
 *
 | 
			
		||||
 *   Should be re-ordered to C,A,B,D
 | 
			
		||||
 *
 | 
			
		||||
 * packages listed in ignore will not be used to detect indirect dependencies
 | 
			
		||||
 *
 | 
			
		||||
 * if reverse is > 0, the dependency order will be reversed.
 | 
			
		||||
 *
 | 
			
		||||
 * This function returns the new alpm_list_t* target list.
 | 
			
		||||
 *
 | 
			
		||||
 */
 | 
			
		||||
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
 | 
			
		||||
		alpm_list_t *targets, int reverse)
 | 
			
		||||
		alpm_list_t *targets, alpm_list_t *ignore, int reverse)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *newtargs = NULL;
 | 
			
		||||
	alpm_list_t *vertices = NULL;
 | 
			
		||||
	alpm_list_t *vptr;
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	alpm_graph_t *vertex;
 | 
			
		||||
 | 
			
		||||
	if(targets == NULL) {
 | 
			
		||||
@@ -139,49 +224,39 @@ alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
 | 
			
		||||
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "started sorting dependencies\n");
 | 
			
		||||
 | 
			
		||||
	vertices = dep_graph_init(targets);
 | 
			
		||||
	vertices = dep_graph_init(handle, targets, ignore);
 | 
			
		||||
 | 
			
		||||
	vptr = vertices;
 | 
			
		||||
	i = vertices;
 | 
			
		||||
	vertex = vertices->data;
 | 
			
		||||
	while(vptr) {
 | 
			
		||||
	while(i) {
 | 
			
		||||
		/* mark that we touched the vertex */
 | 
			
		||||
		vertex->state = -1;
 | 
			
		||||
		int found = 0;
 | 
			
		||||
		while(vertex->childptr && !found) {
 | 
			
		||||
			alpm_graph_t *nextchild = vertex->childptr->data;
 | 
			
		||||
			vertex->childptr = vertex->childptr->next;
 | 
			
		||||
			if(nextchild->state == 0) {
 | 
			
		||||
				found = 1;
 | 
			
		||||
		vertex->state = ALPM_GRAPH_STATE_PROCESSING;
 | 
			
		||||
		int switched_to_child = 0;
 | 
			
		||||
		while(vertex->iterator && !switched_to_child) {
 | 
			
		||||
			alpm_graph_t *nextchild = vertex->iterator->data;
 | 
			
		||||
			vertex->iterator = vertex->iterator->next;
 | 
			
		||||
			if(nextchild->state == ALPM_GRAPH_STATE_UNPROCESSED) {
 | 
			
		||||
				switched_to_child = 1;
 | 
			
		||||
				nextchild->parent = vertex;
 | 
			
		||||
				vertex = nextchild;
 | 
			
		||||
			}
 | 
			
		||||
			else if(nextchild->state == -1) {
 | 
			
		||||
				alpm_pkg_t *vertexpkg = vertex->data;
 | 
			
		||||
				alpm_pkg_t *childpkg = nextchild->data;
 | 
			
		||||
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_WARNING, _("dependency cycle detected:\n"));
 | 
			
		||||
				if(reverse) {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
							_("%s will be removed after its %s dependency\n"),
 | 
			
		||||
							vertexpkg->name, childpkg->name);
 | 
			
		||||
				} else {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
							_("%s will be installed before its %s dependency\n"),
 | 
			
		||||
							vertexpkg->name, childpkg->name);
 | 
			
		||||
				}
 | 
			
		||||
			} else if(nextchild->state == ALPM_GRAPH_STATE_PROCESSING) {
 | 
			
		||||
				_alpm_warn_dep_cycle(handle, targets, vertex, nextchild, reverse);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		if(!found) {
 | 
			
		||||
			newtargs = alpm_list_add(newtargs, vertex->data);
 | 
			
		||||
		if(!switched_to_child) {
 | 
			
		||||
			if(alpm_list_find_ptr(targets, vertex->data)) {
 | 
			
		||||
				newtargs = alpm_list_add(newtargs, vertex->data);
 | 
			
		||||
			}
 | 
			
		||||
			/* mark that we've left this vertex */
 | 
			
		||||
			vertex->state = 1;
 | 
			
		||||
			vertex->state = ALPM_GRAPH_STATE_PROCESSED;
 | 
			
		||||
			vertex = vertex->parent;
 | 
			
		||||
			if(!vertex) {
 | 
			
		||||
				vptr = vptr->next;
 | 
			
		||||
				while(vptr) {
 | 
			
		||||
					vertex = vptr->data;
 | 
			
		||||
					if(vertex->state == 0) break;
 | 
			
		||||
					vptr = vptr->next;
 | 
			
		||||
				/* top level vertex reached, move to the next unprocessed vertex */
 | 
			
		||||
				for(i = i->next; i; i = i->next) {
 | 
			
		||||
					vertex = i->data;
 | 
			
		||||
					if(vertex->state == ALPM_GRAPH_STATE_UNPROCESSED) {
 | 
			
		||||
						break;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
@@ -211,37 +286,6 @@ static int no_dep_version(alpm_handle_t *handle)
 | 
			
		||||
	return (handle->trans->flags & ALPM_TRANS_FLAG_NODEPVERSION);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_depend_t *filtered_depend(alpm_depend_t *dep, int nodepversion)
 | 
			
		||||
{
 | 
			
		||||
	if(nodepversion) {
 | 
			
		||||
		alpm_depend_t *newdep = _alpm_dep_dup(dep);
 | 
			
		||||
		ASSERT(newdep, return dep);
 | 
			
		||||
		newdep->mod = ALPM_DEP_MOD_ANY;
 | 
			
		||||
		dep = newdep;
 | 
			
		||||
	}
 | 
			
		||||
	return dep;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void release_filtered_depend(alpm_depend_t *dep, int nodepversion)
 | 
			
		||||
{
 | 
			
		||||
	if(nodepversion) {
 | 
			
		||||
		free(dep);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
 | 
			
		||||
	for(i = pkgs; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = i->data;
 | 
			
		||||
		if(_alpm_depcmp(pkg, dep)) {
 | 
			
		||||
			return pkg;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Find a package satisfying a specified dependency.
 | 
			
		||||
 * The dependency can include versions with depmod operators.
 | 
			
		||||
 * @param pkgs an alpm_list_t* of alpm_pkg_t where the satisfier will be searched
 | 
			
		||||
@@ -250,12 +294,12 @@ static alpm_pkg_t *find_dep_satisfier(alpm_list_t *pkgs, alpm_depend_t *dep)
 | 
			
		||||
 */
 | 
			
		||||
alpm_pkg_t SYMEXPORT *alpm_find_satisfier(alpm_list_t *pkgs, const char *depstring)
 | 
			
		||||
{
 | 
			
		||||
	alpm_depend_t *dep = _alpm_splitdep(depstring);
 | 
			
		||||
	alpm_depend_t *dep = alpm_dep_from_string(depstring);
 | 
			
		||||
	if(!dep) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
	alpm_pkg_t *pkg = find_dep_satisfier(pkgs, dep);
 | 
			
		||||
	_alpm_dep_free(dep);
 | 
			
		||||
	alpm_dep_free(dep);
 | 
			
		||||
	return pkg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -298,11 +342,16 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
 | 
			
		||||
 | 
			
		||||
		for(j = alpm_pkg_get_depends(tp); j; j = j->next) {
 | 
			
		||||
			alpm_depend_t *depend = j->data;
 | 
			
		||||
			depend = filtered_depend(depend, nodepversion);
 | 
			
		||||
			alpm_depmod_t orig_mod = depend->mod;
 | 
			
		||||
			if(nodepversion) {
 | 
			
		||||
				depend->mod = ALPM_DEP_MOD_ANY;
 | 
			
		||||
			}
 | 
			
		||||
			/* 1. we check the upgrade list */
 | 
			
		||||
			/* 2. we check database for untouched satisfying packages */
 | 
			
		||||
			/* 3. we check the dependency ignore list */
 | 
			
		||||
			if(!find_dep_satisfier(upgrade, depend) &&
 | 
			
		||||
					!find_dep_satisfier(dblist, depend)) {
 | 
			
		||||
					!find_dep_satisfier(dblist, depend) &&
 | 
			
		||||
					!_alpm_depcmp_provides(depend, handle->assumeinstalled)) {
 | 
			
		||||
				/* Unsatisfied dependency in the upgrade list */
 | 
			
		||||
				alpm_depmissing_t *miss;
 | 
			
		||||
				char *missdepstring = alpm_dep_compute_string(depend);
 | 
			
		||||
@@ -312,7 +361,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
 | 
			
		||||
				miss = depmiss_new(tp->name, depend, NULL);
 | 
			
		||||
				baddeps = alpm_list_add(baddeps, miss);
 | 
			
		||||
			}
 | 
			
		||||
			release_filtered_depend(depend, nodepversion);
 | 
			
		||||
			depend->mod = orig_mod;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -323,14 +372,19 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
 | 
			
		||||
			alpm_pkg_t *lp = i->data;
 | 
			
		||||
			for(j = alpm_pkg_get_depends(lp); j; j = j->next) {
 | 
			
		||||
				alpm_depend_t *depend = j->data;
 | 
			
		||||
				depend = filtered_depend(depend, nodepversion);
 | 
			
		||||
				alpm_depmod_t orig_mod = depend->mod;
 | 
			
		||||
				if(nodepversion) {
 | 
			
		||||
					depend->mod = ALPM_DEP_MOD_ANY;
 | 
			
		||||
				}
 | 
			
		||||
				alpm_pkg_t *causingpkg = find_dep_satisfier(modified, depend);
 | 
			
		||||
				/* we won't break this depend, if it is already broken, we ignore it */
 | 
			
		||||
				/* 1. check upgrade list for satisfiers */
 | 
			
		||||
				/* 2. check dblist for satisfiers */
 | 
			
		||||
				/* 3. we check the dependency ignore list */
 | 
			
		||||
				if(causingpkg &&
 | 
			
		||||
				   !find_dep_satisfier(upgrade, depend) &&
 | 
			
		||||
				   !find_dep_satisfier(dblist, depend)) {
 | 
			
		||||
						!find_dep_satisfier(upgrade, depend) &&
 | 
			
		||||
						!find_dep_satisfier(dblist, depend) &&
 | 
			
		||||
						!_alpm_depcmp_provides(depend, handle->assumeinstalled)) {
 | 
			
		||||
					alpm_depmissing_t *miss;
 | 
			
		||||
					char *missdepstring = alpm_dep_compute_string(depend);
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_DEBUG, "checkdeps: transaction would break '%s' dependency of '%s'\n",
 | 
			
		||||
@@ -339,7 +393,7 @@ alpm_list_t SYMEXPORT *alpm_checkdeps(alpm_handle_t *handle,
 | 
			
		||||
					miss = depmiss_new(lp->name, depend, causingpkg->name);
 | 
			
		||||
					baddeps = alpm_list_add(baddeps, miss);
 | 
			
		||||
				}
 | 
			
		||||
				release_filtered_depend(depend, nodepversion);
 | 
			
		||||
				depend->mod = orig_mod;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -381,17 +435,18 @@ int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep)
 | 
			
		||||
	return dep_vercmp(pkg->version, dep->mod, dep->version);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
 | 
			
		||||
/**
 | 
			
		||||
 * @param dep dependency to check against the provision list
 | 
			
		||||
 * @param provisions provision list
 | 
			
		||||
 * @return 1 if provider is found, 0 otherwise
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_depcmp_provides(alpm_depend_t *dep, alpm_list_t *provisions)
 | 
			
		||||
{
 | 
			
		||||
	int satisfy = 0;
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	int satisfy = _alpm_depcmp_literal(pkg, dep);
 | 
			
		||||
 | 
			
		||||
	if(satisfy) {
 | 
			
		||||
		return satisfy;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* check provisions, name and version if available */
 | 
			
		||||
	for(i = alpm_pkg_get_provides(pkg); i && !satisfy; i = i->next) {
 | 
			
		||||
	for(i = provisions; i && !satisfy; i = i->next) {
 | 
			
		||||
		alpm_depend_t *provision = i->data;
 | 
			
		||||
 | 
			
		||||
		if(dep->mod == ALPM_DEP_MOD_ANY) {
 | 
			
		||||
@@ -409,7 +464,13 @@ int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
 | 
			
		||||
	return satisfy;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_depend_t *_alpm_splitdep(const char *depstring)
 | 
			
		||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_depcmp_literal(pkg, dep)
 | 
			
		||||
		|| _alpm_depcmp_provides(dep, alpm_pkg_get_provides(pkg));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_depend_t SYMEXPORT *alpm_dep_from_string(const char *depstring)
 | 
			
		||||
{
 | 
			
		||||
	alpm_depend_t *depend;
 | 
			
		||||
	const char *ptr, *version, *desc;
 | 
			
		||||
@@ -419,11 +480,11 @@ alpm_depend_t *_alpm_splitdep(const char *depstring)
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	MALLOC(depend, sizeof(alpm_depend_t), return NULL);
 | 
			
		||||
	CALLOC(depend, 1, sizeof(alpm_depend_t), return NULL);
 | 
			
		||||
 | 
			
		||||
	/* Note the extra space in ": " to avoid matching the epoch */
 | 
			
		||||
	if((desc = strstr(depstring, ": ")) != NULL) {
 | 
			
		||||
		STRDUP(depend->desc, desc + 2, return NULL);
 | 
			
		||||
		STRDUP(depend->desc, desc + 2, goto error);
 | 
			
		||||
		deplen = desc - depstring;
 | 
			
		||||
	} else {
 | 
			
		||||
		/* no description- point desc at NULL at end of string for later use */
 | 
			
		||||
@@ -463,13 +524,17 @@ alpm_depend_t *_alpm_splitdep(const char *depstring)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* copy the right parts to the right places */
 | 
			
		||||
	STRNDUP(depend->name, depstring, ptr - depstring, return NULL);
 | 
			
		||||
	STRNDUP(depend->name, depstring, ptr - depstring, goto error);
 | 
			
		||||
	depend->name_hash = _alpm_hash_sdbm(depend->name);
 | 
			
		||||
	if(version) {
 | 
			
		||||
		STRNDUP(depend->version, version, desc - version, return NULL);
 | 
			
		||||
		STRNDUP(depend->version, version, desc - version, goto error);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return depend;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	alpm_dep_free(depend);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
 | 
			
		||||
@@ -477,53 +542,42 @@ alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep)
 | 
			
		||||
	alpm_depend_t *newdep;
 | 
			
		||||
	CALLOC(newdep, 1, sizeof(alpm_depend_t), return NULL);
 | 
			
		||||
 | 
			
		||||
	STRDUP(newdep->name, dep->name, return NULL);
 | 
			
		||||
	STRDUP(newdep->version, dep->version, return NULL);
 | 
			
		||||
	STRDUP(newdep->desc, dep->desc, return NULL);
 | 
			
		||||
	STRDUP(newdep->name, dep->name, goto error);
 | 
			
		||||
	STRDUP(newdep->version, dep->version, goto error);
 | 
			
		||||
	STRDUP(newdep->desc, dep->desc, goto error);
 | 
			
		||||
	newdep->name_hash = dep->name_hash;
 | 
			
		||||
	newdep->mod = dep->mod;
 | 
			
		||||
 | 
			
		||||
	return newdep;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	alpm_dep_free(newdep);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* These parameters are messy. We check if this package, given a list of
 | 
			
		||||
 * targets and a db is safe to remove. We do NOT remove it if it is in the
 | 
			
		||||
 * target list, or if the package was explicitly installed and
 | 
			
		||||
 * include_explicit == 0 */
 | 
			
		||||
static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
 | 
			
		||||
		alpm_list_t *targets, int include_explicit)
 | 
			
		||||
/** Move package dependencies from one list to another
 | 
			
		||||
 * @param from list to scan for dependencies
 | 
			
		||||
 * @param to list to add dependencies to
 | 
			
		||||
 * @param pkg package whose dependencies are moved
 | 
			
		||||
 * @param explicit if 0, explicitly installed packages are not moved
 | 
			
		||||
 */
 | 
			
		||||
static void _alpm_select_depends(alpm_list_t **from, alpm_list_t **to,
 | 
			
		||||
		alpm_pkg_t *pkg, int explicit)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
 | 
			
		||||
	if(alpm_pkg_find(targets, pkg->name)) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	alpm_list_t *i, *next;
 | 
			
		||||
	if(!alpm_pkg_get_depends(pkg)) {
 | 
			
		||||
		return;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(!include_explicit) {
 | 
			
		||||
		/* see if it was explicitly installed */
 | 
			
		||||
		if(alpm_pkg_get_reason(pkg) == ALPM_PKG_REASON_EXPLICIT) {
 | 
			
		||||
			_alpm_log(db->handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"excluding %s -- explicitly installed\n", pkg->name);
 | 
			
		||||
			return 0;
 | 
			
		||||
	for(i = *from; i; i = next) {
 | 
			
		||||
		alpm_pkg_t *deppkg = i->data;
 | 
			
		||||
		next = i->next;
 | 
			
		||||
		if((explicit || alpm_pkg_get_reason(deppkg) != ALPM_PKG_REASON_EXPLICIT)
 | 
			
		||||
				&& _alpm_pkg_depends_on(pkg, deppkg)) {
 | 
			
		||||
			*to = alpm_list_add(*to, deppkg);
 | 
			
		||||
			*from = alpm_list_remove_item(*from, i);
 | 
			
		||||
			free(i);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* TODO: checkdeps could be used here, it handles multiple providers
 | 
			
		||||
	 * better, but that also makes it slower.
 | 
			
		||||
	 * Also this would require to first add the package to the targets list,
 | 
			
		||||
	 * then call checkdeps with it, then remove the package from the targets list
 | 
			
		||||
	 * if checkdeps detected it would break something */
 | 
			
		||||
 | 
			
		||||
	/* see if other packages need it */
 | 
			
		||||
	for(i = _alpm_db_get_pkgcache(db); i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *lpkg = i->data;
 | 
			
		||||
		if(_alpm_dep_edge(lpkg, pkg) && !alpm_pkg_find(targets, lpkg->name)) {
 | 
			
		||||
			return 0;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* it's ok to remove */
 | 
			
		||||
	return 1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
@@ -537,31 +591,48 @@ static int can_remove_package(alpm_db_t *db, alpm_pkg_t *pkg,
 | 
			
		||||
 * @param include_explicit if 0, explicitly installed packages are not included
 | 
			
		||||
 * @return 0 on success, -1 on errors
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit)
 | 
			
		||||
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i, *j;
 | 
			
		||||
	alpm_list_t *i, *keep, *rem = NULL;
 | 
			
		||||
 | 
			
		||||
	if(db == NULL || targs == NULL) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for(i = targs; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = i->data;
 | 
			
		||||
		for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
 | 
			
		||||
			alpm_pkg_t *deppkg = j->data;
 | 
			
		||||
			if(_alpm_dep_edge(pkg, deppkg)
 | 
			
		||||
					&& can_remove_package(db, deppkg, targs, include_explicit)) {
 | 
			
		||||
				alpm_pkg_t *copy;
 | 
			
		||||
				_alpm_log(db->handle, ALPM_LOG_DEBUG, "adding '%s' to the targets\n",
 | 
			
		||||
						deppkg->name);
 | 
			
		||||
				/* add it to the target list */
 | 
			
		||||
				if(_alpm_pkg_dup(deppkg, ©)) {
 | 
			
		||||
					return -1;
 | 
			
		||||
				}
 | 
			
		||||
				targs = alpm_list_add(targs, copy);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	keep = alpm_list_copy(_alpm_db_get_pkgcache(db));
 | 
			
		||||
	for(i = *targs; i; i = i->next) {
 | 
			
		||||
		keep = alpm_list_remove(keep, i->data, _alpm_pkg_cmp, NULL);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* recursively select all dependencies for removal */
 | 
			
		||||
	for(i = *targs; i; i = i->next) {
 | 
			
		||||
		_alpm_select_depends(&keep, &rem, i->data, include_explicit);
 | 
			
		||||
	}
 | 
			
		||||
	for(i = rem; i; i = i->next) {
 | 
			
		||||
		_alpm_select_depends(&keep, &rem, i->data, include_explicit);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* recursively select any still needed packages to keep */
 | 
			
		||||
	for(i = keep; i && rem; i = i->next) {
 | 
			
		||||
		_alpm_select_depends(&rem, &keep, i->data, 1);
 | 
			
		||||
	}
 | 
			
		||||
	alpm_list_free(keep);
 | 
			
		||||
 | 
			
		||||
	/* copy selected packages into the target list */
 | 
			
		||||
	for(i = rem; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = i->data, *copy = NULL;
 | 
			
		||||
		_alpm_log(db->handle, ALPM_LOG_DEBUG,
 | 
			
		||||
				"adding '%s' to the targets\n", pkg->name);
 | 
			
		||||
		if(_alpm_pkg_dup(pkg, ©)) {
 | 
			
		||||
			/* we return memory on "non-fatal" error in _alpm_pkg_dup */
 | 
			
		||||
			_alpm_pkg_free(copy);
 | 
			
		||||
			alpm_list_free(rem);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
		*targs = alpm_list_add(*targs, copy);
 | 
			
		||||
	}
 | 
			
		||||
	alpm_list_free(rem);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -589,19 +660,29 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
 | 
			
		||||
 | 
			
		||||
	/* 1. literals */
 | 
			
		||||
	for(i = dbs; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = _alpm_db_get_pkgfromcache(i->data, dep->name);
 | 
			
		||||
		alpm_pkg_t *pkg;
 | 
			
		||||
		alpm_db_t *db = i->data;
 | 
			
		||||
 | 
			
		||||
		if(!(db->usage & (ALPM_DB_USAGE_INSTALL|ALPM_DB_USAGE_UPGRADE))) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		pkg = _alpm_db_get_pkgfromcache(db, dep->name);
 | 
			
		||||
		if(pkg && _alpm_depcmp_literal(pkg, dep)
 | 
			
		||||
				&& !alpm_pkg_find(excluding, pkg->name)) {
 | 
			
		||||
			if(_alpm_pkg_should_ignore(handle, pkg)) {
 | 
			
		||||
				int install = 0;
 | 
			
		||||
			if(alpm_pkg_should_ignore(handle, pkg)) {
 | 
			
		||||
				alpm_question_install_ignorepkg_t question = {
 | 
			
		||||
					.type = ALPM_QUESTION_INSTALL_IGNOREPKG,
 | 
			
		||||
					.install = 0,
 | 
			
		||||
					.pkg = pkg
 | 
			
		||||
				};
 | 
			
		||||
				if(prompt) {
 | 
			
		||||
					QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG, pkg,
 | 
			
		||||
							 NULL, NULL, &install);
 | 
			
		||||
					QUESTION(handle, &question);
 | 
			
		||||
				} else {
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
 | 
			
		||||
							pkg->name, pkg->version);
 | 
			
		||||
				}
 | 
			
		||||
				if(!install) {
 | 
			
		||||
				if(!question.install) {
 | 
			
		||||
					ignored = 1;
 | 
			
		||||
					continue;
 | 
			
		||||
				}
 | 
			
		||||
@@ -611,22 +692,27 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
 | 
			
		||||
	}
 | 
			
		||||
	/* 2. satisfiers (skip literals here) */
 | 
			
		||||
	for(i = dbs; i; i = i->next) {
 | 
			
		||||
		for(j = _alpm_db_get_pkgcache(i->data); j; j = j->next) {
 | 
			
		||||
		alpm_db_t *db = i->data;
 | 
			
		||||
		if(!(db->usage & (ALPM_DB_USAGE_INSTALL|ALPM_DB_USAGE_UPGRADE))) {
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		for(j = _alpm_db_get_pkgcache(db); j; j = j->next) {
 | 
			
		||||
			alpm_pkg_t *pkg = j->data;
 | 
			
		||||
			/* with hash != hash, we can even skip the strcmp() as we know they can't
 | 
			
		||||
			 * possibly be the same string */
 | 
			
		||||
			if(pkg->name_hash != dep->name_hash && _alpm_depcmp(pkg, dep)
 | 
			
		||||
					&& !alpm_pkg_find(excluding, pkg->name)) {
 | 
			
		||||
				if(_alpm_pkg_should_ignore(handle, pkg)) {
 | 
			
		||||
					int install = 0;
 | 
			
		||||
			if((pkg->name_hash != dep->name_hash || strcmp(pkg->name, dep->name) != 0)
 | 
			
		||||
					&& _alpm_depcmp(pkg, dep) && !alpm_pkg_find(excluding, pkg->name)) {
 | 
			
		||||
				if(alpm_pkg_should_ignore(handle, pkg)) {
 | 
			
		||||
					alpm_question_install_ignorepkg_t question = {
 | 
			
		||||
						.type = ALPM_QUESTION_INSTALL_IGNOREPKG,
 | 
			
		||||
						.install = 0,
 | 
			
		||||
						.pkg = pkg
 | 
			
		||||
					};
 | 
			
		||||
					if(prompt) {
 | 
			
		||||
						QUESTION(handle, ALPM_QUESTION_INSTALL_IGNOREPKG,
 | 
			
		||||
									pkg, NULL, NULL, &install);
 | 
			
		||||
						QUESTION(handle, &question);
 | 
			
		||||
					} else {
 | 
			
		||||
						_alpm_log(handle, ALPM_LOG_WARNING, _("ignoring package %s-%s\n"),
 | 
			
		||||
								pkg->name, pkg->version);
 | 
			
		||||
					}
 | 
			
		||||
					if(!install) {
 | 
			
		||||
					if(!question.install) {
 | 
			
		||||
						ignored = 1;
 | 
			
		||||
						continue;
 | 
			
		||||
					}
 | 
			
		||||
@@ -649,15 +735,19 @@ static alpm_pkg_t *resolvedep(alpm_handle_t *handle, alpm_depend_t *dep,
 | 
			
		||||
	}
 | 
			
		||||
	count = alpm_list_count(providers);
 | 
			
		||||
	if(count >= 1) {
 | 
			
		||||
		/* default to first provider if there is no QUESTION callback */
 | 
			
		||||
		int idx = 0;
 | 
			
		||||
		alpm_question_select_provider_t question = {
 | 
			
		||||
			.type = ALPM_QUESTION_SELECT_PROVIDER,
 | 
			
		||||
			/* default to first provider if there is no QUESTION callback */
 | 
			
		||||
			.use_index = 0,
 | 
			
		||||
			.providers = providers,
 | 
			
		||||
			.depend = dep
 | 
			
		||||
		};
 | 
			
		||||
		if(count > 1) {
 | 
			
		||||
			/* if there is more than one provider, we ask the user */
 | 
			
		||||
			QUESTION(handle, ALPM_QUESTION_SELECT_PROVIDER,
 | 
			
		||||
					providers, dep, NULL, &idx);
 | 
			
		||||
			QUESTION(handle, &question);
 | 
			
		||||
		}
 | 
			
		||||
		if(idx >= 0 && idx < count) {
 | 
			
		||||
			alpm_list_t *nth = alpm_list_nth(providers, idx);
 | 
			
		||||
		if(question.use_index >= 0 && question.use_index < count) {
 | 
			
		||||
			alpm_list_t *nth = alpm_list_nth(providers, question.use_index);
 | 
			
		||||
			alpm_pkg_t *pkg = nth->data;
 | 
			
		||||
			alpm_list_free(providers);
 | 
			
		||||
			return pkg;
 | 
			
		||||
@@ -692,10 +782,10 @@ alpm_pkg_t SYMEXPORT *alpm_find_dbs_satisfier(alpm_handle_t *handle,
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
	ASSERT(dbs, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, NULL));
 | 
			
		||||
 | 
			
		||||
	dep = _alpm_splitdep(depstring);
 | 
			
		||||
	dep = alpm_dep_from_string(depstring);
 | 
			
		||||
	ASSERT(dep, return NULL);
 | 
			
		||||
	pkg = resolvedep(handle, dep, dbs, NULL, 1);
 | 
			
		||||
	_alpm_dep_free(dep);
 | 
			
		||||
	alpm_dep_free(dep);
 | 
			
		||||
	return pkg;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -753,7 +843,7 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
 | 
			
		||||
		/* check if one of the packages in the [*packages] list already satisfies
 | 
			
		||||
		 * this dependency */
 | 
			
		||||
		if(find_dep_satisfier(*packages, missdep)) {
 | 
			
		||||
			_alpm_depmiss_free(miss);
 | 
			
		||||
			alpm_depmissing_free(miss);
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		/* check if one of the packages in the [preferred] list already satisfies
 | 
			
		||||
@@ -767,9 +857,9 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"pulling dependency %s (needed by %s)\n",
 | 
			
		||||
					spkg->name, pkg->name);
 | 
			
		||||
			_alpm_depmiss_free(miss);
 | 
			
		||||
			alpm_depmissing_free(miss);
 | 
			
		||||
		} else if(resolvedep(handle, missdep, (targ = alpm_list_add(NULL, handle->db_local)), rem, 0)) {
 | 
			
		||||
			_alpm_depmiss_free(miss);
 | 
			
		||||
			alpm_depmissing_free(miss);
 | 
			
		||||
		} else {
 | 
			
		||||
			handle->pm_errno = ALPM_ERR_UNSATISFIED_DEPS;
 | 
			
		||||
			char *missdepstring = alpm_dep_compute_string(missdep);
 | 
			
		||||
@@ -782,8 +872,9 @@ int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs,
 | 
			
		||||
			}
 | 
			
		||||
			ret = -1;
 | 
			
		||||
		}
 | 
			
		||||
		alpm_list_free(targ);
 | 
			
		||||
		targ = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	alpm_list_free(targ);
 | 
			
		||||
	alpm_list_free(deps);
 | 
			
		||||
 | 
			
		||||
	if(ret != 0) {
 | 
			
		||||
@@ -863,4 +954,3 @@ char SYMEXPORT *alpm_dep_compute_string(const alpm_depend_t *dep)
 | 
			
		||||
 | 
			
		||||
	return str;
 | 
			
		||||
}
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  deps.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2006 by Miklos Vajna <vmiklos@frugalware.org>
 | 
			
		||||
@@ -19,26 +19,23 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_DEPS_H
 | 
			
		||||
#define _ALPM_DEPS_H
 | 
			
		||||
#ifndef ALPM_DEPS_H
 | 
			
		||||
#define ALPM_DEPS_H
 | 
			
		||||
 | 
			
		||||
#include "db.h"
 | 
			
		||||
#include "sync.h"
 | 
			
		||||
#include "package.h"
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
 | 
			
		||||
void _alpm_dep_free(alpm_depend_t *dep);
 | 
			
		||||
alpm_depend_t *_alpm_dep_dup(const alpm_depend_t *dep);
 | 
			
		||||
void _alpm_depmiss_free(alpm_depmissing_t *miss);
 | 
			
		||||
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle, alpm_list_t *targets, int reverse);
 | 
			
		||||
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t *targs, int include_explicit);
 | 
			
		||||
alpm_list_t *_alpm_sortbydeps(alpm_handle_t *handle,
 | 
			
		||||
		alpm_list_t *targets, alpm_list_t *ignore, int reverse);
 | 
			
		||||
int _alpm_recursedeps(alpm_db_t *db, alpm_list_t **targs, int include_explicit);
 | 
			
		||||
int _alpm_resolvedeps(alpm_handle_t *handle, alpm_list_t *localpkgs, alpm_pkg_t *pkg,
 | 
			
		||||
		alpm_list_t *preferred, alpm_list_t **packages, alpm_list_t *remove,
 | 
			
		||||
		alpm_list_t **data);
 | 
			
		||||
alpm_depend_t *_alpm_splitdep(const char *depstring);
 | 
			
		||||
int _alpm_depcmp_literal(alpm_pkg_t *pkg, alpm_depend_t *dep);
 | 
			
		||||
int _alpm_depcmp_provides(alpm_depend_t *dep, alpm_list_t *provisions);
 | 
			
		||||
int _alpm_depcmp(alpm_pkg_t *pkg, alpm_depend_t *dep);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_DEPS_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_DEPS_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  diskspace.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2010-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -84,6 +84,9 @@ static int mount_point_load_fsinfo(alpm_handle_t *handle, alpm_mountpoint_t *mou
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "loading fsinfo for %s\n", mountpoint->mount_dir);
 | 
			
		||||
	mountpoint->read_only = mountpoint->fsp.f_flag & ST_RDONLY;
 | 
			
		||||
	mountpoint->fsinfo_loaded = MOUNT_FSINFO_LOADED;
 | 
			
		||||
#else
 | 
			
		||||
	(void)handle;
 | 
			
		||||
	(void)mountpoint;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
@@ -109,7 +112,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
 | 
			
		||||
 | 
			
		||||
	while((mnt = getmntent(fp))) {
 | 
			
		||||
		CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		mp->mount_dir = strdup(mnt->mnt_dir);
 | 
			
		||||
		STRDUP(mp->mount_dir, mnt->mnt_dir, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		mp->mount_dir_len = strlen(mp->mount_dir);
 | 
			
		||||
 | 
			
		||||
		mount_points = alpm_list_add(mount_points, mp);
 | 
			
		||||
@@ -132,7 +135,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
 | 
			
		||||
 | 
			
		||||
	while((ret = getmntent(fp, &mnt)) == 0) {
 | 
			
		||||
		CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		mp->mount_dir = strdup(mnt->mnt_mountp);
 | 
			
		||||
		STRDUP(mp->mount_dir, mnt->mnt_mountp,  free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		mp->mount_dir_len = strlen(mp->mount_dir);
 | 
			
		||||
 | 
			
		||||
		mount_points = alpm_list_add(mount_points, mp);
 | 
			
		||||
@@ -159,7 +162,7 @@ static alpm_list_t *mount_point_list(alpm_handle_t *handle)
 | 
			
		||||
 | 
			
		||||
	for(; entries-- > 0; fsp++) {
 | 
			
		||||
		CALLOC(mp, 1, sizeof(alpm_mountpoint_t), RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		mp->mount_dir = strdup(fsp->f_mntonname);
 | 
			
		||||
		STRDUP(mp->mount_dir, fsp->f_mntonname, free(mp); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		mp->mount_dir_len = strlen(mp->mount_dir);
 | 
			
		||||
		memcpy(&(mp->fsp), fsp, sizeof(FSSTATSTYPE));
 | 
			
		||||
#if defined(HAVE_GETMNTINFO_STATVFS) && defined(HAVE_STRUCT_STATVFS_F_FLAG)
 | 
			
		||||
@@ -232,7 +235,14 @@ static int calculate_removed_size(alpm_handle_t *handle,
 | 
			
		||||
		const char *filename = file->name;
 | 
			
		||||
 | 
			
		||||
		snprintf(path, PATH_MAX, "%s%s", handle->root, filename);
 | 
			
		||||
		_alpm_lstat(path, &st);
 | 
			
		||||
 | 
			
		||||
		if(llstat(path, &st) == -1) {
 | 
			
		||||
			if(alpm_option_match_noextract(handle, filename)) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
						_("could not get file information for %s\n"), filename);
 | 
			
		||||
			}
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* skip directories and symlinks to be consistent with libarchive that
 | 
			
		||||
		 * reports them to be zero size */
 | 
			
		||||
@@ -338,11 +348,11 @@ static int check_mountpoint(alpm_handle_t *handle, alpm_mountpoint_t *mp)
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
			"partition %s, needed %jd, cushion %ju, free %ju\n",
 | 
			
		||||
			mp->mount_dir, (intmax_t)mp->max_blocks_needed,
 | 
			
		||||
			(uintmax_t)cushion, (uintmax_t)mp->fsp.f_bfree);
 | 
			
		||||
	if(needed >= 0 && (fsblkcnt_t)needed > mp->fsp.f_bfree) {
 | 
			
		||||
			(uintmax_t)cushion, (uintmax_t)mp->fsp.f_bavail);
 | 
			
		||||
	if(needed >= 0 && (fsblkcnt_t)needed > mp->fsp.f_bavail) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("Partition %s too full: %jd blocks needed, %jd blocks free\n"),
 | 
			
		||||
				mp->mount_dir, (intmax_t)needed, (uintmax_t)mp->fsp.f_bfree);
 | 
			
		||||
				_("Partition %s too full: %jd blocks needed, %ju blocks free\n"),
 | 
			
		||||
				mp->mount_dir, (intmax_t)needed, (uintmax_t)mp->fsp.f_bavail);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
@@ -357,7 +367,7 @@ int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
 | 
			
		||||
	size_t j;
 | 
			
		||||
	int error = 0;
 | 
			
		||||
 | 
			
		||||
	/* resolve the cachedir path to ensure we check the right mountpoint.  We
 | 
			
		||||
	/* resolve the cachedir path to ensure we check the right mountpoint. We
 | 
			
		||||
	 * handle failures silently, and continue to use the possibly unresolved
 | 
			
		||||
	 * path. */
 | 
			
		||||
	if(realpath(cachedir, resolved_cachedir) != NULL) {
 | 
			
		||||
@@ -490,5 +500,3 @@ finish:
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  diskspace.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2010-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2010-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef _ALPM_DISKSPACE_H
 | 
			
		||||
#define _ALPM_DISKSPACE_H
 | 
			
		||||
#ifndef ALPM_DISKSPACE_H
 | 
			
		||||
#define ALPM_DISKSPACE_H
 | 
			
		||||
 | 
			
		||||
#if defined(HAVE_SYS_MOUNT_H)
 | 
			
		||||
#include <sys/mount.h>
 | 
			
		||||
@@ -60,6 +60,4 @@ int _alpm_check_diskspace(alpm_handle_t *handle);
 | 
			
		||||
int _alpm_check_downloadspace(alpm_handle_t *handle, const char *cachedir,
 | 
			
		||||
		size_t num_files, off_t *file_sizes);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_DISKSPACE_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_DISKSPACE_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  download.c
 | 
			
		||||
 *  dload.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -90,8 +90,8 @@ static void inthandler(int UNUSED signum)
 | 
			
		||||
	dload_interrupted = ABORT_SIGINT;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int dload_progress_cb(void *file, double dltotal, double dlnow,
 | 
			
		||||
		double UNUSED ultotal, double UNUSED ulnow)
 | 
			
		||||
static int dload_progress_cb(void *file, curl_off_t dltotal, curl_off_t dlnow,
 | 
			
		||||
		curl_off_t UNUSED ultotal, curl_off_t UNUSED ulnow)
 | 
			
		||||
{
 | 
			
		||||
	struct dload_payload *payload = (struct dload_payload *)file;
 | 
			
		||||
	off_t current_size, total_size;
 | 
			
		||||
@@ -106,7 +106,7 @@ static int dload_progress_cb(void *file, double dltotal, double dlnow,
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	current_size = payload->initial_size + (off_t)dlnow;
 | 
			
		||||
	current_size = payload->initial_size + dlnow;
 | 
			
		||||
 | 
			
		||||
	/* is our filesize still under any set limit? */
 | 
			
		||||
	if(payload->max_size && current_size > payload->max_size) {
 | 
			
		||||
@@ -119,19 +119,31 @@ static int dload_progress_cb(void *file, double dltotal, double dlnow,
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	total_size = payload->initial_size + (off_t)dltotal;
 | 
			
		||||
	total_size = payload->initial_size + dltotal;
 | 
			
		||||
 | 
			
		||||
	if(DOUBLE_EQ(dltotal, 0.0) || payload->prevprogress == total_size) {
 | 
			
		||||
	if(dltotal == 0 || payload->prevprogress == total_size) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* initialize the progress bar here to avoid displaying it when
 | 
			
		||||
	 * a repo is up to date and nothing gets downloaded */
 | 
			
		||||
	if(payload->prevprogress == 0) {
 | 
			
		||||
		payload->handle->dlcb(payload->remote_name, 0, (off_t)dltotal);
 | 
			
		||||
	 * a repo is up to date and nothing gets downloaded.
 | 
			
		||||
	 * payload->handle->dlcb will receive the remote_name
 | 
			
		||||
	 * and the following arguments:
 | 
			
		||||
	 * 0, -1: download initialized
 | 
			
		||||
	 * 0, 0: non-download event
 | 
			
		||||
	 * x {x>0}, x: download complete
 | 
			
		||||
	 * x {x>0, x<y}, y {y > 0}: download progress, expected total is known */
 | 
			
		||||
	if(!payload->cb_initialized) {
 | 
			
		||||
		payload->handle->dlcb(payload->remote_name, 0, -1);
 | 
			
		||||
		payload->cb_initialized = 1;
 | 
			
		||||
	}
 | 
			
		||||
	if(payload->prevprogress == current_size) {
 | 
			
		||||
		payload->handle->dlcb(payload->remote_name, 0, 0);
 | 
			
		||||
	} else {
 | 
			
		||||
	/* do NOT include initial_size since it wasn't part of the package's
 | 
			
		||||
	 * download_size (nor included in the total download size callback) */
 | 
			
		||||
		payload->handle->dlcb(payload->remote_name, dlnow, dltotal);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	payload->handle->dlcb(payload->remote_name, current_size, total_size);
 | 
			
		||||
 | 
			
		||||
	payload->prevprogress = current_size;
 | 
			
		||||
 | 
			
		||||
@@ -234,47 +246,6 @@ static size_t dload_parseheader_cb(void *ptr, size_t size, size_t nmemb, void *u
 | 
			
		||||
	return realsize;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int dload_sockopt_cb(void *userdata, curl_socket_t curlfd,
 | 
			
		||||
		curlsocktype purpose)
 | 
			
		||||
{
 | 
			
		||||
	alpm_handle_t *handle = userdata;
 | 
			
		||||
	int optval = 1;
 | 
			
		||||
 | 
			
		||||
	/* this whole method is to prevent FTP control connections from going sour
 | 
			
		||||
	 * during a long data transfer; crappy firewalls love to drop otherwise idle
 | 
			
		||||
	 * connections if there is no traffic. */
 | 
			
		||||
	if(purpose != CURLSOCKTYPE_IPCXN) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* don't abort operation if any setsockopt fails, just log to debug */
 | 
			
		||||
	if(setsockopt(curlfd, SOL_SOCKET, SO_KEEPALIVE, (void *)&optval,
 | 
			
		||||
				sizeof(optval)) < 0) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
				"Failed to set SO_KEEPALIVE on fd %d\n", curlfd);
 | 
			
		||||
	}
 | 
			
		||||
	else {
 | 
			
		||||
#ifdef TCP_KEEPIDLE
 | 
			
		||||
		optval = 60;
 | 
			
		||||
		if(setsockopt(curlfd, IPPROTO_TCP, TCP_KEEPIDLE, (void *)&optval,
 | 
			
		||||
					sizeof(optval)) < 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"Failed to set TCP_KEEPIDLE on fd %d\n", curlfd);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
#ifdef TCP_KEEPINTVL
 | 
			
		||||
		optval = 60;
 | 
			
		||||
		if(setsockopt(curlfd, IPPROTO_TCP, TCP_KEEPINTVL, (void *)&optval,
 | 
			
		||||
					sizeof(optval)) < 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
					"Failed to set TCP_KEEPINTVL on fd %d\n", curlfd);
 | 
			
		||||
		}
 | 
			
		||||
#endif
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void curl_set_handle_opts(struct dload_payload *payload,
 | 
			
		||||
		CURL *curl, char *error_buffer)
 | 
			
		||||
{
 | 
			
		||||
@@ -286,21 +257,24 @@ static void curl_set_handle_opts(struct dload_payload *payload,
 | 
			
		||||
	 * to reset the handle's parameters for each time it's used. */
 | 
			
		||||
	curl_easy_reset(curl);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_URL, payload->fileurl);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_FAILONERROR, 1L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, error_buffer);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_CONNECTTIMEOUT, 10L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_FILETIME, 1L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 0L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_FOLLOWLOCATION, 1L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_PROGRESSFUNCTION, dload_progress_cb);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_PROGRESSDATA, (void *)payload);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_XFERINFOFUNCTION, dload_progress_cb);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_XFERINFODATA, (void *)payload);
 | 
			
		||||
	if(!handle->disable_dl_timeout) {
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_LOW_SPEED_LIMIT, 1L);
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_LOW_SPEED_TIME, 10L);
 | 
			
		||||
	}
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_HEADERFUNCTION, dload_parseheader_cb);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_WRITEHEADER, (void *)payload);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_HEADERDATA, (void *)payload);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_NETRC, CURL_NETRC_OPTIONAL);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_SOCKOPTFUNCTION, dload_sockopt_cb);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_SOCKOPTDATA, (void *)handle);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_TCP_KEEPALIVE, 1L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_TCP_KEEPIDLE, 60L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_TCP_KEEPINTVL, 60L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_HTTPAUTH, CURLAUTH_ANY);
 | 
			
		||||
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "url: %s\n", payload->fileurl);
 | 
			
		||||
 | 
			
		||||
@@ -321,7 +295,7 @@ static void curl_set_handle_opts(struct dload_payload *payload,
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_TIMECONDITION, CURL_TIMECOND_IFMODSINCE);
 | 
			
		||||
		curl_easy_setopt(curl, CURLOPT_TIMEVALUE, (long)st.st_mtime);
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_DEBUG,
 | 
			
		||||
				"using time condition: %lu\n", (long)st.st_mtime);
 | 
			
		||||
				"using time condition: %ld\n", (long)st.st_mtime);
 | 
			
		||||
	} else if(stat(payload->tempfile_name, &st) == 0 && payload->allow_resume) {
 | 
			
		||||
		/* a previous partial download exists, resume from end of file. */
 | 
			
		||||
		payload->tempfile_openmode = "ab";
 | 
			
		||||
@@ -366,7 +340,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
 | 
			
		||||
			fchmod(fd, ~(_getumask()) & 0666) ||
 | 
			
		||||
			!(fp = fdopen(fd, payload->tempfile_openmode))) {
 | 
			
		||||
		unlink(randpath);
 | 
			
		||||
		CLOSE(fd);
 | 
			
		||||
		close(fd);
 | 
			
		||||
		_alpm_log(payload->handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("failed to create temporary file for download\n"));
 | 
			
		||||
		free(randpath);
 | 
			
		||||
@@ -377,7 +351,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
 | 
			
		||||
	payload->tempfile_name = randpath;
 | 
			
		||||
	free(payload->remote_name);
 | 
			
		||||
	STRDUP(payload->remote_name, strrchr(randpath, '/') + 1,
 | 
			
		||||
			RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
			fclose(fp); RET_ERR(payload->handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
 | 
			
		||||
	return fp;
 | 
			
		||||
}
 | 
			
		||||
@@ -386,7 +360,7 @@ static FILE *create_tempfile(struct dload_payload *payload, const char *localpat
 | 
			
		||||
#define HOSTNAME_SIZE 256
 | 
			
		||||
 | 
			
		||||
static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
		const char *localpath, char **final_file, char **final_url)
 | 
			
		||||
		const char *localpath, char **final_file, const char **final_url)
 | 
			
		||||
{
 | 
			
		||||
	int ret = -1;
 | 
			
		||||
	FILE *localf = NULL;
 | 
			
		||||
@@ -400,7 +374,7 @@ static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
	/* shortcut to our handle within the payload */
 | 
			
		||||
	alpm_handle_t *handle = payload->handle;
 | 
			
		||||
	CURL *curl = get_libcurl_handle(handle);
 | 
			
		||||
	handle->pm_errno = 0;
 | 
			
		||||
	handle->pm_errno = ALPM_ERR_OK;
 | 
			
		||||
 | 
			
		||||
	/* make sure these are NULL */
 | 
			
		||||
	FREE(payload->tempfile_name);
 | 
			
		||||
@@ -457,6 +431,7 @@ static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
	/* Ignore any SIGPIPE signals. With libcurl, these shouldn't be happening,
 | 
			
		||||
	 * but better safe than sorry. Store the old signal handler first. */
 | 
			
		||||
	mask_signal(SIGPIPE, SIG_IGN, &orig_sig_pipe);
 | 
			
		||||
	dload_interrupted = 0;
 | 
			
		||||
	mask_signal(SIGINT, &inthandler, &orig_sig_int);
 | 
			
		||||
 | 
			
		||||
	/* perform transfer */
 | 
			
		||||
@@ -465,8 +440,8 @@ static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
			payload->curlerr);
 | 
			
		||||
 | 
			
		||||
	/* disconnect relationships from the curl handle for things that might go out
 | 
			
		||||
	 * of scope, but could still be touched on connection teardown.  This really
 | 
			
		||||
	 * only applies to FTP transfers. See FS#26327 for an example. */
 | 
			
		||||
	 * of scope, but could still be touched on connection teardown. This really
 | 
			
		||||
	 * only applies to FTP transfers. */
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_NOPROGRESS, 1L);
 | 
			
		||||
	curl_easy_setopt(curl, CURLOPT_ERRORBUFFER, (char *)NULL);
 | 
			
		||||
 | 
			
		||||
@@ -477,12 +452,14 @@ static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "response code: %ld\n", payload->respcode);
 | 
			
		||||
			if(payload->respcode >= 400) {
 | 
			
		||||
				payload->unlink_on_fail = 1;
 | 
			
		||||
				/* non-translated message is same as libcurl */
 | 
			
		||||
				snprintf(error_buffer, sizeof(error_buffer),
 | 
			
		||||
						"The requested URL returned error: %ld", payload->respcode);
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
						_("failed retrieving file '%s' from %s : %s\n"),
 | 
			
		||||
						payload->remote_name, hostname, error_buffer);
 | 
			
		||||
				if(!payload->errors_ok) {
 | 
			
		||||
					/* non-translated message is same as libcurl */
 | 
			
		||||
					snprintf(error_buffer, sizeof(error_buffer),
 | 
			
		||||
							"The requested URL returned error: %ld", payload->respcode);
 | 
			
		||||
					_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
							_("failed retrieving file '%s' from %s : %s\n"),
 | 
			
		||||
							payload->remote_name, hostname, error_buffer);
 | 
			
		||||
				}
 | 
			
		||||
				goto cleanup;
 | 
			
		||||
			}
 | 
			
		||||
			break;
 | 
			
		||||
@@ -490,14 +467,20 @@ static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
			/* handle the interrupt accordingly */
 | 
			
		||||
			if(dload_interrupted == ABORT_OVER_MAXFILESIZE) {
 | 
			
		||||
				payload->curlerr = CURLE_FILESIZE_EXCEEDED;
 | 
			
		||||
				payload->unlink_on_fail = 1;
 | 
			
		||||
				handle->pm_errno = ALPM_ERR_LIBCURL;
 | 
			
		||||
				/* use the 'size exceeded' message from libcurl */
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
						_("failed retrieving file '%s' from %s : %s\n"),
 | 
			
		||||
						payload->remote_name, hostname,
 | 
			
		||||
						curl_easy_strerror(CURLE_FILESIZE_EXCEEDED));
 | 
			
		||||
						_("failed retrieving file '%s' from %s : expected download size exceeded\n"),
 | 
			
		||||
						payload->remote_name, hostname);
 | 
			
		||||
			}
 | 
			
		||||
			goto cleanup;
 | 
			
		||||
		case CURLE_COULDNT_RESOLVE_HOST:
 | 
			
		||||
			payload->unlink_on_fail = 1;
 | 
			
		||||
			handle->pm_errno = ALPM_ERR_SERVER_BAD_URL;
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
					_("failed retrieving file '%s' from %s : %s\n"),
 | 
			
		||||
					payload->remote_name, hostname, error_buffer);
 | 
			
		||||
			goto cleanup;
 | 
			
		||||
		default:
 | 
			
		||||
			/* delete zero length downloads */
 | 
			
		||||
			if(fstat(fileno(localf), &st) == 0 && st.st_size == 0) {
 | 
			
		||||
@@ -547,23 +530,26 @@ static int curl_download_internal(struct dload_payload *payload,
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(payload->content_disp_name) {
 | 
			
		||||
		/* content-disposition header has a better name for our file */
 | 
			
		||||
		free(payload->destfile_name);
 | 
			
		||||
		payload->destfile_name = get_fullpath(localpath, payload->content_disp_name, "");
 | 
			
		||||
	} else {
 | 
			
		||||
		const char *effective_filename = strrchr(effective_url, '/');
 | 
			
		||||
		if(effective_filename && strlen(effective_filename) > 2) {
 | 
			
		||||
			effective_filename++;
 | 
			
		||||
	if(payload->trust_remote_name) {
 | 
			
		||||
		if(payload->content_disp_name) {
 | 
			
		||||
			/* content-disposition header has a better name for our file */
 | 
			
		||||
			free(payload->destfile_name);
 | 
			
		||||
			payload->destfile_name = get_fullpath(localpath,
 | 
			
		||||
				get_filename(payload->content_disp_name), "");
 | 
			
		||||
		} else {
 | 
			
		||||
			const char *effective_filename = strrchr(effective_url, '/');
 | 
			
		||||
			if(effective_filename && strlen(effective_filename) > 2) {
 | 
			
		||||
				effective_filename++;
 | 
			
		||||
 | 
			
		||||
			/* if destfile was never set, we wrote to a tempfile. even if destfile is
 | 
			
		||||
			 * set, we may have followed some redirects and the effective url may
 | 
			
		||||
			 * have a better suggestion as to what to name our file. in either case,
 | 
			
		||||
			 * refactor destfile to this newly derived name. */
 | 
			
		||||
			if(!payload->destfile_name || strcmp(effective_filename,
 | 
			
		||||
						strrchr(payload->destfile_name, '/') + 1) != 0) {
 | 
			
		||||
				free(payload->destfile_name);
 | 
			
		||||
				payload->destfile_name = get_fullpath(localpath, effective_filename, "");
 | 
			
		||||
				/* if destfile was never set, we wrote to a tempfile. even if destfile is
 | 
			
		||||
				 * set, we may have followed some redirects and the effective url may
 | 
			
		||||
				 * have a better suggestion as to what to name our file. in either case,
 | 
			
		||||
				 * refactor destfile to this newly derived name. */
 | 
			
		||||
				if(!payload->destfile_name || strcmp(effective_filename,
 | 
			
		||||
							strrchr(payload->destfile_name, '/') + 1) != 0) {
 | 
			
		||||
					free(payload->destfile_name);
 | 
			
		||||
					payload->destfile_name = get_fullpath(localpath, effective_filename, "");
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
@@ -601,7 +587,7 @@ cleanup:
 | 
			
		||||
	unmask_signal(SIGINT, &orig_sig_int);
 | 
			
		||||
	unmask_signal(SIGPIPE, &orig_sig_pipe);
 | 
			
		||||
	/* if we were interrupted, trip the old handler */
 | 
			
		||||
	if(dload_interrupted) {
 | 
			
		||||
	if(dload_interrupted == ABORT_SIGINT) {
 | 
			
		||||
		raise(SIGINT);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -617,7 +603,7 @@ cleanup:
 | 
			
		||||
 * @return 0 on success, -1 on error (pm_errno is set accordingly if errors_ok == 0)
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_download(struct dload_payload *payload, const char *localpath,
 | 
			
		||||
		char **final_file, char **final_url)
 | 
			
		||||
		char **final_file, const char **final_url)
 | 
			
		||||
{
 | 
			
		||||
	alpm_handle_t *handle = payload->handle;
 | 
			
		||||
 | 
			
		||||
@@ -625,6 +611,9 @@ int _alpm_download(struct dload_payload *payload, const char *localpath,
 | 
			
		||||
#ifdef HAVE_LIBCURL
 | 
			
		||||
		return curl_download_internal(payload, localpath, final_file, final_url);
 | 
			
		||||
#else
 | 
			
		||||
		/* work around unused warnings when building without libcurl */
 | 
			
		||||
		(void)final_file;
 | 
			
		||||
		(void)final_url;
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_EXTERNAL_DOWNLOAD, -1);
 | 
			
		||||
#endif
 | 
			
		||||
	} else {
 | 
			
		||||
@@ -645,7 +634,7 @@ static char *filecache_find_url(alpm_handle_t *handle, const char *url)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	filebase++;
 | 
			
		||||
	if(filebase == '\0') {
 | 
			
		||||
	if(*filebase == '\0') {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
@@ -656,8 +645,8 @@ static char *filecache_find_url(alpm_handle_t *handle, const char *url)
 | 
			
		||||
char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
 | 
			
		||||
{
 | 
			
		||||
	char *filepath;
 | 
			
		||||
	const char *cachedir;
 | 
			
		||||
	char *final_file = NULL, *final_pkg_url = NULL;
 | 
			
		||||
	const char *cachedir, *final_pkg_url = NULL;
 | 
			
		||||
	char *final_file = NULL;
 | 
			
		||||
	struct dload_payload payload;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
@@ -675,6 +664,7 @@ char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
 | 
			
		||||
		STRDUP(payload.fileurl, url, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		payload.allow_resume = 1;
 | 
			
		||||
		payload.handle = handle;
 | 
			
		||||
		payload.trust_remote_name = 1;
 | 
			
		||||
 | 
			
		||||
		/* download the file */
 | 
			
		||||
		ret = _alpm_download(&payload, cachedir, &final_file, &final_pkg_url);
 | 
			
		||||
@@ -693,12 +683,13 @@ char SYMEXPORT *alpm_fetch_pkgurl(alpm_handle_t *handle, const char *url)
 | 
			
		||||
		size_t len;
 | 
			
		||||
 | 
			
		||||
		len = strlen(final_pkg_url) + 5;
 | 
			
		||||
		MALLOC(payload.fileurl, len, RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		MALLOC(payload.fileurl, len, free(final_file); RET_ERR(handle, ALPM_ERR_MEMORY, NULL));
 | 
			
		||||
		snprintf(payload.fileurl, len, "%s.sig", final_pkg_url);
 | 
			
		||||
 | 
			
		||||
		sig_filepath = filecache_find_url(handle, payload.fileurl);
 | 
			
		||||
		if(sig_filepath == NULL) {
 | 
			
		||||
			payload.handle = handle;
 | 
			
		||||
			payload.trust_remote_name = 1;
 | 
			
		||||
			payload.force = 1;
 | 
			
		||||
			payload.errors_ok = (handle->siglevel & ALPM_SIG_PACKAGE_OPTIONAL);
 | 
			
		||||
 | 
			
		||||
@@ -742,4 +733,13 @@ void _alpm_dload_payload_reset(struct dload_payload *payload)
 | 
			
		||||
	memset(payload, '\0', sizeof(*payload));
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(payload, return);
 | 
			
		||||
 | 
			
		||||
	FREE(payload->fileurl);
 | 
			
		||||
	payload->initial_size += payload->prevprogress;
 | 
			
		||||
	payload->prevprogress = 0;
 | 
			
		||||
	payload->unlink_on_fail = 0;
 | 
			
		||||
	payload->cb_initialized = 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  dload.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_DLOAD_H
 | 
			
		||||
#define _ALPM_DLOAD_H
 | 
			
		||||
#ifndef ALPM_DLOAD_H
 | 
			
		||||
#define ALPM_DLOAD_H
 | 
			
		||||
 | 
			
		||||
#include "alpm_list.h"
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
@@ -31,6 +31,8 @@ struct dload_payload {
 | 
			
		||||
	char *destfile_name;
 | 
			
		||||
	char *content_disp_name;
 | 
			
		||||
	char *fileurl;
 | 
			
		||||
	alpm_list_t *servers;
 | 
			
		||||
	long respcode;
 | 
			
		||||
	off_t initial_size;
 | 
			
		||||
	off_t max_size;
 | 
			
		||||
	off_t prevprogress;
 | 
			
		||||
@@ -38,18 +40,17 @@ struct dload_payload {
 | 
			
		||||
	int allow_resume;
 | 
			
		||||
	int errors_ok;
 | 
			
		||||
	int unlink_on_fail;
 | 
			
		||||
	alpm_list_t *servers;
 | 
			
		||||
	int trust_remote_name;
 | 
			
		||||
	int cb_initialized;
 | 
			
		||||
#ifdef HAVE_LIBCURL
 | 
			
		||||
	CURLcode curlerr;       /* last error produced by curl */
 | 
			
		||||
#endif
 | 
			
		||||
	long respcode;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
void _alpm_dload_payload_reset(struct dload_payload *payload);
 | 
			
		||||
void _alpm_dload_payload_reset_for_retry(struct dload_payload *payload);
 | 
			
		||||
 | 
			
		||||
int _alpm_download(struct dload_payload *payload, const char *localpath,
 | 
			
		||||
		char **final_file, char **final_url);
 | 
			
		||||
		char **final_file, const char **final_url);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_DLOAD_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_DLOAD_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  error.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -100,6 +100,8 @@ const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
 | 
			
		||||
			return _("operation not compatible with the transaction type");
 | 
			
		||||
		case ALPM_ERR_TRANS_NOT_LOCKED:
 | 
			
		||||
			return _("transaction commit attempt when database is not locked");
 | 
			
		||||
		case ALPM_ERR_TRANS_HOOK_FAILED:
 | 
			
		||||
			return _("failed to run transaction hooks");
 | 
			
		||||
		/* Packages */
 | 
			
		||||
		case ALPM_ERR_PKG_NOT_FOUND:
 | 
			
		||||
			return _("could not find or read package");
 | 
			
		||||
@@ -111,6 +113,8 @@ const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
 | 
			
		||||
			return _("invalid or corrupted package (checksum)");
 | 
			
		||||
		case ALPM_ERR_PKG_INVALID_SIG:
 | 
			
		||||
			return _("invalid or corrupted package (PGP signature)");
 | 
			
		||||
		case ALPM_ERR_PKG_MISSING_SIG:
 | 
			
		||||
			return _("package missing required signature");
 | 
			
		||||
		case ALPM_ERR_PKG_OPEN:
 | 
			
		||||
			return _("cannot open package file");
 | 
			
		||||
		case ALPM_ERR_PKG_CANT_REMOVE:
 | 
			
		||||
@@ -160,5 +164,3 @@ const char SYMEXPORT *alpm_strerror(alpm_errno_t err)
 | 
			
		||||
			return _("unexpected error");
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  filelist.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2012-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2012-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -25,199 +25,6 @@
 | 
			
		||||
#include "filelist.h"
 | 
			
		||||
#include "util.h"
 | 
			
		||||
 | 
			
		||||
/** Helper function for comparing strings when sorting */
 | 
			
		||||
static int _alpm_filelist_strcmp(const void *s1, const void *s2)
 | 
			
		||||
{
 | 
			
		||||
	return strcmp(*(char **)s1, *(char **)s2);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* TODO make sure callers check the return value so we can bail on errors.
 | 
			
		||||
 * For now we soldier on as best we can, skipping paths that are too long to
 | 
			
		||||
 * resolve and using the original filenames on memory errors.  */
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Resolves a symlink and its children.
 | 
			
		||||
 *
 | 
			
		||||
 * @attention Pre-condition: files must be sorted!
 | 
			
		||||
 *
 | 
			
		||||
 * @param files filelist to resolve
 | 
			
		||||
 * @param i pointer to the index in files to start processing, will point to
 | 
			
		||||
 * the last file processed on return
 | 
			
		||||
 * @param path absolute path for the symlink being resolved
 | 
			
		||||
 * @param root_len length of the root portion of path
 | 
			
		||||
 * @param resolving is file \i in \files a symlink that needs to be resolved
 | 
			
		||||
 *
 | 
			
		||||
 * @return 0 on success, -1 on error
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_filelist_resolve_link(alpm_filelist_t *files, size_t *i,
 | 
			
		||||
		char *path, size_t root_len, int resolving)
 | 
			
		||||
{
 | 
			
		||||
	char *causal_dir = NULL; /* symlink being resolved */
 | 
			
		||||
	char *filename_r = NULL; /* resolved filename */
 | 
			
		||||
	size_t causal_dir_len = 0, causal_dir_r_len = 0;
 | 
			
		||||
 | 
			
		||||
	if(resolving) {
 | 
			
		||||
		/* deal with the symlink being resolved */
 | 
			
		||||
		MALLOC(filename_r, PATH_MAX, goto error);
 | 
			
		||||
		causal_dir = files->files[*i].name;
 | 
			
		||||
		causal_dir_len = strlen(causal_dir);
 | 
			
		||||
		if(realpath(path, filename_r) == NULL) {
 | 
			
		||||
			files->resolved_path[*i] = causal_dir;
 | 
			
		||||
			FREE(filename_r);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
		causal_dir_r_len = strlen(filename_r + root_len) + 1;
 | 
			
		||||
		if(causal_dir_r_len >= PATH_MAX) {
 | 
			
		||||
			files->resolved_path[*i] = causal_dir;
 | 
			
		||||
			FREE(filename_r);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
		/* remove root_r from filename_r */
 | 
			
		||||
		memmove(filename_r, filename_r + root_len, causal_dir_r_len);
 | 
			
		||||
		filename_r[causal_dir_r_len - 1] = '/';
 | 
			
		||||
		filename_r[causal_dir_r_len] = '\0';
 | 
			
		||||
		STRDUP(files->resolved_path[*i], filename_r, goto error);
 | 
			
		||||
		(*i)++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for(; *i < files->count; (*i)++) {
 | 
			
		||||
		char *filename = files->files[*i].name;
 | 
			
		||||
		size_t filename_len = strlen(filename);
 | 
			
		||||
		size_t filename_r_len = filename_len;
 | 
			
		||||
		struct stat sbuf;
 | 
			
		||||
		int exists;
 | 
			
		||||
 | 
			
		||||
		if(resolving) {
 | 
			
		||||
			if(filename_len < causal_dir_len || strncmp(filename, causal_dir, causal_dir_len) != 0) {
 | 
			
		||||
				/* not inside causal_dir anymore */
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			filename_r_len = filename_len + causal_dir_r_len - causal_dir_len;
 | 
			
		||||
			if(filename_r_len >= PATH_MAX) {
 | 
			
		||||
				/* resolved path is too long */
 | 
			
		||||
				files->resolved_path[*i] = filename;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			strcpy(filename_r + causal_dir_r_len, filename + causal_dir_len);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* deal with files and paths too long to resolve*/
 | 
			
		||||
		if(filename[filename_len - 1] != '/' || root_len + filename_r_len >= PATH_MAX) {
 | 
			
		||||
			if(resolving) {
 | 
			
		||||
				STRDUP(files->resolved_path[*i], filename_r, goto error);
 | 
			
		||||
			} else {
 | 
			
		||||
				files->resolved_path[*i] = filename;
 | 
			
		||||
			}
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* construct absolute path and stat() */
 | 
			
		||||
		strcpy(path + root_len, resolving ? filename_r : filename);
 | 
			
		||||
		exists = !_alpm_lstat(path, &sbuf);
 | 
			
		||||
 | 
			
		||||
		/* deal with symlinks */
 | 
			
		||||
		if(exists && S_ISLNK(sbuf.st_mode)) {
 | 
			
		||||
			_alpm_filelist_resolve_link(files, i, path, root_len, 1);
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* deal with normal directories */
 | 
			
		||||
		if(resolving) {
 | 
			
		||||
			STRDUP(files->resolved_path[*i], filename_r, goto error);
 | 
			
		||||
		} else {
 | 
			
		||||
			files->resolved_path[*i] = filename;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* deal with children of non-existent directories to reduce lstat() calls */
 | 
			
		||||
		if(!exists) {
 | 
			
		||||
			for((*i)++; *i < files->count; (*i)++) {
 | 
			
		||||
				char *f = files->files[*i].name;
 | 
			
		||||
				size_t f_len = strlen(f);
 | 
			
		||||
				size_t f_r_len;
 | 
			
		||||
 | 
			
		||||
				if(f_len < filename_len || strncmp(f, filename, filename_len) != 0) {
 | 
			
		||||
					/* not inside the non-existent dir anymore */
 | 
			
		||||
					break;
 | 
			
		||||
				}
 | 
			
		||||
 | 
			
		||||
				f_r_len = f_len + causal_dir_r_len - causal_dir_len;
 | 
			
		||||
				if(resolving && f_r_len <= PATH_MAX) {
 | 
			
		||||
					strcpy(filename_r + causal_dir_r_len, f + causal_dir_len);
 | 
			
		||||
					STRDUP(files->resolved_path[*i], filename_r, goto error);
 | 
			
		||||
				} else {
 | 
			
		||||
					files->resolved_path[*i] = f;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			(*i)--;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	(*i)--;
 | 
			
		||||
 | 
			
		||||
	FREE(filename_r);
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	FREE(filename_r);
 | 
			
		||||
	/* out of memory, set remaining files to their original names */
 | 
			
		||||
	for(; *i < files->count; (*i)++) {
 | 
			
		||||
		files->resolved_path[*i] = files->files[*i].name;
 | 
			
		||||
	}
 | 
			
		||||
	(*i)--;
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/**
 | 
			
		||||
 * @brief Takes a file list and resolves all directory paths according to the
 | 
			
		||||
 * filesystem
 | 
			
		||||
 *
 | 
			
		||||
 * @attention Pre-condition: files must be sorted!
 | 
			
		||||
 *
 | 
			
		||||
 * @note A symlink and directory at the same path in two difference packages
 | 
			
		||||
 * causes a conflict so the filepath can not change as packages get installed
 | 
			
		||||
 *
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
 * @param files list of files to resolve
 | 
			
		||||
 *
 | 
			
		||||
 * @return 0 on success, -1 on error
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_filelist_resolve(alpm_handle_t *handle, alpm_filelist_t *files)
 | 
			
		||||
{
 | 
			
		||||
	char path[PATH_MAX];
 | 
			
		||||
	size_t root_len, i = 0;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	if(!files || files->resolved_path) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	CALLOC(files->resolved_path, files->count, sizeof(char *), return -1);
 | 
			
		||||
 | 
			
		||||
	/* not much point in going on if we can't even resolve root */
 | 
			
		||||
	if(realpath(handle->root, path) == NULL){
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	root_len = strlen(path);
 | 
			
		||||
	if(root_len + 1 >= PATH_MAX) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
	/* append '/' if root is not "/" */
 | 
			
		||||
	if(path[root_len - 1] != '/') {
 | 
			
		||||
		path[root_len] = '/';
 | 
			
		||||
		root_len++;
 | 
			
		||||
		path[root_len] = '\0';
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ret = _alpm_filelist_resolve_link(files, &i, path, root_len, 0);
 | 
			
		||||
 | 
			
		||||
	qsort(files->resolved_path, files->count, sizeof(char *),
 | 
			
		||||
			_alpm_filelist_strcmp);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
/* Returns the difference of the provided two lists of files.
 | 
			
		||||
 * Pre-condition: both lists are sorted!
 | 
			
		||||
 * When done, free the list but NOT the contained data.
 | 
			
		||||
@@ -229,8 +36,8 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
 | 
			
		||||
	size_t ctrA = 0, ctrB = 0;
 | 
			
		||||
 | 
			
		||||
	while(ctrA < filesA->count && ctrB < filesB->count) {
 | 
			
		||||
		char *strA = filesA->resolved_path[ctrA];
 | 
			
		||||
		char *strB = filesB->resolved_path[ctrB];
 | 
			
		||||
		char *strA = filesA->files[ctrA].name;
 | 
			
		||||
		char *strB = filesB->files[ctrB].name;
 | 
			
		||||
 | 
			
		||||
		int cmp = strcmp(strA, strB);
 | 
			
		||||
		if(cmp < 0) {
 | 
			
		||||
@@ -247,13 +54,30 @@ alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
 | 
			
		||||
 | 
			
		||||
	/* ensure we have completely emptied pA */
 | 
			
		||||
	while(ctrA < filesA->count) {
 | 
			
		||||
		ret = alpm_list_add(ret, filesA->resolved_path[ctrA]);
 | 
			
		||||
		ret = alpm_list_add(ret, filesA->files[ctrA].name);
 | 
			
		||||
		ctrA++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_filelist_pathcmp(const char *p1, const char *p2)
 | 
			
		||||
{
 | 
			
		||||
	while(*p1 && *p1 == *p2) {
 | 
			
		||||
		p1++;
 | 
			
		||||
		p2++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* skip trailing '/' */
 | 
			
		||||
	if(*p1 == '\0' && *p2 == '/') {
 | 
			
		||||
		p2++;
 | 
			
		||||
	} else if(*p2 == '\0' && *p1 == '/') {
 | 
			
		||||
		p1++;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return *p1 - *p2;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* Returns the intersection of the provided two lists of files.
 | 
			
		||||
 * Pre-condition: both lists are sorted!
 | 
			
		||||
 * When done, free the list but NOT the contained data.
 | 
			
		||||
@@ -263,52 +87,23 @@ alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *ret = NULL;
 | 
			
		||||
	size_t ctrA = 0, ctrB = 0;
 | 
			
		||||
	alpm_file_t *arrA = filesA->files, *arrB = filesB->files;
 | 
			
		||||
 | 
			
		||||
	while(ctrA < filesA->count && ctrB < filesB->count) {
 | 
			
		||||
		int cmp, isdirA, isdirB;
 | 
			
		||||
		char *strA, *strB;
 | 
			
		||||
 | 
			
		||||
		isdirA = 0;
 | 
			
		||||
		strA = filesA->resolved_path[ctrA];
 | 
			
		||||
		if(strA[strlen(strA)-1] == '/') {
 | 
			
		||||
			isdirA = 1;
 | 
			
		||||
			strA = strndup(filesA->resolved_path[ctrA], strlen(strA)-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		isdirB = 0;
 | 
			
		||||
		strB = filesB->resolved_path[ctrB];
 | 
			
		||||
		if(strB[strlen(strB)-1] == '/') {
 | 
			
		||||
			isdirB = 1;
 | 
			
		||||
			strB = strndup(filesB->resolved_path[ctrB], strlen(strB)-1);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		cmp = strcmp(strA, strB);
 | 
			
		||||
		const char *strA = arrA[ctrA].name, *strB = arrB[ctrB].name;
 | 
			
		||||
		int cmp = _alpm_filelist_pathcmp(strA, strB);
 | 
			
		||||
		if(cmp < 0) {
 | 
			
		||||
			ctrA++;
 | 
			
		||||
		} else if(cmp > 0) {
 | 
			
		||||
			ctrB++;
 | 
			
		||||
		} else {
 | 
			
		||||
			/* TODO: this creates conflicts between a symlink to a directory in
 | 
			
		||||
			 * one package and a real directory in the other. For example,
 | 
			
		||||
			 * lib -> /usr/lib in pkg1 and /lib in pkg2.  This would be allowed
 | 
			
		||||
			 * when installing one package at a time _provided_ pkg1 is installed
 | 
			
		||||
			 * first. This will need adjusted if the order of package install can
 | 
			
		||||
			 * be guaranteed to install the symlink first */
 | 
			
		||||
 | 
			
		||||
			/* when not directories, item in both qualifies as an intersect */
 | 
			
		||||
			if(! (isdirA && isdirB)) {
 | 
			
		||||
				ret = alpm_list_add(ret, filesA->resolved_path[ctrA]);
 | 
			
		||||
			if(strA[strlen(strA) - 1] != '/' || strB[strlen(strB) - 1] != '/') {
 | 
			
		||||
				ret = alpm_list_add(ret, arrA[ctrA].name);
 | 
			
		||||
			}
 | 
			
		||||
			ctrA++;
 | 
			
		||||
			ctrB++;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(isdirA) {
 | 
			
		||||
			free(strA);
 | 
			
		||||
		}
 | 
			
		||||
		if(isdirB) {
 | 
			
		||||
			free(strB);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
@@ -316,18 +111,17 @@ alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
 | 
			
		||||
 | 
			
		||||
/* Helper function for comparing files list entries
 | 
			
		||||
 */
 | 
			
		||||
int _alpm_files_cmp(const void *f1, const void *f2)
 | 
			
		||||
static int _alpm_files_cmp(const void *f1, const void *f2)
 | 
			
		||||
{
 | 
			
		||||
	const alpm_file_t *file1 = f1;
 | 
			
		||||
	const alpm_file_t *file2 = f2;
 | 
			
		||||
	return strcmp(file1->name, file2->name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
char SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
 | 
			
		||||
alpm_file_t SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
 | 
			
		||||
		const char *path)
 | 
			
		||||
{
 | 
			
		||||
	alpm_file_t key, *match;
 | 
			
		||||
	alpm_file_t key;
 | 
			
		||||
 | 
			
		||||
	if(!filelist) {
 | 
			
		||||
		return NULL;
 | 
			
		||||
@@ -335,17 +129,19 @@ char SYMEXPORT *alpm_filelist_contains(alpm_filelist_t *filelist,
 | 
			
		||||
 | 
			
		||||
	key.name = (char *)path;
 | 
			
		||||
 | 
			
		||||
	match = bsearch(&key, filelist->files, filelist->count,
 | 
			
		||||
	return bsearch(&key, filelist->files, filelist->count,
 | 
			
		||||
			sizeof(alpm_file_t), _alpm_files_cmp);
 | 
			
		||||
 | 
			
		||||
	if(match) {
 | 
			
		||||
		return match->name;
 | 
			
		||||
	} else if(filelist->resolved_path) {
 | 
			
		||||
		return bsearch(&path, filelist->resolved_path, filelist->count,
 | 
			
		||||
				sizeof(char *), _alpm_filelist_strcmp);
 | 
			
		||||
	} else {
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
void _alpm_filelist_sort(alpm_filelist_t *filelist)
 | 
			
		||||
{
 | 
			
		||||
	size_t i;
 | 
			
		||||
	for(i = 1; i < filelist->count; i++) {
 | 
			
		||||
		if(strcmp(filelist->files[i - 1].name, filelist->files[i].name) > 0) {
 | 
			
		||||
			/* filelist is not pre-sorted */
 | 
			
		||||
			qsort(filelist->files, filelist->count,
 | 
			
		||||
					sizeof(alpm_file_t), _alpm_files_cmp);
 | 
			
		||||
			return;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  filelist.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2012-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2012-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -16,23 +16,17 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_FILELIST_H
 | 
			
		||||
#define _ALPM_FILELIST_H
 | 
			
		||||
#ifndef ALPM_FILELIST_H
 | 
			
		||||
#define ALPM_FILELIST_H
 | 
			
		||||
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
 | 
			
		||||
int _alpm_filelist_resolve_link(alpm_filelist_t *files, size_t *i,
 | 
			
		||||
		char *path, size_t root_len, int resolving);
 | 
			
		||||
int _alpm_filelist_resolve(alpm_handle_t *handle, alpm_filelist_t *files);
 | 
			
		||||
 | 
			
		||||
alpm_list_t *_alpm_filelist_difference(alpm_filelist_t *filesA,
 | 
			
		||||
		alpm_filelist_t *filesB);
 | 
			
		||||
 | 
			
		||||
alpm_list_t *_alpm_filelist_intersection(alpm_filelist_t *filesA,
 | 
			
		||||
		alpm_filelist_t *filesB);
 | 
			
		||||
 | 
			
		||||
int _alpm_files_cmp(const void *f1, const void *f2);
 | 
			
		||||
void _alpm_filelist_sort(alpm_filelist_t *filelist);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_FILELIST_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_FILELIST_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  graph.c - helpful graph structure and setup/teardown methods
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2007-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2007-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -31,9 +31,8 @@ alpm_graph_t *_alpm_graph_new(void)
 | 
			
		||||
 | 
			
		||||
void _alpm_graph_free(void *data)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(data != NULL, return);
 | 
			
		||||
	alpm_graph_t *graph = data;
 | 
			
		||||
	alpm_list_free(graph->children);
 | 
			
		||||
	free(graph);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  graph.h - helpful graph structure and setup/teardown methods
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2007-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2007-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
@@ -16,25 +16,29 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_GRAPH_H
 | 
			
		||||
#define _ALPM_GRAPH_H
 | 
			
		||||
#ifndef ALPM_GRAPH_H
 | 
			
		||||
#define ALPM_GRAPH_H
 | 
			
		||||
 | 
			
		||||
#include <sys/types.h> /* off_t */
 | 
			
		||||
 | 
			
		||||
#include "alpm_list.h"
 | 
			
		||||
 | 
			
		||||
enum __alpm_graph_vertex_state {
 | 
			
		||||
	ALPM_GRAPH_STATE_UNPROCESSED,
 | 
			
		||||
	ALPM_GRAPH_STATE_PROCESSING,
 | 
			
		||||
	ALPM_GRAPH_STATE_PROCESSED
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
typedef struct __alpm_graph_t {
 | 
			
		||||
	char state; /* 0: untouched, -1: entered, other: leaving time */
 | 
			
		||||
	off_t weight; /* weight of the node */
 | 
			
		||||
	void *data;
 | 
			
		||||
	struct __alpm_graph_t *parent; /* where did we come from? */
 | 
			
		||||
	alpm_list_t *children;
 | 
			
		||||
	alpm_list_t *childptr; /* points to a child in children list */
 | 
			
		||||
	alpm_list_t *iterator; /* used for DFS without recursion */
 | 
			
		||||
	off_t weight; /* weight of the node */
 | 
			
		||||
	enum __alpm_graph_vertex_state state;
 | 
			
		||||
} alpm_graph_t;
 | 
			
		||||
 | 
			
		||||
alpm_graph_t *_alpm_graph_new(void);
 | 
			
		||||
void _alpm_graph_free(void *data);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_GRAPH_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_GRAPH_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  group.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -49,5 +49,3 @@ void _alpm_group_free(alpm_group_t *grp)
 | 
			
		||||
	alpm_list_free(grp->packages);
 | 
			
		||||
	FREE(grp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  group.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,14 +17,12 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_GROUP_H
 | 
			
		||||
#define _ALPM_GROUP_H
 | 
			
		||||
#ifndef ALPM_GROUP_H
 | 
			
		||||
#define ALPM_GROUP_H
 | 
			
		||||
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
 | 
			
		||||
alpm_group_t *_alpm_group_new(const char *name);
 | 
			
		||||
void _alpm_group_free(alpm_group_t *grp);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_GROUP_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_GROUP_H */
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  handle.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *  Copyright (c) 2005 by Aurelien Foret <orelien@chez.com>
 | 
			
		||||
 *  Copyright (c) 2005, 2006 by Miklos Vajna <vmiklos@frugalware.org>
 | 
			
		||||
@@ -37,6 +37,7 @@
 | 
			
		||||
#include "delta.h"
 | 
			
		||||
#include "trans.h"
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
#include "deps.h"
 | 
			
		||||
 | 
			
		||||
alpm_handle_t *_alpm_handle_new(void)
 | 
			
		||||
{
 | 
			
		||||
@@ -44,6 +45,7 @@ alpm_handle_t *_alpm_handle_new(void)
 | 
			
		||||
 | 
			
		||||
	CALLOC(handle, 1, sizeof(alpm_handle_t), return NULL);
 | 
			
		||||
	handle->deltaratio = 0.0;
 | 
			
		||||
	handle->lockfd = -1;
 | 
			
		||||
 | 
			
		||||
	return handle;
 | 
			
		||||
}
 | 
			
		||||
@@ -69,33 +71,42 @@ void _alpm_handle_free(alpm_handle_t *handle)
 | 
			
		||||
	curl_easy_cleanup(handle->curl);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_LIBGPGME
 | 
			
		||||
	FREELIST(handle->known_keys);
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	regfree(&handle->delta_regex);
 | 
			
		||||
 | 
			
		||||
	/* free memory */
 | 
			
		||||
	_alpm_trans_free(handle->trans);
 | 
			
		||||
	FREE(handle->root);
 | 
			
		||||
	FREE(handle->dbpath);
 | 
			
		||||
	FREE(handle->dbext);
 | 
			
		||||
	FREELIST(handle->cachedirs);
 | 
			
		||||
	FREELIST(handle->hookdirs);
 | 
			
		||||
	FREE(handle->logfile);
 | 
			
		||||
	FREE(handle->lockfile);
 | 
			
		||||
	FREE(handle->arch);
 | 
			
		||||
	FREE(handle->gpgdir);
 | 
			
		||||
	FREELIST(handle->dbs_sync);
 | 
			
		||||
	FREELIST(handle->noupgrade);
 | 
			
		||||
	FREELIST(handle->noextract);
 | 
			
		||||
	FREELIST(handle->ignorepkg);
 | 
			
		||||
	FREELIST(handle->ignoregroup);
 | 
			
		||||
	FREELIST(handle->overwrite_files);
 | 
			
		||||
 | 
			
		||||
	alpm_list_free_inner(handle->assumeinstalled, (alpm_list_fn_free)alpm_dep_free);
 | 
			
		||||
	alpm_list_free(handle->assumeinstalled);
 | 
			
		||||
 | 
			
		||||
	FREE(handle);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Lock the database */
 | 
			
		||||
int _alpm_handle_lock(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	int fd;
 | 
			
		||||
	char *dir, *ptr;
 | 
			
		||||
 | 
			
		||||
	ASSERT(handle->lockfile != NULL, return -1);
 | 
			
		||||
	ASSERT(handle->lckstream == NULL, return 0);
 | 
			
		||||
	ASSERT(handle->lockfd < 0, return 0);
 | 
			
		||||
 | 
			
		||||
	/* create the dir of the lockfile first */
 | 
			
		||||
	dir = strdup(handle->lockfile);
 | 
			
		||||
@@ -110,31 +121,52 @@ int _alpm_handle_lock(alpm_handle_t *handle)
 | 
			
		||||
	FREE(dir);
 | 
			
		||||
 | 
			
		||||
	do {
 | 
			
		||||
		fd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL, 0000);
 | 
			
		||||
	} while(fd == -1 && errno == EINTR);
 | 
			
		||||
	if(fd >= 0) {
 | 
			
		||||
		FILE *f = fdopen(fd, "w");
 | 
			
		||||
		fprintf(f, "%ld\n", (long)getpid());
 | 
			
		||||
		fflush(f);
 | 
			
		||||
		fsync(fd);
 | 
			
		||||
		handle->lckstream = f;
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
	return -1;
 | 
			
		||||
		handle->lockfd = open(handle->lockfile, O_WRONLY | O_CREAT | O_EXCL | O_CLOEXEC, 0000);
 | 
			
		||||
	} while(handle->lockfd == -1 && errno == EINTR);
 | 
			
		||||
 | 
			
		||||
	return (handle->lockfd >= 0 ? 0 : -1);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Remove the database lock file
 | 
			
		||||
 * @param handle the context handle
 | 
			
		||||
 * @return 0 on success, -1 on error
 | 
			
		||||
 *
 | 
			
		||||
 * @note Safe to call from inside signal handlers.
 | 
			
		||||
 */
 | 
			
		||||
int SYMEXPORT alpm_unlock(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(handle != NULL, return -1);
 | 
			
		||||
	ASSERT(handle->lockfile != NULL, return 0);
 | 
			
		||||
	ASSERT(handle->lockfd >= 0, return 0);
 | 
			
		||||
 | 
			
		||||
	close(handle->lockfd);
 | 
			
		||||
	handle->lockfd = -1;
 | 
			
		||||
 | 
			
		||||
	if(unlink(handle->lockfile) != 0) {
 | 
			
		||||
		RET_ERR_ASYNC_SAFE(handle, ALPM_ERR_SYSTEM, -1);
 | 
			
		||||
	} else {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/** Remove a lock file */
 | 
			
		||||
int _alpm_handle_unlock(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	ASSERT(handle->lockfile != NULL, return -1);
 | 
			
		||||
	ASSERT(handle->lckstream != NULL, return 0);
 | 
			
		||||
 | 
			
		||||
	fclose(handle->lckstream);
 | 
			
		||||
	handle->lckstream = NULL;
 | 
			
		||||
 | 
			
		||||
	if(unlink(handle->lockfile) && errno != ENOENT) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	if(alpm_unlock(handle) != 0) {
 | 
			
		||||
		if(errno == ENOENT) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
					_("lock file missing %s\n"), handle->lockfile);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"warning: lock file missing %s\n", handle->lockfile);
 | 
			
		||||
			return 0;
 | 
			
		||||
		} else {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
					_("could not remove lock file %s\n"), handle->lockfile);
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX,
 | 
			
		||||
					"warning: could not remove lock file %s\n", handle->lockfile);
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -193,6 +225,12 @@ const char SYMEXPORT *alpm_option_get_dbpath(alpm_handle_t *handle)
 | 
			
		||||
	return handle->dbpath;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_option_get_hookdirs(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
	return handle->hookdirs;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_option_get_cachedirs(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
@@ -247,6 +285,18 @@ alpm_list_t SYMEXPORT *alpm_option_get_ignoregroups(alpm_handle_t *handle)
 | 
			
		||||
	return handle->ignoregroup;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_option_get_overwrite_files(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
	return handle->overwrite_files;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_list_t SYMEXPORT *alpm_option_get_assumeinstalled(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
	return handle->assumeinstalled;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char SYMEXPORT *alpm_option_get_arch(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
@@ -265,6 +315,12 @@ int SYMEXPORT alpm_option_get_checkspace(alpm_handle_t *handle)
 | 
			
		||||
	return handle->checkspace;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
const char SYMEXPORT *alpm_option_get_dbext(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return NULL);
 | 
			
		||||
	return handle->dbext;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_logcb(alpm_handle_t *handle, alpm_cb_log cb)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
@@ -361,6 +417,58 @@ alpm_errno_t _alpm_set_directory_option(const char *value,
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_hookdir(alpm_handle_t *handle, const char *hookdir)
 | 
			
		||||
{
 | 
			
		||||
	char *newhookdir;
 | 
			
		||||
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	ASSERT(hookdir != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
 | 
			
		||||
	newhookdir = canonicalize_path(hookdir);
 | 
			
		||||
	if(!newhookdir) {
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_MEMORY, -1);
 | 
			
		||||
	}
 | 
			
		||||
	handle->hookdirs = alpm_list_add(handle->hookdirs, newhookdir);
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "option 'hookdir' = %s\n", newhookdir);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_hookdirs(alpm_handle_t *handle, alpm_list_t *hookdirs)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->hookdirs) {
 | 
			
		||||
		FREELIST(handle->hookdirs);
 | 
			
		||||
	}
 | 
			
		||||
	for(i = hookdirs; i; i = i->next) {
 | 
			
		||||
		int ret = alpm_option_add_hookdir(handle, i->data);
 | 
			
		||||
		if(ret) {
 | 
			
		||||
			return ret;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_hookdir(alpm_handle_t *handle, const char *hookdir)
 | 
			
		||||
{
 | 
			
		||||
	char *vdata = NULL;
 | 
			
		||||
	char *newhookdir;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	ASSERT(hookdir != NULL, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
 | 
			
		||||
	newhookdir = canonicalize_path(hookdir);
 | 
			
		||||
	if(!newhookdir) {
 | 
			
		||||
		RET_ERR(handle, ALPM_ERR_MEMORY, -1);
 | 
			
		||||
	}
 | 
			
		||||
	handle->hookdirs = alpm_list_remove_str(handle->hookdirs, newhookdir, &vdata);
 | 
			
		||||
	FREE(newhookdir);
 | 
			
		||||
	if(vdata != NULL) {
 | 
			
		||||
		FREE(vdata);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_cachedir(alpm_handle_t *handle, const char *cachedir)
 | 
			
		||||
{
 | 
			
		||||
	char *newcachedir;
 | 
			
		||||
@@ -425,7 +533,7 @@ int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	handle->logfile = strdup(logfile);
 | 
			
		||||
	STRDUP(handle->logfile, logfile, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
 | 
			
		||||
	/* free the old logfile path string, and close the stream so logaction
 | 
			
		||||
	 * will reopen a new stream on the new logfile */
 | 
			
		||||
@@ -442,17 +550,11 @@ int SYMEXPORT alpm_option_set_logfile(alpm_handle_t *handle, const char *logfile
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_gpgdir(alpm_handle_t *handle, const char *gpgdir)
 | 
			
		||||
{
 | 
			
		||||
	int err;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(!gpgdir) {
 | 
			
		||||
		handle->pm_errno = ALPM_ERR_WRONG_ARGS;
 | 
			
		||||
		return -1;
 | 
			
		||||
	if((err = _alpm_set_directory_option(gpgdir, &(handle->gpgdir), 0))) {
 | 
			
		||||
		RET_ERR(handle, err, -1);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(handle->gpgdir) {
 | 
			
		||||
		FREE(handle->gpgdir);
 | 
			
		||||
	}
 | 
			
		||||
	handle->gpgdir = strdup(gpgdir);
 | 
			
		||||
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "option 'gpgdir' = %s\n", handle->gpgdir);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
@@ -464,111 +566,184 @@ int SYMEXPORT alpm_option_set_usesyslog(alpm_handle_t *handle, int usesyslog)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
static int _alpm_option_strlist_add(alpm_handle_t *handle, alpm_list_t **list, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	char *dup;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	STRDUP(dup, str, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
	*list = alpm_list_add(*list, dup);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_option_strlist_set(alpm_handle_t *handle, alpm_list_t **list, alpm_list_t *newlist)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->noupgrade = alpm_list_add(handle->noupgrade, strdup(pkg));
 | 
			
		||||
	FREELIST(*list);
 | 
			
		||||
	*list = alpm_list_strdup(newlist);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_option_strlist_rem(alpm_handle_t *handle, alpm_list_t **list, const char *str)
 | 
			
		||||
{
 | 
			
		||||
	char *vdata = NULL;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	*list = alpm_list_remove_str(*list, str, &vdata);
 | 
			
		||||
	if(vdata != NULL) {
 | 
			
		||||
		FREE(vdata);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_noupgrade(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_option_strlist_add(handle, &(handle->noupgrade), pkg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_noupgrades(alpm_handle_t *handle, alpm_list_t *noupgrade)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->noupgrade) FREELIST(handle->noupgrade);
 | 
			
		||||
	handle->noupgrade = alpm_list_strdup(noupgrade);
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_set(handle, &(handle->noupgrade), noupgrade);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_noupgrade(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
{
 | 
			
		||||
	char *vdata = NULL;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->noupgrade = alpm_list_remove_str(handle->noupgrade, pkg, &vdata);
 | 
			
		||||
	if(vdata != NULL) {
 | 
			
		||||
		FREE(vdata);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_rem(handle, &(handle->noupgrade), pkg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_noextract(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
int SYMEXPORT alpm_option_match_noupgrade(alpm_handle_t *handle, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->noextract = alpm_list_add(handle->noextract, strdup(pkg));
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_fnmatch_patterns(handle->noupgrade, path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_noextract(alpm_handle_t *handle, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_option_strlist_add(handle, &(handle->noextract), path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_noextracts(alpm_handle_t *handle, alpm_list_t *noextract)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->noextract) FREELIST(handle->noextract);
 | 
			
		||||
	handle->noextract = alpm_list_strdup(noextract);
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_set(handle, &(handle->noextract), noextract);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_noextract(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
int SYMEXPORT alpm_option_remove_noextract(alpm_handle_t *handle, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	char *vdata = NULL;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->noextract = alpm_list_remove_str(handle->noextract, pkg, &vdata);
 | 
			
		||||
	if(vdata != NULL) {
 | 
			
		||||
		FREE(vdata);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_rem(handle, &(handle->noextract), path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_match_noextract(alpm_handle_t *handle, const char *path)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_fnmatch_patterns(handle->noextract, path);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_ignorepkg(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->ignorepkg = alpm_list_add(handle->ignorepkg, strdup(pkg));
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_add(handle, &(handle->ignorepkg), pkg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_ignorepkgs(alpm_handle_t *handle, alpm_list_t *ignorepkgs)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->ignorepkg) FREELIST(handle->ignorepkg);
 | 
			
		||||
	handle->ignorepkg = alpm_list_strdup(ignorepkgs);
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_set(handle, &(handle->ignorepkg), ignorepkgs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_ignorepkg(alpm_handle_t *handle, const char *pkg)
 | 
			
		||||
{
 | 
			
		||||
	char *vdata = NULL;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->ignorepkg = alpm_list_remove_str(handle->ignorepkg, pkg, &vdata);
 | 
			
		||||
	if(vdata != NULL) {
 | 
			
		||||
		FREE(vdata);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_rem(handle, &(handle->ignorepkg), pkg);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_ignoregroup(alpm_handle_t *handle, const char *grp)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->ignoregroup = alpm_list_add(handle->ignoregroup, strdup(grp));
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_add(handle, &(handle->ignoregroup), grp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_ignoregroups(alpm_handle_t *handle, alpm_list_t *ignoregrps)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->ignoregroup) FREELIST(handle->ignoregroup);
 | 
			
		||||
	handle->ignoregroup = alpm_list_strdup(ignoregrps);
 | 
			
		||||
	return 0;
 | 
			
		||||
	return _alpm_option_strlist_set(handle, &(handle->ignoregroup), ignoregrps);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_ignoregroup(alpm_handle_t *handle, const char *grp)
 | 
			
		||||
{
 | 
			
		||||
	char *vdata = NULL;
 | 
			
		||||
	return _alpm_option_strlist_rem(handle, &(handle->ignoregroup), grp);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_overwrite_file(alpm_handle_t *handle, const char *glob)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_option_strlist_add(handle, &(handle->overwrite_files), glob);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_overwrite_files(alpm_handle_t *handle, alpm_list_t *globs)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_option_strlist_set(handle, &(handle->overwrite_files), globs);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_overwrite_file(alpm_handle_t *handle, const char *glob)
 | 
			
		||||
{
 | 
			
		||||
	return _alpm_option_strlist_rem(handle, &(handle->overwrite_files), glob);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_add_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep)
 | 
			
		||||
{
 | 
			
		||||
	alpm_depend_t *depcpy;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	handle->ignoregroup = alpm_list_remove_str(handle->ignoregroup, grp, &vdata);
 | 
			
		||||
	ASSERT(dep->mod == ALPM_DEP_MOD_EQ || dep->mod == ALPM_DEP_MOD_ANY,
 | 
			
		||||
			RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
	ASSERT((depcpy = _alpm_dep_dup(dep)), RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
 | 
			
		||||
	/* fill in name_hash in case dep was built by hand */
 | 
			
		||||
	depcpy->name_hash = _alpm_hash_sdbm(dep->name);
 | 
			
		||||
	handle->assumeinstalled = alpm_list_add(handle->assumeinstalled, depcpy);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_assumeinstalled(alpm_handle_t *handle, alpm_list_t *deps)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->assumeinstalled) {
 | 
			
		||||
		alpm_list_free_inner(handle->assumeinstalled, (alpm_list_fn_free)alpm_dep_free);
 | 
			
		||||
		alpm_list_free(handle->assumeinstalled);
 | 
			
		||||
	}
 | 
			
		||||
	while(deps) {
 | 
			
		||||
		if(alpm_option_add_assumeinstalled(handle, deps->data) != 0) {
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
		deps = deps->next;
 | 
			
		||||
	}
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int assumeinstalled_cmp(const void *d1, const void *d2)
 | 
			
		||||
{
 | 
			
		||||
	const alpm_depend_t *dep1 = d1;
 | 
			
		||||
	const alpm_depend_t *dep2 = d2;
 | 
			
		||||
 | 
			
		||||
	if(dep1->name_hash != dep2->name_hash
 | 
			
		||||
			|| strcmp(dep1->name, dep2->name) != 0) {
 | 
			
		||||
		return -1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(dep1->version && dep2->version
 | 
			
		||||
			&& strcmp(dep1->version, dep2->version) == 0) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(dep1->version == NULL && dep2->version == NULL) {
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
	return -1;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_remove_assumeinstalled(alpm_handle_t *handle, const alpm_depend_t *dep)
 | 
			
		||||
{
 | 
			
		||||
	alpm_depend_t *vdata = NULL;
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
 | 
			
		||||
	handle->assumeinstalled = alpm_list_remove(handle->assumeinstalled, dep, &assumeinstalled_cmp, (void **)&vdata);
 | 
			
		||||
	if(vdata != NULL) {
 | 
			
		||||
		FREE(vdata);
 | 
			
		||||
		alpm_dep_free(vdata);
 | 
			
		||||
		return 1;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -576,11 +751,7 @@ int SYMEXPORT alpm_option_set_arch(alpm_handle_t *handle, const char *arch)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	if(handle->arch) FREE(handle->arch);
 | 
			
		||||
	if(arch) {
 | 
			
		||||
		handle->arch = strdup(arch);
 | 
			
		||||
	} else {
 | 
			
		||||
		handle->arch = NULL;
 | 
			
		||||
	}
 | 
			
		||||
	STRDUP(handle->arch, arch, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
@@ -613,8 +784,23 @@ int SYMEXPORT alpm_option_set_checkspace(alpm_handle_t *handle, int checkspace)
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_dbext(alpm_handle_t *handle, const char *dbext)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	ASSERT(dbext, RET_ERR(handle, ALPM_ERR_WRONG_ARGS, -1));
 | 
			
		||||
 | 
			
		||||
	if(handle->dbext) {
 | 
			
		||||
		FREE(handle->dbext);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	STRDUP(handle->dbext, dbext, RET_ERR(handle, ALPM_ERR_MEMORY, -1));
 | 
			
		||||
 | 
			
		||||
	_alpm_log(handle, ALPM_LOG_DEBUG, "option 'dbext' = %s\n", handle->dbext);
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle,
 | 
			
		||||
		alpm_siglevel_t level)
 | 
			
		||||
		int level)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
#ifdef HAVE_LIBGPGME
 | 
			
		||||
@@ -627,14 +813,14 @@ int SYMEXPORT alpm_option_set_default_siglevel(alpm_handle_t *handle,
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_siglevel_t SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle)
 | 
			
		||||
int SYMEXPORT alpm_option_get_default_siglevel(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	return handle->siglevel;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle,
 | 
			
		||||
		alpm_siglevel_t level)
 | 
			
		||||
		int level)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
#ifdef HAVE_LIBGPGME
 | 
			
		||||
@@ -647,14 +833,18 @@ int SYMEXPORT alpm_option_set_local_file_siglevel(alpm_handle_t *handle,
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_siglevel_t SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *handle)
 | 
			
		||||
int SYMEXPORT alpm_option_get_local_file_siglevel(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	return handle->localfilesiglevel;
 | 
			
		||||
	if(handle->localfilesiglevel & ALPM_SIG_USE_DEFAULT) {
 | 
			
		||||
		return handle->siglevel;
 | 
			
		||||
	} else {
 | 
			
		||||
		return handle->localfilesiglevel;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle,
 | 
			
		||||
		alpm_siglevel_t level)
 | 
			
		||||
		int level)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
#ifdef HAVE_LIBGPGME
 | 
			
		||||
@@ -667,10 +857,22 @@ int SYMEXPORT alpm_option_set_remote_file_siglevel(alpm_handle_t *handle,
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
alpm_siglevel_t SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle)
 | 
			
		||||
int SYMEXPORT alpm_option_get_remote_file_siglevel(alpm_handle_t *handle)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
	return handle->remotefilesiglevel;
 | 
			
		||||
	if(handle->remotefilesiglevel & ALPM_SIG_USE_DEFAULT) {
 | 
			
		||||
		return handle->siglevel;
 | 
			
		||||
	} else {
 | 
			
		||||
		return handle->remotefilesiglevel;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
int SYMEXPORT alpm_option_set_disable_dl_timeout(alpm_handle_t *handle,
 | 
			
		||||
		unsigned short disable_dl_timeout)
 | 
			
		||||
{
 | 
			
		||||
	CHECK_HANDLE(handle, return -1);
 | 
			
		||||
#ifdef HAVE_LIBCURL
 | 
			
		||||
	handle->disable_dl_timeout = disable_dl_timeout;
 | 
			
		||||
#endif
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 
 | 
			
		||||
@@ -1,7 +1,7 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  handle.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2006-2013 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2006-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *  Copyright (c) 2002-2006 by Judd Vinet <jvinet@zeroflux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
@@ -17,8 +17,8 @@
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
#ifndef _ALPM_HANDLE_H
 | 
			
		||||
#define _ALPM_HANDLE_H
 | 
			
		||||
#ifndef ALPM_HANDLE_H
 | 
			
		||||
#define ALPM_HANDLE_H
 | 
			
		||||
 | 
			
		||||
#include <stdio.h>
 | 
			
		||||
#include <sys/types.h>
 | 
			
		||||
@@ -31,16 +31,16 @@
 | 
			
		||||
#include <curl/curl.h>
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#define EVENT(h, e, d1, d2) \
 | 
			
		||||
#define EVENT(h, e) \
 | 
			
		||||
do { \
 | 
			
		||||
	if((h)->eventcb) { \
 | 
			
		||||
		(h)->eventcb(e, d1, d2); \
 | 
			
		||||
		(h)->eventcb((alpm_event_t *) (e)); \
 | 
			
		||||
	} \
 | 
			
		||||
} while(0)
 | 
			
		||||
#define QUESTION(h, q, d1, d2, d3, r) \
 | 
			
		||||
#define QUESTION(h, q) \
 | 
			
		||||
do { \
 | 
			
		||||
	if((h)->questioncb) { \
 | 
			
		||||
		(h)->questioncb(q, d1, d2, d3, r); \
 | 
			
		||||
		(h)->questioncb((alpm_question_t *) (q)); \
 | 
			
		||||
	} \
 | 
			
		||||
} while(0)
 | 
			
		||||
#define PROGRESS(h, e, p, per, n, r) \
 | 
			
		||||
@@ -52,22 +52,26 @@ do { \
 | 
			
		||||
 | 
			
		||||
struct __alpm_handle_t {
 | 
			
		||||
	/* internal usage */
 | 
			
		||||
	alpm_db_t *db_local;       /* local db pointer */
 | 
			
		||||
	alpm_db_t *db_local;    /* local db pointer */
 | 
			
		||||
	alpm_list_t *dbs_sync;  /* List of (alpm_db_t *) */
 | 
			
		||||
	FILE *logstream;        /* log file stream pointer */
 | 
			
		||||
	FILE *lckstream;        /* lock file stream pointer if one exists */
 | 
			
		||||
	alpm_trans_t *trans;
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_LIBCURL
 | 
			
		||||
	/* libcurl handle */
 | 
			
		||||
	CURL *curl;             /* reusable curl_easy handle */
 | 
			
		||||
	unsigned short disable_dl_timeout;
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
#ifdef HAVE_LIBGPGME
 | 
			
		||||
	alpm_list_t *known_keys;  /* keys verified to be in our keychain */
 | 
			
		||||
#endif
 | 
			
		||||
 | 
			
		||||
	/* callback functions */
 | 
			
		||||
	alpm_cb_log logcb;      /* Log callback function */
 | 
			
		||||
	alpm_cb_download dlcb;  /* Download callback function */
 | 
			
		||||
	alpm_cb_log logcb;          /* Log callback function */
 | 
			
		||||
	alpm_cb_download dlcb;      /* Download callback function */
 | 
			
		||||
	alpm_cb_totaldl totaldlcb;  /* Total download callback function */
 | 
			
		||||
	alpm_cb_fetch fetchcb;  /* Download file callback function */
 | 
			
		||||
	alpm_cb_fetch fetchcb;      /* Download file callback function */
 | 
			
		||||
	alpm_cb_event eventcb;
 | 
			
		||||
	alpm_cb_question questioncb;
 | 
			
		||||
	alpm_cb_progress progresscb;
 | 
			
		||||
@@ -79,27 +83,34 @@ struct __alpm_handle_t {
 | 
			
		||||
	char *lockfile;          /* Name of the lock file */
 | 
			
		||||
	char *gpgdir;            /* Directory where GnuPG files are stored */
 | 
			
		||||
	alpm_list_t *cachedirs;  /* Paths to pacman cache directories */
 | 
			
		||||
	alpm_list_t *hookdirs;   /* Paths to hook directories */
 | 
			
		||||
	alpm_list_t *overwrite_files; /* Paths that may be overwritten */
 | 
			
		||||
 | 
			
		||||
	/* package lists */
 | 
			
		||||
	alpm_list_t *noupgrade;   /* List of packages NOT to be upgraded */
 | 
			
		||||
	alpm_list_t *noextract;   /* List of files NOT to extract */
 | 
			
		||||
	alpm_list_t *ignorepkg;   /* List of packages to ignore */
 | 
			
		||||
	alpm_list_t *ignoregroup; /* List of groups to ignore */
 | 
			
		||||
	alpm_list_t *assumeinstalled;   /* List of virtual packages used to satisfy dependencies */
 | 
			
		||||
 | 
			
		||||
	/* options */
 | 
			
		||||
	char *arch;              /* Architecture of packages we should allow */
 | 
			
		||||
	double deltaratio;       /* Download deltas if possible; a ratio value */
 | 
			
		||||
	int usesyslog;           /* Use syslog instead of logfile? */ /* TODO move to frontend */
 | 
			
		||||
	int checkspace;          /* Check disk space before installing */
 | 
			
		||||
	alpm_siglevel_t siglevel;   /* Default signature verification level */
 | 
			
		||||
	alpm_siglevel_t localfilesiglevel;  /* Signature verification level for local file
 | 
			
		||||
	char *dbext;             /* Sync DB extension */
 | 
			
		||||
	int siglevel;            /* Default signature verification level */
 | 
			
		||||
	int localfilesiglevel;   /* Signature verification level for local file
 | 
			
		||||
	                                       upgrade operations */
 | 
			
		||||
	alpm_siglevel_t remotefilesiglevel; /* Signature verification level for remote file
 | 
			
		||||
	int remotefilesiglevel;  /* Signature verification level for remote file
 | 
			
		||||
	                                       upgrade operations */
 | 
			
		||||
 | 
			
		||||
	/* error code */
 | 
			
		||||
	alpm_errno_t pm_errno;
 | 
			
		||||
 | 
			
		||||
	/* lock file descriptor */
 | 
			
		||||
	int lockfd;
 | 
			
		||||
 | 
			
		||||
	/* for delta parsing efficiency */
 | 
			
		||||
	int delta_regex_compiled;
 | 
			
		||||
	regex_t delta_regex;
 | 
			
		||||
@@ -114,6 +125,4 @@ int _alpm_handle_unlock(alpm_handle_t *handle);
 | 
			
		||||
alpm_errno_t _alpm_set_directory_option(const char *value,
 | 
			
		||||
		char **storage, int must_exist);
 | 
			
		||||
 | 
			
		||||
#endif /* _ALPM_HANDLE_H */
 | 
			
		||||
 | 
			
		||||
/* vim: set ts=2 sw=2 noet: */
 | 
			
		||||
#endif /* ALPM_HANDLE_H */
 | 
			
		||||
 
 | 
			
		||||
							
								
								
									
										784
									
								
								lib/libalpm/hook.c
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										784
									
								
								lib/libalpm/hook.c
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,784 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  hook.c
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2015-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
 *  the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
 *  (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is distributed in the hope that it will be useful,
 | 
			
		||||
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 *  GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#include <ctype.h>
 | 
			
		||||
#include <dirent.h>
 | 
			
		||||
#include <errno.h>
 | 
			
		||||
#include <limits.h>
 | 
			
		||||
#include <string.h>
 | 
			
		||||
 | 
			
		||||
#include "handle.h"
 | 
			
		||||
#include "hook.h"
 | 
			
		||||
#include "ini.h"
 | 
			
		||||
#include "log.h"
 | 
			
		||||
#include "trans.h"
 | 
			
		||||
#include "util.h"
 | 
			
		||||
 | 
			
		||||
enum _alpm_hook_op_t {
 | 
			
		||||
	ALPM_HOOK_OP_INSTALL = (1 << 0),
 | 
			
		||||
	ALPM_HOOK_OP_UPGRADE = (1 << 1),
 | 
			
		||||
	ALPM_HOOK_OP_REMOVE = (1 << 2),
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
enum _alpm_trigger_type_t {
 | 
			
		||||
	ALPM_HOOK_TYPE_PACKAGE = 1,
 | 
			
		||||
	ALPM_HOOK_TYPE_FILE,
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _alpm_trigger_t {
 | 
			
		||||
	enum _alpm_hook_op_t op;
 | 
			
		||||
	enum _alpm_trigger_type_t type;
 | 
			
		||||
	alpm_list_t *targets;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _alpm_hook_t {
 | 
			
		||||
	char *name;
 | 
			
		||||
	char *desc;
 | 
			
		||||
	alpm_list_t *triggers;
 | 
			
		||||
	alpm_list_t *depends;
 | 
			
		||||
	char **cmd;
 | 
			
		||||
	alpm_list_t *matches;
 | 
			
		||||
	alpm_hook_when_t when;
 | 
			
		||||
	int abort_on_fail, needs_targets;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
struct _alpm_hook_cb_ctx {
 | 
			
		||||
	alpm_handle_t *handle;
 | 
			
		||||
	struct _alpm_hook_t *hook;
 | 
			
		||||
};
 | 
			
		||||
 | 
			
		||||
static void _alpm_trigger_free(struct _alpm_trigger_t *trigger)
 | 
			
		||||
{
 | 
			
		||||
	if(trigger) {
 | 
			
		||||
		FREELIST(trigger->targets);
 | 
			
		||||
		free(trigger);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void _alpm_wordsplit_free(char **ws)
 | 
			
		||||
{
 | 
			
		||||
	if(ws) {
 | 
			
		||||
		char **c;
 | 
			
		||||
		for(c = ws; *c; c++) {
 | 
			
		||||
			free(*c);
 | 
			
		||||
		}
 | 
			
		||||
		free(ws);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static void _alpm_hook_free(struct _alpm_hook_t *hook)
 | 
			
		||||
{
 | 
			
		||||
	if(hook) {
 | 
			
		||||
		free(hook->name);
 | 
			
		||||
		free(hook->desc);
 | 
			
		||||
		_alpm_wordsplit_free(hook->cmd);
 | 
			
		||||
		alpm_list_free_inner(hook->triggers, (alpm_list_fn_free) _alpm_trigger_free);
 | 
			
		||||
		alpm_list_free(hook->triggers);
 | 
			
		||||
		alpm_list_free(hook->matches);
 | 
			
		||||
		FREELIST(hook->depends);
 | 
			
		||||
		free(hook);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_trigger_validate(alpm_handle_t *handle,
 | 
			
		||||
		struct _alpm_trigger_t *trigger, const char *file)
 | 
			
		||||
{
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	if(trigger->targets == NULL) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("Missing trigger targets in hook: %s\n"), file);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(trigger->type == 0) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("Missing trigger type in hook: %s\n"), file);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(trigger->op == 0) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("Missing trigger operation in hook: %s\n"), file);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_validate(alpm_handle_t *handle,
 | 
			
		||||
		struct _alpm_hook_t *hook, const char *file)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	if(hook->triggers == NULL) {
 | 
			
		||||
		/* special case: allow triggerless hooks as a way of creating dummy
 | 
			
		||||
		 * hooks that can be used to mask lower priority hooks */
 | 
			
		||||
		return 0;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for(i = hook->triggers; i; i = i->next) {
 | 
			
		||||
		if(_alpm_trigger_validate(handle, i->data, file) != 0) {
 | 
			
		||||
			ret = -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(hook->cmd == NULL) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("Missing Exec option in hook: %s\n"), file);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(hook->when == 0) {
 | 
			
		||||
		ret = -1;
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
				_("Missing When option in hook: %s\n"), file);
 | 
			
		||||
	} else if(hook->when != ALPM_HOOK_PRE_TRANSACTION && hook->abort_on_fail) {
 | 
			
		||||
		_alpm_log(handle, ALPM_LOG_WARNING,
 | 
			
		||||
				_("AbortOnFail set for PostTransaction hook: %s\n"), file);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static char **_alpm_wordsplit(char *str)
 | 
			
		||||
{
 | 
			
		||||
	char *c = str, *end;
 | 
			
		||||
	char **out = NULL, **outsave;
 | 
			
		||||
	size_t count = 0;
 | 
			
		||||
 | 
			
		||||
	if(str == NULL) {
 | 
			
		||||
		errno = EINVAL;
 | 
			
		||||
		return NULL;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	for(c = str; isspace(*c); c++);
 | 
			
		||||
	while(*c) {
 | 
			
		||||
		size_t wordlen = 0;
 | 
			
		||||
 | 
			
		||||
		/* extend our array */
 | 
			
		||||
		outsave = out;
 | 
			
		||||
		if((out = realloc(out, (count + 1) * sizeof(char*))) == NULL) {
 | 
			
		||||
			out = outsave;
 | 
			
		||||
			goto error;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		/* calculate word length and check for unbalanced quotes */
 | 
			
		||||
		for(end = c; *end && !isspace(*end); end++) {
 | 
			
		||||
			if(*end == '\'' || *end == '"') {
 | 
			
		||||
				char quote = *end;
 | 
			
		||||
				while(*(++end) && *end != quote) {
 | 
			
		||||
					if(*end == '\\' && *(end + 1) == quote) {
 | 
			
		||||
						end++;
 | 
			
		||||
					}
 | 
			
		||||
					wordlen++;
 | 
			
		||||
				}
 | 
			
		||||
				if(*end != quote) {
 | 
			
		||||
					errno = EINVAL;
 | 
			
		||||
					goto error;
 | 
			
		||||
				}
 | 
			
		||||
			} else {
 | 
			
		||||
				if(*end == '\\' && (end[1] == '\'' || end[1] == '"')) {
 | 
			
		||||
					end++; /* skip the '\\' */
 | 
			
		||||
				}
 | 
			
		||||
				wordlen++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(wordlen == (size_t) (end - c)) {
 | 
			
		||||
			/* no internal quotes or escapes, copy it the easy way */
 | 
			
		||||
			if((out[count++] = strndup(c, wordlen)) == NULL) {
 | 
			
		||||
				goto error;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			/* manually copy to remove quotes and escapes */
 | 
			
		||||
			char *dest = out[count++] = malloc(wordlen + 1);
 | 
			
		||||
			if(dest == NULL) { goto error; }
 | 
			
		||||
			while(c < end) {
 | 
			
		||||
				if(*c == '\'' || *c == '"') {
 | 
			
		||||
					char quote = *c;
 | 
			
		||||
					/* we know there must be a matching end quote,
 | 
			
		||||
					 * no need to check for '\0' */
 | 
			
		||||
					for(c++; *c != quote; c++) {
 | 
			
		||||
						if(*c == '\\' && *(c + 1) == quote) {
 | 
			
		||||
							c++;
 | 
			
		||||
						}
 | 
			
		||||
						*(dest++) = *c;
 | 
			
		||||
					}
 | 
			
		||||
					c++;
 | 
			
		||||
				} else {
 | 
			
		||||
					if(*c == '\\' && (c[1] == '\'' || c[1] == '"')) {
 | 
			
		||||
						c++; /* skip the '\\' */
 | 
			
		||||
					}
 | 
			
		||||
					*(dest++) = *(c++);
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
			*dest = '\0';
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if(*end == '\0') {
 | 
			
		||||
			break;
 | 
			
		||||
		} else {
 | 
			
		||||
			for(c = end + 1; isspace(*c); c++);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	outsave = out;
 | 
			
		||||
	if((out = realloc(out, (count + 1) * sizeof(char*))) == NULL) {
 | 
			
		||||
		out = outsave;
 | 
			
		||||
		goto error;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	out[count++] = NULL;
 | 
			
		||||
 | 
			
		||||
	return out;
 | 
			
		||||
 | 
			
		||||
error:
 | 
			
		||||
	/* can't use wordsplit_free here because NULL has not been appended */
 | 
			
		||||
	while(count) {
 | 
			
		||||
		free(out[--count]);
 | 
			
		||||
	}
 | 
			
		||||
	free(out);
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_parse_cb(const char *file, int line,
 | 
			
		||||
		const char *section, char *key, char *value, void *data)
 | 
			
		||||
{
 | 
			
		||||
	struct _alpm_hook_cb_ctx *ctx = data;
 | 
			
		||||
	alpm_handle_t *handle = ctx->handle;
 | 
			
		||||
	struct _alpm_hook_t *hook = ctx->hook;
 | 
			
		||||
 | 
			
		||||
#define error(...) _alpm_log(handle, ALPM_LOG_ERROR, __VA_ARGS__); return 1;
 | 
			
		||||
#define warning(...) _alpm_log(handle, ALPM_LOG_WARNING, __VA_ARGS__);
 | 
			
		||||
 | 
			
		||||
	if(!section && !key) {
 | 
			
		||||
		error(_("error while reading hook %s: %s\n"), file, strerror(errno));
 | 
			
		||||
	} else if(!section) {
 | 
			
		||||
		error(_("hook %s line %d: invalid option %s\n"), file, line, key);
 | 
			
		||||
	} else if(!key) {
 | 
			
		||||
		/* beginning a new section */
 | 
			
		||||
		if(strcmp(section, "Trigger") == 0) {
 | 
			
		||||
			struct _alpm_trigger_t *t;
 | 
			
		||||
			CALLOC(t, sizeof(struct _alpm_trigger_t), 1, return 1);
 | 
			
		||||
			hook->triggers = alpm_list_add(hook->triggers, t);
 | 
			
		||||
		} else if(strcmp(section, "Action") == 0) {
 | 
			
		||||
			/* no special processing required */
 | 
			
		||||
		} else {
 | 
			
		||||
			error(_("hook %s line %d: invalid section %s\n"), file, line, section);
 | 
			
		||||
		}
 | 
			
		||||
	} else if(strcmp(section, "Trigger") == 0) {
 | 
			
		||||
		struct _alpm_trigger_t *t = hook->triggers->prev->data;
 | 
			
		||||
		if(strcmp(key, "Operation") == 0) {
 | 
			
		||||
			if(strcmp(value, "Install") == 0) {
 | 
			
		||||
				t->op |= ALPM_HOOK_OP_INSTALL;
 | 
			
		||||
			} else if(strcmp(value, "Upgrade") == 0) {
 | 
			
		||||
				t->op |= ALPM_HOOK_OP_UPGRADE;
 | 
			
		||||
			} else if(strcmp(value, "Remove") == 0) {
 | 
			
		||||
				t->op |= ALPM_HOOK_OP_REMOVE;
 | 
			
		||||
			} else {
 | 
			
		||||
				error(_("hook %s line %d: invalid value %s\n"), file, line, value);
 | 
			
		||||
			}
 | 
			
		||||
		} else if(strcmp(key, "Type") == 0) {
 | 
			
		||||
			if(t->type != 0) {
 | 
			
		||||
				warning(_("hook %s line %d: overwriting previous definition of %s\n"), file, line, "Type");
 | 
			
		||||
			}
 | 
			
		||||
			if(strcmp(value, "Package") == 0) {
 | 
			
		||||
				t->type = ALPM_HOOK_TYPE_PACKAGE;
 | 
			
		||||
			} else if(strcmp(value, "File") == 0) {
 | 
			
		||||
				t->type = ALPM_HOOK_TYPE_FILE;
 | 
			
		||||
			} else {
 | 
			
		||||
				error(_("hook %s line %d: invalid value %s\n"), file, line, value);
 | 
			
		||||
			}
 | 
			
		||||
		} else if(strcmp(key, "Target") == 0) {
 | 
			
		||||
			char *val;
 | 
			
		||||
			STRDUP(val, value, return 1);
 | 
			
		||||
			t->targets = alpm_list_add(t->targets, val);
 | 
			
		||||
		} else {
 | 
			
		||||
			error(_("hook %s line %d: invalid option %s\n"), file, line, key);
 | 
			
		||||
		}
 | 
			
		||||
	} else if(strcmp(section, "Action") == 0) {
 | 
			
		||||
		if(strcmp(key, "When") == 0) {
 | 
			
		||||
			if(hook->when != 0) {
 | 
			
		||||
				warning(_("hook %s line %d: overwriting previous definition of %s\n"), file, line, "When");
 | 
			
		||||
			}
 | 
			
		||||
			if(strcmp(value, "PreTransaction") == 0) {
 | 
			
		||||
				hook->when = ALPM_HOOK_PRE_TRANSACTION;
 | 
			
		||||
			} else if(strcmp(value, "PostTransaction") == 0) {
 | 
			
		||||
				hook->when = ALPM_HOOK_POST_TRANSACTION;
 | 
			
		||||
			} else {
 | 
			
		||||
				error(_("hook %s line %d: invalid value %s\n"), file, line, value);
 | 
			
		||||
			}
 | 
			
		||||
		} else if(strcmp(key, "Description") == 0) {
 | 
			
		||||
			if(hook->desc != NULL) {
 | 
			
		||||
				warning(_("hook %s line %d: overwriting previous definition of %s\n"), file, line, "Description");
 | 
			
		||||
				FREE(hook->desc);
 | 
			
		||||
			}
 | 
			
		||||
			STRDUP(hook->desc, value, return 1);
 | 
			
		||||
		} else if(strcmp(key, "Depends") == 0) {
 | 
			
		||||
			char *val;
 | 
			
		||||
			STRDUP(val, value, return 1);
 | 
			
		||||
			hook->depends = alpm_list_add(hook->depends, val);
 | 
			
		||||
		} else if(strcmp(key, "AbortOnFail") == 0) {
 | 
			
		||||
			hook->abort_on_fail = 1;
 | 
			
		||||
		} else if(strcmp(key, "NeedsTargets") == 0) {
 | 
			
		||||
			hook->needs_targets = 1;
 | 
			
		||||
		} else if(strcmp(key, "Exec") == 0) {
 | 
			
		||||
			if(hook->cmd != NULL) {
 | 
			
		||||
				warning(_("hook %s line %d: overwriting previous definition of %s\n"), file, line, "Exec");
 | 
			
		||||
				_alpm_wordsplit_free(hook->cmd);
 | 
			
		||||
			}
 | 
			
		||||
			if((hook->cmd = _alpm_wordsplit(value)) == NULL) {
 | 
			
		||||
				if(errno == EINVAL) {
 | 
			
		||||
					error(_("hook %s line %d: invalid value %s\n"), file, line, value);
 | 
			
		||||
				} else {
 | 
			
		||||
					error(_("hook %s line %d: unable to set option (%s)\n"),
 | 
			
		||||
							file, line, strerror(errno));
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			error(_("hook %s line %d: invalid option %s\n"), file, line, key);
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
#undef error
 | 
			
		||||
#undef warning
 | 
			
		||||
 | 
			
		||||
	return 0;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_trigger_match_file(alpm_handle_t *handle,
 | 
			
		||||
		struct _alpm_hook_t *hook, struct _alpm_trigger_t *t)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i, *j, *install = NULL, *upgrade = NULL, *remove = NULL;
 | 
			
		||||
	size_t isize = 0, rsize = 0;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	/* check if file will be installed */
 | 
			
		||||
	for(i = handle->trans->add; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = i->data;
 | 
			
		||||
		alpm_filelist_t filelist = pkg->files;
 | 
			
		||||
		size_t f;
 | 
			
		||||
		for(f = 0; f < filelist.count; f++) {
 | 
			
		||||
			if(alpm_option_match_noextract(handle, filelist.files[f].name) == 0) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			if(_alpm_fnmatch_patterns(t->targets, filelist.files[f].name) == 0) {
 | 
			
		||||
				install = alpm_list_add(install, filelist.files[f].name);
 | 
			
		||||
				isize++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* check if file will be removed due to package upgrade */
 | 
			
		||||
	for(i = handle->trans->add; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *spkg = i->data;
 | 
			
		||||
		alpm_pkg_t *pkg = spkg->oldpkg;
 | 
			
		||||
		if(pkg) {
 | 
			
		||||
			alpm_filelist_t filelist = pkg->files;
 | 
			
		||||
			size_t f;
 | 
			
		||||
			for(f = 0; f < filelist.count; f++) {
 | 
			
		||||
				if(_alpm_fnmatch_patterns(t->targets, filelist.files[f].name) == 0) {
 | 
			
		||||
					remove = alpm_list_add(remove, filelist.files[f].name);
 | 
			
		||||
					rsize++;
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* check if file will be removed due to package removal */
 | 
			
		||||
	for(i = handle->trans->remove; i; i = i->next) {
 | 
			
		||||
		alpm_pkg_t *pkg = i->data;
 | 
			
		||||
		alpm_filelist_t filelist = pkg->files;
 | 
			
		||||
		size_t f;
 | 
			
		||||
		for(f = 0; f < filelist.count; f++) {
 | 
			
		||||
			if(_alpm_fnmatch_patterns(t->targets, filelist.files[f].name) == 0) {
 | 
			
		||||
				remove = alpm_list_add(remove, filelist.files[f].name);
 | 
			
		||||
				rsize++;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	i = install = alpm_list_msort(install, isize, (alpm_list_fn_cmp)strcmp);
 | 
			
		||||
	j = remove = alpm_list_msort(remove, rsize, (alpm_list_fn_cmp)strcmp);
 | 
			
		||||
	while(i) {
 | 
			
		||||
		while(j && strcmp(i->data, j->data) > 0) {
 | 
			
		||||
			j = j->next;
 | 
			
		||||
		}
 | 
			
		||||
		if(j == NULL) {
 | 
			
		||||
			break;
 | 
			
		||||
		}
 | 
			
		||||
		if(strcmp(i->data, j->data) == 0) {
 | 
			
		||||
			char *path = i->data;
 | 
			
		||||
			upgrade = alpm_list_add(upgrade, path);
 | 
			
		||||
			while(i && strcmp(i->data, path) == 0) {
 | 
			
		||||
				alpm_list_t *next = i->next;
 | 
			
		||||
				install = alpm_list_remove_item(install, i);
 | 
			
		||||
				free(i);
 | 
			
		||||
				i = next;
 | 
			
		||||
			}
 | 
			
		||||
			while(j && strcmp(j->data, path) == 0) {
 | 
			
		||||
				alpm_list_t *next = j->next;
 | 
			
		||||
				remove = alpm_list_remove_item(remove, j);
 | 
			
		||||
				free(j);
 | 
			
		||||
				j = next;
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			i = i->next;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	ret = (t->op & ALPM_HOOK_OP_INSTALL && install)
 | 
			
		||||
			|| (t->op & ALPM_HOOK_OP_UPGRADE && upgrade)
 | 
			
		||||
			|| (t->op & ALPM_HOOK_OP_REMOVE && remove);
 | 
			
		||||
 | 
			
		||||
	if(hook->needs_targets) {
 | 
			
		||||
#define _save_matches(_op, _matches) \
 | 
			
		||||
	if(t->op & _op && _matches) { \
 | 
			
		||||
		hook->matches = alpm_list_join(hook->matches, _matches); \
 | 
			
		||||
	} else { \
 | 
			
		||||
		alpm_list_free(_matches); \
 | 
			
		||||
	}
 | 
			
		||||
		_save_matches(ALPM_HOOK_OP_INSTALL, install);
 | 
			
		||||
		_save_matches(ALPM_HOOK_OP_UPGRADE, upgrade);
 | 
			
		||||
		_save_matches(ALPM_HOOK_OP_REMOVE, remove);
 | 
			
		||||
#undef _save_matches
 | 
			
		||||
	} else {
 | 
			
		||||
		alpm_list_free(install);
 | 
			
		||||
		alpm_list_free(upgrade);
 | 
			
		||||
		alpm_list_free(remove);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_trigger_match_pkg(alpm_handle_t *handle,
 | 
			
		||||
		struct _alpm_hook_t *hook, struct _alpm_trigger_t *t)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *install = NULL, *upgrade = NULL, *remove = NULL;
 | 
			
		||||
 | 
			
		||||
	if(t->op & ALPM_HOOK_OP_INSTALL || t->op & ALPM_HOOK_OP_UPGRADE) {
 | 
			
		||||
		alpm_list_t *i;
 | 
			
		||||
		for(i = handle->trans->add; i; i = i->next) {
 | 
			
		||||
			alpm_pkg_t *pkg = i->data;
 | 
			
		||||
			if(_alpm_fnmatch_patterns(t->targets, pkg->name) == 0) {
 | 
			
		||||
				if(pkg->oldpkg) {
 | 
			
		||||
					if(t->op & ALPM_HOOK_OP_UPGRADE) {
 | 
			
		||||
						if(hook->needs_targets) {
 | 
			
		||||
							upgrade = alpm_list_add(upgrade, pkg->name);
 | 
			
		||||
						} else {
 | 
			
		||||
							return 1;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				} else {
 | 
			
		||||
					if(t->op & ALPM_HOOK_OP_INSTALL) {
 | 
			
		||||
						if(hook->needs_targets) {
 | 
			
		||||
							install = alpm_list_add(install, pkg->name);
 | 
			
		||||
						} else {
 | 
			
		||||
							return 1;
 | 
			
		||||
						}
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(t->op & ALPM_HOOK_OP_REMOVE) {
 | 
			
		||||
		alpm_list_t *i;
 | 
			
		||||
		for(i = handle->trans->remove; i; i = i->next) {
 | 
			
		||||
			alpm_pkg_t *pkg = i->data;
 | 
			
		||||
			if(pkg && _alpm_fnmatch_patterns(t->targets, pkg->name) == 0) {
 | 
			
		||||
				if(!alpm_list_find(handle->trans->add, pkg, _alpm_pkg_cmp)) {
 | 
			
		||||
					if(hook->needs_targets) {
 | 
			
		||||
						remove = alpm_list_add(remove, pkg->name);
 | 
			
		||||
					} else {
 | 
			
		||||
						return 1;
 | 
			
		||||
					}
 | 
			
		||||
				}
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	/* if we reached this point we either need the target lists or we didn't
 | 
			
		||||
	 * match anything and the following calls will all be no-ops */
 | 
			
		||||
	hook->matches = alpm_list_join(hook->matches, install);
 | 
			
		||||
	hook->matches = alpm_list_join(hook->matches, upgrade);
 | 
			
		||||
	hook->matches = alpm_list_join(hook->matches, remove);
 | 
			
		||||
 | 
			
		||||
	return install || upgrade || remove;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_trigger_match(alpm_handle_t *handle,
 | 
			
		||||
		struct _alpm_hook_t *hook, struct _alpm_trigger_t *t)
 | 
			
		||||
{
 | 
			
		||||
	return t->type == ALPM_HOOK_TYPE_PACKAGE
 | 
			
		||||
		? _alpm_hook_trigger_match_pkg(handle, hook, t)
 | 
			
		||||
		: _alpm_hook_trigger_match_file(handle, hook, t);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_triggered(alpm_handle_t *handle, struct _alpm_hook_t *hook)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
	for(i = hook->triggers; i; i = i->next) {
 | 
			
		||||
		if(_alpm_hook_trigger_match(handle, hook, i->data)) {
 | 
			
		||||
			if(!hook->needs_targets) {
 | 
			
		||||
				return 1;
 | 
			
		||||
			} else {
 | 
			
		||||
				ret = 1;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_cmp(struct _alpm_hook_t *h1, struct _alpm_hook_t *h2)
 | 
			
		||||
{
 | 
			
		||||
	return strcmp(h1->name, h2->name);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *find_hook(alpm_list_t *haystack, const void *needle)
 | 
			
		||||
{
 | 
			
		||||
	while(haystack) {
 | 
			
		||||
		struct _alpm_hook_t *h = haystack->data;
 | 
			
		||||
		if(h && strcmp(h->name, needle) == 0) {
 | 
			
		||||
			return haystack;
 | 
			
		||||
		}
 | 
			
		||||
		haystack = haystack->next;
 | 
			
		||||
	}
 | 
			
		||||
	return NULL;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static ssize_t _alpm_hook_feed_targets(char *buf, ssize_t needed, alpm_list_t **pos)
 | 
			
		||||
{
 | 
			
		||||
	size_t remaining = needed, written = 0;;
 | 
			
		||||
	size_t len;
 | 
			
		||||
 | 
			
		||||
	while(*pos && (len = strlen((*pos)->data)) + 1 <= remaining) {
 | 
			
		||||
		memcpy(buf, (*pos)->data, len);
 | 
			
		||||
		buf[len++] = '\n';
 | 
			
		||||
		*pos = (*pos)->next;
 | 
			
		||||
		buf += len;
 | 
			
		||||
		remaining -= len;
 | 
			
		||||
		written += len;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(*pos && remaining) {
 | 
			
		||||
		memcpy(buf, (*pos)->data, remaining);
 | 
			
		||||
		(*pos)->data = (char*) (*pos)->data + remaining;
 | 
			
		||||
		written += remaining;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return written;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static alpm_list_t *_alpm_strlist_dedup(alpm_list_t *list)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i = list;
 | 
			
		||||
	while(i) {
 | 
			
		||||
		alpm_list_t *next = i->next;
 | 
			
		||||
		while(next && strcmp(i->data, next->data) == 0) {
 | 
			
		||||
			list = alpm_list_remove_item(list, next);
 | 
			
		||||
			free(next);
 | 
			
		||||
			next = i->next;
 | 
			
		||||
		}
 | 
			
		||||
		i = next;
 | 
			
		||||
	}
 | 
			
		||||
	return list;
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
static int _alpm_hook_run_hook(alpm_handle_t *handle, struct _alpm_hook_t *hook)
 | 
			
		||||
{
 | 
			
		||||
	alpm_list_t *i, *pkgs = _alpm_db_get_pkgcache(handle->db_local);
 | 
			
		||||
 | 
			
		||||
	for(i = hook->depends; i; i = i->next) {
 | 
			
		||||
		if(!alpm_find_satisfier(pkgs, i->data)) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("unable to run hook %s: %s\n"),
 | 
			
		||||
					hook->name, _("could not satisfy dependencies"));
 | 
			
		||||
			return -1;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(hook->needs_targets) {
 | 
			
		||||
		alpm_list_t *ctx;
 | 
			
		||||
		hook->matches = alpm_list_msort(hook->matches,
 | 
			
		||||
				alpm_list_count(hook->matches), (alpm_list_fn_cmp)strcmp);
 | 
			
		||||
		/* hooks with multiple triggers could have duplicate matches */
 | 
			
		||||
		ctx = hook->matches = _alpm_strlist_dedup(hook->matches);
 | 
			
		||||
		return _alpm_run_chroot(handle, hook->cmd[0], hook->cmd,
 | 
			
		||||
				(_alpm_cb_io) _alpm_hook_feed_targets, &ctx);
 | 
			
		||||
	} else {
 | 
			
		||||
		return _alpm_run_chroot(handle, hook->cmd[0], hook->cmd, NULL, NULL);
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
int _alpm_hook_run(alpm_handle_t *handle, alpm_hook_when_t when)
 | 
			
		||||
{
 | 
			
		||||
	alpm_event_hook_t event = { .when = when };
 | 
			
		||||
	alpm_event_hook_run_t hook_event;
 | 
			
		||||
	alpm_list_t *i, *hooks = NULL, *hooks_triggered = NULL;
 | 
			
		||||
	const char *suffix = ".hook";
 | 
			
		||||
	size_t suflen = strlen(suffix), triggered = 0;
 | 
			
		||||
	int ret = 0;
 | 
			
		||||
 | 
			
		||||
	for(i = alpm_list_last(handle->hookdirs); i; i = alpm_list_previous(i)) {
 | 
			
		||||
		char path[PATH_MAX];
 | 
			
		||||
		size_t dirlen;
 | 
			
		||||
		struct dirent *entry;
 | 
			
		||||
		DIR *d;
 | 
			
		||||
 | 
			
		||||
		if((dirlen = strlen(i->data)) >= PATH_MAX) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("could not open directory: %s: %s\n"),
 | 
			
		||||
					(char *)i->data, strerror(ENAMETOOLONG));
 | 
			
		||||
			ret = -1;
 | 
			
		||||
			continue;
 | 
			
		||||
		}
 | 
			
		||||
		memcpy(path, i->data, dirlen + 1);
 | 
			
		||||
 | 
			
		||||
		if(!(d = opendir(path))) {
 | 
			
		||||
			if(errno == ENOENT) {
 | 
			
		||||
				continue;
 | 
			
		||||
			} else {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
						_("could not open directory: %s: %s\n"), path, strerror(errno));
 | 
			
		||||
				ret = -1;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		while((errno = 0, entry = readdir(d))) {
 | 
			
		||||
			struct _alpm_hook_cb_ctx ctx = { handle, NULL };
 | 
			
		||||
			struct stat buf;
 | 
			
		||||
			size_t name_len;
 | 
			
		||||
 | 
			
		||||
			if(strcmp(entry->d_name, ".") == 0 || strcmp(entry->d_name, "..") == 0) {
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if((name_len = strlen(entry->d_name)) >= PATH_MAX - dirlen) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR, _("could not open file: %s%s: %s\n"),
 | 
			
		||||
						path, entry->d_name, strerror(ENAMETOOLONG));
 | 
			
		||||
				ret = -1;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
			memcpy(path + dirlen, entry->d_name, name_len + 1);
 | 
			
		||||
 | 
			
		||||
			if(name_len < suflen
 | 
			
		||||
					|| strcmp(entry->d_name + name_len - suflen, suffix) != 0) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "skipping non-hook file %s\n", path);
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(find_hook(hooks, entry->d_name)) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "skipping overridden hook %s\n", path);
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(stat(path, &buf) != 0) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_ERROR,
 | 
			
		||||
						_("could not stat file %s: %s\n"), path, strerror(errno));
 | 
			
		||||
				ret = -1;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if(S_ISDIR(buf.st_mode)) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "skipping directory %s\n", path);
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			CALLOC(ctx.hook, sizeof(struct _alpm_hook_t), 1,
 | 
			
		||||
					ret = -1; closedir(d); goto cleanup);
 | 
			
		||||
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_DEBUG, "parsing hook file %s\n", path);
 | 
			
		||||
			if(parse_ini(path, _alpm_hook_parse_cb, &ctx) != 0
 | 
			
		||||
					|| _alpm_hook_validate(handle, ctx.hook, path)) {
 | 
			
		||||
				_alpm_log(handle, ALPM_LOG_DEBUG, "parsing hook file %s failed\n", path);
 | 
			
		||||
				_alpm_hook_free(ctx.hook);
 | 
			
		||||
				ret = -1;
 | 
			
		||||
				continue;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			STRDUP(ctx.hook->name, entry->d_name, ret = -1; closedir(d); goto cleanup);
 | 
			
		||||
			hooks = alpm_list_add(hooks, ctx.hook);
 | 
			
		||||
		}
 | 
			
		||||
		if(errno != 0) {
 | 
			
		||||
			_alpm_log(handle, ALPM_LOG_ERROR, _("could not read directory: %s: %s\n"),
 | 
			
		||||
					(char *) i->data, strerror(errno));
 | 
			
		||||
			ret = -1;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		closedir(d);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(ret != 0 && when == ALPM_HOOK_PRE_TRANSACTION) {
 | 
			
		||||
		goto cleanup;
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	hooks = alpm_list_msort(hooks, alpm_list_count(hooks),
 | 
			
		||||
			(alpm_list_fn_cmp)_alpm_hook_cmp);
 | 
			
		||||
 | 
			
		||||
	for(i = hooks; i; i = i->next) {
 | 
			
		||||
		struct _alpm_hook_t *hook = i->data;
 | 
			
		||||
		if(hook && hook->when == when && _alpm_hook_triggered(handle, hook)) {
 | 
			
		||||
			hooks_triggered = alpm_list_add(hooks_triggered, hook);
 | 
			
		||||
			triggered++;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	if(hooks_triggered != NULL) {
 | 
			
		||||
		event.type = ALPM_EVENT_HOOK_START;
 | 
			
		||||
		EVENT(handle, (void *)&event);
 | 
			
		||||
 | 
			
		||||
		hook_event.position = 1;
 | 
			
		||||
		hook_event.total = triggered;
 | 
			
		||||
 | 
			
		||||
		for(i = hooks_triggered; i; i = i->next, hook_event.position++) {
 | 
			
		||||
			struct _alpm_hook_t *hook = i->data;
 | 
			
		||||
			alpm_logaction(handle, ALPM_CALLER_PREFIX, "running '%s'...\n", hook->name);
 | 
			
		||||
 | 
			
		||||
			hook_event.type = ALPM_EVENT_HOOK_RUN_START;
 | 
			
		||||
			hook_event.name = hook->name;
 | 
			
		||||
			hook_event.desc = hook->desc;
 | 
			
		||||
			EVENT(handle, &hook_event);
 | 
			
		||||
 | 
			
		||||
			if(_alpm_hook_run_hook(handle, hook) != 0 && hook->abort_on_fail) {
 | 
			
		||||
				ret = -1;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			hook_event.type = ALPM_EVENT_HOOK_RUN_DONE;
 | 
			
		||||
			EVENT(handle, &hook_event);
 | 
			
		||||
 | 
			
		||||
			if(ret != 0 && when == ALPM_HOOK_PRE_TRANSACTION) {
 | 
			
		||||
				break;
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		alpm_list_free(hooks_triggered);
 | 
			
		||||
 | 
			
		||||
		event.type = ALPM_EVENT_HOOK_DONE;
 | 
			
		||||
		EVENT(handle, (void *)&event);
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
cleanup:
 | 
			
		||||
	alpm_list_free_inner(hooks, (alpm_list_fn_free) _alpm_hook_free);
 | 
			
		||||
	alpm_list_free(hooks);
 | 
			
		||||
 | 
			
		||||
	return ret;
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										27
									
								
								lib/libalpm/hook.h
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										27
									
								
								lib/libalpm/hook.h
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,27 @@
 | 
			
		||||
/*
 | 
			
		||||
 *  hook.h
 | 
			
		||||
 *
 | 
			
		||||
 *  Copyright (c) 2015-2018 Pacman Development Team <pacman-dev@archlinux.org>
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is free software; you can redistribute it and/or modify
 | 
			
		||||
 *  it under the terms of the GNU General Public License as published by
 | 
			
		||||
 *  the Free Software Foundation; either version 2 of the License, or
 | 
			
		||||
 *  (at your option) any later version.
 | 
			
		||||
 *
 | 
			
		||||
 *  This program is distributed in the hope that it will be useful,
 | 
			
		||||
 *  but WITHOUT ANY WARRANTY; without even the implied warranty of
 | 
			
		||||
 *  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 | 
			
		||||
 *  GNU General Public License for more details.
 | 
			
		||||
 *
 | 
			
		||||
 *  You should have received a copy of the GNU General Public License
 | 
			
		||||
 *  along with this program.  If not, see <http://www.gnu.org/licenses/>.
 | 
			
		||||
 */
 | 
			
		||||
 | 
			
		||||
#ifndef ALPM_HOOK_H
 | 
			
		||||
#define ALPM_HOOK_H
 | 
			
		||||
 | 
			
		||||
#include "alpm.h"
 | 
			
		||||
 | 
			
		||||
int _alpm_hook_run(alpm_handle_t *handle, alpm_hook_when_t when);
 | 
			
		||||
 | 
			
		||||
#endif /* ALPM_HOOK_H */
 | 
			
		||||
							
								
								
									
										1
									
								
								lib/libalpm/ini.c
									
									
									
									
									
										Symbolic link
									
								
							
							
						
						
									
										1
									
								
								lib/libalpm/ini.c
									
									
									
									
									
										Symbolic link
									
								
							@@ -0,0 +1 @@
 | 
			
		||||
../../src/common/ini.c
 | 
			
		||||
Some files were not shown because too many files have changed in this diff Show More
		Reference in New Issue
	
	Block a user