Ticket #8221: upd.patch
File upd.patch, 11.0 KB (added by gwhitneycom1@…, 17 years ago) |
---|
-
src/port/port.1
358 358 For example: 359 359 .Pp 360 360 .Dl "port -n upgrade ethereal" 361 .Pp 362 Note that in selecting the variants to use in the upgraded build of the 363 port, any variants specified on the command line take highest precedence, 364 then the variants active in the latest installed version of the port, and 365 finally the global variants specified in variants.conf, if any. Note that 366 upgrade will not normally rebuild a port only to change the selected 367 variants; you can either specify -f, or deactivate the port and reinstall it 368 with different variants. 361 369 .Ss clean 362 370 Clean the files used for building 363 371 .Ar portname . -
src/port/port.tcl
1410 1410 global global_variations 1411 1411 require_portlist portlist 1412 1412 foreachport $portlist { 1413 # Merge global variations into the variations specified for this port 1414 foreach { variation value } [array get global_variations] { 1415 if { ![info exists variations($variation)] } { 1416 set variations($variation) $value 1417 } 1418 } 1419 1420 darwinports::upgrade $portname "port:$portname" [array get variations] [array get options] 1413 # Global variations will have to be merged into the specified 1414 # variations, but perhaps after the installed variations are 1415 # merged. So we pass them into upgrade: 1416 darwinports::upgrade $portname "port:$portname" [array get global_variations] [array get variations] [array get options] 1421 1417 } 1422 1418 1423 1419 return 0 -
src/darwinports1.0/darwinports.tcl
1607 1607 } 1608 1608 1609 1609 # upgrade procedure 1610 proc darwinports::upgrade {portname dspec variationslist optionslist {depscachename ""}} {1610 proc darwinports::upgrade {portname dspec globalvarlist variationslist optionslist {depscachename ""}} { 1611 1611 global darwinports::registry.installtype 1612 1612 global darwinports::portarchivemode 1613 1613 array set options $optionslist 1614 # Note $variationslist is left alone and so retains the original 1615 # requested variations, which should be passed to recursive calls to 1616 # upgrade; while variations gets existing variants and global variations 1617 # merged in later on, so it applies only to this port's upgrafe 1614 1618 array set variations $variationslist 1615 1619 if {![string match "" $depscachename]} { 1616 1620 upvar $depscachename depscache … … 1646 1650 # if this is set (not 0) we dont follow the deps 1647 1651 set depflag 0 1648 1652 1653 # Sooner or later we may have to open this port to update the portinfo 1654 # by evaluating the variants. Keep track of whether this has happened 1655 set portwasopened 0 1656 1649 1657 # set version_installed 1650 1658 set ilist {} 1651 1659 if { [catch {set ilist [registry::installed $portname ""]} result] } { … … 1653 1661 ui_debug "$portname is *not* installed by DarwinPorts" 1654 1662 # open porthandle 1655 1663 set porturl $portinfo(porturl) 1656 1657 1664 if {![info exists porturl]} { 1665 set porturl file://./ 1658 1666 } 1659 if {[catch {set workername [dportopen $porturl [array get options] ]} result]} { 1660 global errorInfo 1661 ui_debug "$errorInfo" 1667 # Merge the global variations into the specified 1668 foreach { variation value } $globalvarlist { 1669 if { ![info exists variations($variation)] } { 1670 set variations($variation) $value 1671 } 1672 } 1673 1674 if {[catch {set workername [dportopen $porturl [array get options] [array get variations]]} result]} { 1675 global errorInfo 1676 ui_debug "$errorInfo" 1662 1677 ui_error "Unable to open port: $result" 1663 return 1 1664 } 1678 return 1 1679 } 1680 # While we're at it, update the portinfo 1681 array unset portinfo 1682 array set portinfo [dportinfo $workername] 1683 set portwasopened 1 1665 1684 1666 1685 if {![_dportispresent $workername $dspec ] } { 1667 1686 # port in not installed - install it! … … 1671 1690 ui_error "Unable to exec port: $result" 1672 1691 return 1 1673 1692 } 1693 if {$result > 0} { 1694 ui_error "Problem while installing $portname" 1695 return $result 1696 } 1674 1697 } else { 1675 1698 # port installed outside DP 1676 1699 ui_debug "$portname installed outside the MacPorts system" 1677 1700 set depflag 1 1678 1701 } 1679 1702 1703 # update ilist since we just did an installation 1704 set ilist [registry::installed $portname ""] 1680 1705 } else { 1681 1706 ui_error "Checking installed version failed: $result" 1682 1707 exit 1 … … 1685 1710 set anyactive 0 1686 1711 set version_installed 0 1687 1712 set epoch_installed 0 1713 1688 1714 if {$ilist == ""} { 1689 1715 # XXX this sets $version_installed to $version_in_tree even if not installed!! 1690 1716 set version_installed $version_in_tree … … 1717 1743 } 1718 1744 } 1719 1745 } 1720 if { [lindex $num 4] == 0 && 0 == [string compare "image" ${darwinports::registry.installtype}] } { 1746 # record the variant of the latest version 1747 set variant [lindex $num 3] 1748 if { [lindex $num 4] == 0 && 0 == [string compare "image" ${darwinports::registry.installtype}] } { 1721 1749 # activate the latest installed version 1722 1750 if {[catch {portimage::activate $portname $version_installed$variant $optionslist} result]} { 1723 1751 global errorInfo 1724 1752 ui_debug "$errorInfo" 1725 1753 ui_error "Activating $portname $version_installed failed: $result" 1726 1754 return 1 1727 1755 } 1728 1756 } … … 1731 1759 # output version numbers 1732 1760 ui_debug "epoch: in tree: $epoch_in_tree installed: $epoch_installed" 1733 1761 ui_debug "$portname $version_in_tree exists in the ports tree" 1734 ui_debug "$portname $version_installed is installed"1762 ui_debug "$portname $version_installed $variant is installed" 1735 1763 1736 1764 # set the nodeps option 1737 1765 if {![info exists options(ports_nodeps)]} { … … 1740 1768 set nodeps yes 1741 1769 } 1742 1770 1771 # save existing variant for later use 1772 set oldvariant $variant 1773 if {$portwasopened == 0} { 1774 # If the port has not been opened, then before we do 1775 # dependencies, we need to figure out the final variants, 1776 # open the port, and update the portinfo. (If it was opened, 1777 # then the variants must still be the ones we opened it with, 1778 # and the portinfo is correct.) 1779 1780 set porturl $portinfo(porturl) 1781 if {![info exists porturl]} { 1782 set porturl file://./ 1783 } 1784 1785 # check if the variants is present in $version_in_tree 1786 set variant [split $variant +] 1787 ui_debug "Merging existing variants $variant into variants" 1788 if {[info exists portinfo(variants)]} { 1789 set avariants $portinfo(variants) 1790 } else { 1791 set avariants {} 1792 } 1793 ui_debug "available variants are : $avariants" 1794 foreach v $variant { 1795 if {[lsearch $avariants $v] == -1} { 1796 } else { 1797 ui_debug "variant $v is present in $portname $version_in_tree" 1798 if { ![info exists variations($v)]} { 1799 set variations($v) "+" 1800 } 1801 } 1802 } 1803 1804 # Now merge in the global (i.e. variants.conf) variations. 1805 # We wait until now so that existing variants for this port 1806 # override global variations 1807 foreach { variation value } $globalvarlist { 1808 if { ![info exists variations($variation)] } { 1809 set variations($variation) $value 1810 } 1811 } 1812 1813 ui_debug "new fully merged portvariants: [array get variations]" 1814 1815 if {[catch {set workername [dportopen $porturl [array get options] [array get variations]]} result]} { 1816 global errorInfo 1817 ui_debug "$errorInfo" 1818 ui_error "Unable to open port: $result" 1819 return 1 1820 } 1821 1822 array unset portinfo 1823 array set portinfo [dportinfo $workername] 1824 set portwasopened 1 1825 } 1826 1827 1743 1828 if {$nodeps == "yes" || $depflag == 1} { 1744 1829 ui_debug "Not following dependencies" 1745 1830 set depflag 0 … … 1750 1835 if {![llength [array get depscache $i]]} { 1751 1836 set d [lindex [split $i :] end] 1752 1837 set depscache($i) 1 1753 upgrade $d $i $ variationslist $optionslist depscache1838 upgrade $d $i $globalvarlist $variationslist $optionslist depscache 1754 1839 } 1755 1840 } 1756 1841 } … … 1760 1845 if {![llength [array get depscache $i]]} { 1761 1846 set d [lindex [split $i :] end] 1762 1847 set depscache($i) 1 1763 upgrade $d $i $ variationslist $optionslist depscache1848 upgrade $d $i $globalvarlist $variationslist $optionslist depscache 1764 1849 } 1765 1850 } 1766 1851 } … … 1770 1855 if {![llength [array get depscache $i]]} { 1771 1856 set d [lindex [split $i :] end] 1772 1857 set depscache($i) 1 1773 upgrade $d $i $ variationslist $optionslist depscache1858 upgrade $d $i $globalvarlist $variationslist $optionslist depscache 1774 1859 } 1775 1860 } 1776 1861 } … … 1779 1864 # check installed version against version in ports 1780 1865 if { [rpm-vercomp $version_installed $version_in_tree] >= 0 && ![info exists options(ports_force)] } { 1781 1866 ui_debug "No need to upgrade! $portname $version_installed >= $portname $version_in_tree" 1867 if {[info exists portinfo(portvariants)] 1868 && $portinfo(portvariants) != $oldvariant} { 1869 ui_warn "Skipping upgrdae since $portname $version_installed >= $portname $version_in_tree, even though installed variant $oldvariant differs from $portinfo(portvariants). Specify -f to force upgrade." 1870 } 1782 1871 if { $epoch_installed >= $epoch_in_tree } { 1783 1872 # Check if we have to do dependents 1784 1873 if {[info exists options(ports_do_dependents)]} { … … 1791 1880 if { [llength deplist] > 0 } { 1792 1881 foreach dep $deplist { 1793 1882 set dpname [lindex $dep 2] 1794 darwinports::upgrade $dpname "port:$dpname" [array get variations][array get options]1883 darwinports::upgrade $dpname "port:$dpname" $globalvarlist $variationslist [array get options] 1795 1884 } 1796 1885 } 1797 1886 } … … 1803 1892 } 1804 1893 } 1805 1894 1806 # open porthandle1807 set porturl $portinfo(porturl)1808 if {![info exists porturl]} {1809 set porturl file://./1810 }1811 1895 1812 # check if the variants is present in $version_in_tree1813 set oldvariant $variant1814 set variant [split $variant +]1815 ui_debug "variants to install $variant"1816 if {[info exists portinfo(variants)]} {1817 set avariants $portinfo(variants)1818 } else {1819 set avariants {}1820 }1821 ui_debug "available variants are : $avariants"1822 foreach v $variant {1823 if {[lsearch $avariants $v] == -1} {1824 } else {1825 ui_debug "variant $v is present in $portname $version_in_tree"1826 set variations($v) "+"1827 }1828 }1829 ui_debug "new portvariants: [array get variations]"1830 1831 if {[catch {set workername [dportopen $porturl [array get options] [array get variations]]} result]} {1832 global errorInfo1833 ui_debug "$errorInfo"1834 ui_error "Unable to open port: $result"1835 return 11836 }1837 1838 1896 # install version_in_tree 1839 1897 if {0 == [string compare "yes" ${darwinports::portarchivemode}]} { 1840 1898 set upgrade_action "archive" … … 1887 1945 if { [llength deplist] > 0 } { 1888 1946 foreach dep $deplist { 1889 1947 set dpname [lindex $dep 2] 1890 darwinports::upgrade $dpname "port:$dpname" [array get variations][array get options]1948 darwinports::upgrade $dpname "port:$dpname" $globalvarlist $variationslist [array get options] 1891 1949 } 1892 1950 } 1893 1951 }