diff --git a/abuild.conf.in b/abuild.conf.in index 5db5a6ca5d52bf69d67e21b40889b3666b81c973..9d03acf5918d5f68563e2320d7efb6b5c9f6e1c9 100644 --- a/abuild.conf.in +++ b/abuild.conf.in @@ -15,7 +15,7 @@ #REPODEST=$HOME/packages/ # PACKAGER and MAINTAINER are used by newapkbuild when creating new aports for -# the APKBUILD's "Contributor:" and "Maintainer:" comments, respectively. +# the APKBUILD's "Contributor:" comment and "maintainer" field, respectively. #PACKAGER="Your Name <your@email.address>" #MAINTAINER="$PACKAGER" diff --git a/abuild.in b/abuild.in index cbd90de043d8001d522d58b6c03522f8b8795294..3dabe6580aa58e9bdc8f7a7bc016e58fce991e20 100644 --- a/abuild.in +++ b/abuild.in @@ -306,8 +306,8 @@ default_validate() { [ -n "$conflicts" ] && die "APKBUILD contains \$conflicts. Explicit conflicts should be added as '!pkgname' to depends" check_maintainer || die "Provide a valid RFC822 maintainer address" - [ $(grep '^# *Maintainer:' "$APKBUILD" | wc -l) -gt 1 ] \ - && die "More than one maintainer" + grep -q '^# *Maintainer:' "$APKBUILD" \ + && warning "Setting the maintainer with a comment is deprecated. Use maintainer=\"$maintainer\" instead" check_license || warning "Please use valid SPDX license identifiers found at: https://spdx.org/licenses" check_depends_dev || warning "depends_dev found but no development subpackage found" @@ -990,9 +990,7 @@ git_last_commit_epoch() { } get_maintainer() { - if [ -z "$maintainer" ]; then - maintainer=$(awk -F': ' '/# *Maintainer/ {print $2}' "$APKBUILD") - fi + : "${maintainer:=$(awk -F': ' '/# *Maintainer/ {print $2}' "$APKBUILD")}" } check_maintainer() { diff --git a/apkbuild-cpan.in b/apkbuild-cpan.in index 73d091e39b180382f7ff2a865a783692752f63b5..33f17a8838fa4f3b12ca6a662693707471a1c03b 100755 --- a/apkbuild-cpan.in +++ b/apkbuild-cpan.in @@ -39,8 +39,9 @@ my $package_mappings = { }; our $packager = ""; my $template = <<'EOF'; -# Automatically generated by apkbuild-cpan, template 4 +# Automatically generated by apkbuild-cpan, template 5 [% authors %] +maintainer=[% maintainer %] pkgname=[% pkgname %] pkgver=[% pkgver %] pkgrel=[% pkgrel %] @@ -95,11 +96,12 @@ sub read_assignments_from_file { my %hash = ( %sline, %mline ); return \%hash if $filename ne 'APKBUILD'; - my $authors = join( "\n", - $text =~ /^# Contributor: .*$/mg, - $text =~ /^# Maintainer: .*$/mg ); + my $authors = $text =~ /^# Contributor: .*$/mg; $hash{'authors'} = $authors if length($authors) > 1; + my $maintainer = $text =~ /^# Maintainer: .*$/mg; + $hash{'maintainer'} = $maintainer if length($maintainer) > 1; + my $options = $text =~ m/^options=\"(.*)\"(.*)$/mg; $hash{'options'} = "$1" if length($options) >= 1; $hash{'options_comment'} = "$2" if length($options) >= 1; @@ -153,6 +155,7 @@ sub write_apkbuild { my ( $distdata, $apkbuild, $moddata ) = @_; my $authors = undef; + my $maintainer = $packager; my $replaces = undef; my $provides = undef; my $pkgrel = 0; @@ -161,6 +164,8 @@ sub write_apkbuild { my $orig_source = undef; if ( defined $apkbuild ) { $authors = $apkbuild->{authors}; + $maintainer = $apkbuild->{maintainer}; + $pkgrel = $apkbuild->{pkgrel}; $provides = $apkbuild->{provides}; $replaces = $apkbuild->{replaces}; $pkgrel = $apkbuild->{pkgrel}; @@ -190,8 +195,9 @@ sub write_apkbuild { my %repl = ( authors => ( $authors - or "# Contributor: $packager\n# Maintainer: $packager" + or "# Contributor: $packager" ), + maintainer => $maintainer, pkgname => map_cpan_to_apk( $moddata->{distribution} ), pkgreal => $pkgreal, pkgver => $pkgver, diff --git a/apkbuild-pypi.in b/apkbuild-pypi.in index 88ee804156974f633de8fa1f52a56244044bc908..333479bb33dbf2ec2300aa04055f5bfa48064dcf 100755 --- a/apkbuild-pypi.in +++ b/apkbuild-pypi.in @@ -16,8 +16,9 @@ my %pkgmap = (); my %licenses = (); my $template = <<'EOF'; -# Automatically generated by apkbuild-pypi, template 4 +# Automatically generated by apkbuild-pypi, template 5 [% authors %] +maintainer=[% maintainer %] pkgname=[% pkgname %] pkgver=[% pkgver %] pkgrel=[% pkgrel %] @@ -76,11 +77,12 @@ sub read_assignments_from_file { my %hash = ( %sline, %mline ); return \%hash if $filename ne 'APKBUILD'; - my $authors = join( "\n", - $text =~ /^# Contributor: .*$/mg, - $text =~ /^# Maintainer: .*$/mg ); + my $authors = $text =~ /^# Contributor: .*$/mg; $hash{'authors'} = $authors if length($authors) > 1; + my $maintainer = $text =~ /^# Maintainer: .*$/mg; + $hash{'maintainer'} = $maintainer if length($maintainer) > 1; + if ($text =~ m/^provides=\"(.*)\"(.*)$/m) { $hash{'provides'} = $1; $hash{'provides_comment'} = $2; @@ -181,6 +183,7 @@ sub write_apkbuild { my $replaces = undef; my $provides = undef; my $authors = undef; + my $maintainer = $packager; my $license = undef; my $url = undef; my $pkgname = undef; @@ -199,6 +202,7 @@ sub write_apkbuild { if (defined $apkbuild) { $authors = $apkbuild->{authors}; + $maintainer = $apkbuild->{maintainer}; $provides = $apkbuild->{provides}; $replaces = $apkbuild->{replaces}; $license = $apkbuild->{license}; @@ -220,7 +224,8 @@ sub write_apkbuild { my $srcurl = get_source($distdata); my %repl = ( - authors => ($authors or "# Contributor: $packager\n# Maintainer: $packager"), + authors => ($authors or "# Contributor: $packager"), + maintainer => $mantainer, pkgname => ($pkgname or map_pypi_to_apk($pkgreal)), pkgreal => $pkgreal, pkgver => $distdata->{info}{version}, diff --git a/newapkbuild.in b/newapkbuild.in index 855d522b9b14e89235358db853b0d38e1e1aeef3..8b95106f326745e09bd0aadaa2bf078ca7354fee 100644 --- a/newapkbuild.in +++ b/newapkbuild.in @@ -304,7 +304,7 @@ newaport() { # Generate header with standard variables cat >APKBUILD<<__EOF__ # Contributor:${PACKAGER:+" "}${PACKAGER} -# Maintainer:${MAINTAINER:+" "}${MAINTAINER} +maintainer="$MAINTAINER" pkgname=$pkgname pkgver=$pv pkgrel=0 diff --git a/sample.APKBUILD b/sample.APKBUILD index 876e1e03c648f5ec8c9e9d192c686b2ffbcb8923..de6485d99150b23b03f496aabc05a2a551303a1c 100644 --- a/sample.APKBUILD +++ b/sample.APKBUILD @@ -4,7 +4,7 @@ # then please put 'unknown'. # Contributor: Your Name <youremail@domain.com> -# Maintainer: Your Name <youremail@domain.com> +maintainer="Your Name <youremail@domain.com>" pkgname=NAME pkgver=VERSION pkgrel=0 diff --git a/tests/abuild_test b/tests/abuild_test index af99a28d451e0ae42ecd4bbb065a194520b92ff2..775cb57d7273ae8d795e2ecbe88758567c6808a1 100755 --- a/tests/abuild_test +++ b/tests/abuild_test @@ -96,7 +96,7 @@ abuild_build_fail_body() { init_keys mkdir buildfail cat >buildfail/APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="buildfail" pkgver="1.0" pkgrel=0 @@ -127,7 +127,7 @@ abuild_invalid_filename_body() { mkdir invalid-filename cd invalid-filename cat >APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="invalid-filename" pkgver="1.0" pkgrel=0 @@ -159,7 +159,7 @@ abuild_usr_lib64_body() { mkdir lib64test cd lib64test cat >APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="lib64test" pkgver="1.0" pkgrel=0 @@ -297,7 +297,7 @@ abuild_subpkg_dep_leak_body() { mkdir -p testrepo/subpkg-dep-leak cd testrepo/subpkg-dep-leak cat > APKBUILD <<-EOF - # Maintainer: Natanael Copa <ncopa@alpinelinux.org> + maintainer="Natanael Copa <ncopa@alpinelinux.org>" pkgname="subpkg-dep-leak" pkgver=1.0 pkgrel=0 @@ -367,7 +367,7 @@ abuild_reject_init_with_improper_shebang_body() { mkdir invalid-initd cd invalid-initd cat >APKBUILD<<-EOF - # Maintainer: Natanael Copa <ncopa@alpinelinux.org> + maintainer="Natanael Copa <ncopa@alpinelinux.org>" pkgname="invalid-initd" pkgver="1.0" pkgrel=0 @@ -536,7 +536,7 @@ abuild_git_ceiling_body() { mkdir git-pkg cd git-pkg cat >APKBUILD<<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="git-pkg" pkgver="1.0" pkgrel=0 @@ -566,7 +566,7 @@ abuild_package_size_body() { cd test-size cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" # test package pkgname="test-size" @@ -676,7 +676,7 @@ abuild_keepdirs_body() { cd test-amove cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" # test package pkgname="test-keepdirs" @@ -702,7 +702,7 @@ abuild_amove_body() { cd test-amove cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" # test package pkgname="test-amove" @@ -798,7 +798,7 @@ abuild_doc_body() { cd foo cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" # test package pkgname="foo" pkgver="1.0" @@ -836,7 +836,7 @@ abuild_dev_body() { cd foo cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" # test package pkgname="foo" pkgver="1.0" @@ -875,7 +875,7 @@ abuild_devhelp_warn_body() { cd foo cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" pkgname="foo" pkgver="1.0" pkgrel=0 @@ -898,7 +898,7 @@ abuild_devhelp_body() { cd foo cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" pkgname="foo" pkgver="1.0" pkgrel=0 @@ -926,14 +926,14 @@ abuild_check_maintainer_body() { "Trailing Space <n@example.com> " \ "Foo<u@example.com>" \ '"Quotes <u@example.com>"'; do - printf "# Maintainer: %s\n%s\n" "$m" "pkgname=foo" > APKBUILD + printf "maintainer='%s'\npkgname=foo\n" "${m//"'"/"'\\''"}" > APKBUILD atf_check -s not-exit:0 \ -e match:"ERROR:" \ abuild check_maintainer done for m in "Test User <123@example.com>" "Foo O'Brian <n@example.com>" "Åukasz Something <s@example.com>"; do - printf "# Maintainer: %s\n%s\n" "$m" "pkgname=foo" > APKBUILD + printf "maintainer='%s'\npkgname=foo\n" "${m//"'"/"'\\''"}" > APKBUILD atf_check abuild check_maintainer done } @@ -945,7 +945,7 @@ abuild_cleanoldpkg_body() { for arch in aarch64 x86_64; do for v in 0.9 1.0 1.1; do cat > APKBUILD <<-EOF - # Maintainer: Test User 123 <123@example.com> + maintainer="Test User 123 <123@example.com>" # test package pkgname="foo" pkgver="$v" @@ -1008,7 +1008,7 @@ abuild_pyc_warn_body() { mkdir -p pycachetest cd pycachetest cat >APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="pycachetest" pkgver="1.0" pkgrel=0 @@ -1033,7 +1033,7 @@ abuild_pyc_body() { mkdir -p foo cd foo cat >APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="foo" pkgver="1.0" pkgrel=0 @@ -1082,7 +1082,7 @@ abuild_command_provides_body() { mkdir testprovides cd testprovides cat >APKBUILD<<-EOF - # Maintainer: Natanael Copa <ncopa@alpinelinux.org> + maintainer="Natanael Copa <ncopa@alpinelinux.org>" pkgname=testprovides pkgver=1.0 pkgrel=0 @@ -1117,7 +1117,7 @@ abuild_gocache_dir_body() { mkdir gocache-dir cd gocache-dir cat >APKBUILD<<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="gocache-dir" pkgver="1.0" pkgrel=0 @@ -1148,7 +1148,7 @@ abuild_cargo_home_dir_body() { mkdir cargo-home-dir cd cargo-home-dir cat >APKBUILD<<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="cargo-home-dir" pkgver="1.0" pkgrel=0 @@ -1179,7 +1179,7 @@ abuild_fish_comp_split_body() { mkdir fish-split-dir cd fish-split-dir cat >APKBUILD<<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="fish-split-dir" pkgver="1.0" pkgrel=0 @@ -1236,7 +1236,7 @@ abuild_deps_body() { mkdir testdeps cd testdeps cat >APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="testdeps" pkgver="1.0" pkgrel=0 @@ -1296,7 +1296,7 @@ abuild_usr_merge_body() { mkdir usrmergetest cd usrmergetest cat >APKBUILD <<-EOF - # Maintainer: Joe User <juser@example.com> + maintainer="Joe User <juser@example.com>" pkgname="usrmergetest" pkgver="1.0" pkgrel=0 diff --git a/tests/abump_test b/tests/abump_test index eadf173561adfb088d3f0111558ec107915f6312..d59dda00287099f2fa375ef976703ceefdeb3e9d 100755 --- a/tests/abump_test +++ b/tests/abump_test @@ -40,7 +40,7 @@ abump_simple_bump_body() { cd main/foo echo "first" > foo-1.0.txt cat > APKBUILD <<-EOF - # Maintainer: Test user <user@example.com> + maintainer="Test user <user@example.com>" pkgname="foo" pkgver=1.0 pkgrel=0 @@ -84,7 +84,7 @@ abump_isolates_apkbuild_body() { cd main/bar echo "first" > bar-1.0.txt cat > APKBUILD <<-"EOF" - # Maintainer: Test user <user@example.com> + maintainer="Test user <user@example.com>" pkgname="bar" pkgver=1.0 pkgrel=0 diff --git a/tests/testrepo/dbgpkg/APKBUILD b/tests/testrepo/dbgpkg/APKBUILD index e090c35fe281c1ecf2dc822f11d3139bae3df27b..9782fb7e0b6c25cc477e4abae7409ab9176bc0d5 100644 --- a/tests/testrepo/dbgpkg/APKBUILD +++ b/tests/testrepo/dbgpkg/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname="dbgpkg" diff --git a/tests/testrepo/invalid-filename/APKBUILD b/tests/testrepo/invalid-filename/APKBUILD index 97931884cf1d4bf56ebefc3f7d788e25e2b0d35b..ecf368da7caeb86b2bd32d7892b6c1a97eb310a8 100644 --- a/tests/testrepo/invalid-filename/APKBUILD +++ b/tests/testrepo/invalid-filename/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname="invalid-filename" diff --git a/tests/testrepo/large-doc-subpkg/APKBUILD b/tests/testrepo/large-doc-subpkg/APKBUILD index 631d3757e2a172b9a3d402212667c9e02552fcf4..623c4b2f9db33433ea67216a318a7a105366a871 100644 --- a/tests/testrepo/large-doc-subpkg/APKBUILD +++ b/tests/testrepo/large-doc-subpkg/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname="large-doc-subpkg" diff --git a/tests/testrepo/lib64test/APKBUILD b/tests/testrepo/lib64test/APKBUILD index 7da888f432d77b97731186515c46602464e4ec2e..0f3c1d7ad435d0cbb152f4b0848b43f81c256930 100644 --- a/tests/testrepo/lib64test/APKBUILD +++ b/tests/testrepo/lib64test/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname="lib64test" diff --git a/tests/testrepo/pkg path with spaces/APKBUILD b/tests/testrepo/pkg path with spaces/APKBUILD index 9a1687ac4be5afbe02b996c8aeeea179d947b837..70afebc6d4dbcbc2e2120957c58a309b33b71bb9 100644 --- a/tests/testrepo/pkg path with spaces/APKBUILD +++ b/tests/testrepo/pkg path with spaces/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname="pkg-path-with-spaces" diff --git a/tests/testrepo/pkg1/APKBUILD b/tests/testrepo/pkg1/APKBUILD index a87d7d0247d7bd29943600366b0c654e927310c3..60b9efdf713f9d681b45dac4e157ffba1de256f4 100644 --- a/tests/testrepo/pkg1/APKBUILD +++ b/tests/testrepo/pkg1/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname="pkg1" diff --git a/tests/testrepo/py3 foo and bar/APKBUILD b/tests/testrepo/py3 foo and bar/APKBUILD index 28837a7355a31b7a86a4eff4ef2afd626605620d..1bb3802471219e16b3a1f679660e010e556af32b 100644 --- a/tests/testrepo/py3 foo and bar/APKBUILD +++ b/tests/testrepo/py3 foo and bar/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Test user <user@example.com> +maintainer="Test user <user@example.com>" pkgname=py3-foo-and-bar pkgver=1.0.0 pkgrel=0 diff --git a/tests/testrepo/py3-conflicting-python-versions/APKBUILD b/tests/testrepo/py3-conflicting-python-versions/APKBUILD index 12190b098473b7dca08f43917fb14fa8b52b7dd9..d4f72368fde33c0b69f26ca48ae233057cf963c8 100644 --- a/tests/testrepo/py3-conflicting-python-versions/APKBUILD +++ b/tests/testrepo/py3-conflicting-python-versions/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Test user <user@example.com> +maintainer="Test user <user@example.com>" pkgname=py3-conflicting-python-versions pkgver=1.0.0 pkgrel=0 diff --git a/tests/testrepo/setcap/APKBUILD b/tests/testrepo/setcap/APKBUILD index 6d5eb882f45d63b49a3e25f10d8aaf6e93373756..d6f9d4b8f3284b2b7db7133878e0709d6993ec99 100644 --- a/tests/testrepo/setcap/APKBUILD +++ b/tests/testrepo/setcap/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname=setcap diff --git a/tests/testrepo/subpackage-arch/APKBUILD b/tests/testrepo/subpackage-arch/APKBUILD index a4db324d3751a186b4fa5c2f7b1cd53a58374eed..ace5945525687295bd7e850c3f15507024316e3a 100644 --- a/tests/testrepo/subpackage-arch/APKBUILD +++ b/tests/testrepo/subpackage-arch/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname=${TESTNAME-test-pkgname} diff --git a/tests/testrepo/test-licenses/APKBUILD b/tests/testrepo/test-licenses/APKBUILD index 0d954b7a7ccc57b298c9f0ca53553b8957a790e4..947c46ef08713a97c63caccf6fe39b7cff77c172 100644 --- a/tests/testrepo/test-licenses/APKBUILD +++ b/tests/testrepo/test-licenses/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Olliver Schinagl <oliver@schinagl.nl> +maintainer="Olliver Schinagl <oliver@schinagl.nl>" # test package pkgname="${TESTNAME-test-licenses}" diff --git a/tests/testrepo/test-pkgname/APKBUILD b/tests/testrepo/test-pkgname/APKBUILD index b75ca3e4bfd1b2f1cbdee65d12429bd6d68e85db..c1eee33e766cb44282a9d4077f8ea371113bb3dc 100644 --- a/tests/testrepo/test-pkgname/APKBUILD +++ b/tests/testrepo/test-pkgname/APKBUILD @@ -1,4 +1,4 @@ -# Maintainer: Natanael Copa <ncopa@alpinelinux.org> +maintainer="Natanael Copa <ncopa@alpinelinux.org>" # test package pkgname=${TESTNAME-test-pkgname}