Ticket #671: portpackage.patch

File portpackage.patch, 1.4 KB (added by robert@…, 21 years ago)

fix "port package" to include receipt file in pkg file.

  • src/port1.0/portpackage.tcl

    diff -b -u -w -r1.42 portpackage.tcl
    old new  
    5656proc package_pkg {portname portversion portrevision} {
    5757    global portdbpath destpath workpath prefix portresourcepath description package.destpath long_description homepage
    5858
     59        # make sure package contains receipt file
     60    if [string length [registry_exists $portname $portversion]] {
     61                set rfile [registry_exists $portname $portversion]
     62                if [string length $rfile] {
     63                        file mkdir "${destpath}/[file dirname ${rfile}]"
     64                        file copy -force $rfile "${destpath}/${rfile}"
     65                }
     66        }
     67
    5968    set resourcepath ${workpath}/pkg_resources
    6069    # XXX: we need to support .lproj in resources.
    6170    set pkgpath ${package.destpath}/${portname}-${portversion}.pkg
     
    7786    system "cd ${destpath} && pax -x cpio -w -z . > ${pkgpath}/Contents/Archive.pax.gz"
    7887
    7988    write_sizes_file ${pkgpath}/Contents/Resources/Archive.sizes ${portname} ${portversion} ${pkgpath} ${destpath}
     89
     90        # make sure to remove receipt from destpath when finished
     91    if [file exists "${destpath}/${rfile}"] {
     92                # remove receipt file
     93                file delete "${destpath}/${rfile}"
     94                # prune leftover empty directories
     95                catch {system "find \"${destpath}\" -depth -type d -print | xargs rmdir 2>/dev/null"}
     96        }
    8097
    8198    return 0
    8299}