Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 2bc2f49507
Fetching contributors…

Cannot retrieve contributors at this time

executable file 88 lines (70 sloc) 2.168 kb
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88
#! /bin/bash

if [ -z $1 ] ; then
    echo "Removes a PEAR package from svn.php.net."
    echo ""
    echo "Usage: ./3-svn-remove.sh package"
    echo ""
    echo " package: the PEAR package name"
    echo ""
    exit 1
fi

package=$1
svn_repo=https://svn.php.net/repository/pear/packages

# Don't touch this variable!
pear_package_repo=https://svn.php.net/repository/pear/packages


# Quietly check: are the dependencies installed?

tmp=`svn --version`
if [ $? -ne 0 ] ; then
    echo "ERROR: svn must be installed and in your PATH."
    exit 1
fi


svn rm $svn_repo/$package \
    -m "$package moved to https://github.com/pear/$package"
if [ $? -ne 0 ] ; then
    echo "ERROR: could not remove $package from svn.php.net."
    exit 1
fi


if [ $svn_repo = $pear_package_repo ] ; then
    if [ -d packages-all ] ; then
        svn up packages-all --depth empty
    else
        svn checkout https://svn.php.net/repository/pear/packages-all --depth empty
    fi
    if [ $? -ne 0 ] ; then
        echo "ERROR: could not checkout package-all."
        exit 1
    fi

    svn propget svn:externals packages-all > propget.txt
    if [ $? -ne 0 ] ; then
        echo "ERROR: could not get properties of package-all."
        rm -f propget.txt
        exit 1
    fi

    sed "/$package$/d" propget.txt > propset.txt
    if [ $? -ne 0 ] ; then
        echo "ERROR: could not modify propget.txt."
        rm -f propget.txt propset.txt
        exit 1
    fi

    svn propset svn:externals packages-all -F propset.txt
    if [ $? -ne 0 ] ; then
        echo ""
        echo "ERROR: could not set properties of package-all."
        echo "Examine the propget.txt file, then run:"
        echo "svn propset svn:externals packages-all -F propset.txt"
        echo ""
        rm -f propget.txt
        exit 1
    fi

    rm -f propget.txt propset.txt

    svn commit -m "$package moved to https://github.com/pear/$package" packages-all
    if [ $? -ne 0 ] ; then
        echo "ERROR: could not commit package-all."
        exit 1
    fi
fi


# Voila!

echo ""
echo "------ PEAR MIGRATION RESULT ------"
echo "Congratulations! The package migration process is complete."
echo ""
Something went wrong with that request. Please try again.