From owner-svn-src-user@freebsd.org  Thu Jan 28 20:42:30 2016
Return-Path: <owner-svn-src-user@freebsd.org>
Delivered-To: svn-src-user@mailman.ysv.freebsd.org
Received: from mx1.freebsd.org (mx1.freebsd.org
 [IPv6:2001:1900:2254:206a::19:1])
 by mailman.ysv.freebsd.org (Postfix) with ESMTP id 9CCFFA7094E
 for <svn-src-user@mailman.ysv.freebsd.org>;
 Thu, 28 Jan 2016 20:42:30 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from repo.freebsd.org (repo.freebsd.org
 [IPv6:2610:1c1:1:6068::e6a:0])
 (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
 (Client did not present a certificate)
 by mx1.freebsd.org (Postfix) with ESMTPS id 568F496F;
 Thu, 28 Jan 2016 20:42:30 +0000 (UTC) (envelope-from des@FreeBSD.org)
Received: from repo.freebsd.org ([127.0.1.37])
 by repo.freebsd.org (8.15.2/8.15.2) with ESMTP id u0SKgTKQ010631;
 Thu, 28 Jan 2016 20:42:29 GMT (envelope-from des@FreeBSD.org)
Received: (from des@localhost)
 by repo.freebsd.org (8.15.2/8.15.2/Submit) id u0SKgTan010630;
 Thu, 28 Jan 2016 20:42:29 GMT (envelope-from des@FreeBSD.org)
Message-Id: <201601282042.u0SKgTan010630@repo.freebsd.org>
X-Authentication-Warning: repo.freebsd.org: des set sender to des@FreeBSD.org
 using -f
From: =?UTF-8?Q?Dag-Erling_Sm=c3=b8rgrav?= <des@FreeBSD.org>
Date: Thu, 28 Jan 2016 20:42:29 +0000 (UTC)
To: src-committers@freebsd.org, svn-src-user@freebsd.org
Subject: svn commit: r295014 - user/des/compat
X-SVN-Group: user
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
X-BeenThere: svn-src-user@freebsd.org
X-Mailman-Version: 2.1.20
Precedence: list
List-Id: "SVN commit messages for the experimental &quot; user&quot;
 src tree" <svn-src-user.freebsd.org>
List-Unsubscribe: <https://lists.freebsd.org/mailman/options/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=unsubscribe>
List-Archive: <http://lists.freebsd.org/pipermail/svn-src-user/>
List-Post: <mailto:svn-src-user@freebsd.org>
List-Help: <mailto:svn-src-user-request@freebsd.org?subject=help>
List-Subscribe: <https://lists.freebsd.org/mailman/listinfo/svn-src-user>,
 <mailto:svn-src-user-request@freebsd.org?subject=subscribe>
X-List-Received-Date: Thu, 28 Jan 2016 20:42:30 -0000

Author: des
Date: Thu Jan 28 20:42:29 2016
New Revision: 295014
URL: https://svnweb.freebsd.org/changeset/base/295014

Log:
  Use unique names for all files so we can more easily generate multiple
  tarballs in one go, as well as compare them to earlier versions.

Modified:
  user/des/compat/mkcompat.sh

Modified: user/des/compat/mkcompat.sh
==============================================================================
--- user/des/compat/mkcompat.sh	Thu Jan 28 20:36:03 2016	(r295013)
+++ user/des/compat/mkcompat.sh	Thu Jan 28 20:42:29 2016	(r295014)
@@ -39,7 +39,7 @@ error() {
 	exit 1
 }
 
-[ $# -ne 3 ] || error "usage: ${progname} /path/old /path/new"
+[ $# -eq 2 ] || error "usage: ${progname} /path/old /path/new"
 
 # Extract version information from old release
 old="$1"
@@ -108,12 +108,14 @@ portname="compat${old_major}x"
 portversion="${old_revision}.${old_version}.${today}"
 pkgname="${portname}-${old_arch}-${portversion}"
 tarname="${pkgname}.tar.xz"
-mtree="mtree.${old_arch}"
+mtree="mtree-${old_arch}-${portversion}"
 echo '#mtree' >"${mtree}"
-plist="pkg-plist.${old_arch}"
+plist="pkg-plist-${old_arch}-${portversion}"
 :>"${plist}"
-distinfo="distinfo.${old_arch}"
+distinfo="distinfo-${old_arch}-${portversion}"
 :>"${distinfo}"
+digests="digests-${old_arch}-${portversion}"
+:>"${digests}"
 
 # Search old tree for libraries which do not exist in the new tree
 (cd "${old}" && find -s lib* usr/lib* -type f -name 'lib*.so.*') | \
@@ -122,17 +124,20 @@ distinfo="distinfo.${old_arch}"
 	if [ ! -f "${new}/${file}" ] ; then
 	    lib=$(basename "${file}")
 	    dir=$(basename $(dirname "${file}"))
-	    if [ -f "${pkgname}/${dir}/${lib}" ] ; then
-		error "duplicate library: ${dir}/${lib}"
+	    target="${dir}/${lib}"
+	    if [ -f "${pkgname}/${target}" ] ; then
+		error "duplicate library: ${target}"
 	    fi
-	    notice "missing ${dir}/${lib}"
-	    echo "${pkgname}/${dir}/${lib} uid=0 gid=0 mode=0444" \
+	    notice "missing ${target}"
+	    echo "${pkgname}/${target} uid=0 gid=0 mode=0444" \
 		 "type=file content=${old}/${file}" >>"${mtree}"
-	    echo "${dir}/${lib}" >>"${plist}"
+	    echo "${dir}/compat/${lib}" >>"${plist}"
+	    echo $(sha256 -q "${old}/${file}") "${target}" >>"${digests}"
 	fi
     done
 sort "${plist}" >"${plist}-" && mv "${plist}-" "${plist}"
 sort "${mtree}" >"${mtree}-" && mv "${mtree}-" "${mtree}"
+sort -k 2 "${digests}" > "${digests}-" && mv "${digests}-" "${digests}"
 
 # Create tarball and distinfo
 tar -Jcf "${tarname}" @"${mtree}" || exit 1