pkgsrc-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[.joined/pkgsrc/trunk]: .joined/pkgsrc/pkgtools/url2pkg url2pkg: remove inter...



details:   https://anonhg.NetBSD.org/.joined/pkgsrc/rev/923a16e067be
branches:  trunk
changeset: 370879:923a16e067be
user:      rillig <rillig%pkgsrc.org@localhost>
date:      Sat Jan 01 14:04:11 2022 +0000

description:
url2pkg: remove interactivity

In the first phase, url2pkg generates a minimal package Makefile, barely
enough for downloading the distfile from the given URL.  That part runs
fully automated in almost all cases, so there is no need to invoke the
editor at this point.

After adjusting the package Makefile based on the downloaded and
extracted distfile, url2pkg has done its job, so there is no reason to
run the editor there as well.

Bump version.

diffstat:

 pkgtools/url2pkg/Makefile              |   4 ++--
 pkgtools/url2pkg/files/url2pkg.8       |  12 ++----------
 pkgtools/url2pkg/files/url2pkg.py      |  14 +++++++-------
 pkgtools/url2pkg/files/url2pkg_test.py |   4 +---
 4 files changed, 12 insertions(+), 22 deletions(-)

diffs (131 lines):

diff -r b5c22c7d91da -r 923a16e067be pkgtools/url2pkg/Makefile
--- a/pkgtools/url2pkg/Makefile Sat Jan 01 13:55:48 2022 +0000
+++ b/pkgtools/url2pkg/Makefile Sat Jan 01 14:04:11 2022 +0000
@@ -1,6 +1,6 @@
-# $NetBSD: Makefile,v 1.121 2021/11/14 09:20:15 rillig Exp $
+# $NetBSD: Makefile,v 1.122 2022/01/01 14:04:11 rillig Exp $
 
-PKGNAME=       url2pkg-21.3.0
+PKGNAME=       url2pkg-21.4.0
 CATEGORIES=    pkgtools
 
 MAINTAINER=    rillig%NetBSD.org@localhost
diff -r b5c22c7d91da -r 923a16e067be pkgtools/url2pkg/files/url2pkg.8
--- a/pkgtools/url2pkg/files/url2pkg.8  Sat Jan 01 13:55:48 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.8  Sat Jan 01 14:04:11 2022 +0000
@@ -1,4 +1,4 @@
-.\"    $NetBSD: url2pkg.8,v 1.14 2019/10/06 12:50:41 rillig Exp $
+.\"    $NetBSD: url2pkg.8,v 1.15 2022/01/01 14:04:11 rillig Exp $
 .\"
 .\" Copyright (c) 2001, 2019 The NetBSD Foundation, Inc.
 .\" All rights reserved.
@@ -27,7 +27,7 @@
 .\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
 .\" POSSIBILITY OF SUCH DAMAGE.
 .\"
-.Dd Oct 3, 2019
+.Dd January 1, 2022
 .Dt URL2PKG 8
 .Os
 .Sh NAME
@@ -49,17 +49,9 @@
 .Nm
 helps creating a package;
 it is not intended to fly on autopilot, though.
-Hence, after creating the package, the user's usual editor is invoked
-to edit the
-.Pa Makefile ,
-since in almost all cases the package needs manual work.
 .Pp
 .Sh ENVIRONMENT
 .Bl -tag -width indent
-.It PKGEDITOR, EDITOR
-Editor used for
-.Pa Makefile
-edition.
 .It PKGMAINTAINER, REPLYTO
 Name used for the MAINTAINER field in the package
 .Pa Makefile .
diff -r b5c22c7d91da -r 923a16e067be pkgtools/url2pkg/files/url2pkg.py
--- a/pkgtools/url2pkg/files/url2pkg.py Sat Jan 01 13:55:48 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg.py Sat Jan 01 14:04:11 2022 +0000
@@ -1,5 +1,5 @@
 #! @PYTHONBIN@
-# $NetBSD: url2pkg.py,v 1.33 2021/11/14 09:20:15 rillig Exp $
+# $NetBSD: url2pkg.py,v 1.34 2022/01/01 14:04:11 rillig Exp $
 
 # Copyright (c) 2019 The NetBSD Foundation, Inc.
 # All rights reserved.
@@ -75,7 +75,6 @@
     perl5: str
     pkgsrcdir: Union[Path, Any]
     pythonbin: str
-    editor: str
     pkgdir: Union[Path, Any]
     out: Any
     err: Any
@@ -87,7 +86,6 @@
         self.perl5 = '@PERL5@'
         self.pkgsrcdir = Path(os.getenv('PKGSRCDIR') or '@PKGSRCDIR@')
         self.pythonbin = '@PYTHONBIN@'
-        self.editor = os.getenv('PKGEDITOR') or os.getenv('EDITOR') or 'vi'
 
         # the following are overridden in tests
         self.pkgdir = Path('.')
@@ -572,8 +570,6 @@
         ]
         plist.is_file() or Lines(*plist_lines).write_to(plist)
 
-        subprocess.check_call([g.editor, makefile])
-
         g.bmake('clean', 'distinfo', 'extract')
 
         return initial_lines
@@ -1184,6 +1180,10 @@
             self.g.bmake('distinfo')
 
 
+def usage():
+    sys.exit(f'usage: {sys.argv[0]} [-v|--verbose] [URL]')
+
+
 def main(argv: List[str], g: Globals):
     if not os.path.isfile('../../mk/bsd.pkg.mk'):
         sys.exit(f'{argv[0]}: must be run from a package directory '
@@ -1195,9 +1195,9 @@
             if opt in ('-v', '--verbose'):
                 g.verbose = True
     except getopt.GetoptError:
-        sys.exit(f'usage: {argv[0]} [-v|--verbose] [URL]')
+        usage()
 
-    url = args[0] if args else input('URL: ')
+    url = args[0] if args else usage()
     if not re.fullmatch(r'\w+://[!-~]+?/[!-~]+', url):
         sys.exit(f'url2pkg: invalid URL: {url}')
 
diff -r b5c22c7d91da -r 923a16e067be pkgtools/url2pkg/files/url2pkg_test.py
--- a/pkgtools/url2pkg/files/url2pkg_test.py    Sat Jan 01 13:55:48 2022 +0000
+++ b/pkgtools/url2pkg/files/url2pkg_test.py    Sat Jan 01 14:04:11 2022 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: url2pkg_test.py,v 1.33 2021/11/14 09:20:15 rillig Exp $
+# $NetBSD: url2pkg_test.py,v 1.34 2022/01/01 14:04:11 rillig Exp $
 
 import pytest
 from url2pkg import *
@@ -692,7 +692,6 @@
 
 def test_Generator_generate_package(tmp_path: Path):
     url = 'https://ftp.gnu.org/pub/gnu/cflow/cflow-1.6.tar.gz'
-    g.editor = 'true'  # the shell command
     g.make = 'true'  # the shell command
     g.pkgdir = tmp_path
 
@@ -1561,7 +1560,6 @@
 def test_main__valid_URL():
     import shutil
 
-    g.editor = 'true'
     g.make = os.getenv('MAKE') or sys.exit('MAKE must be set')
     g.pkgdir = g.pkgsrcdir / 'pkgtools' / 'url2pkg-test-main'
     g.pkgdir.is_dir() and shutil.rmtree(g.pkgdir)



Home | Main Index | Thread Index | Old Index