public inbox for cygwin@cygwin.com
 help / color / mirror / Atom feed
From: Lemures Lemniscati <lemures.lemniscati@gmail.com>
To: cygwin@cygwin.com
Subject: cygport: Request a new feature in order to set owner/group names in packaged tarballs.
Date: Mon, 03 Aug 2020 20:55:15 +0900	[thread overview]
Message-ID: <20200803205512.E3F1.50F79699@gmail.com> (raw)

Hi!

This is another patch, so that cygport shall make tarballs with
specified owner and group names.

e.g.) Invoke like this:

PKG_OWNER_GROUP=lovely/cygwin cygport fabulous.cygport package

and we'll get tarballs with a owner name 'lovely' and a group name 'cygwin'.

But, there may be more suitable names for variables other than
PKG_OWNER_GROUP, PKG_OWNER, PKG_GROUP...

Regards,

Lem

====

diff -ur a/cygport-0.34.0/lib/pkg_pkg.cygpart c/cygport-0.34.0/lib/pkg_pkg.cygpart
--- a/cygport-0.34.0/lib/pkg_pkg.cygpart	2020-05-11 01:06:43.000000000 +0900
+++ c/cygport-0.34.0/lib/pkg_pkg.cygpart	2020-08-03 20:13:37.954717700 +0900
@@ -19,6 +19,16 @@
 # along with cygport.  If not, see <http://www.gnu.org/licenses/>.
 #
 ################################################################################
+# If PKG_OWNER_GROUP is nonempty, we split it into PKG_OWNER and PKG_GROUP
+if [ -n "${PKG_OWNER_GROUP}" ]; then
+  PKG_OWNER=${PKG_OWNER_GROUP%%/*}
+  PKG_GROUP=${PKG_OWNER_GROUP##*/}
+fi
+# If PKG_OWNER and PKG_GROUP are respectively nonempty,
+# set tar options to TAR_OWNER and TAR_GROUP respectively,
+# which is to be used when creating archives.
+[ -z "${PKG_OWNER}" ] && TAR_OWNER= || TAR_OWNER="--owner=${PKG_OWNER}"
+[ -z "${PKG_GROUP}" ] && TAR_GROUP= || TAR_GROUP="--group=${PKG_GROUP}"
 
 #****** Chapter 12/Packaging
 #  INTRODUCTION
@@ -170,7 +180,7 @@
 		if defined pkg_contents
 		then
 			mkdir -p ${distdir}/${PN}/${distsubdir};
-			tar Jcvf ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.tar.xz \
+			tar ${TAR_OWNER} ${TAR_GROUP} -Jcvf ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.tar.xz \
 				--exclude=usr/lib/debug --exclude=usr/src \
 				--exclude=${autoloaddir} \
 				${pkg_contents} \
@@ -179,7 +189,7 @@
 		else
 			inform "Creating empty package"
 			mkdir -p ${distdir}/${PN}/${distsubdir};
-			tar -Jcf ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.tar.xz --files-from /dev/null \
+			tar ${TAR_OWNER} ${TAR_GROUP} -Jcf ${distdir}/${PN}/${distsubdir}/${pkg_name[${n}]}-${PVR}.tar.xz --files-from /dev/null \
 				|| error "Empty package creation failed"
 			> ${T}/.${pkg_name[${n}]}.lst
 		fi
@@ -194,7 +204,7 @@
 
 		__step "${PN}-debuginfo-${PVR}.tar.xz";
 		mkdir -p ${distdir}/${PN}/${PN}-debuginfo;
-		tar Jcvf ${distdir}/${PN}/${PN}-debuginfo/${PN}-debuginfo-${PVR}.tar.xz \
+		tar ${TAR_OWNER} ${TAR_GROUP} -Jcvf ${distdir}/${PN}/${PN}-debuginfo/${PN}-debuginfo-${PVR}.tar.xz \
 			usr/*/debug/ ${autoloaddir} ${!dbg_contents_var} \
 			| tee ${T}/.${PN}-debuginfo.lst \
 			|| error "Debuginfo package creation failed: ${PN}-debuginfo"
@@ -519,7 +529,7 @@
 
 	cd ${spkgdir%/*};
 
-	tar Jcvf ${distdir}/${PN}/${PF}-src.tar.xz ${spkgdir##*/}/ || error "Source package creation failed"
+	tar ${TAR_OWNER} ${TAR_GROUP} -Jcvf ${distdir}/${PN}/${PF}-src.tar.xz ${spkgdir##*/}/ || error "Source package creation failed"
 	echo;
 }
 
@@ -828,7 +838,7 @@
 			fi
 
 			mkdir -p ${distdir}/${PN}/${obssubdir};
-			tar -Jcf ${distdir}/${PN}/${obssubdir}/${obspkg}-${PVR}.tar.xz --files-from /dev/null
+			tar ${TAR_OWNER} ${TAR_GROUP} -Jcf ${distdir}/${PN}/${obssubdir}/${obspkg}-${PVR}.tar.xz --files-from /dev/null
 
 			__step "${pkg_name[${n}]} OBSOLETES: ${obspkg}"
 
@@ -880,7 +890,7 @@
 		for obspkg in ${!dbg_obsoletes_var}
 		do
 			mkdir -p ${distdir}/${PN}/${obspkg};
-			tar -Jcf ${distdir}/${PN}/${obspkg}/${obspkg}-${PVR}.tar.xz --files-from /dev/null
+			tar ${TAR_OWNER} ${TAR_GROUP} -Jcf ${distdir}/${PN}/${obspkg}/${obspkg}-${PVR}.tar.xz --files-from /dev/null
 
 			__step "${PN}-debuginfo OBSOLETES: ${obspkg}"
 

             reply	other threads:[~2020-08-03 11:55 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-08-03 11:55 Lemures Lemniscati [this message]
2020-08-03 19:24 ` Achim Gratz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20200803205512.E3F1.50F79699@gmail.com \
    --to=lemures.lemniscati@gmail.com \
    --cc=cygwin@cygwin.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).