cygport: Request a new feature in order to set owner/group names in packaged tarballs.

Lemures Lemniscati lemures.lemniscati@gmail.com
Mon Aug 3 11:55:15 GMT 2020


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}"
 


More information about the Cygwin mailing list