| @@ -1,15 +1,15 @@ | | | @@ -1,15 +1,15 @@ |
1 | #! @PYTHONBIN@ | | 1 | #! @PYTHONBIN@ |
2 | # $NetBSD: url2pkg.py,v 1.23 2019/10/27 13:15:04 rillig Exp $ | | 2 | # $NetBSD: url2pkg.py,v 1.24 2019/10/27 19:19:55 rillig Exp $ |
3 | | | 3 | |
4 | # Copyright (c) 2019 The NetBSD Foundation, Inc. | | 4 | # Copyright (c) 2019 The NetBSD Foundation, Inc. |
5 | # All rights reserved. | | 5 | # All rights reserved. |
6 | # | | 6 | # |
7 | # This code is derived from software contributed to The NetBSD Foundation | | 7 | # This code is derived from software contributed to The NetBSD Foundation |
8 | # by Roland Illig. | | 8 | # by Roland Illig. |
9 | # | | 9 | # |
10 | # Redistribution and use in source and binary forms, with or without | | 10 | # Redistribution and use in source and binary forms, with or without |
11 | # modification, are permitted provided that the following conditions | | 11 | # modification, are permitted provided that the following conditions |
12 | # are met: | | 12 | # are met: |
13 | # 1. Redistributions of source code must retain the above copyright | | 13 | # 1. Redistributions of source code must retain the above copyright |
14 | # notice, this list of conditions and the following disclaimer. | | 14 | # notice, this list of conditions and the following disclaimer. |
15 | # 2. Redistributions in binary form must reproduce the above copyright | | 15 | # 2. Redistributions in binary form must reproduce the above copyright |
| @@ -112,45 +112,47 @@ class Globals: | | | @@ -112,45 +112,47 @@ class Globals: |
112 | subprocess.check_call([self.make, *args], cwd=self.pkgdir) | | 112 | subprocess.check_call([self.make, *args], cwd=self.pkgdir) |
113 | | | 113 | |
114 | def show_var(self, varname: str) -> str: | | 114 | def show_var(self, varname: str) -> str: |
115 | output = subprocess.check_output((self.make, 'show-var', 'VARNAME=' + varname)) | | 115 | output = subprocess.check_output((self.make, 'show-var', 'VARNAME=' + varname)) |
116 | return output.decode('utf-8').strip() | | 116 | return output.decode('utf-8').strip() |
117 | | | 117 | |
118 | def pkgsrc_license(self, license_name: str) -> str: | | 118 | def pkgsrc_license(self, license_name: str) -> str: |
119 | known_licenses = ( | | 119 | known_licenses = ( |
120 | ('', | | 120 | ('', |
121 | 'Apache Software License', # too unspecific; needs a version number | | 121 | 'Apache Software License', # too unspecific; needs a version number |
122 | 'BSD'), # too unspecific, may be 2-clause, 3-clause, 4-clause | | 122 | 'BSD'), # too unspecific, may be 2-clause, 3-clause, 4-clause |
123 | ('${PERL5_LICENSE}', 'perl'), | | 123 | ('${PERL5_LICENSE}', 'perl'), |
124 | ('apache-2.0', 'Apache 2', 'Apache 2.0'), | | 124 | ('apache-2.0', 'Apache 2', 'Apache 2.0'), |
| | | 125 | ('artistic-2.0', 'artistic_2'), |
125 | ('gnu-gpl-v3', 'GNU Lesser General Public License (LGPL), Version 3'), | | 126 | ('gnu-gpl-v3', 'GNU Lesser General Public License (LGPL), Version 3'), |
126 | ('gnu-lgpl-v2', 'LGPL'), | | 127 | ('gnu-lgpl-v2', 'LGPL'), |
127 | ('mit', 'MIT', 'MIT License'), | | 128 | ('mit', 'MIT', 'MIT License'), |
128 | ('python-software-foundation', | | 129 | ('python-software-foundation', |
129 | 'PSF', 'PSF license', 'Python Software Foundation License'), | | 130 | 'PSF', 'PSF license', 'Python Software Foundation License'), |
130 | ('zpl-2.1', 'ZPL 2.1'), | | 131 | ('zpl-2.1', 'ZPL 2.1'), |
131 | ) | | 132 | ) |
132 | | | 133 | |
133 | for known_license in known_licenses: | | 134 | for known_license in known_licenses: |
134 | if license_name in known_license: | | 135 | if license_name in known_license: |
135 | return known_license[0] | | 136 | return known_license[0] |
136 | if (self.pkgsrcdir / 'licenses' / license_name).is_file(): | | 137 | if (self.pkgsrcdir / 'licenses' / license_name).is_file(): |
137 | return license_name | | 138 | return license_name |
138 | return '' | | 139 | return '' |
139 | | | 140 | |
| | | 141 | |
140 | class Lines: | | 142 | class Lines: |
141 | """ | | 143 | """ |
142 | A list of Makefile lines with high-level methods for manipulating | | 144 | A list of lines (typically from a Makefile, but other file types work as |
143 | variable assignments. | | 145 | well) with high-level methods for manipulating variable assignments. |
144 | """ | | 146 | """ |
145 | lines: List[str] | | 147 | lines: List[str] |
146 | | | 148 | |
147 | def __init__(self, *lines: str) -> None: | | 149 | def __init__(self, *lines: str) -> None: |
148 | self.lines = [] | | 150 | self.lines = [] |
149 | for line in lines: | | 151 | for line in lines: |
150 | self.add(line) | | 152 | self.add(line) |
151 | | | 153 | |
152 | @classmethod | | 154 | @classmethod |
153 | def read_from(cls, src: Union[Path, Any]) -> 'Lines': | | 155 | def read_from(cls, src: Union[Path, Any]) -> 'Lines': |
154 | return Lines(*src.read_text().splitlines()) | | 156 | return Lines(*src.read_text().splitlines()) |
155 | | | 157 | |
156 | def write_to(self, dst: Union[Path, Any]): | | 158 | def write_to(self, dst: Union[Path, Any]): |
| @@ -473,38 +475,43 @@ class Generator: | | | @@ -473,38 +475,43 @@ class Generator: |
473 | | | 475 | |
474 | def generate_Makefile(self) -> Lines: | | 476 | def generate_Makefile(self) -> Lines: |
475 | self.adjust_site_SourceForge() | | 477 | self.adjust_site_SourceForge() |
476 | self.adjust_site_GitHub_archive() | | 478 | self.adjust_site_GitHub_archive() |
477 | self.adjust_site_GitHub_release() | | 479 | self.adjust_site_GitHub_release() |
478 | self.foreach_site_from_sites_mk(self.adjust_site_from_sites_mk) | | 480 | self.foreach_site_from_sites_mk(self.adjust_site_from_sites_mk) |
479 | self.adjust_site_other() | | 481 | self.adjust_site_other() |
480 | self.adjust_everything_else() | | 482 | self.adjust_everything_else() |
481 | return self.generate_lines() | | 483 | return self.generate_lines() |
482 | | | 484 | |
483 | def generate_package(self, g: Globals) -> Lines: | | 485 | def generate_package(self, g: Globals) -> Lines: |
484 | pkgdir = g.pkgdir | | 486 | pkgdir = g.pkgdir |
485 | makefile = pkgdir / 'Makefile' | | 487 | makefile = pkgdir / 'Makefile' |
486 | descr = pkgdir / 'DESCR' | | | |
487 | plist = pkgdir / 'PLIST' | | 488 | plist = pkgdir / 'PLIST' |
488 | | | 489 | |
489 | initial_lines = self.generate_Makefile() | | 490 | initial_lines = self.generate_Makefile() |
490 | | | 491 | |
491 | try: | | 492 | try: |
492 | makefile.replace(f'{makefile}.url2pkg~') | | 493 | makefile.replace(f'{makefile}.url2pkg~') |
493 | except OSError: | | 494 | except OSError: |
494 | pass | | 495 | pass |
495 | initial_lines.write_to(makefile) | | 496 | initial_lines.write_to(makefile) |
496 | plist.is_file() or Lines('@comment $''NetBSD$').write_to(plist) | | 497 | |
497 | descr.is_file() or Lines().write_to(descr) | | 498 | plist_lines = [ |
| | | 499 | f'@comment $''NetBSD$', |
| | | 500 | f'@comment TODO: to fill this file with the file listing:', |
| | | 501 | f'@comment TODO: 1. run "{g.make} package"', |
| | | 502 | f'@comment TODO: 2. run "{g.make} print-PLIST"' |
| | | 503 | ] |
| | | 504 | plist.is_file() or Lines(*plist_lines).write_to(plist) |
498 | | | 505 | |
499 | subprocess.check_call([g.editor, makefile]) | | 506 | subprocess.check_call([g.editor, makefile]) |
500 | | | 507 | |
501 | g.bmake('clean', 'distinfo', 'extract') | | 508 | g.bmake('clean', 'distinfo', 'extract') |
502 | | | 509 | |
503 | return initial_lines | | 510 | return initial_lines |
504 | | | 511 | |
505 | | | 512 | |
506 | class Adjuster: | | 513 | class Adjuster: |
507 | """ | | 514 | """ |
508 | After the distfile has been downloaded and extracted, the | | 515 | After the distfile has been downloaded and extracted, the |
509 | adjust_* methods of this class inspect the extracted files | | 516 | adjust_* methods of this class inspect the extracted files |
510 | and adjust the variable definitions in the package Makefile. | | 517 | and adjust the variable definitions in the package Makefile. |
| @@ -560,47 +567,50 @@ class Adjuster: | | | @@ -560,47 +567,50 @@ class Adjuster: |
560 | # these are inserted below the second paragraph in the Makefile. | | 567 | # these are inserted below the second paragraph in the Makefile. |
561 | todos: List[str] | | 568 | todos: List[str] |
562 | | | 569 | |
563 | # the package name is based on DISTNAME and modified by | | 570 | # the package name is based on DISTNAME and modified by |
564 | # pkgname_prefix and pkgname_transform. | | 571 | # pkgname_prefix and pkgname_transform. |
565 | pkgname_prefix: str # example: ${PYPKGPREFIX}- | | 572 | pkgname_prefix: str # example: ${PYPKGPREFIX}- |
566 | pkgname_transform: str # example: :S,-v,-, | | 573 | pkgname_transform: str # example: :S,-v,-, |
567 | | | 574 | |
568 | # all lines of the package Makefile, for direct modification. | | 575 | # all lines of the package Makefile, for direct modification. |
569 | makefile_lines: Lines | | 576 | makefile_lines: Lines |
570 | | | 577 | |
571 | regenerate_distinfo: bool | | 578 | regenerate_distinfo: bool |
572 | | | 579 | |
| | | 580 | descr_lines: List[str] |
| | | 581 | |
573 | def __init__(self, g: Globals, url: str, initial_lines: Lines): | | 582 | def __init__(self, g: Globals, url: str, initial_lines: Lines): |
574 | self.g = g | | 583 | self.g = g |
575 | self.url = url | | 584 | self.url = url |
576 | self.initial_lines = initial_lines | | 585 | self.initial_lines = initial_lines |
577 | self.abs_wrkdir = Path('') | | 586 | self.abs_wrkdir = Path('') |
578 | self.abs_wrksrc = Path('') | | 587 | self.abs_wrksrc = Path('') |
579 | self.wrksrc_files = [] | | 588 | self.wrksrc_files = [] |
580 | self.wrksrc_dirs = [] | | 589 | self.wrksrc_dirs = [] |
581 | self.categories = [] | | 590 | self.categories = [] |
582 | self.depends = [] | | 591 | self.depends = [] |
583 | self.build_depends = [] | | 592 | self.build_depends = [] |
584 | self.test_depends = [] | | 593 | self.test_depends = [] |
585 | self.bl3_lines = [] | | 594 | self.bl3_lines = [] |
586 | self.includes = [] | | 595 | self.includes = [] |
587 | self.build_vars = [] | | 596 | self.build_vars = [] |
588 | self.extra_vars = [] | | 597 | self.extra_vars = [] |
589 | self.todos = [] | | 598 | self.todos = [] |
590 | self.pkgname_prefix = '' | | 599 | self.pkgname_prefix = '' |
591 | self.pkgname_transform = '' | | 600 | self.pkgname_transform = '' |
592 | self.makefile_lines = Lines() | | 601 | self.makefile_lines = Lines() |
593 | self.regenerate_distinfo = False | | 602 | self.regenerate_distinfo = False |
| | | 603 | self.descr_lines = [] |
594 | | | 604 | |
595 | def add_dependency(self, kind: str, pkgbase: str, constraint: str, dep_dir: str) -> None: | | 605 | def add_dependency(self, kind: str, pkgbase: str, constraint: str, dep_dir: str) -> None: |
596 | """ add_dependency('DEPENDS', 'package', '>=1', '../../category/package') """ | | 606 | """ add_dependency('DEPENDS', 'package', '>=1', '../../category/package') """ |
597 | | | 607 | |
598 | self.g.debug('add_dependency: {0} {1} {2} {3}', kind, pkgbase, constraint, dep_dir) | | 608 | self.g.debug('add_dependency: {0} {1} {2} {3}', kind, pkgbase, constraint, dep_dir) |
599 | | | 609 | |
600 | def bl3_identifier(): | | 610 | def bl3_identifier(): |
601 | try: | | 611 | try: |
602 | with open(dep_dir + '/buildlink3.mk') as f: | | 612 | with open(dep_dir + '/buildlink3.mk') as f: |
603 | for line in f: | | 613 | for line in f: |
604 | m = re.search(r'^BUILDLINK_TREE\+=\s*(\S+)$', line) | | 614 | m = re.search(r'^BUILDLINK_TREE\+=\s*(\S+)$', line) |
605 | if m: | | 615 | if m: |
606 | return m[1] | | 616 | return m[1] |
| @@ -688,49 +698,72 @@ class Adjuster: | | | @@ -688,49 +698,72 @@ class Adjuster: |
688 | if not self.makefile_lines.set(varname, value): | | 698 | if not self.makefile_lines.set(varname, value): |
689 | self.extra_vars.append(Var(varname, '=', value)) | | 699 | self.extra_vars.append(Var(varname, '=', value)) |
690 | | | 700 | |
691 | def set_license(self, license_name: str, license_default: str): | | 701 | def set_license(self, license_name: str, license_default: str): |
692 | pkgsrc_license_name = self.g.pkgsrc_license(license_name) | | 702 | pkgsrc_license_name = self.g.pkgsrc_license(license_name) |
693 | if pkgsrc_license_name != '': | | 703 | if pkgsrc_license_name != '': |
694 | self.set_or_add('LICENSE', pkgsrc_license_name) | | 704 | self.set_or_add('LICENSE', pkgsrc_license_name) |
695 | elif license_default != '': | | 705 | elif license_default != '': |
696 | self.set_or_add('#LICENSE', license_default) | | 706 | self.set_or_add('#LICENSE', license_default) |
697 | | | 707 | |
698 | def wrksrc_open(self, relative_pathname: str): | | 708 | def wrksrc_open(self, relative_pathname: str): |
699 | return (self.abs_wrksrc / relative_pathname).open() | | 709 | return (self.abs_wrksrc / relative_pathname).open() |
700 | | | 710 | |
| | | 711 | def wrksrc_head(self, relative_pathname: str, n: int): |
| | | 712 | try: |
| | | 713 | with (self.abs_wrksrc / relative_pathname).open(encoding="UTF-8") as f: |
| | | 714 | return f.read().splitlines()[:n] |
| | | 715 | except IOError: |
| | | 716 | return [] |
| | | 717 | |
701 | def wrksrc_find(self, what: Union[str, Callable[[str], bool]]) -> List[str]: | | 718 | def wrksrc_find(self, what: Union[str, Callable[[str], bool]]) -> List[str]: |
702 | def search(f): | | 719 | def search(f): |
703 | return re.search(what, f) if type(what) == str else what(f) | | 720 | return re.search(what, f) if type(what) == str else what(f) |
704 | | | 721 | |
705 | return list(sorted(filter(search, self.wrksrc_files))) | | 722 | return list(sorted(filter(search, self.wrksrc_files))) |
706 | | | 723 | |
707 | def wrksrc_grep(self, filename: str, pattern: str) -> List[Union[str, List[str]]]: | | 724 | def wrksrc_grep(self, filename: str, pattern: str) -> List[Union[str, List[str]]]: |
708 | with self.wrksrc_open(filename) as f: | | 725 | with self.wrksrc_open(filename) as f: |
709 | matches = [] | | 726 | matches = [] |
710 | for line in f: | | 727 | for line in f: |
711 | line = line.rstrip('\n') | | 728 | line = line.rstrip('\n') |
712 | m = re.search(pattern, line) | | 729 | m = re.search(pattern, line) |
713 | if m: | | 730 | if m: |
714 | groups = list(m.groups()) | | 731 | groups = list(m.groups()) |
715 | matches.append(groups if groups else line) | | 732 | matches.append(groups if groups else line) |
716 | return matches | | 733 | return matches |
717 | | | 734 | |
718 | def wrksrc_isdir(self, relative_pathname: str) -> bool: | | 735 | def wrksrc_isdir(self, relative_pathname: str) -> bool: |
719 | return (self.abs_wrksrc / relative_pathname).is_dir() | | 736 | return (self.abs_wrksrc / relative_pathname).is_dir() |
720 | | | 737 | |
721 | def wrksrc_isfile(self, relative_pathname: str) -> bool: | | 738 | def wrksrc_isfile(self, relative_pathname: str) -> bool: |
722 | return (self.abs_wrksrc / relative_pathname).is_file() | | 739 | return (self.abs_wrksrc / relative_pathname).is_file() |
723 | | | 740 | |
| | | 741 | def adjust_descr(self): |
| | | 742 | for filename in ('README', 'README.txt', 'README.md'): |
| | | 743 | lines = self.wrksrc_head(filename, 21) |
| | | 744 | if len(lines) == 21: |
| | | 745 | lines[-1] = '...' |
| | | 746 | if lines: |
| | | 747 | self.descr_lines = [ |
| | | 748 | f'TODO: Adjust the following lines from {filename}', |
| | | 749 | '', |
| | | 750 | *lines] |
| | | 751 | return |
| | | 752 | |
| | | 753 | self.descr_lines = [ |
| | | 754 | 'TODO: Fill in a short description of the package.', |
| | | 755 | 'TODO: It should be between 3 and 20 lines.'] |
| | | 756 | |
724 | def adjust_configure(self): | | 757 | def adjust_configure(self): |
725 | if not self.wrksrc_isfile('configure'): | | 758 | if not self.wrksrc_isfile('configure'): |
726 | return | | 759 | return |
727 | | | 760 | |
728 | configures = self.wrksrc_find(r'(^|/)configure$') | | 761 | configures = self.wrksrc_find(r'(^|/)configure$') |
729 | if configures: | | 762 | if configures: |
730 | gnu = any(self.wrksrc_grep(configure, r'\b(Free Software Foundation|autoconf)\b') | | 763 | gnu = any(self.wrksrc_grep(configure, r'\b(Free Software Foundation|autoconf)\b') |
731 | for configure in configures) | | 764 | for configure in configures) |
732 | varname = 'GNU_CONFIGURE' if gnu else 'HAS_CONFIGURE' | | 765 | varname = 'GNU_CONFIGURE' if gnu else 'HAS_CONFIGURE' |
733 | self.build_vars.append(Var(varname, '=', 'yes')) | | 766 | self.build_vars.append(Var(varname, '=', 'yes')) |
734 | | | 767 | |
735 | def adjust_cmake(self): | | 768 | def adjust_cmake(self): |
736 | if self.wrksrc_isfile('CMakeLists.txt'): | | 769 | if self.wrksrc_isfile('CMakeLists.txt'): |
| @@ -755,27 +788,27 @@ class Adjuster: | | | @@ -755,27 +788,27 @@ class Adjuster: |
755 | if self.wrksrc_isdir('libltdl'): | | 788 | if self.wrksrc_isdir('libltdl'): |
756 | self.includes.append('../../devel/libltdl/convenience.mk') | | 789 | self.includes.append('../../devel/libltdl/convenience.mk') |
757 | | | 790 | |
758 | def adjust_perl_module_Build_PL(self): | | 791 | def adjust_perl_module_Build_PL(self): |
759 | # Example packages: | | 792 | # Example packages: |
760 | # devel/p5-Algorithm-CheckDigits | | 793 | # devel/p5-Algorithm-CheckDigits |
761 | | | 794 | |
762 | cmd = f'{self.g.perl5} -I{self.g.libdir} -I. Build.PL' | | 795 | cmd = f'{self.g.perl5} -I{self.g.libdir} -I. Build.PL' |
763 | self.read_dependencies(cmd, {}, self.abs_wrksrc, '') | | 796 | self.read_dependencies(cmd, {}, self.abs_wrksrc, '') |
764 | self.build_vars.append(Var('PERL5_MODULE_TYPE', '=', 'Module::Build')) | | 797 | self.build_vars.append(Var('PERL5_MODULE_TYPE', '=', 'Module::Build')) |
765 | | | 798 | |
766 | def adjust_perl_module_Makefile_PL(self): | | 799 | def adjust_perl_module_Makefile_PL(self): |
767 | # Example packages: | | 800 | # Example packages: |
768 | # devel/p5-Algorithm-Diff (no dependencies) | | 801 | # devel/p5-Algorithm-Diff (no dependencies, no license) |
769 | # devel/p5-Carp-Assert-More (dependencies without version numbers) | | 802 | # devel/p5-Carp-Assert-More (dependencies without version numbers) |
770 | # www/p5-HTML-Quoted (dependency with version number) | | 803 | # www/p5-HTML-Quoted (dependency with version number) |
771 | | | 804 | |
772 | # To avoid fix_up_makefile error for p5-HTML-Quoted, generate Makefile first. | | 805 | # To avoid fix_up_makefile error for p5-HTML-Quoted, generate Makefile first. |
773 | cmd1 = f'{self.g.perl5} -I. Makefile.PL </dev/null 1>&0 2>&0' | | 806 | cmd1 = f'{self.g.perl5} -I. Makefile.PL </dev/null 1>&0 2>&0' |
774 | subprocess.call(cmd1, shell=True, cwd=self.abs_wrksrc) | | 807 | subprocess.call(cmd1, shell=True, cwd=self.abs_wrksrc) |
775 | | | 808 | |
776 | cmd2 = f'{self.g.perl5} -I{self.g.libdir} -I. Makefile.PL' | | 809 | cmd2 = f'{self.g.perl5} -I{self.g.libdir} -I. Makefile.PL' |
777 | self.read_dependencies(cmd2, {}, self.abs_wrksrc, '') | | 810 | self.read_dependencies(cmd2, {}, self.abs_wrksrc, '') |
778 | | | 811 | |
779 | def adjust_perl_module_homepage(self): | | 812 | def adjust_perl_module_homepage(self): |
780 | if '${MASTER_SITE_PERL_CPAN:' not in self.makefile_lines.get('MASTER_SITES'): | | 813 | if '${MASTER_SITE_PERL_CPAN:' not in self.makefile_lines.get('MASTER_SITES'): |
781 | return | | 814 | return |
| @@ -980,39 +1013,42 @@ class Adjuster: | | | @@ -980,39 +1013,42 @@ class Adjuster: |
980 | def scan(basedir: Union[Path, Any], only: Callable[[Path], bool]) -> List[str]: | | 1013 | def scan(basedir: Union[Path, Any], only: Callable[[Path], bool]) -> List[str]: |
981 | relevant = (f for f in basedir.rglob('*') if only(f)) | | 1014 | relevant = (f for f in basedir.rglob('*') if only(f)) |
982 | relative = (str(f.relative_to(basedir)) for f in relevant) | | 1015 | relative = (str(f.relative_to(basedir)) for f in relevant) |
983 | return list(sorted((f for f in relative if not f.startswith('.')))) | | 1016 | return list(sorted((f for f in relative if not f.startswith('.')))) |
984 | | | 1017 | |
985 | self.g.debug('Adjusting the Makefile') | | 1018 | self.g.debug('Adjusting the Makefile') |
986 | self.makefile_lines = Lines.read_from(self.g.pkgdir / 'Makefile') | | 1019 | self.makefile_lines = Lines.read_from(self.g.pkgdir / 'Makefile') |
987 | | | 1020 | |
988 | self.abs_wrkdir = Path(self.g.show_var('WRKDIR')) | | 1021 | self.abs_wrkdir = Path(self.g.show_var('WRKDIR')) |
989 | self.determine_wrksrc() | | 1022 | self.determine_wrksrc() |
990 | self.wrksrc_dirs = scan(self.abs_wrksrc, Path.is_dir) | | 1023 | self.wrksrc_dirs = scan(self.abs_wrksrc, Path.is_dir) |
991 | self.wrksrc_files = scan(self.abs_wrksrc, Path.is_file) | | 1024 | self.wrksrc_files = scan(self.abs_wrksrc, Path.is_file) |
992 | | | 1025 | |
| | | 1026 | self.adjust_descr() |
993 | self.adjust_configure() | | 1027 | self.adjust_configure() |
994 | self.adjust_cmake() | | 1028 | self.adjust_cmake() |
995 | self.adjust_meson() | | 1029 | self.adjust_meson() |
996 | self.adjust_gconf2_schemas() | | 1030 | self.adjust_gconf2_schemas() |
997 | self.adjust_libtool() | | 1031 | self.adjust_libtool() |
998 | self.adjust_perl_module() | | 1032 | self.adjust_perl_module() |
999 | self.adjust_python_module() | | 1033 | self.adjust_python_module() |
1000 | self.adjust_cargo() | | 1034 | self.adjust_cargo() |
1001 | self.adjust_pkg_config() | | 1035 | self.adjust_pkg_config() |
1002 | self.adjust_po() | | 1036 | self.adjust_po() |
1003 | self.adjust_use_languages() | | 1037 | self.adjust_use_languages() |
1004 | | | 1038 | |
1005 | self.generate_lines().write_to(self.g.pkgdir / 'Makefile') | | 1039 | self.generate_lines().write_to(self.g.pkgdir / 'Makefile') |
| | | 1040 | descr = (self.g.pkgdir / 'DESCR') |
| | | 1041 | descr.is_file() or Lines(*self.descr_lines).write_to(descr) |
1006 | | | 1042 | |
1007 | if self.regenerate_distinfo: | | 1043 | if self.regenerate_distinfo: |
1008 | self.g.bmake('distinfo') | | 1044 | self.g.bmake('distinfo') |
1009 | | | 1045 | |
1010 | | | 1046 | |
1011 | def main(argv: List[str], g: Globals): | | 1047 | def main(argv: List[str], g: Globals): |
1012 | if not os.path.isfile('../../mk/bsd.pkg.mk'): | | 1048 | if not os.path.isfile('../../mk/bsd.pkg.mk'): |
1013 | sys.exit(f'{argv[0]}: must be run from a package directory (.../pkgsrc/category/package)') | | 1049 | sys.exit(f'{argv[0]}: must be run from a package directory (.../pkgsrc/category/package)') |
1014 | | | 1050 | |
1015 | try: | | 1051 | try: |
1016 | opts, args = getopt.getopt(argv[1:], 'v', ['verbose']) | | 1052 | opts, args = getopt.getopt(argv[1:], 'v', ['verbose']) |
1017 | for (opt, _) in opts: | | 1053 | for (opt, _) in opts: |
1018 | if opt in ('-v', '--verbose'): | | 1054 | if opt in ('-v', '--verbose'): |