[pacman-dev] [PATCH v2] makepkg: Add flag for printing SRCINFO to stdout

Johannes Löthberg johannes at kyriasis.com
Mon May 25 21:46:37 UTC 2015


This commit adds a makepkg option to generate and print the SRCINFO file
for a PKGBUILD, required by the new AUR, to stdout.

AUR 4.0 will use Git instead of source tarballs for uploading packages,
so making makepkg capable of printing the SRCINFO would simplify package
management, instead of having to extract it from a source tarball.

It is also useful for scripting other things, so that instead of having
to parse PKGBUILDs, one can make makepkg generate the SRCINFO and then
you can parse that instead, which is much simpler and less error-prone.
---
Now with documentation and justification!

 doc/makepkg.8.txt     | 3 +++
 scripts/makepkg.sh.in | 9 ++++++++-
 2 files changed, 11 insertions(+), 1 deletion(-)

diff --git a/doc/makepkg.8.txt b/doc/makepkg.8.txt
index 41df30e..4323fd3 100644
--- a/doc/makepkg.8.txt
+++ b/doc/makepkg.8.txt
@@ -207,6 +207,9 @@ Options
 	List the packages that would be produced without building. Listed
 	package names do not include PKGEXT.
 
+*\--printsrcinfo*::
+	Generate and print the SRCINFO file to stdout.
+
 Additional Features
 -------------------
 makepkg supports building development versions of packages without having to
diff --git a/scripts/makepkg.sh.in b/scripts/makepkg.sh.in
index c74e84a..2613b31 100644
--- a/scripts/makepkg.sh.in
+++ b/scripts/makepkg.sh.in
@@ -1723,6 +1723,7 @@ usage() {
 	printf -- "$(gettext "  --nosign         Do not create a signature for the package")\n"
 	printf -- "$(gettext "  --packagelist    Only list packages that would be produced, without PKGEXT")\n"
 	printf -- "$(gettext "  --pkg <list>     Only build listed packages from a split package")\n"
+	printf -- "$(gettext "  --printsrcinfo   Print the generated SRCINFO and exit")\n"
 	printf -- "$(gettext "  --sign           Sign the resulting package with %s")\n" "gpg"
 	printf -- "$(gettext "  --skipchecksums  Do not verify checksums of the source files")\n"
 	printf -- "$(gettext "  --skipinteg      Do not perform any verification checks on source files")\n"
@@ -1768,7 +1769,7 @@ OPT_SHORT="AcCdefFghiLmop:rRsSV"
 OPT_LONG=('allsource' 'check' 'clean' 'cleanbuild' 'config:' 'force' 'geninteg'
           'help' 'holdver' 'ignorearch' 'install' 'key:' 'log' 'noarchive' 'nobuild'
           'nocolor' 'nocheck' 'nodeps' 'noextract' 'noprepare' 'nosign' 'packagelist'
-          'pkg:' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg'
+          'pkg:' 'printsrcinfo' 'repackage' 'rmdeps' 'sign' 'skipchecksums' 'skipinteg'
           'skippgpcheck' 'source' 'syncdeps' 'verifysource' 'version')
 
 # Pacman Options
@@ -1813,6 +1814,7 @@ while true; do
 		-p)               shift; BUILDFILE=$1 ;;
 		--pkg)            shift; IFS=, read -ra p <<<"$1"; PKGLIST+=("${p[@]}"); unset p ;;
 		--packagelist)    PACKAGELIST=1 IGNOREARCH=1;;
+		--printsrcinfo)   PRINTSRCINFO=1 ;;
 		-r|--rmdeps)      RMDEPS=1 ;;
 		-R|--repackage)   REPKG=1 ;;
 		--sign)           SIGNPKG='y' ;;
@@ -2099,6 +2101,11 @@ if (( PACKAGELIST )); then
 	exit 0
 fi
 
+if (( PRINTSRCINFO )); then
+	write_srcinfo
+	exit 0
+fi
+
 if (( ! PKGVERFUNC )); then
 	check_build_status
 fi
-- 
2.4.1


More information about the pacman-dev mailing list