VirtualBox

Changeset 39180 in vbox


Ignore:
Timestamp:
Nov 2, 2011 8:59:30 PM (13 years ago)
Author:
vboxsync
svn:sync-xref-src-repo-rev:
74659
Message:

ExtPack: Adding a 'edition' attribute to the Version tag and cleaning up the version string validation confusion. Currently hacking the edition into the version property of IExtPack, adding a property later.

Location:
trunk/src/VBox/Main
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/include/ExtPackUtil.h

    r37843 r39180  
    9090    /** The version string. */
    9191    RTCString               strVersion;
     92    /** The edition string. */
     93    RTCString               strEdition;
    9294    /** The internal revision number. */
    9395    uint32_t                uRevision;
     
    120122RTCString   *VBoxExtPackUnmangleName(const char *pszMangledName, size_t cbMax);
    121123int                 VBoxExtPackCalcDir(char *pszExtPackDir, size_t cbExtPackDir, const char *pszParentDir, const char *pszName);
    122 bool                VBoxExtPackIsValidVersionString(const char *pszName);
     124bool                VBoxExtPackIsValidVersionString(const char *pszVersion);
     125bool                VBoxExtPackIsValidEditionString(const char *pszEdition);
    123126bool                VBoxExtPackIsValidModuleString(const char *pszModule);
    124127
  • trunk/src/VBox/Main/src-all/ExtPackManagerImpl.cpp

    r37843 r39180  
    390390    if (SUCCEEDED(hrc))
    391391    {
    392         Bstr str(m->Desc.strVersion);
    393         str.cloneTo(a_pbstrVersion);
     392        /* HACK ALERT: This is for easing backporting to 4.1. The edition stuff
     393           will be changed into a separate */
     394        if (m->Desc.strEdition.isEmpty())
     395        {
     396            Bstr str(m->Desc.strVersion);
     397            str.cloneTo(a_pbstrVersion);
     398        }
     399        else
     400        {
     401            RTCString strHack(m->Desc.strVersion);
     402            strHack.append('-');
     403            strHack.append(m->Desc.strEdition);
     404
     405            Bstr str(strHack);
     406            str.cloneTo(a_pbstrVersion);
     407        }
    394408    }
    395409    return hrc;
     
    16101624    if (SUCCEEDED(hrc))
    16111625    {
    1612         Bstr str(m->Desc.strVersion);
    1613         str.cloneTo(a_pbstrVersion);
     1626        /* HACK ALERT: This is for easing backporting to 4.1. The edition stuff
     1627           will be changed into a separate */
     1628        if (m->Desc.strEdition.isEmpty())
     1629        {
     1630            Bstr str(m->Desc.strVersion);
     1631            str.cloneTo(a_pbstrVersion);
     1632        }
     1633        else
     1634        {
     1635            RTCString strHack(m->Desc.strVersion);
     1636            strHack.append('-');
     1637            strHack.append(m->Desc.strEdition);
     1638
     1639            Bstr str(strHack);
     1640            str.cloneTo(a_pbstrVersion);
     1641        }
    16141642    }
    16151643    return hrc;
     
    30523080        {
    30533081            if (pExtPackData->fUsable)
    3054                 LogRel(("  %s (Version: %s r%u; VRDE Module: %s)\n",
     3082                LogRel(("  %s (Version: %s r%u%s%s; VRDE Module: %s)\n",
    30553083                        pExtPackData->Desc.strName.c_str(),
    30563084                        pExtPackData->Desc.strVersion.c_str(),
    30573085                        pExtPackData->Desc.uRevision,
     3086                        pExtPackData->Desc.strEdition.isEmpty() ? "" : " ",
     3087                        pExtPackData->Desc.strEdition.c_str(),
    30583088                        pExtPackData->Desc.strVrdeModule.c_str() ));
    30593089            else
    3060                 LogRel(("  %s (Version: %s r%u; VRDE Module: %s unusable because of '%s')\n",
     3090                LogRel(("  %s (Version: %s r%u%s%s; VRDE Module: %s unusable because of '%s')\n",
    30613091                        pExtPackData->Desc.strName.c_str(),
    30623092                        pExtPackData->Desc.strVersion.c_str(),
    30633093                        pExtPackData->Desc.uRevision,
     3094                        pExtPackData->Desc.strEdition.isEmpty() ? "" : " ",
     3095                        pExtPackData->Desc.strEdition.c_str(),
    30643096                        pExtPackData->Desc.strVrdeModule.c_str(),
    30653097                        pExtPackData->strWhyUnusable.c_str() ));
  • trunk/src/VBox/Main/src-all/ExtPackUtil.cpp

    r39172 r39180  
    55
    66/*
    7  * Copyright (C) 2010 Oracle Corporation
     7 * Copyright (C) 2010-2011 Oracle Corporation
    88 *
    99 * This file is part of VirtualBox Open Source Edition (OSE), as
     
    7070    a_pExtPackDesc->strDescription.setNull();
    7171    a_pExtPackDesc->strVersion.setNull();
     72    a_pExtPackDesc->strEdition.setNull();
    7273    a_pExtPackDesc->uRevision = 0;
    7374    a_pExtPackDesc->strMainModule.setNull();
     
    146147        uRevision = 0;
    147148
     149    const char *pszEdition;
     150    if (!pVersionElm->getAttributeValue("edition", pszEdition))
     151        pszEdition = "";
     152    if (!VBoxExtPackIsValidEditionString(pszEdition))
     153        return &(new RTCString("Invalid edition string: "))->append(pszEdition);
     154
    148155    const xml::ElementNode *pMainModuleElm = pVBoxExtPackElm->findChildElement("MainModule");
    149156    if (!pMainModuleElm)
     
    194201    a_pExtPackDesc->strDescription  = pszDesc;
    195202    a_pExtPackDesc->strVersion      = pszVersion;
     203    a_pExtPackDesc->strEdition      = pszEdition;
    196204    a_pExtPackDesc->uRevision       = uRevision;
    197205    a_pExtPackDesc->strMainModule   = pszMainModule;
     
    350358    a_pExtPackDesc->strDescription.setNull();
    351359    a_pExtPackDesc->strVersion.setNull();
     360    a_pExtPackDesc->strEdition.setNull();
    352361    a_pExtPackDesc->uRevision = 0;
    353362    a_pExtPackDesc->strMainModule.setNull();
     
    573582    if (*pszVersion == '-' || *pszVersion == '_')
    574583    {
     584        /** @todo Should probably restrict this to known build types (alpha,
     585         *        beta, rc, ++). */
    575586        do
    576587            pszVersion++;
     
    581592    }
    582593
    583     /* revision or nothing */
    584     if (*pszVersion != '\0')
    585     {
    586         if (*pszVersion != 'r')
     594    return *pszVersion == '\0';
     595}
     596
     597/**
     598 * Validates the extension pack edition string.
     599 *
     600 * @returns true if valid, false if not.
     601 * @param   pszEdition          The edition string to validate.
     602 */
     603bool VBoxExtPackIsValidEditionString(const char *pszEdition)
     604{
     605    if (*pszEdition)
     606    {
     607        if (!RT_C_IS_UPPER(*pszEdition))
    587608            return false;
     609
    588610        do
    589             pszVersion++;
    590         while (RT_C_IS_DIGIT(*pszVersion));
    591     }
    592 
    593     /* upper case string indicating the edition */
    594     if (*pszVersion == '-')
    595     {
    596         do
    597             pszVersion++;
    598         while (RT_C_IS_UPPER(*pszVersion));
    599     }
    600 
    601     return *pszVersion == '\0';
     611            pszEdition++;
     612        while (   RT_C_IS_UPPER(*pszEdition)
     613               || RT_C_IS_DIGIT(*pszEdition)
     614               || *pszEdition == '-'
     615               || *pszEdition == '_');
     616    }
     617    return *pszEdition == '\0';
    602618}
    603619
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette