pkgsrc-Changes archive

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

CVS commit: pkgsrc/pkgtools/url2pkg



Module Name:    pkgsrc
Committed By:   rillig
Date:           Sat Jan  1 14:04:11 UTC 2022

Modified Files:
        pkgsrc/pkgtools/url2pkg: Makefile
        pkgsrc/pkgtools/url2pkg/files: url2pkg.8 url2pkg.py url2pkg_test.py

Log Message:
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.


To generate a diff of this commit:
cvs rdiff -u -r1.121 -r1.122 pkgsrc/pkgtools/url2pkg/Makefile
cvs rdiff -u -r1.14 -r1.15 pkgsrc/pkgtools/url2pkg/files/url2pkg.8
cvs rdiff -u -r1.33 -r1.34 pkgsrc/pkgtools/url2pkg/files/url2pkg.py \
    pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: pkgsrc/pkgtools/url2pkg/Makefile
diff -u pkgsrc/pkgtools/url2pkg/Makefile:1.121 pkgsrc/pkgtools/url2pkg/Makefile:1.122
--- pkgsrc/pkgtools/url2pkg/Makefile:1.121      Sun Nov 14 09:20:15 2021
+++ pkgsrc/pkgtools/url2pkg/Makefile    Sat Jan  1 14:04:11 2022
@@ -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

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.8
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.8:1.14 pkgsrc/pkgtools/url2pkg/files/url2pkg.8:1.15
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.8:1.14        Sun Oct  6 12:50:41 2019
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.8     Sat Jan  1 14:04:11 2022
@@ -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 @@ fills in some variables in the package
 .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 .

Index: pkgsrc/pkgtools/url2pkg/files/url2pkg.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.33 pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.34
--- pkgsrc/pkgtools/url2pkg/files/url2pkg.py:1.33       Sun Nov 14 09:20:15 2021
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg.py    Sat Jan  1 14:04:11 2022
@@ -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 @@ class Globals:
     perl5: str
     pkgsrcdir: Union[Path, Any]
     pythonbin: str
-    editor: str
     pkgdir: Union[Path, Any]
     out: Any
     err: Any
@@ -87,7 +86,6 @@ class Globals:
         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 @@ class Generator:
         ]
         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 @@ class Adjuster:
             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 @@ def main(argv: List[str], g: Globals):
             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}')
 
Index: pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py
diff -u pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.33 pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.34
--- pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py:1.33  Sun Nov 14 09:20:15 2021
+++ pkgsrc/pkgtools/url2pkg/files/url2pkg_test.py       Sat Jan  1 14:04:11 2022
@@ -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_adjust_everything_els
 
 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__verbose():
 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