[123004] trunk/base
afb at macports.org
afb at macports.org
Sun Aug 3 11:55:09 PDT 2014
Revision: 123004
https://trac.macports.org/changeset/123004
Author: afb at macports.org
Date: 2014-08-03 11:55:09 -0700 (Sun, 03 Aug 2014)
Log Message:
-----------
base: remove package support for rpm and deb
Modified Paths:
--------------
trunk/base/doc/port.1
trunk/base/doc/port.1.txt
trunk/base/doc/prefix.mtree.in
trunk/base/portmgr/packaging/SETUP.chroot.sh
trunk/base/portmgr/packaging/buildall.sh
trunk/base/src/macports1.0/macports.tcl
trunk/base/src/package1.0/Makefile.in
trunk/base/src/package1.0/package.tcl
trunk/base/src/port/port.tcl
trunk/base/src/port1.0/portsandbox.tcl
trunk/base/src/port1.0/portutil.tcl
Removed Paths:
-------------
trunk/base/portmgr/packaging/dpkgall.tcl
trunk/base/portmgr/packaging/rpmall.tcl
trunk/base/src/package1.0/portdpkg.tcl
trunk/base/src/package1.0/portrpm.tcl
trunk/base/src/package1.0/portsrpm.tcl
trunk/base/src/package1.0/tests/portdpkg.test
Modified: trunk/base/doc/port.1
===================================================================
--- trunk/base/doc/port.1 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/doc/port.1 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1243,24 +1243,6 @@
\fIportname\fR
and its dependencies\&.
.RE
-.PP
-rpm
-.RS 4
-Creates an RPM binary package of
-\fIportname\fR, similar to a tgz \(lqarchive\(rq\&.
-.RE
-.PP
-srpm
-.RS 4
-Creates a SRPM source package of
-\fIportname\fR, similar to a xar \(lqportpkg\(rq\&.
-.RE
-.PP
-dpkg
-.RS 4
-Creates a DEB binary package of
-\fIportname\fR\&.
-.RE
.SH "EXAMPLES"
.sp
The following demonstrates invoking port with the extract target on portdir \(lqtextproc/figlet\(rq and extract\&.suffix set to \(lq\&.tgz\(rq:
Modified: trunk/base/doc/port.1.txt
===================================================================
--- trunk/base/doc/port.1.txt 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/doc/port.1.txt 2014-08-03 18:55:09 UTC (rev 123004)
@@ -638,16 +638,7 @@
Creates an internet-enabled disk image containing an OS X metapackage of
'portname' and its dependencies.
-rpm::
- Creates an RPM binary package of 'portname', similar to a tgz ``archive''.
-srpm::
- Creates a SRPM source package of 'portname', similar to a xar ``portpkg''.
-
-dpkg::
- Creates a DEB binary package of 'portname'.
-
-
EXAMPLES
--------
Modified: trunk/base/doc/prefix.mtree.in
===================================================================
--- trunk/base/doc/prefix.mtree.in 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/doc/prefix.mtree.in 2014-08-03 18:55:09 UTC (rev 123004)
@@ -237,8 +237,6 @@
skel
..
..
- src
- ..
var
..
www
Modified: trunk/base/portmgr/packaging/SETUP.chroot.sh
===================================================================
--- trunk/base/portmgr/packaging/SETUP.chroot.sh 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/portmgr/packaging/SETUP.chroot.sh 2014-08-03 18:55:09 UTC (rev 123004)
@@ -31,7 +31,6 @@
mkdir -p /darwinports/logs
mkdir -p /darwinports/pkgs
mkdir -p /darwinports/mpkgs
-mkdir -p /darwinports/rpms
cd $HOME/darwinports
#tclsh base/src/portmgr/packageall.tcl
Modified: trunk/base/portmgr/packaging/buildall.sh
===================================================================
--- trunk/base/portmgr/packaging/buildall.sh 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/portmgr/packaging/buildall.sh 2014-08-03 18:55:09 UTC (rev 123004)
@@ -97,9 +97,6 @@
echo "file:///darwinports/dports" > /opt/local/etc/ports/sources.conf
echo "BatchMode yes" >> /etc/ssh_config
EOF
- if [ "$PKGTYPE" = "dpkg" ]; then
- echo "/opt/local/bin/port install dpkg" >> $dir/bootstrap.sh
- fi
chmod 755 $dir/bootstrap.sh
echo "Bootstrapping darwinports in chroot"
/sbin/mount_devfs devfs ${dir}/dev
@@ -137,7 +134,7 @@
# main: This is where we start the show.
TGTPORTS=""
-PKGTYPE=rpmpackage
+PKGTYPE=mpkg
if [ $# -lt 1 ]; then
echo "Usage: $0 chrootdir [-p pkgtype] [targetportsfile]"
@@ -207,10 +204,6 @@
echo $pkg >> outputdir/summary/portspackaged
if [ "$PKGTYPE" = "mpkg" ]; then
mv $DIR/Package/*.mpkg outputdir/Packages/
- elif [ "$PKGTYPE" = "rpmpackage" ]; then
- mv $DIR/Package/RPMS/${ARCH}/*.rpm outputdir/Packages/
- elif [ "$PKGTYPE" = "dpkg" ]; then
- mv $DIR/Package/*.deb outputdir/Packages/
fi
type="succeeded"
fi
Deleted: trunk/base/portmgr/packaging/dpkgall.tcl
===================================================================
--- trunk/base/portmgr/packaging/dpkgall.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/portmgr/packaging/dpkgall.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1,943 +0,0 @@
-#!/usr/bin/env tclsh8.4
-# dpkgbuild.tcl
-# $Id$
-#
-# Copyright (c) 2009-2011 The MacPorts Project
-# Copyright (c) 2004 Landon Fuller <landonf at macports.org>
-# Copyright (c) 2003 Kevin Van Vechten <kevin at opendarwin.org>
-# Copyright (c) 2002 Apple Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-#######################################
-#
-# Must be installed outside of dports tree:
-# tcl 8.4
-# curl
-# tar
-# gzip
-# unzip
-# dports tree
-#
-# A tar file containing full /${portprefix} directory tree, stored in:
-# $pkgrepo/$architecture/root.tar.gz
-# The /${portprefix} directory tree must contain:
-# MacPorts installation
-# dpkg
-#
-# Configuration:
-# /etc/ports/dpkg.conf
-# /etc/ports/dpkg
-#
-#######################################
-
-package require darwinports
-
-# Configuration Namespace
-namespace eval dpkg {
- variable configopts "pkgrepo architecture portlistfile portprefix dportsrc silentmode initialports"
-
- # Preferences
- variable silentmode false
- variable configfile "/etc/ports/dpkg.conf"
- variable portlist ""
- variable portprefix "/usr/dports"
- variable dportsrc "/usr/darwinports"
- variable pkgrepo "/export/dpkg/"
- # architecture is set in main
- variable architecture
- variable initialports "dpkg apt"
- variable aptpackagedir
- variable packagedir
- # portlistfile defaults to ${pkgrepo}/${architecture}/etc/buildlist.txt (set in main)
- variable portlistfile
- # baselistfile defaults to ${pkgrepo}/${architecture}/etc/baselist.txt (set in main)
- variable baselistfile
-
- # Non-user modifiable.
- # Ports required for building. Format:
- # <binary> <portname> <binary> <portname> ...
- variable requiredports "dpkg dpkg apt-get apt"
-
- # Current log file descriptor
- variable logfd
-}
-
-# MacPorts UI Event Callbacks
-proc ui_prefix {priority} {
- switch $priority {
- debug {
- return "Debug: "
- }
- error {
- return "Error: "
- }
- warn {
- return "Warning: "
- }
- default {
- return ""
- }
- }
-}
-
-proc ui_channels {priority} {
- global dpkg::logfd
- if {[info exists logfd] && $logfd ne ""} {
- return {$logfd}
- } elseif {$message(priority) ne "debug"} {
- # If there's no log file, echo to stdout
- return {stdout}
- }
-}
-
-proc ui_silent {message} {
- global dpkg::silentmode
- if {"${silentmode}" != true} {
- puts $message
- ui_msg $message
- } else {
- ui_msg $message
- }
-}
-
-# Outputs message to console and to log
-# Should only be used with errors
-proc ui_noisy_error {message} {
- puts $message
- ui_error $message
-}
-
-proc log_message {channel message} {
- seek $channel 0 end
- puts $channel $message
- flush $channel
-}
-
-# Read in configuration file
-proc readConfig {file} {
- global dpkg::configopts
-
- set fd [open $file r]
- while {[gets $fd line] >= 0} {
- foreach option $configopts {
- if {[regexp "^$option\[ \t\]+(\[A-Za-z0-9_:,\./-\]+$)" $line match val] == 1} {
- set dpkg::$option $val
- }
- }
- }
-}
-
-# Read a list of newline seperated port names from $file
-proc readPortList {file} {
- set fd [open $file r]
- set portlist ""
-
- while {[gets $fd line] >= 0} {
- lappend portlist $line
- }
-
- return $portlist
-}
-
-# Escape all regex characters in a portname
-proc regex_escape_portname {portname} {
- regsub -all "(\\(){1}|(\\)){1}|(\\{1}){1}|(\\+){1}|(\\{1}){1}|(\\{){1}|(\\}){1}|(\\^){1}|(\\$){1}|(\\.){1}|(\\\\){1}" $portname "\\\\&" escaped_string
- return $escaped_string
-}
-
-# Print usage string
-proc print_usage {args} {
- global argv0
- puts "Usage: [file tail $argv0] \[-qa\] \[-f configfile\] \[-p portlist\]"
- puts " -q Quiet mode (only errors reported)"
- puts " -w No warnings (progress still reported)"
- puts " -a Build all ports"
- puts " -b Re-generate base install archive"
- puts " -p Attempt to build ports that do not advertise support for the build platform"
- puts " -i Initialize Build System (Should only be run on a new build system)"
-}
-
-# Delete and restore the build system
-proc reset_tree {args} {
- global dpkg::portprefix dpkg::pkgrepo dpkg::architecture
-
- ui_silent "Restoring pristine ${portprefix} from ${pkgrepo}/${architecture}/root.tar.gz"
- if {[catch {system "rm -Rf ${portprefix}"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- if {[catch {system "rm -Rf /usr/X11R6"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- if {[catch {system "rm -Rf /etc/X11"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- if {[catch {system "cd / && tar xvf ${pkgrepo}/${architecture}/root.tar.gz"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- ui_silent "Linking static distfiles directory to ${portprefix}/var/db/dports/distfiles."
- if {[file isdirectory ${portprefix}/var/db/dports/distfiles"]} {
- if {[catch {system "rm -rf ${portprefix}/var/db/dports/distfiles"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- if {[catch {system "ln -s ${pkgrepo}/distfiles ${portprefix}/var/db/dports/distfiles"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
- }
-}
-
-proc main {argc argv} {
- global dpkg::configfile dpkg::pkgrepo dpkg::architecture dpkg::portlistfile
- global dpkg::portsArray dpkg::portprefix dpkg::silentmode dpkg::logfd dpkg::packagedir dpkg::aptpackagedir
- global dpkg::requiredports dpkg::baselistfile tcl_platform
-
- # First time through, we reset the tree
- set firstrun_flag true
-
- # Read command line options
- set buildall_flag false
- set anyplatform_flag false
- set nowarn_flag false
- set basegen_flag false
- set initialize_flag false
-
- for {set i 0} {$i < $argc} {incr i} {
- set arg [lindex $argv $i]
- switch -- $arg {
- -a {
- set buildall_flag true
- }
- -b {
- set basegen_flag true
- }
- -f {
- incr i
- set configfile [lindex $argv $i]
-
- if {![file readable $configfile]} {
- return -code error "Configuration file \"$configfile\" is unreadable."
- }
- }
- -i {
- set initialize_flag true
- }
- -p {
- incr i
- set portlistfile [lindex $argv $i]
- if {![file readable $portlistfile]} {
- return -code error "Port list file \"$portlistfile\" is unreadable."
- }
- }
- -q {
- set silentmode true
- }
- -w {
- set nowarn_flag true
- }
- -p {
- set anyplatform_flag true
- }
- default {
- print_usage
- exit 1
- }
- }
- }
-
- # Initialize System
- array set ui_options {}
- array set options {}
- array set variations {}
- mportinit ui_options options variations
-
- # If -i was specified, install base system and exit
- if {$initialize_flag == "true"} {
- initialize_system
- exit 0
- }
-
- # We must have dpkg by now
- if {[catch {set_architecture} result]} {
- puts "$result."
- puts "Have you initialized the build system? Use the -i flag:"
- print_usage
- exit 1
- }
-
- # Set the platform
- set platformString [string tolower $tcl_platform(os)]
-
- set packagedir ${pkgrepo}/${architecture}/packages/
- set aptpackagedir ${pkgrepo}/apt/dists/stable/main/binary-${architecture}/
-
- # Read configuration files
- if {[file readable $configfile]} {
- readConfig $configfile
- }
-
- # If portlistfile has not been set, supply a reasonable default
- if {![info exists portlistfile]} {
- # The default portlist file
- set portlistfile [file join $pkgrepo $architecture etc buildlist.txt]
- }
-
- # If baselistfile has not been set, supply a reasonable default
- if {![info exists baselistfile]} {
- # The default baselist file
- set baselistfile [file join $pkgrepo $architecture etc baselist.txt]
- }
-
- # Read the port list
- if {[file readable $portlistfile]} {
- set portlist [readPortList $portlistfile]
- } else {
- set portlist ""
- }
-
- if {[file readable $baselistfile]} {
- set baselist [readPortList $baselistfile]
- } else {
- set baselist ""
- }
-
- # If no portlist file was specified, create a portlist that includes all ports
- if {[llength $portlist] == 0 || "$buildall_flag" == "true"} {
- set res [mportlistall]
- foreach {name array} $res {
- lappend portlist $name
- }
- } else {
- # Port list was specified. Ensure that all the specified ports are available.
- # Add ${baselist} and get_required_ports to the list
- set portlist [lsort -unique [concat $portlist $baselist [get_required_ports]]]
- foreach port $portlist {
- set fail false
-
- if {[catch {set res [get_portinfo $port]} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Error: $result"
- set fail true
- }
-
- # Add all of the specified ports' dependencies to the portlist
- set dependencies [get_dependencies $port false]
- foreach dep $dependencies {
- lappend portlist [lindex $dep 0]
- }
- }
- if {"$fail" == "true"} {
- exit 1
- }
- }
-
- # Clean out duplicates
- set portlist [lsort -unique $portlist]
-
- # Ensure that the log directory exists, and open up
- # the default debug log
- open_default_log w
-
- # Set the dport options
- # Package build path
- set options(package.destpath) ${packagedir}
-
- # Ensure that it exists
- file mkdir $options(package.destpath)
-
- # Force mode
- set options(ports_force) yes
-
- # Set variations (empty)
- set variations [list]
-
-
- if {"$silentmode" != "true" && "$nowarn_flag" != "true"} {
- puts "WARNING: The full contents of ${portprefix}, /usr/X11R6, and /etc/X11 will be deleted by this script. If you do not want this, control-C NOW."
- exec sleep 10
- }
-
- # Destroy the existing apt repository
- if {[catch {system "rm -Rf ${aptpackagedir}"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- # Recreate
- file mkdir ${aptpackagedir}
-
- close_default_log
-
- foreach port $portlist {
- # Open the default debug log write/append
- open_default_log
-
- if {[catch {set res [get_portinfo $port]} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: port search failed: $error"
- exit 1
- }
-
- # Reset array from previous runs
- unset -nocomplain portinfo
- array set portinfo [lindex $res 1]
-
- if {![info exists portinfo(name)] ||
- ![info exists portinfo(version)] ||
- ![info exists portinfo(revision)] ||
- ![info exists portinfo(categories)]} {
- ui_noisy_error "Internal error: $name missing some portinfo keys"
- close $logfd
- continue
- }
-
- # open correct subport
- set options(subport) $portinfo(name)
-
- # Skip un-supported ports
- if {[info exists portinfo(platforms)] && ${anyplatform_flag} != "true"} {
- if {[lsearch $portinfo(platforms) $platformString] == -1} {
- ui_silent "Skipping unsupported port $portinfo(name) (platform: $platformString supported: $portinfo(platforms))"
- continue
- }
- }
-
-
- # Add apt override line. dpkg is special cased and marked 'required'
- # TODO: add the ability to specify the "required" priority for specific
- # ports in a config file.
- if {"$portinfo(name)" == "dpkg"} {
- set pkg_priority required
- } else {
- set pkg_priority optional
- }
- add_override $portinfo(name) $pkg_priority [lindex $portinfo(categories) 0]
-
- # Skip up-to-date software
- set pkgfile [get_pkgpath $portinfo(name) $portinfo(version) $portinfo(revision)]
- if {[file exists ${pkgfile}]} {
- if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
- if {[file readable $pkgfile] && ([file mtime ${pkgfile}] > [file mtime ${portpath}/Portfile])} {
- ui_silent "Skipping ${portinfo(name)}-${portinfo(version)}-${portinfo(revision)}; package is up to date."
- # Shove the package into the apt repository
- copy_pkg_to_apt $portinfo(name) $portinfo(version) $portinfo(revision) [lindex $portinfo(categories) 0]
- continue
- }
- }
- }
-
- # We're going to actually build the package, reset the tree
- # if this is our first time through. The tree is always reset
- # at the end of a packaging run, too.
- if {$firstrun_flag == true} {
- reset_tree
- set firstrun_flag false
- }
-
- ui_silent "Building $portinfo(name) ..."
-
- # Close the main debug log
- close_default_log
-
- # Create log directory and open the build log
- file mkdir [file join ${pkgrepo} ${architecture} log build ${port}]
- set logfd [open ${pkgrepo}/${architecture}/log/build/${port}/build.log w 0644]
-
- # Install binary dependencies if possible
- set dependencies [get_dependencies $portinfo(name)]
- foreach dep $dependencies {
- install_binary_if_available $dep
- }
-
- if {[catch {set workername [mportopen $portinfo(porturl) [array get options] [array get variations] yes]} result] || $result == 1} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: unable to open port: $result"
- exit 1
- }
-
- if {[catch {set result [mportexec $workername clean]} result] || $result == 1} {
- ui_noisy_error "Cleaning $portinfo(name) failed, consult build log"
-
- # Close the log
- close $logfd
-
- # Copy the log to the failure directory
- copy_failure_log $portinfo(name)
-
- # Close the port
- mportclose $workername
-
- continue
- }
-
- # Re-open the port. MacPorts doesn't play well with multiple targets, apparently
- mportclose $workername
- if {[catch {set workername [mportopen $portinfo(porturl) [array get options] [array get variations] yes]} result] || $result == 1} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: unable to open port: $result"
- exit 1
- }
-
- if {[catch {set result [mportexec $workername dpkg]} result] || $result == 1} {
- ui_noisy_error "Packaging $portinfo(name) failed, consult build log"
-
- # Copy the log to the failure directory
- copy_failure_log $portinfo(name)
-
- # Close the port
- mportclose $workername
-
- # Close the log
- close $logfd
-
- # Open default log
- open_default_log
-
- ui_silent "Resetting /usr/dports ..."
- reset_tree
- ui_silent "Done."
-
- # Close the log
- close $logfd
-
- continue
- }
-
- ui_silent "Package build for $portinfo(name) succeeded"
-
- # Into the apt repository you go!
- copy_pkg_to_apt $portinfo(name) $portinfo(version) $portinfo(revision) [lindex $portinfo(categories) 0]
-
- ui_silent "Resetting /usr/dports ..."
- reset_tree
- ui_silent "Done."
-
- # Close the log
- close $logfd
-
- # Delete any previous failure logs
- delete_failure_log $portinfo(name)
-
- # Close the port
- mportclose $workername
- }
-
- open_default_log
-
- # If required, rebuild the clientinstall.tgz
- if {$basegen_flag == true} {
- # dpkg is always required
- set pkglist [lsort -unique [concat dpkg $baselist [get_required_ports]]]
- set workdir [file join ${pkgrepo} ${architecture}]
- set rootdir [file join $workdir clientroot]
- set rootfile [file join $workdir client-root.tar.gz]
- file mkdir ${rootdir}
-
- # dpkg is required
- array set portinfo [lindex [get_portinfo dpkg] 1]
- set pkgfile [get_pkgpath $portinfo(name) $portinfo(version) $portinfo(revision)]
- system "cd \"${rootdir}\" && ar x \"${pkgfile}\" data.tar.gz"
- system "cd \"${rootdir}\" && tar xvf data.tar.gz; rm data.tar.gz"
-
- foreach port $pkglist {
- set dependencies [get_dependencies $port false]
- foreach dep $dependencies {
- lappend newpkglist [lindex $dep 0]
- }
- }
-
- if {[info exists newpkglist]} {
- set pkglist [lsort -unique [concat $newpkglist $pkglist]]
- }
-
- foreach port $pkglist {
- array set portinfo [lindex [get_portinfo $port] 1]
- system "dpkg --root \"${rootdir}\" --force-depends -i \"[get_pkgpath $portinfo(name) $portinfo(version) $portinfo(revision)]\""
- }
-
- system "cd \"${rootdir}\" && tar cf \"[file join ${workdir} clientinstall.tar.gz]\" ."
- file delete -force ${rootdir}
- }
-
- ui_silent "Building apt-get index ..."
- if {[catch {system "cd ${pkgrepo}/apt && dpkg-scanpackages dists override >${aptpackagedir}/Packages"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-
- if {[catch {system "cd ${aptpackagedir} && gzip Packages"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
- remove_override_file
- ui_silent "Done."
-
- ui_silent "Package run finished."
- close_default_log
-
- exit 0
-}
-
-# Return ports listed in $dpkg::requiredports that are not
-# installed
-proc get_required_ports {args} {
- global dpkg::requiredports
- set reqlist ""
-
- foreach {binary port} $requiredports {
- if {[find_binary $binary] eq ""} {
- lappend reqlist $port
- }
- }
- return $reqlist
-}
-
-# Given a binary name, searches PATH
-proc find_binary {binary} {
- global env
- set path [split $env(PATH) :]
- foreach dir $path {
- set file [file join $dir $binary]
- if {[file exists $file]} {
- return $file
- }
- }
- return ""
-}
-
-# Set the architecture global
-proc set_architecture {args} {
- set dpkg::architecture "[exec dpkg --print-installation-architecture]"
-}
-
-# Initialize a new build system
-proc initialize_system {args} {
- global dpkg::initialports dpkg::pkgrepo
- global dpkg::architecture dpkg::portprefix
-
- # Create standard directories
- ui_msg "Creating ${pkgrepo} directory"
- file mkdir ${pkgrepo}
-
- set builddeps ""
- set rundeps ""
-
- foreach port [get_required_ports] {
- set builddeps [concat $builddeps [get_dependencies $port true]]
- set rundeps [concat $rundeps [get_dependencies $port false]]
- }
-
- set buildlist [lsort -unique $builddeps]
-
- foreach port $builddeps {
- if {[lsearch -exact $port $rundeps] >= 0} {
- lappend removelist $port
- }
- }
-
- set options ""
- set variations ""
-
- foreach port [get_required_ports] {
- set options(subport) $port
- if {[catch {do_portexec $port [array get options] [array get variants] activate} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Fatal error: $result"
- exit 1
- }
- }
-
- if {[info exists removelist]} {
- ui_msg "Removing build dependencies ..."
- foreach portlist $removelist {
- set port [lindex $portlist 0]
-
- ui_msg "Uninstalling $port."
- if { [catch {registry_uninstall::uninstall $portname $portversion "" 0 [array get options]} result] } {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_errorr "Fatal error: Uninstalling $port failed: $result"
- exit 1
- }
- }
- ui_msg "Done."
- }
-
-
- if {[catch {set_architecture} result]} {
- puts "Fatal error: $result."
- exit 1
- }
-
- ui_msg "Creating [file join ${pkgrepo} ${architecture}] directory"
- file mkdir [file join ${pkgrepo} ${architecture}]
- file mkdir [file join ${pkgrepo} ${architecture} etc]
-
- ui_msg "Generating pristine archive: [file join ${pkgrepo} ${architecture} root.tar.gz]"
- if {[catch {system "tar -zcf \"[file join ${pkgrepo} ${architecture} root.tar.gz]\" \"${portprefix}\""} result]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Fatal error: Archive creation failed: $result"
- exit 1
- }
-
- ui_msg "Build system successfully initialized!"
-}
-
-# Execute a target on a port (by port name)
-proc do_portexec {port options variants target} {
-
- array set portinfo [lindex [get_portinfo $port] 1]
-
- if {[catch {set workername [mportopen $portinfo(porturl) $options $variants yes]} result] || $result == 1} {
- return -code error "Internal error: unable to open port: $result"
- exit 1
- }
-
- if {[catch {set result [mportexec $workername $target]} result] || $result == 1} {
-
- # Close the port
- mportclose $workername
-
- # Return error
- return -code error "Executing target $target on $portinfo(name) failed."
- }
-}
-
-proc get_portinfo {port} {
- set searchstring [regex_escape_portname $port]
- set res [mportlookup ${searchstring}]
-
- if {[llength $res] < 2} {
- return -code error "Port \"$port\" not found in index."
- }
-
- return $res
-}
-
-# Given name, version, and revision, returns the path to a package file
-proc get_pkgpath {name version revision} {
- global dpkg::pkgrepo dpkg::architecture
- global dpkg::packagedir
- if {${revision} == 0} {
- set revision ""
- } else {
- set revision "-${revision}"
- }
-
- return [string tolower ${packagedir}/${name}_${version}${revision}_${architecture}.deb]
-}
-
-# Opens the default log file and sets dpkg::logfd
-proc open_default_log {{mode a}} {
- global dpkg::pkgrepo dpkg::architecture dpkg::logfd
- # Ensure that the log directory exists, and open up
- # the default debug log
- file mkdir ${pkgrepo}/${architecture}/log/
- set logfd [open ${pkgrepo}/${architecture}/log/debug.log ${mode} 0644]
-}
-
-# Closes the current logfile
-proc close_default_log {args} {
- global dpkg::logfd
- close $logfd
-}
-
-# Copies a port log file to the failure directory
-proc copy_failure_log {name} {
- global dpkg::pkgrepo dpkg::architecture
- # Copy the log to the failure log directory
- file mkdir ${pkgrepo}/${architecture}/log/failure/${name}
- file copy -force ${pkgrepo}/${architecture}/log/build/${name}/build.log ${pkgrepo}/${architecture}/log/failure/${name}/
-}
-
-# Deletes a port's failure log
-proc delete_failure_log {name} {
- global dpkg::pkgrepo dpkg::architecture
- if {[catch {system "rm -Rf ${pkgrepo}/${architecture}/log/failure/${name}"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-}
-
-# Add an override entry to the apt override file
-proc add_override {name priority section {maintainer ""}} {
- global dpkg::aptpackagedir dpkg::pkgrepo
- set output "${name} ${priority} ${section}"
- if {${maintainer} != ""} {
- append output " ${maintainer}"
- }
- set fd [open "${pkgrepo}/apt/override" a 0644]
- puts $fd $output
- close $fd
-}
-
-# Deletes the apt override file
-proc remove_override_file {args} {
- global dpkg::aptpackagedir dpkg::pkgrepo
- if {[catch {file delete -force ${pkgrepo}/apt/override} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
-}
-
-# Copies a given package to the apt repository
-proc copy_pkg_to_apt {name version revision category} {
- global dpkg::aptpackagedir
-
- set pkgfile [get_pkgpath $name $version $revision]
- file mkdir $aptpackagedir/main/$category
- file link -hard $aptpackagedir/main/$category/[file tail $pkgfile] $pkgfile
-}
-
-# Recursive bottom-up approach of building a list of dependencies.
-proc get_dependencies {portname {includeBuildDeps "true"}} {
- set result [get_dependencies_recurse $portname $includeBuildDeps]
- return [lsort -unique $result]
-}
-
-proc get_dependencies_recurse {portname includeBuildDeps} {
- set result {}
-
- set res [get_portinfo $portname]
-
- foreach {name array} $res {
- array set portinfo $array
- if {![info exists portinfo(name)] ||
- ![info exists portinfo(version)] ||
- ![info exists portinfo(revision)] ||
- ![info exists portinfo(categories)]} {
- ui_error "Internal error: $name missing some portinfo keys"
- continue
- }
-
- lappend result [list $portinfo(name) $portinfo(version) $portinfo(revision) [lindex $portinfo(categories) 0]]
-
- # Append the package's dependents to the result list
- set depends {}
- if {[info exists portinfo(depends_run)]} { eval "lappend depends $portinfo(depends_run)" }
- if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
- if {$includeBuildDeps == "true" && [info exists portinfo(depends_build)]} {
- eval "lappend depends $portinfo(depends_build)"
- }
- if {$includeBuildDeps == "true" && [info exists portinfo(depends_fetch)]} {
- eval "lappend depends $portinfo(depends_fetch)"
- }
- if {$includeBuildDeps == "true" && [info exists portinfo(depends_extract)]} {
- eval "lappend depends $portinfo(depends_extract)"
- }
- foreach depspec $depends {
- set dep [lindex [split $depspec :] end]
- set x [get_dependencies_recurse $dep $includeBuildDeps]
- eval "lappend result $x"
- set result [lsort -unique $result]
- }
- }
- return $result
-}
-
-# Install binary packages if they've already been built. This will
-# speed up the testing, since we won't have to recompile dependencies
-# which have already been compiled.
-
-proc install_binary_if_available {dep} {
- global dpkg::architecture dpkg::pkgrepo dpkg::portprefix
-
- set portname [lindex $dep 0]
- set portversion [lindex $dep 1]
- set portrevision [lindex $dep 2]
- set category [lindex $dep 3]
-
- if {${portrevision} != ""} {
- set verstring ${portversion}_${portrevision}
- } else {
- set verstring ${portversion}
- }
-
- set receiptdir [file join $portprefix var db receipts ${portname} ${verstring}]
- set pkgpath [get_pkgpath ${portname} ${portversion} ${portrevision}]
-
- # Check if the package is available, and ensure that it has not already been
- # installed through MacPorts (bootstrap packages such as dpkg and its
- # dependencies are always installed)
- if {[file readable $pkgpath] && ![file exists $receiptdir/receipt.bz2]} {
- ui_silent "Installing binary: $pkgpath"
- if {[catch {system "dpkg --force-depends -i ${pkgpath}"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
- # Touch the receipt
- file mkdir $receiptdir
- if {[catch {system "touch [file join $receiptdir receipt.bz2]"} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_noisy_error "Internal error: $error"
- exit 1
- }
- }
-}
-
-### main() entry point ####
-main $argc $argv
Deleted: trunk/base/portmgr/packaging/rpmall.tcl
===================================================================
--- trunk/base/portmgr/packaging/rpmall.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/portmgr/packaging/rpmall.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1,502 +0,0 @@
-#!/usr/bin/env tclsh
-# rpmall.tcl
-# $Id$
-#
-# Copyright (c) 2009-2011 The MacPorts Project
-# Copyright (c) 2003 Benjamin Reed <ranger at befunk.com>
-# Copyright (c) 2003 Kevin Van Vechten <kevin at opendarwin.org>
-# Copyright (c) 2002 Apple Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-
-package require darwinports
-
-# globals
-set portdir .
-
-# UI Instantiations
-array set ui_options {}
-# ui_options(ports_debug) - If set, output debugging messages.
-# ui_options(ports_verbose) - If set, output info messages (ui_info)
-# ui_options(ports_quiet) - If set, don't output "standard messages"
-
-# ui_options accessor
-proc ui_isset {val} {
- global ui_options
- if {[info exists ui_options($val)]} {
- if {$ui_options($val) eq "yes"} {
- return 1
- }
- }
- return 0
-}
-
-set options(package.destpath) "/darwinports/rpms"
-
-# UI Callback
-
-proc ui_prefix {priority} {
- switch $priority {
- debug {
- return "DEBUG: "
- }
- error {
- return "Error: "
- }
- warn {
- return "Warning: "
- }
- default {
- return ""
- }
- }
-}
-
-proc ui_channels {priority} {
- global logfd
- switch $priority {
- debug {
- if {[ui_isset ports_debug]} {
- return {stdout}
- } else {
- return {}
- }
- }
- info {
- # put verbose stuff only to the log file
- if {[ui_isset ports_verbose]} {
- return {$logfd}
- } else {
- return {}
- }
- }
- msg {
- if {[ui_isset ports_quiet]} {
- return {}
- } else {
- return {stdout}
- }
- }
- default {
- return {stdout}
- }
- }
-}
-
-proc pkg_ui_log {message} {
- global logfd
- if {$logfd ne ""} {
- log_message $logfd $message
- }
-}
-
-proc log_message {channel message} {
- seek $channel 0 end
- puts $channel $message
- flush $channel
-}
-
-# Recursive bottom-up approach of building a list of dependencies.
-proc get_dependencies {portname includeBuildDeps} {
- set result {}
-
- if {[catch {set search [mportsearch "^$portname\$"]} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Internal error: port search failed: $error"
- return {}
- }
- foreach {name array} $search {
- array set portinfo $array
- if {![info exists portinfo(name)] ||
- ![info exists portinfo(version)] ||
- ![info exists portinfo(categories)]} {
- ui_error "Internal error: $name missing some portinfo keys"
- continue
- }
- if {![info exists portinfo(revision)]} {
- set portinfo(revision) 0
- }
-
- set portname $portinfo(name)
- set portversion $portinfo(version)
- set revision $portinfo(revision)
-
- # Append the package itself to the result list
- lappend result [list $portname $portversion $revision]
-
- # Append the package's dependents to the result list
- set depends {}
- if {[info exists portinfo(depends_run)]} { eval "lappend depends $portinfo(depends_run)" }
- if {[info exists portinfo(depends_lib)]} { eval "lappend depends $portinfo(depends_lib)" }
- if {$includeBuildDeps ne "" && [info exists portinfo(depends_build)]} {
- eval "lappend depends $portinfo(depends_build)"
- }
- if {$includeBuildDeps ne "" && [info exists portinfo(depends_fetch)]} {
- eval "lappend depends $portinfo(depends_fetch)"
- }
- if {$includeBuildDeps ne "" && [info exists portinfo(depends_extract)]} {
- eval "lappend depends $portinfo(depends_extract)"
- }
- foreach depspec $depends {
- set dep [lindex [split $depspec :] end]
- set x [get_dependencies $dep $includeBuildDeps]
- eval "lappend result $x"
- set result [lsort -unique $result]
- }
- }
- return $result
-}
-
-# Install binary packages if they've already been built. This will
-# speed up the testing, since we won't have to recompile dependencies
-# which have already been compiled.
-
-proc install_binary_if_available {dep} {
- set portname [lindex $dep 0]
- set portversion [lindex $dep 1]
- set revision [lindex $dep 2]
-
- foreach dir {"${prefix}/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
- foreach arch {"ppc" "i386" "fat"} {
- set rpmpath "${dir}/${arch}/${portname}-${portversion}-${revision}.${arch}.rpm"
- if {[file readable $rpmpath]} {
- ui_msg "Installing binary: $rpmpath"
- if {[catch {system "rpm -Uvh --force $rpmpath"} error ]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Internal error: $error"
- } else {
- return true
- }
- }
- }
- }
- return false
-}
-
-
-# Standard procedures
-
-proc fatal args {
- global argv0
- puts stderr "$argv0: $args"
- exit
-}
-
-# Main
-array set options [list]
-array set variations [list]
-
-# set ui_options(ports_verbose) yes
-if {![file exists /usr/bin/sw_vers]} {
- set variations(puredarwin) "+"
-}
-
-if {[catch {mportinit ui_options options variations} result]} {
- puts "Failed to initialize ports system, $result"
- exit 1
-}
-
-package require Pextlib
-
-# If no arguments were given, default to all ports.
-if {[llength $argv] == 0} {
- lappend argv ".*"
-}
-
-foreach pname $argv {
- if {[catch {set allpackages [mportsearch "^${pname}\$"]} result]} {
- puts "port search failed: $result"
- exit 1
- }
-
- set logpath "/darwinports/logs"
- set logfd ""
-
- foreach {name array} $allpackages {
- array unset portinfo
- array set portinfo $array
-
- #ui_msg "foo $portinfo(porturl)"
-
- # Start with verbose output off;
- # this will prevent the repopulation of /opt/local from getting logged.
- set ui_options(ports_verbose) no
-
- if {![info exists portinfo(porturl)]} {
- puts stderr "Internal error: no porturl for $name"
- continue
- }
- if {![info exists portinfo(revision)]} {
- set portinfo(revision) 0
- }
-
- set porturl $portinfo(porturl)
-
- # this is used to short-circuit the RPM check and
- # move on to the next package
-
- global exit_loop
- set exit_loop false
-
- # Skip up-to-date packages
- if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
- if {[info exists portinfo(name)] &&
- [info exists portinfo(version)] &&
- [info exists portinfo(revision)]} {
- set portname $portinfo(name)
- set portversion $portinfo(version)
- set revision $portinfo(revision)
-
- foreach dir {"/opt/local/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
- foreach arch {"ppc" "i386" "fat"} {
- set rpmpath "${dir}/${arch}/${portname}-${portversion}-${revision}.${arch}.rpm"
- #ui_msg "trying ${rpmpath}"
- if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
- puts stderr "-> skipping ${portname}-${portversion}; package is up to date."
- set exit_loop true
- break
- }
- }
- if {${exit_loop}} {
- break
- }
- }
- }
- }
- if {${exit_loop}} {
- continue
- }
-
- # Skip packages which previously failed
- set exit_loop false
-
- # Skip up-to-date packages
- if {[regsub {^file://} $portinfo(porturl) "" portpath]} {
- if {[info exists portinfo(name)] &&
- [info exists portinfo(version)] &&
- [info exists portinfo(revision)]} {
- set portname $portinfo(name)
- set portversion $portinfo(version)
- set revision $portinfo(revision)
-
- set logfilepath "${logpath}/${portname}.log"
- if {[file readable ${logfilepath}] && ([file mtime ${logfilepath}] > [file mtime ${portpath}/Portfile])} {
- puts stderr "-> skipping ${portname}-${portversion}; package failed, but has not changed."
- set exit_loop true
- }
- }
- }
- if {${exit_loop}} {
- continue
- }
-
- # Building the port:
- # - remove /opt/local so it won't pollute the port.
- # - re-install MacPorts.
- # - keep distfiles outside /opt/local so we don't have to keep fetching them.
- # - send out an email to the maintainer if any errors occurred.
-
- set remove_files ""
- foreach dir {"/opt/local/src/apple/RPMS" "/usr/src/apple/RPMS" "/darwinports/rpms/RPMS"} {
- foreach arch {"ppc" "i386" "fat"} {
- set remove_files "${remove_files} '${dir}/${arch}/'*.rpm"
- }
- }
- system "rpm -q --queryformat='%{name} ' -p ${remove_files} | xargs rpm -e || true"
-
- ui_msg "-> Removing /opt/local"
- #unset ui_options(ports_verbose)
- if {[catch {system "rm -Rf /opt/local"} error]} {
- puts stderr "Internal error: $error"
- }
- # this is bad on pure darwin :)
- #if {[catch {system "rm -Rf /usr/X11R6"} error]} {
- # puts stderr "Internal error: $error"
- #}
- #if {[catch {system "rm -Rf /etc/X11"} error]} {
- # puts stderr "Internal error: $error"
- #}
- #if {[catch {system "rm -Rf /etc/fonts"} error]} {
- # puts stderr "Internal error: $error"
- #}
- ui_msg "-> Installing MacPorts"
- if {[catch {system "cd $env(HOME)/darwinports && make && make install"} error]} {
- puts stderr "Internal error: $error"
- }
- if {[catch {system "rmdir /opt/local/var/db/dports/distfiles"} error]} {
- puts stderr "Internal error: $error"
- }
- if {[catch {system "ln -s /darwinports/distfiles /opt/local/var/db/dports/distfiles"} error]} {
- puts stderr "Internal error: $error"
- }
- #set ui_options(ports_verbose) yes
-
- # If there was a log file left over from the previous pass,
- # then the port failed with an error. Send the log in an
- # email to the maintainers.
- if {$logfd ne ""} {
- close $logfd
- set logfd ""
- }
- #if {[file readable $logfilename]} {
- # if {[catch {system "<$logfilename /usr/sbin/sendmail -t"} error]} {
- # puts stderr "Internal error: $error"
- # }
- #}
-
- # Open the log file for writing
- set logfd [open ${logpath}/${name}.log w]
-
- set valid 1
-
- set lint_errors {}
- set portname ""
- set portversion ""
- set description ""
- set category ""
-
- if {![info exists portinfo(name)]} {
- lappend lint_errors "missing name key"
- set valid 0
- } else {
- set portname $portinfo(name)
- }
-
- if {![info exists portinfo(description)]} {
- lappend lint_errors "missing description key"
- set valid 0
- } else {
- set description $portinfo(description)
- }
-
- if {![info exists portinfo(version)]} {
- lappend lint_errors "missing version key"
- set valid 0
- } else {
- set portversion $portinfo(version)
- }
-
- if {![info exists portinfo(categories)]} {
- lappend lint_errors "missing categories key"
- set valid 0
- } else {
- set category [lindex $portinfo(categories) 0]
- }
-
- if {![info exists portinfo(maintainers)]} {
- append lint_errors "missing maintainers key"
- set valid 0
- set maintainers kevin at opendarwin.org
- } else {
- set maintainers $portinfo(maintainers)
- }
-
- pkg_ui_log "To: [join $maintainers {, }]"
- pkg_ui_log "From: donotreply at opendarwin.org"
- pkg_ui_log "Subject: MacPorts $portinfo(name)-$portinfo(version) build failure"
- pkg_ui_log ""
- pkg_ui_log "The following is a transcript produced by the MacPorts automated build "
- pkg_ui_log "system. You are receiving this email because you are listed as a maintainer "
- pkg_ui_log "of this port, which has failed the automated packaging process. Please update "
- pkg_ui_log "the port as soon as possible."
- pkg_ui_log ""
- pkg_ui_log ""
- pkg_ui_log "Thank you,"
- pkg_ui_log "The MacPorts Team"
- pkg_ui_log ""
- pkg_ui_log "================================================================================"
- pkg_ui_log ""
-
- if {!$valid} {
- foreach error $lint_errors {
- ui_error $error
- }
- }
-
- ui_msg "--> Packaging ${category}/${portname}-${portversion}"
-
- foreach prebuild {"ccache" "rpm" "unzip"} {
- if {![file exists /bin/${prebuild}] && ![file exists /usr/bin/${prebuild}]} {
- ui_msg "---> Pre-installing ${prebuild}"
- if {[catch {set search [mportsearch "^${prebuild}\$"]} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Internal error: port search ${prebuild} failed: $error"
- }
- array set prebuildinfo [lindex $search 1]
- set ui_options(ports_verbose) yes
- set options(subport) ${prebuild}
- if {[catch {set workername [mportopen $prebuildinfo(porturl) [array get options] [array get variations] yes]} result] ||
- $result == 1} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Internal error: unable to install ${prebuild}... exiting"
- exit 1
- }
- if {[catch {set result [mportexec $workername activate]} result] ||
- $result == 1} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "installation of ${prebuild} failed: $result"
- mportclose $workername
- exit 1
- }
- }
- }
-
- # Turn on verbose output for the build
- set ui_options(ports_verbose) yes
- set options(subport) $name
- if {[catch {set workername [mportopen $porturl [array get options] [array get variations]]} result] ||
- $result == 1} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "Internal error: unable to open port: $result"
- continue
- }
- if {[catch {set result [mportexec $workername rpmpackage]} result] ||
- $result == 1} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "port package failed: $result"
- mportclose $workername
- continue
- }
- set ui_options(ports_verbose) no
- # Turn verbose output off after the build
-
- mportclose $workername
-
- # We made it to the end. We can delete the log file.
- close $logfd
- set logfd ""
- file delete ${logpath}/${name}.log
- }
-
-}
-# end foreach pname
Modified: trunk/base/src/macports1.0/macports.tcl
===================================================================
--- trunk/base/src/macports1.0/macports.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/macports1.0/macports.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -3361,10 +3361,7 @@
dmg -
mdmg -
pkg -
- mpkg -
- rpm -
- dpkg -
- srpm {return 1}
+ mpkg {return 1}
default {return 0}
}
}
@@ -3379,14 +3376,11 @@
configure -
build {return "depends_fetch depends_extract depends_build depends_lib"}
test -
- srpm -
destroot {return "depends_fetch depends_extract depends_build depends_lib depends_run"}
dmg -
pkg -
mdmg -
- mpkg -
- rpm -
- dpkg {
+ mpkg {
if {[global_option_isset ports_binary_only] ||
(![global_option_isset ports_source_only] && [$workername eval _archive_available])} {
return "depends_lib depends_run"
Modified: trunk/base/src/package1.0/Makefile.in
===================================================================
--- trunk/base/src/package1.0/Makefile.in 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/package1.0/Makefile.in 2014-08-03 18:55:09 UTC (rev 123004)
@@ -6,7 +6,7 @@
INSTALLDIR= ${DESTDIR}${TCL_PACKAGE_PATH}/package1.0
SRCS= package.tcl portdmg.tcl portmdmg.tcl portmpkg.tcl portpkg.tcl \
- portrpm.tcl portsrpm.tcl portdpkg.tcl portunarchive.tcl \
+ portunarchive.tcl \
portarchivefetch.tcl
all:: pkgIndex.tcl
Modified: trunk/base/src/package1.0/package.tcl
===================================================================
--- trunk/base/src/package1.0/package.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/package1.0/package.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -33,12 +33,9 @@
# standard package load
package provide mp_package 1.0
-package require portrpm 1.0
-package require portsrpm 1.0
package require portpkg 1.0
package require portmpkg 1.0
package require portdmg 1.0
package require portmdmg 1.0
-package require portdpkg 1.0
package require portarchivefetch 1.0
package require portunarchive 1.0
Deleted: trunk/base/src/package1.0/portdpkg.tcl
===================================================================
--- trunk/base/src/package1.0/portdpkg.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/package1.0/portdpkg.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1,206 +0,0 @@
-# et:ts=4
-# portdpkg.tcl
-# $Id$
-#
-# Copyright (c) 2005, 2007, 2009, 2011 The MacPorts Project
-# Copyright (c) 2004 Landon Fuller <landonf at macports.org>
-# Copyright (c) 2002 - 2003 Apple Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-package provide portdpkg 1.0
-package require portutil 1.0
-
-set org.macports.dpkg [target_new org.macports.dpkg portdpkg::main]
-target_runtype ${org.macports.dpkg} always
-target_provides ${org.macports.dpkg} dpkg
-target_requires ${org.macports.dpkg} archivefetch unarchive destroot
-
-namespace eval portdpkg {
-}
-
-# Options
-options dpkg.asroot \
- package.destpath
-
-# Set up defaults
-default dpkg.asroot yes
-
-set_ui_prefix
-
-proc portdpkg::main {args} {
- global UI_PREFIX destpath os.arch os.platform supported_archs configure.build_arch
-
- ui_msg "$UI_PREFIX [format [msgcat::mc "Creating dpkg for %s-%s"] [option subport] [option version]]"
-
- # get deplist
- set deps [make_dependency_list [option subport]]
- set deps [lsort -unique $deps]
- foreach dep $deps {
- set name [lindex [split $dep /] 0]
- set vers [lindex [split $dep /] 1]
- # don't re-package ourself
- if {$name != [option subport]} {
- lappend dependencies "${name} (>= ${vers})"
- }
- }
-
- if {[info exists dependencies]} {
- ui_debug $dependencies
- }
-
- set controlpath [file join ${destpath} DEBIAN]
- if {[file exists ${controlpath}]} {
- if {![file isdirectory ${controlpath}]} {
- return -code error [format [msgcat::mc "Can not create dpkg control directory. %s not a directory."] ${controlpath}]
- } else {
- ui_info [msgcat::mc "Removing stale dpkg control directory."]
- delete "${controlpath}"
- }
- }
- file mkdir ${controlpath}
-
- set controlfd [open [file join ${controlpath} control] w+]
-
- # Size, in kilobytes, of ${destpath}
- set pkg_installed-size [expr {[dirSize ${destpath}] / 1024}]
-
- # Create debian dependency list
- if {[info exists dependencies]} {
- if {[llength ${dependencies}] != 0} {
- set pkg_depends [join ${dependencies} ", "]
- }
- }
-
- # Create dpkg version number
- if {[option epoch] != 0} {
- set pkg_version "[option epoch]:[option version]"
- } else {
- set pkg_version "[option version]"
- }
- if {[option revision] != 0} {
- append pkg_version "-[option revision]"
- }
-
- # Set dpkg category to first (main) category
- set pkg_category [lindex [option categories] 0]
-
- # Format the long description. Add a homepage if possible.
- if {[exists long_description]} {
- set pkg_long_description " [option long_description]\n"
- } elseif {[exists description]} {
- set pkg_long_description " [option description]\n"
- } else {
- set pkg_long_description " [option subport]\n"
- }
-
- if {[exists homepage]} {
- append pkg_long_description " .\n"
- append pkg_long_description " [option homepage]\n"
- }
-
- # Discern correct architecture
- # From http://www.debian.org/doc/debian-policy/ch-customized-programs.html#fr55:
- # The following architectures and operating systems are currently recognised
- # by dpkg-archictecture. The architecture, arch, is one of the following:
- # alpha, arm, hppa, i386, ia64, m68k, mips, mipsel, powerpc, s390, sh, sheb,
- # sparc and sparc64. The operating system, os, is one of: linux, gnu,
- # freebsd and openbsd. Use of gnu in this string is reserved for the
- # GNU/Hurd operating system.
- switch -regex ${configure.build_arch} {
- i[3-9]86 { set pkg_arch "i386" }
- x86_64 { set pkg_arch "x86_64" }
- default { set pkg_arch ${os.arch} }
- }
-
- # On systems other than Linux, the Architecture must contain
- # the operating system name
- if {${os.platform} != "linux"} {
- set pkg_arch "${os.platform}-${pkg_arch}"
- } elseif {${pkg_arch} == "x86_64"} {
- set pkg_arch "amd64"
- }
-
- # An architecture-independent package
- if {$supported_archs eq "noarch"} {
- set pkg_arch "all"
- }
-
- puts $controlfd "Package: [option subport]"
- puts $controlfd "Architecture: ${pkg_arch}"
- puts $controlfd "Version: ${pkg_version}"
- puts $controlfd "Section: ${pkg_category}"
- puts $controlfd "Maintainer: [option maintainers]"
- if {[info exists pkg_depends]} {
- puts $controlfd "Depends: ${pkg_depends}"
- }
- puts $controlfd "Installed-Size: ${pkg_installed-size}"
-
- puts $controlfd "Description: [option description]"
- # pkg_long_description is pre-formatted. Do not add a newline
- puts -nonewline $controlfd "$pkg_long_description"
- close $controlfd
-
- # Build debian package in package.destpath
- system "dpkg-deb -b \"${destpath}\" \"[option package.destpath]\""
-
- ui_info [msgcat::mc "Removing dpkg control directory."]
- delete "${controlpath}"
-}
-
-proc portdpkg::make_dependency_list {portname} {
- set result {}
- if {[catch {set res [mport_lookup $portname]} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "port lookup failed: $error"
- return 1
- }
- foreach {name array} $res {
- array set portinfo $array
-
- if {[info exists portinfo(depends_run)] || [info exists portinfo(depends_lib)]} {
- # get the union of depends_run and depends_lib
- # xxx: only examines the portfile component of the depspec
- set depends {}
- if {[info exists portinfo(depends_run)]} {
- lappend depends {*}$portinfo(depends_run)
- }
- if {[info exists portinfo(depends_lib)]} {
- lappend depends {*}$portinfo(depends_lib)
- }
-
- foreach depspec $depends {
- set dep [lindex [split $depspec :] end]
- lappend result {*}[make_dependency_list $dep]
- }
- }
- lappend result $portinfo(name)/$portinfo(version)
- unset portinfo
- }
- return $result
-}
Deleted: trunk/base/src/package1.0/portrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portrpm.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/package1.0/portrpm.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1,254 +0,0 @@
-# et:ts=4
-# portrpm.tcl
-# $Id$
-#
-# Copyright (c) 2005 - 2007, 2009 - 2011, 2013 The MacPorts Project
-# Copyright (c) 2002 - 2003 Apple Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-package provide portrpm 1.0
-package require portutil 1.0
-
-set org.macports.rpm [target_new org.macports.rpm portrpm::rpm_main]
-target_runtype ${org.macports.rpm} always
-target_provides ${org.macports.rpm} rpm
-target_requires ${org.macports.rpm} archivefetch unarchive destroot
-
-namespace eval portrpm {
-}
-
-# Options
-options rpm.asroot \
- package.destpath
-
-# Set up defaults
-default rpm.asroot yes
-
-default rpm.srcdir {${prefix}/src/macports}
-default rpm.tmpdir {${prefix}/var/tmp}
-
-set_ui_prefix
-
-proc portrpm::rpm_main {args} {
- global subport version revision UI_PREFIX
-
- ui_msg "$UI_PREFIX [format [msgcat::mc "Creating RPM package for %s-%s"] ${subport} ${version}]"
-
- return [rpm_pkg $subport $version $revision]
-}
-
-proc portrpm::rpm_pkg {portname portversion portrevision} {
- global UI_PREFIX rpm.asroot package.destpath portdbpath destpath workpath \
- prefix categories maintainers description long_description \
- homepage epoch portpath os.platform os.arch os.version os.major \
- supported_archs configure.build_arch license
-
- set rpmdestpath ""
- if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
- set rpm.asroot no
- set pkgpath ${package.destpath}
- file mkdir ${pkgpath}/BUILD \
- ${pkgpath}/RPMS \
- ${pkgpath}/SOURCES \
- ${pkgpath}/SPECS \
- ${pkgpath}/SRPMS
- set rpmdestpath "--define '_topdir ${pkgpath}'"
- }
-
- set rpmbuildarch ""
- if {$supported_archs eq "noarch"} {
- set rpmbuildarch "--target noarch"
- } elseif {[variant_exists universal] && [variant_isset universal]} {
- set rpmbuildarch "--target fat"
- } elseif {${configure.build_arch} != ""} {
- set rpmbuildarch "--target ${configure.build_arch}"
- }
-
- foreach dir [list "${prefix}/src/macports/RPMS" "${prefix}/src/apple/RPMS" "/usr/src/apple/RPMS" "/macports/rpms/RPMS"] {
- foreach arch [list ${configure.build_arch} ${os.arch} "fat" "noarch"] {
- set rpmpath "$dir/${arch}/${portname}-${portversion}-${portrevision}.${arch}.rpm"
- if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
- ui_debug "$rpmpath"
- ui_msg "$UI_PREFIX [format [msgcat::mc "RPM package for %s version %s is up-to-date"] ${portname} ${portversion}]"
- return 0
- }
- }
- }
-
- set specpath ${workpath}/${portname}.spec
- # long_description, description, or homepage may not exist
- foreach variable {long_description description homepage categories maintainers} {
- if {![info exists $variable]} {
- set pkg_$variable ""
- } else {
- set pkg_$variable [set $variable]
- }
- }
- set category [lindex [split $categories " "] 0]
- set maintainer $maintainers
-
- set dependencies {}
- # get deplist
- set deps [make_dependency_list $portname]
- set deps [lsort -unique $deps]
- foreach dep $deps {
- set name [lindex [split $dep /] 0]
- set vers [lindex [split $dep /] 1]
- # don't re-package ourself
- if {$name != $portname} {
- lappend dependencies "${name} >= ${vers}"
- }
- }
-
- # depend on system (virtual packages for apple stuff)
- lappend dependencies "org.macports.${os.platform}${os.major}"
-
- set listpath ${workpath}/${portname}.filelist
- system "rm -f '${workpath}/${portname}.filelist' && touch '${workpath}/${portname}.filelist'"
- #system "cd '${destpath}' && find . -type d | grep -v -E '^.$' | sed -e 's/\"/\\\"/g' -e 's/^./%dir \"/' -e 's/$/\"/' > '${workpath}/${portname}.filelist'"
- system "cd '${destpath}' && find . ! -type d | grep -v /etc/ | sed -e 's/\"/\\\"/g' -e 's/^./\"/' -e 's/$/\"/' >> '${workpath}/${portname}.filelist'"
- system "cd '${destpath}' && find . ! -type d | grep /etc/ | sed -e 's/\"/\\\"/g' -e 's/^./%config \"/' -e 's/$/\"/' >> '${workpath}/${portname}.filelist'"
- write_spec ${specpath} ${destpath} ${listpath} $portname $portversion $portrevision $pkg_description $pkg_long_description $pkg_homepage $category $license $maintainer $dependencies $epoch
- system "MP_USERECEIPTS='${portdbpath}/receipts' rpmbuild -bb -v ${rpmbuildarch} ${rpmdestpath} ${specpath}"
-
- return 0
-}
-
-proc portrpm::make_dependency_list {portname} {
- set result {}
- if {[catch {set res [mport_lookup $portname]} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "port lookup failed: $error"
- return 1
- }
- foreach {name array} $res {
- array set portinfo $array
-
- if {[info exists portinfo(depends_run)] || [info exists portinfo(depends_lib)]} {
- # get the union of depends_run and depends_lib
- # xxx: only examines the portfile component of the depspec
- set depends {}
- if {[info exists portinfo(depends_run)]} {
- lappend depends {*}$portinfo(depends_run)
- }
- if {[info exists portinfo(depends_lib)]} {
- lappend depends {*}$portinfo(depends_lib)
- }
-
- foreach depspec $depends {
- set dep [lindex [split $depspec :] end]
-
- # xxx: nasty hack
- if {$dep ne "XFree86"} {
- lappend result {*}[make_dependency_list $dep]
- }
- }
- }
- lappend result $portinfo(name)/$portinfo(version)
- unset portinfo
- }
- ui_debug "dependencies for ${portname}: $result"
- return $result
-}
-
-proc portrpm::word_wrap {orig Length} {
- set pos 0
- set line ""
- set text ""
-
- set words [split $orig]
- set numWords [llength $words]
- for {set cnt 0} {$cnt < $numWords} {incr cnt} {
- set w [lindex $words $cnt]
- set wLen [string length $w]
-
- if {($pos+$wLen < $Length)} {
- # append word to current line
- if {$pos} {append line " "; incr pos}
- append line $w
- incr pos $wLen
- } else {
- # line full => write buffer and begin a new line
- if {[string length $text]} {append text "\n"}
- append text $line
- set line $w
- set pos $wLen
- }
- }
-
- if {[string length $text]} {append text "\n"}
- if {[string length $line]} {append text $line}
- return $text
-}
-
-proc portrpm::write_spec {specfile destroot filelist portname portversion portrevision description long_description homepage category license maintainer dependencies epoch} {
- set specfd [open ${specfile} w+]
- set origportname ${portname}
- regsub -all -- "\-" $portversion "_" portversion
- regsub -all -- "\-" $portname "_" portname
- puts $specfd "\#Spec file generated by MacPorts
-%define distribution MacPorts
-%define vendor MacPorts
-%define packager ${maintainer}
-
-%define buildroot ${destroot}
-# Avoid cleaning BuildRoot in the pre-install:
-%define __spec_install_pre %{___build_pre}
-%define __spec_clean_body %{nil}
-
-Summary: ${description}
-Name: ${portname}
-Version: ${portversion}
-Release: ${portrevision}
-Group: ${category}
-License: ${license}
-URL: ${homepage}
-BuildRoot: ${destroot}
-AutoReq: no"
- if {$epoch != 0} {
- puts $specfd "Epoch: ${epoch}"
- }
- if {[llength ${dependencies}] != 0} {
- foreach require ${dependencies} {
- puts $specfd "Requires: [regsub -all -- "\-" $require "_"]"
- }
- }
- set wrap_description [word_wrap ${long_description} 72]
- puts $specfd "
-%description
-$wrap_description
-
-%prep
-%build
-%install
-%clean
-
-%files -f ${filelist}"
- close $specfd
-}
Deleted: trunk/base/src/package1.0/portsrpm.tcl
===================================================================
--- trunk/base/src/package1.0/portsrpm.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/package1.0/portsrpm.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1,301 +0,0 @@
-# et:ts=4
-# portsrpm.tcl
-# $Id$
-#
-# Copyright (c) 2007, 2009, 2011, 2013 The MacPorts Project
-# Copyright (c) 2002 - 2003 Apple Inc.
-# All rights reserved.
-#
-# Redistribution and use in source and binary forms, with or without
-# modification, are permitted provided that the following conditions
-# are met:
-# 1. Redistributions of source code must retain the above copyright
-# notice, this list of conditions and the following disclaimer.
-# 2. Redistributions in binary form must reproduce the above copyright
-# notice, this list of conditions and the following disclaimer in the
-# documentation and/or other materials provided with the distribution.
-# 3. Neither the name of Apple Inc. nor the names of its contributors
-# may be used to endorse or promote products derived from this software
-# without specific prior written permission.
-#
-# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
-# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
-# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
-# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
-# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
-# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
-# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
-# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
-# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
-# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
-# POSSIBILITY OF SUCH DAMAGE.
-#
-
-package provide portsrpm 1.0
-package require portutil 1.0
-package require portfetch 1.0
-
-set org.macports.srpm [target_new org.macports.srpm portsrpm::srpm_main]
-target_runtype ${org.macports.srpm} always
-target_provides ${org.macports.srpm} srpm
-target_requires ${org.macports.srpm} checksum
-
-namespace eval portsrpm {
-}
-
-options package.destpath
-
-# Set up defaults
-default srpm.asroot yes
-
-set_ui_prefix
-
-proc portsrpm::srpm_main {args} {
- global subport version revision UI_PREFIX
-
- ui_msg "$UI_PREFIX [format [msgcat::mc "Creating SRPM package for %s-%s"] ${subport} ${version}]"
-
- return [srpm_pkg $subport $version $revision]
-}
-
-proc portsrpm::srpm_pkg {portname portversion portrevision} {
- global UI_PREFIX package.destpath portdbpath destpath workpath distpath \
- prefix categories maintainers description long_description \
- homepage epoch portpath distfiles os.platform os.arch os.version \
- os.major
-
- set fetch_urls {}
- portfetch::checkfiles fetch_urls
-
- set rpmdestpath ""
- if {![string equal ${package.destpath} ${workpath}] && ![string equal ${package.destpath} ""]} {
- set pkgpath ${package.destpath}
- file mkdir ${pkgpath}/BUILD \
- ${pkgpath}/RPMS \
- ${pkgpath}/SOURCES \
- ${pkgpath}/SPECS \
- ${pkgpath}/SRPMS
- set rpmdestpath "--define '_topdir ${pkgpath}'"
- }
-
- foreach dir [list "${prefix}/src/macports/SRPMS" "${prefix}/src/apple/SRPMS" "/usr/src/apple/SRPMS" "/macports/rpms/SRPMS"] {
- foreach arch {"src" "nosrc"} {
- set rpmpath "$dir/${portname}-${portversion}-${portrevision}.${arch}.rpm"
- if {[file readable $rpmpath] && ([file mtime ${rpmpath}] >= [file mtime ${portpath}/Portfile])} {
- ui_debug "$rpmpath"
- ui_msg "$UI_PREFIX [format [msgcat::mc "SRPM package for %s version %s is up-to-date"] ${portname} ${portversion}]"
- return 0
- }
- }
- }
-
- set specpath ${workpath}/${portname}-port.spec
- # long_description, description, or homepage may not exist
- foreach variable {long_description description homepage categories maintainers} {
- if {![info exists $variable]} {
- set pkg_$variable ""
- } else {
- set pkg_$variable [set $variable]
- }
- }
- set category [lindex [split $categories " "] 0]
- set license "Unknown"
- set maintainer $maintainers
-
- set dependencies {}
- # get deplist
- set deps [make_dependency_list $portname]
- set deps [lsort -unique $deps]
- foreach dep $deps {
- set name [lindex [split $dep /] 0]
- set vers [lindex [split $dep /] 1]
- # don't re-package ourself
- if {$name != $portname} {
- lappend dependencies "${name} >= ${vers}"
- }
- }
-
- # true = .src.rpm (with distfiles), false = .nosrc.rpm (without distfiles)
- set src false
-
- #set sourcespath ${prefix}/src/macports/SOURCES
- set sourcespath "`rpm --eval %{_sourcedir}`"
-
- system "cp -p ${portpath}/Portfile ${sourcespath}/$portname-Portfile"
- if {[info exists ${portpath}/files]} {
- system "cd ${portpath} && zip -r -q ${sourcespath}/$portname-files.zip files -x \\*.DS_Store -x files/.svn\\*"
- set zip $portname-files.zip
- } else {
- set zip ""
- }
- foreach dist $distfiles {
- system "cp -p ${distpath}/${dist} ${sourcespath}/${dist}"
- }
-
- write_port_spec ${specpath} $portname $portversion $portrevision $pkg_description $pkg_long_description $pkg_homepage $category $license $maintainer $distfiles $fetch_urls $dependencies $epoch $src $zip
- system "rpmbuild -bs -v --nodeps ${rpmdestpath} ${specpath}"
-
- return 0
-}
-
-proc portsrpm::make_dependency_list {portname} {
- set result {}
- if {[catch {set res [mport_lookup $portname]} error]} {
- global errorInfo
- ui_debug "$errorInfo"
- ui_error "port lookup failed: $error"
- return 1
- }
- foreach {name array} $res {
- array set portinfo $array
-
- if {[info exists portinfo(depends_fetch)] || [info exists portinfo(depends_extract)]
- || [info exists portinfo(depends_build)] || [info exists portinfo(depends_lib)]} {
- # get the union of depends_fetch, depends_extract, depends_build and depends_lib
- # xxx: only examines the portfile component of the depspec
- set depends {}
- if {[info exists portinfo(depends_fetch)]} {
- lappend depends {*}$portinfo(depends_fetch)
- }
- if {[info exists portinfo(depends_extract)]} {
- lappend depends {*}$portinfo(depends_extract)
- }
- if {[info exists portinfo(depends_build)]} {
- lappend depends {*}$portinfo(depends_build)
- }
- if {[info exists portinfo(depends_lib)]} {
- lappend depends {*}$portinfo(depends_lib)
- }
-
- foreach depspec $depends {
- set dep [lindex [split $depspec :] end]
-
- # xxx: nasty hack
- if {$dep != "XFree86"} {
- lappend result {*}[make_dependency_list $dep]
- }
- }
- }
- lappend result $portinfo(name)/$portinfo(version)
- unset portinfo
- }
- ui_debug "dependencies for ${portname}: $result"
- return $result
-}
-
-proc portsrpm::word_wrap {orig Length} {
- set pos 0
- set line ""
- set text ""
-
- set words [split $orig]
- set numWords [llength $words]
- for {set cnt 0} {$cnt < $numWords} {incr cnt} {
- set w [lindex $words $cnt]
- set wLen [string length $w]
-
- if {($pos+$wLen < $Length)} {
- # append word to current line
- if {$pos} {append line " "; incr pos}
- append line $w
- incr pos $wLen
- } else {
- # line full => write buffer and begin a new line
- if {[string length $text]} {append text "\n"}
- append text $line
- set line $w
- set pos $wLen
- }
- }
-
- if {[string length $text]} {append text "\n"}
- if {[string length $line]} {append text $line}
- return $text
-}
-
-proc portsrpm::write_port_spec {specfile portname portversion portrevision description long_description homepage category license maintainer distfiles fetch_urls dependencies epoch src zip} {
- set specfd [open ${specfile} w+]
- set origportname ${portname}
- regsub -all -- "\-" $portversion "_" portversion
- regsub -all -- "\-" $portname "_" portname
- puts $specfd "\#Spec file generated by MacPorts
-%define distribution MacPorts
-%define vendor MacPorts
-%define packager ${maintainer}
-
-Summary: ${description}
-Name: ${portname}
-Version: ${portversion}
-Release: ${portrevision}
-Group: ${category}
-License: ${license}
-URL: ${homepage}
-BuildRoot: %{_tmppath}/%{name}-%{version}-root
-Source0: ${portname}-Portfile"
- if {$zip ne ""} {
- puts $specfd "Source1: $zip"
- }
- if {$epoch != 0} {
- puts $specfd "Epoch: ${epoch}"
- }
- set first 2
- set count $first
- puts $specfd "#distfiles"
- foreach file ${distfiles} {
-
- puts -nonewline $specfd "Source${count}: "
- if {![info exists $fetch_urls]} {
- foreach {url_var distfile} ${fetch_urls} {
- if {$distfile eq $file} {
- global portfetch::$url_var master_sites
- set site [lindex [set $url_var] 0]
- set file [portfetch::assemble_url $site $distfile]
- break
- }
- }
- }
- puts $specfd $file
- if (!$src) {
- puts $specfd "NoSource: $count"
- }
- incr count
- }
- puts $specfd "AutoReq: no"
- if {[llength ${dependencies}] != 0} {
- foreach require ${dependencies} {
- puts $specfd "BuildRequires: [regsub -all -- "\-" $require "_"]"
- }
- }
- set wrap_description [word_wrap ${long_description} 72]
- if {$zip ne ""} {
- set and "-a 1"
- } else {
- set and ""
- }
- puts $specfd "
-%description
-$wrap_description
-
-%prep
-%setup -c $and -T
-cp -p %{SOURCE0} Portfile
-#prepare work area
-port fetch
-port checksum
-port extract
-port patch
-
-%build
-port configure
-port build
-
-%install
-rm -rf \$RPM_BUILD_ROOT
-mkdir -p \$RPM_BUILD_ROOT
-port destroot
-port rpm
-
-%clean
-port clean"
- close $specfd
-}
Deleted: trunk/base/src/package1.0/tests/portdpkg.test
===================================================================
--- trunk/base/src/package1.0/tests/portdpkg.test 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/package1.0/tests/portdpkg.test 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1,73 +0,0 @@
-# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
-
-package require tcltest 2
-namespace import tcltest::*
-
-set pwd [file dirname [file normalize $argv0]]
-
-source ../package_test_autoconf.tcl
-package require macports 1.0
-
-array set ui_options {}
-#set ui_options(ports_debug) yes
-#set ui_options(ports_verbose) yes
-mportinit ui_options
-
-package require portdpkg 1.0
-source ./library.tcl
-macports_worker_init
-
-
-test main {
- Port dpkg main unit test.
-} -constraints { ![catch {exec which dpkg-deb}]
-
-} -setup {
- set os.platform darwin
- set os.major 10
- set os.arch i386
- set epoch 1
-
- set destpath $pwd/pkg
- set configure.build_arch build_arch
- set package.destpath $pwd/pkg
-
- set subport fondu
- set version 060102
- set revision 1
- set maintainers {test at macports.org}
- set description test.description
- set categories test
- set supported_archs noarch
-
-
-} -body {
- if {[catch {portdpkg::main}] != 0} {
- return "FAIL: cannot create dmg"
- }
- if {![file exists $pwd/pkg/fondu_060102-1_all.deb]} {
- return "FAIL: missing .deb file"
- }
- return "Package deb successful."
-
-} -cleanup {
- file delete -force $pwd/pkg
-
-} -result "Package deb successful."
-
-
-test make_dependency_list {
- Make dependency list unit test.
-} -setup {
- set subport fondu
- set version 060102
- set revision 1
-} -body {
- if {[portdpkg::make_dependency_list $subport] != "fondu/060102"} {
- return "FAIL: could not make dependency list"
- }
- return "Make dependency list successful."
-} -result "Make dependency list successful."
-
-
-cleanupTests
Modified: trunk/base/src/port/port.tcl
===================================================================
--- trunk/base/src/port/port.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/port/port.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -4257,12 +4257,9 @@
unarchive [list action_target [ACTION_ARGS_PORTS]] \
dmg [list action_target [ACTION_ARGS_PORTS]] \
mdmg [list action_target [ACTION_ARGS_PORTS]] \
- dpkg [list action_target [ACTION_ARGS_PORTS]] \
mpkg [list action_target [ACTION_ARGS_PORTS]] \
pkg [list action_target [ACTION_ARGS_PORTS]] \
portpkg [list action_target [ACTION_ARGS_PORTS]] \
- rpm [list action_target [ACTION_ARGS_PORTS]] \
- srpm [list action_target [ACTION_ARGS_PORTS]] \
\
quit [list action_exit [ACTION_ARGS_NONE]] \
exit [list action_exit [ACTION_ARGS_NONE]] \
Modified: trunk/base/src/port1.0/portsandbox.tcl
===================================================================
--- trunk/base/src/port1.0/portsandbox.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/port1.0/portsandbox.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -43,7 +43,7 @@
# sandbox-exec -p '(version 1) (allow default) (deny file-write*) (allow file-write* <filter>)' some-command
proc portsandbox::set_profile {target} {
global os.major portsandbox_profile workpath distpath altprefix \
- package.destpath configure.ccache ccache_dir rpm.srcdir rpm.tmpdir
+ package.destpath configure.ccache ccache_dir
switch $target {
activate -
@@ -73,10 +73,6 @@
set allow_dirs [list ${package.destpath}]
}
}
- rpm -
- srpm {
- set allow_dirs [list ${rpm.srcdir} ${rpm.tmpdir}]
- }
}
# TODO: remove altprefix support
Modified: trunk/base/src/port1.0/portutil.tcl
===================================================================
--- trunk/base/src/port1.0/portutil.tcl 2014-08-03 16:11:31 UTC (rev 123003)
+++ trunk/base/src/port1.0/portutil.tcl 2014-08-03 18:55:09 UTC (rev 123004)
@@ -1457,9 +1457,6 @@
pkg -
portpkg -
mpkg -
- rpm -
- srpm -
- dpkg -
mdmg -
"" { set deptypes "depends_fetch depends_extract depends_lib depends_build depends_run" }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.macosforge.org/pipermail/macports-changes/attachments/20140803/81e3d1c6/attachment-0001.html>
More information about the macports-changes
mailing list