Hello fellow developers,

I have a problem with repoman. I keep breaking the dependency tree. Jabub 
knows what I'm talking about. Latest examples are bugs #196470, #196472 and 
#196474. On a side note I actually don't want to break the dependency tree...

Attached are the scripts I use to commit packages stable/unstable. Somewhere 
must be a bug!

'name_split.cpp' splits a package name like sys-devel/gcc-4.1.2 into category, 
package name and version number. It's done in c++ as that's the only language 
I do more with than 'hello world' programms. Not much more, just more. ;-)

'mp.sh' is the script which calls name_split, repoman etc. It's pretty 
straight forward and only does the things I would also do by hand.

So if I want to mark for example sys-devel/gcc-4.1.2 stable on ppc64 I call 
mp.sh like this: mp.sh ppc64 sys-devel/gcc-4.1.2 "Stable on ppc64"

If someone has a hint where the problem is, I would really appreciate that.

Best regards,

-markus

P.S.: yes, I do 'cvs up' on the whole tree, before starting a commit.

Attachment: mp.sh
Description: application/shellscript

#include <iostream>
#include <string>

using namespace std;

class splitted_names
{
    public:
        splitted_names(string name);
        string get_category() {return category;}
        string get_package() {return package;}
        string get_version() {return version;}
    private:
        string category,
               package,
               version;
};

int main(int argc, char* argv[])
{
    if (argc != 3 || argv[1] == "-h")
    {
        cout << "Useage: " << argv[0]
	    << " -[cpv] category/package-version" << endl
            << "Options:" << endl
            << "    -c : print the category" << endl
            << "    -p : print the package name" << endl
            << "    -v : print the package version" << endl
            << "    -h : print this help" << endl
            << "NOTE: Only one of -c, -p, -v is allowed" << endl;
        return EXIT_FAILURE;
    }

    splitted_names the_string((string)argv[2]);

    string option = (string)argv[1];

    if (option == "-c")
    {
        cout << the_string.get_category() << endl;
    }
    else if (option == "-p")
    {
        cout << the_string.get_package() << endl;
    }
    else if (option == "-v")
    {
        cout << the_string.get_version() << endl;
    }

    return EXIT_SUCCESS;
}

splitted_names::splitted_names (string name)
{
    category = "";
    package = "";
    version = "";
    int start_copy = 0,
        stop_copy = 0;

    // do not copy a leading '='
    if (name[0] == '=')
    {
        start_copy = 1;
    }
    stop_copy = name.find('/');
    category.assign(name, start_copy, stop_copy-start_copy);

    if (name.length() > stop_copy)
    {
        start_copy = stop_copy+1;
    }
    for (int i = start_copy; i < name.length(); i++)
    {
        if (name.at(i) == '-')
        {
            if (name.at(i+1) == '0'
                    || name.at(i+1) == '1'
                    || name.at(i+1) == '2'
                    || name.at(i+1) == '3'
                    || name.at(i+1) == '4'
                    || name.at(i+1) == '5'
                    || name.at(i+1) == '6'
                    || name.at(i+1) == '7'
                    || name.at(i+1) == '8'
                    || name.at(i+1) == '9' )
            {
                stop_copy = i-1;
                break;
            }
        }
    }
    package.assign(name, start_copy, stop_copy-start_copy+1);

    
    if (name.length() > stop_copy)
    {
        start_copy = stop_copy+2;
    }
    stop_copy = name.length();
    version.assign(name, start_copy, stop_copy-start_copy);
}

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to