pkgsrc-Bugs archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: pkg/34695



The following reply was made to PR pkg/34695; it has been noted by GNATS.

From: "Mike M. Volokhov" <mishka%netbsd.org@localhost>
To: gnats-bugs%NetBSD.org@localhost
Cc: 
Subject: Re: pkg/34695
Date: Thu, 5 Oct 2006 15:25:35 +0000

 The awk code used in origianl patch is somewhat NetBSD dependent - other
 awk implementations may missing some features, like systime(). So, taking
 Solaris' nawk as a lowest denominator, please use the patch below:
 
 
 Index: fetch.mk
 ===================================================================
 RCS file: /cvsroot/pkgsrc/mk/fetch/fetch.mk,v
 retrieving revision 1.20
 diff -u -r1.20 fetch.mk
 --- fetch.mk   27 Jul 2006 18:48:03 -0000      1.20
 +++ fetch.mk   5 Oct 2006 15:05:54 -0000
 @@ -30,10 +30,21 @@
  _BUILD_DEFS+= _DISTFILES _PATCHFILES
  
  # Set up _ORDERED_SITES to work out the exact list of sites for every file,
 -# using the dynamic sites script, or sorting according to the master site
 -# list or the patterns in MASTER_SORT or MASTER_SORT_REGEX as appropriate.
 +# using the dynamic sites script, or ordering according to the master site
 +# list, MASTER_SORT_RANDOM randomization feature, or the patterns in
 +# MASTER_SORT or MASTER_SORT_REGEX as appropriate.
  # No actual sorting is done until _ORDERED_SITES is expanded.
  #
 +.if defined(MASTER_SORT_RANDOM) && !empty(MASTER_SORT_RANDOM:M[yY][eE][sS])
 +_MASTER_RAND_AWK= BEGIN { srand(seed) } {                             \
 +              n = split($$0, site);                                   \
 +              for (i = n; i > 0; i--) {                               \
 +                      ir = int(rand() * i + 1);                       \
 +                      t = site[i]; site[i] = site[ir]; site[ir] = t;  \
 +                      print site[i]; } }
 +_RAND_SITES_CMD= | ${AWK} -v seed=$$$$ '${_MASTER_RAND_AWK}' | tee /tmp/sites
 +.endif
 +
  .if defined(MASTER_SORT) || defined(MASTER_SORT_REGEX)
  MASTER_SORT?=
  MASTER_SORT_REGEX?=
 @@ -44,9 +55,12 @@
  _MASTER_SORT_AWK+= /${srt:C/\//\\\//g}/ { good["${srt:S/\\/\\\\/g}"] = 
good["${srt:S/\\/\\\\/g}"] " " $$0 ; next; }
  .  endfor
  _MASTER_SORT_AWK+= { rest = rest " " $$0; } END { n=split(gl, gla); 
for(i=1;i<=n;i++) { print good[gla[i]]; } print rest; }
 +_SORT_SITES_CMD+= | ${AWK} '${_MASTER_SORT_AWK}'
 +.endif
  
 -_SORT_SITES_CMD= ${ECHO} $$unsorted_sites | ${AWK} '${_MASTER_SORT_AWK}'
 -_ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} 
`${_SORT_SITES_CMD:S/\\/\\\\/g:C/"/\"/g}`
 +.if defined(_RAND_SITES_CMD) || defined(_SORT_SITES_CMD)
 +_SORT_SITES_FULL_CMD= ${ECHO} $$unsorted_sites ${_RAND_SITES_CMD} 
${_SORT_SITES_CMD}
 +_ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} 
`${_SORT_SITES_FULL_CMD:S/\\/\\\\/g:C/"/\"/g}`
  .else
  _ORDERED_SITES= ${_MASTER_SITE_OVERRIDE} $$unsorted_sites
  .endif
 @@ -245,8 +259,8 @@
                fi;                                                     \
        done
        ${_PKG_SILENT}${_PKG_DEBUG}set -e;                              \
 -      unsorted_sites="${SITES.${.TARGET:T:S/=/--/}} ${_MASTER_SITE_BACKUP}"; \
 -      sites="${_ORDERED_SITES}";                                      \
 +      unsorted_sites="${SITES.${.TARGET:T:S/=/--/}}";                 \
 +      sites="${_ORDERED_SITES} ${_MASTER_SITE_BACKUP}";               \
        cd ${.TARGET:H:S/\/${DIST_SUBDIR}$//} &&                        \
        ${_FETCH_CMD} ${_FETCH_ARGS} ${.TARGET:T} $$sites
        ${_PKG_SILENT}${_PKG_DEBUG}                                     \
 
 
 The defaults/mk.conf patch still with no changes.
 
 --
 Mishka.
 
 P.S. Thanks to salo for warning me on this problem.
 



Home | Main Index | Thread Index | Old Index