Thu Oct 3 16:43:58 2019 UTC ()
pkgtools/url2pkg: use filenames relative to WRKSRC

Before this change, the Python implementation had written absolute paths
to PKGCONFIG_OVERRIDE, which didn't make sense.


(rillig)
diff -r1.4 -r1.5 pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -r1.3 -r1.4 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py

cvs diff -r1.4 -r1.5 pkgsrc/pkgtools/url2pkg/files/url2pkg.py (expand / switch to unified diff)

--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py 2019/10/03 16:32:47 1.4
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py 2019/10/03 16:43:58 1.5
@@ -1,15 +1,15 @@ @@ -1,15 +1,15 @@
1#! @PYTHONBIN@ 1#! @PYTHONBIN@
2# $NetBSD: url2pkg.py,v 1.4 2019/10/03 16:32:47 rillig Exp $ 2# $NetBSD: url2pkg.py,v 1.5 2019/10/03 16:43:58 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
@@ -802,32 +802,36 @@ class Adjuster: @@ -802,32 +802,36 @@ class Adjuster:
802 802
803 lines.append('CATEGORIES', ' '.join(self.categories)) 803 lines.append('CATEGORIES', ' '.join(self.categories))
804 804
805 self.adjust_lines_python_module(lines, url) 805 self.adjust_lines_python_module(lines, url)
806 806
807 for varname in self.update_vars: 807 for varname in self.update_vars:
808 debug('update_var {0} {1}', varname, self.update_vars[varname]) 808 debug('update_var {0} {1}', varname, self.update_vars[varname])
809 lines.set(varname, self.update_vars[varname]) 809 lines.set(varname, self.update_vars[varname])
810 810
811 return lines 811 return lines
812 812
813 def adjust_package_from_extracted_distfiles(self, url: str): 813 def adjust_package_from_extracted_distfiles(self, url: str):
814 814
 815 def scan(basedir: str, pattern: str) -> List[str]:
 816 full_paths = glob.glob(f'{basedir}/{pattern}', recursive=True)
 817 return list(f[len(basedir) + 1:] for f in full_paths)
 818
815 debug('Adjusting the Makefile') 819 debug('Adjusting the Makefile')
816 820
817 self.abs_wrkdir = show_var('WRKDIR') 821 self.abs_wrkdir = show_var('WRKDIR')
818 self.determine_wrksrc() 822 self.determine_wrksrc()
819 self.wrksrc_files = glob.glob(f'{self.abs_wrksrc}/**', recursive=True) 823 self.wrksrc_files = scan(self.abs_wrksrc, '**')
820 self.wrksrc_dirs = glob.glob(f'{self.abs_wrksrc}/**/', recursive=True) 824 self.wrksrc_dirs = scan(self.abs_wrksrc, '**/')
821 825
822 self.makefile_lines = Lines.read_from(config.pkgdir + '/Makefile') 826 self.makefile_lines = Lines.read_from(config.pkgdir + '/Makefile')
823 827
824 self.adjust_configure() 828 self.adjust_configure()
825 self.adjust_cmake() 829 self.adjust_cmake()
826 self.adjust_meson() 830 self.adjust_meson()
827 self.adjust_gconf2_schemas() 831 self.adjust_gconf2_schemas()
828 self.adjust_libtool() 832 self.adjust_libtool()
829 self.adjust_perl_module(url) 833 self.adjust_perl_module(url)
830 self.adjust_python_module() 834 self.adjust_python_module()
831 self.adjust_cargo() 835 self.adjust_cargo()
832 self.adjust_pkg_config() 836 self.adjust_pkg_config()
833 self.adjust_po() 837 self.adjust_po()

cvs diff -r1.3 -r1.4 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py (expand / switch to unified diff)

--- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py 2019/10/03 16:32:47 1.3
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py 2019/10/03 16:43:58 1.4
@@ -1,14 +1,14 @@ @@ -1,14 +1,14 @@
1# $NetBSD: url2pkg_test.py,v 1.3 2019/10/03 16:32:47 rillig Exp $ 1# $NetBSD: url2pkg_test.py,v 1.4 2019/10/03 16:43:58 rillig Exp $
2 2
3from url2pkg import * 3from url2pkg import *
4 4
5 5
6def setup_function(_): 6def setup_function(_):
7 config.pkgsrcdir = os.getenv('PKGSRCDIR') 7 config.pkgsrcdir = os.getenv('PKGSRCDIR')
8 assert config.pkgsrcdir is not None 8 assert config.pkgsrcdir is not None
9 os.chdir(config.pkgsrcdir + '/pkgtools/url2pkg') 9 os.chdir(config.pkgsrcdir + '/pkgtools/url2pkg')
10 10
11 11
12def str_vars(vars: List[Var]) -> List[str]: 12def str_vars(vars: List[Var]) -> List[str]:
13 return list(map(lambda var: var.name + var.op + var.value, vars)) 13 return list(map(lambda var: var.name + var.op + var.value, vars))
14 14