Portfiles based off of Subversion trunk?

Jon Hermansen jon.hermansen at gmail.com
Thu Feb 3 06:50:42 PST 2011


Even though I'm sure I probably shouldn't do this, I did figure out how:

svn.revision        [exec svn info https://svn.example.com/foo/bar/baz |
> perl -n -e "if ( /^Last Changed Rev: (\\d+)$/ ) { print \$1 };"]


Rainer, I'm not sure I understand your explanation completely. If I:

   1. portindex
   2. increment the revision of the project's directory
   3. port install portname

and then run 'port info --version portname' will I see the revision my
Portfile gave when I ran 'portindex' originally?

Even with that discrepancy, I think I can work around it by determining if
we're running 'portindex' or 'port livecheck', etc. and do the right thing
instead of always overriding svn.revision based on what my Subversion server
says. Of course, this will probably mean I'll have to do some bookkeeping,
store data into a local file, or something to that effect - which I'm
perfectly fine with.

Criticism/comments welcome.

On Thu, Jan 13, 2011 at 11:14 AM, Jon Hermansen <jon.hermansen at gmail.com>wrote:

> Hey Rainer,
>  Yep, that's how I figured it'd work. I may end up using $Rev$ in the
> Portfile, since my ports are now in our Subversion repository and that is a
> relatively easy way to track when they change.
>
> Thanks for the help!
>
>
> On Thu, Jan 13, 2011 at 9:41 AM, Rainer Müller <raimue at macports.org>wrote:
>
>> Hello Jon,
>>
>> On 2011-01-13 09:33 , Jon Hermansen wrote:
>> > I'm writing some Portfiles as an experiment for some tools I use at
>> > work. We keep these packages in Subversion and I am currently using
>> > 'fetch.type svn' to pull the sources. Is there a way that I can specify
>> > that my packages' version numbers are based on the checked out revision?
>> > Does TCL have backticks or something similar, and could I use that to
>> > pull this data in?
>>
>> Usually Portfiles are supposed to generate reproducible results, which
>> means that they are currently not meant to track a HEAD revision.
>>
>> At the moment, the version is set at the time of parsing the Portfile.
>> As this happens before the fetch, the svn revision number is not yet
>> available.
>>
>> But even if we store the real version number based on the svn revision
>> in the registry it wouldn't work. With portdbformat sqlite in
>> registry2.0, Portfiles are stored in the registry to support
>> activate/deactivate hooks. The version number would need to be updated
>> inside the Portfile to work correctly.
>>
>> I would recommend to manually update the Portfile to the current HEAD
>> revision or use a sed script to automate the task.
>>
>> Use something like this:
>>
>>  svn.revision 123
>>  version ${svn.revision}
>>
>> HTH,
>> Rainer
>>
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macosforge.org/pipermail/macports-users/attachments/20110203/14213753/attachment.html>


More information about the macports-users mailing list