@@ -1564,15 +1564,30 @@ def extract_source(self, source, cwd):
1564
1564
# print("Unrecognized extension for {}".format(filename))
1565
1565
# raise Exception()
1566
1566
1567
- def apply_patch (self , filename ):
1567
+ def apply_patch (self , filename , arch = 'armeabi' ):
1568
1568
"""
1569
1569
Apply a patch from the current recipe directory into the current
1570
1570
build directory.
1571
1571
"""
1572
1572
info ("Applying patch {}" .format (filename ))
1573
1573
filename = join (self .recipe_dir , filename )
1574
- # AND: get_build_dir shouldn't need to hardcode armeabi
1575
- sh .patch ("-t" , "-d" , self .get_build_dir ('armeabi' ), "-p1" , "-i" , filename )
1574
+ shprint (sh .patch , "-t" , "-d" , self .get_build_dir (arch ), "-p1" ,
1575
+ "-i" , filename , _tail = 10 )
1576
+
1577
+ def apply_all_patches (self , wildcard = join ('patches' ,'*.patch' ), arch = 'armeabi' ):
1578
+ patches = glob .glob (join (self .recipe_dir , wildcard ))
1579
+ if not patches :
1580
+ warning ('requested patches {} not found for {}' .format (wildcard , self .name ))
1581
+ for filename in sorted (patches ):
1582
+ name = splitext (basename (filename ))[0 ]
1583
+ patched_flag = join (self .get_build_container_dir (arch ), name + '.patched' )
1584
+ if exists (patched_flag ):
1585
+ info ('patch {} already applied to {}, skipping' .format (name , self .name ))
1586
+ else :
1587
+ self .apply_patch (filename , arch = arch )
1588
+ sh .touch (patched_flag )
1589
+ return len (patches )
1590
+
1576
1591
1577
1592
def copy_file (self , filename , dest ):
1578
1593
info ("Copy {} to {}" .format (filename , dest ))
0 commit comments