Return a ``text`` applying some refinements and fixes. This applies a list of special cases fixes represented by ApkBuildFixer instances. These are unfortunate hacks to cope with limitations of shell parameter expansion that would be hard to fix OR to handle parameters that are
(text)
| 642 | |
| 643 | |
| 644 | def fix_apkbuild(text): |
| 645 | """ |
| 646 | Return a ``text`` applying some refinements and fixes. |
| 647 | |
| 648 | This applies a list of special cases fixes represented by ApkBuildFixer |
| 649 | instances. These are unfortunate hacks to cope with limitations of shell |
| 650 | parameter expansion that would be hard to fix OR to handle parameters that |
| 651 | are not available OR just because it would require executing a build |
| 652 | otherwise. |
| 653 | |
| 654 | """ |
| 655 | replacements = [ |
| 656 | ApkBuildFixer( |
| 657 | if_these_strings_are_present=('pkgname=qt',), |
| 658 | function=fix_qt, |
| 659 | ), |
| 660 | ApkBuildFixer( |
| 661 | if_these_strings_are_present=('pkgname=gcc\n',), |
| 662 | function=replace_fix, |
| 663 | args=('$_target', ''), |
| 664 | ), |
| 665 | ApkBuildFixer( |
| 666 | if_these_strings_are_present=('jool', 'For custom kernels set $FLAVOR.', '_flavor="$FLAVOR"',), |
| 667 | function=replace_fix, |
| 668 | args=('_flavor="$FLAVOR"', '_flavor=lts'), |
| 669 | ), |
| 670 | ApkBuildFixer( |
| 671 | if_these_strings_are_present=('pkgname=ufw\n',), |
| 672 | function=replace_fix, |
| 673 | args=('$(echo $pkgver|cut -c1-4)', '$pkgver'), |
| 674 | ), |
| 675 | ApkBuildFixer( |
| 676 | if_these_strings_are_present=('pkgname=rtpengine-$_flavor',), |
| 677 | function=replace_fix, |
| 678 | args=('# rtpengine version\n', '_flavor=lts\n'), |
| 679 | ), |
| 680 | ApkBuildFixer( |
| 681 | if_these_strings_are_present=('\t*.*.*.*) _v=${pkgver%.*};;', '\t*.*.*) _v=$pkgver;;'), |
| 682 | function=fix_libreoffice_version, |
| 683 | ), |
| 684 | ApkBuildFixer( |
| 685 | if_these_strings_are_present=('\t*.90*) _rel=unstable;;', '\t*) _rel=stable;;'), |
| 686 | function=fix_kde_version, |
| 687 | ), |
| 688 | ApkBuildFixer( |
| 689 | if_these_strings_are_present=('_kernver=${pkgver%.*};;', '_kernver=$pkgver;;'), |
| 690 | function=fix_kernver_version, |
| 691 | ), |
| 692 | ApkBuildFixer( |
| 693 | if_these_strings_are_present=('_kernver=${pkgver%.*};;', '_kernver=${pkgver};;'), |
| 694 | function=fix_kernver_version, |
| 695 | ), |
| 696 | |
| 697 | ApkBuildFixer( |
| 698 | if_these_strings_are_present=('\t*.*.*) _v=${pkgver%.*};;', '\t*.*) _v=$pkgver;;'), |
| 699 | function=fix_dunder_v_version, |
| 700 | ), |
| 701 | ApkBuildFixer( |
no test coverage detected