public inbox for cygwin-apps@cygwin.com
 help / color / mirror / Atom feed
* [PATCH cygport] Make a build-depends list from a cygport file
@ 2021-01-24  5:40 Lemures Lemniscati
  0 siblings, 0 replies; only message in thread
From: Lemures Lemniscati @ 2021-01-24  5:40 UTC (permalink / raw)
  To: cygwin-apps

[-- Attachment #1: Type: text/plain, Size: 1230 bytes --]

Hi!

Here are small patches, which might be useful (I guess).

1. We can get a build-depends list from a cygport file by

     cygport foo.cygport builddep-oneline | tail -1

   and can easily use the results from other scripts.

2. Make sure a build-depends list in *-src.hint be a single line
   (just a fool-proof).

----

* 0001-New-functions-in-lib-pkg_info.cygpart.patch

    New functions in lib/pkg_info.cygpart
    
    * __make_oneline_sorted(), __make_list_sorted():
      print a space-separated, or newline-ending list of args
    
    * __show_build_deps_oneline(), __show_build_deps():
      print ${BUILD_REQUIRES} and 'cygport' by the functions above


* 0002-New-commands-builddep-oneline.patch

    New commands: builddep*oneline and builddep* to show BUILD_REQUIRES
    
    * cygport builddep*oneline
    * cygport builddep*
    
    We can get a space-separated list of build-depends by
    
        cygport foo.cygport builddep-oneline | tail -1
    
    Note:
      It's safe to extract a last line explicitly,
      in case cygport outputs something else.


* 0003-Make-sure-build-depends-in-src_hint-is-oneline.patch

    Use __show_build_deps_oneline() to generate *-src.hint files

----

Regards,

Lem

[-- Attachment #2: 0001-New-functions-in-lib-pkg_info.cygpart.patch --]
[-- Type: application/octet-stream, Size: 1365 bytes --]

From f38f833baff07ebb1f7831464a18d03f652dbc8a Mon Sep 17 00:00:00 2001
From: Lemures Lemniscati <lemures.lemniscati@gmail.com>
Date: Sun, 24 Jan 2021 14:16:20 +0900
Subject: [PATCH] New functions in lib/pkg_info.cygpart

* __make_oneline_sorted(), __make_list_sorted():
  print a space-separated, or newline-ending list of args

* __show_build_deps_oneline(), __show_build_deps():
  print ${BUILD_REQUIRES} and 'cygport' by the functions above

diff --git a/lib/pkg_info.cygpart b/lib/pkg_info.cygpart
index 98f7808..bc04a41 100644
--- a/lib/pkg_info.cygpart
+++ b/lib/pkg_info.cygpart
@@ -658,5 +658,25 @@ __show_web() {
 	${mybrowser} ${mywww} &>/dev/null &
 }
 
+__make_oneline_sorted() {
+	# Make a space separated list of items;
+	# spaces are trimmed and squeezed.
+	printf '%s\n' $@ | sort -u | sed -ze 's/\n/ /g;s/ $//'
+}
+__make_list_sorted() {
+	# Make a list of items; one item per line.
+	printf '%s\n' $@ | sort -u
+}
+
+__show_build_deps_oneline() {
+	__make_oneline_sorted cygport ${BUILD_REQUIRES}
+}
+
+__show_build_deps() {
+	__make_list_sorted cygport ${BUILD_REQUIRES}
+}
+
 readonly -f __list_files __list_debug_files __list_deps \
-	    __show_deps __show_info __show_web __pager
+	    __show_deps __show_info __show_web __pager \
+	    __show_build_deps __show_build_deps_oneline \
+	    __make_list_sorted __make_oneline_sorted
-- 
2.30.0


[-- Attachment #3: 0002-New-commands-builddep-oneline.patch --]
[-- Type: application/octet-stream, Size: 1198 bytes --]

From ea8bf0f0886c5adcb95dee71b753c357aa211a71 Mon Sep 17 00:00:00 2001
From: Lemures Lemniscati <lemures.lemniscati@gmail.com>
Date: Sun, 24 Jan 2021 14:16:21 +0900
Subject: [PATCH] New commands: builddep*oneline and builddep* to show
 BUILD_REQUIRES

* cygport builddep*oneline
* cygport builddep*

We can get a space-separated list of build-depends by

    cygport foo.cygport builddep-oneline | tail -1

Note:
  It's safe to extract a last line explicitly,
  in case cygport outputs something else.

diff --git a/bin/cygport.in b/bin/cygport.in
index 12909fe..fd289d7 100755
--- a/bin/cygport.in
+++ b/bin/cygport.in
@@ -318,7 +318,7 @@ source ${_privlibdir}/src_install.cygpart
 source ${_privlibdir}/src_postinst.cygpart
 ###
 
-### __list_files, __show_deps, __show_info, __show_web
+### __list_files, __show_deps, __show_info, __show_web, __show_build_deps, __show_build_deps_oneline
 source ${_privlibdir}/pkg_info.cygpart
 ###
 
@@ -615,6 +615,14 @@ do
 			__list_debug_files;
 			_status=$?;
 			;;
+		builddep*oneline)
+			__show_build_deps_oneline;
+			_status=$?;
+			;;
+		builddep*)
+			__show_build_deps;
+			_status=$?;
+			;;
 		dep*)
 			__show_deps;
 			_status=$?;
-- 
2.30.0


[-- Attachment #4: 0003-Make-sure-build-depends-in-src_hint-is-oneline.patch --]
[-- Type: application/octet-stream, Size: 748 bytes --]

From 1fe567106a371cccaa0750fdb192104528d6aeab Mon Sep 17 00:00:00 2001
From: Lemures Lemniscati <lemures.lemniscati@gmail.com>
Date: Sun, 24 Jan 2021 14:16:22 +0900
Subject: [PATCH] Use __show_build_deps_oneline() to generate *-src.hint files


diff --git a/lib/pkg_pkg.cygpart b/lib/pkg_pkg.cygpart
index e4f5012..e0993f2 100644
--- a/lib/pkg_pkg.cygpart
+++ b/lib/pkg_pkg.cygpart
@@ -915,7 +915,7 @@ _EOF
 		then
 			cat > ${distdir}/${PN}/${PN}-${PVR}-src.hint <<-_EOF
 category: ${!pkg_category_var:-${CATEGORY}}
-build-depends: cygport ${BUILD_REQUIRES}
+build-depends: $(__show_build_deps_oneline)
 sdesc: "${!pkg_summary_var:-${SUMMARY}}"
 ldesc: "${!pkg_description_var:-${DESCRIPTION:-${!pkg_summary_var:-${SUMMARY}}}}"
 skip:
-- 
2.30.0


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2021-01-24  5:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-24  5:40 [PATCH cygport] Make a build-depends list from a cygport file Lemures Lemniscati

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).