Wesley Shields wrote:

>> I'd like to finalize how it should look in +CONTENTS before I make this
>> change, but it will get done eventually.  :)
>>
>> One way I was exploring is adding
>>
>> @comment DISTFILE:$filename:$size:$md5:$sha256

I think that's good, the other information might come in handy down
the road. One thing you might want to consider is to put the md5 sum
at the end, since at some point down the road (maybe years from now,
but still ...) we're likely to drop md5 altogether.

>> into the generated plist.  This way we shouldn't have to change
>> pkg_create and only modify pkg_info and other tools.  I haven't tested
>> this fully but it was just a fairly easy and concise way that I believe
>> will work. By adding it to +CONTENTS using some type of @comment line we
>> can avoid changing pkg_create and make for easier adoption.  The only
>> changes that will need to be made will be to those programs which
>> process +CONTENTS directly, and even those modifications will be
>> minimal.

I think you're probably right about this, but I'd like to hear from
some people who are more knowledgeable about the port's internals than
I am first.

I should have spoken up earlier, but you have a couple of
inefficiencies and duplicated code that doesn't have to be there. Take
a look at the attached, which also implements the change I mentioned
above. Also, for something like this where you just need the Nth
element of a line that is in a standard format, cut(1) is a lot more
efficient than awk.

Doug

-- 

    This .signature sanitized for your protection

Index: bsd.port.mk
===================================================================
RCS file: /usr/local/ncvs/ports/Mk/bsd.port.mk,v
retrieving revision 1.544
diff -u -r1.544 bsd.port.mk
--- bsd.port.mk 30 Sep 2006 19:25:45 -0000      1.544
+++ bsd.port.mk 5 Dec 2006 21:39:26 -0000
@@ -5395,11 +5395,20 @@
 # files exist.
 
 .if !target(generate-plist)
+.if defined(DIST_SUBDIR)
+PDS=   "${DIST_SUBDIR}/"
+.endif
 generate-plist:
        @${ECHO_MSG} "===>   Generating temporary packing list"
        @${MKDIR} `${DIRNAME} ${TMPPLIST}`
        @if [ ! -f ${DESCR} ]; then ${ECHO_CMD} "** Missing pkg-descr for 
${PKGNAME}."; exit 1; fi
        @>${TMPPLIST}
+       @for file in ${DISTFILES} ${PATCHFILES}; do \
+               distsize=`${GREP} "^SIZE (${PDS}$$file)" ${MD5_FILE} | ${CUT} 
-f4 -d' '`; \
+               distsha256=`${GREP} "^SHA256 (${PDS}$$file)" ${MD5_FILE} | 
${CUT} -f4 -d' '`; \
+               distmd5=`${GREP} "^MD5 (${PDS}$$file)" ${MD5_FILE} | ${CUT} -f4 
-d' '`; \
+               ${ECHO_CMD} "@comment 
DISTFILE:${PDS}$${file}:$${distsize}:$${distsha256}:$${distmd5}" >> 
${TMPPLIST}; \
+       done
        @for file in ${PLIST_FILES}; do \
                ${ECHO_CMD} $${file} | ${SED} ${PLIST_SUB:S/$/!g/:S/^/ -e 
s!%%/:S/=/%%!/} >> ${TMPPLIST}; \
        done

Attachment: signature.asc
Description: OpenPGP digital signature

Reply via email to