Page MenuHomeFreeBSD

Mk/Uses/cran.mk: default WWW to the canonical CRAN package URL
ClosedPublic

Authored by dteske on Mon, Sep 14, 10:47 PM.
Tags
None
Referenced Files
F172506512: D59678.id186731.diff
Fri, Sep 18, 10:26 PM
F172475297: D59678.diff
Fri, Sep 18, 5:53 PM
F172469615: D59678.diff
Fri, Sep 18, 4:52 PM
Unknown Object (File)
Wed, Sep 16, 12:36 PM
Unknown Object (File)
Tue, Sep 15, 6:03 PM
Unknown Object (File)
Tue, Sep 15, 11:05 AM
Unknown Object (File)
Tue, Sep 15, 6:42 AM
Unknown Object (File)
Tue, Sep 15, 6:42 AM
Subscribers
None

Details

Summary

The WWW of older R ports is https://cran.r-project.org/web/packages/${PORTNAME}
The WWW of newer R ports is https://cran.r-project.org/package=${PORTNAME}

There are currently 230 R-cran ports using the older URL and 168 using the
newer. R-cran does not recommend the older URL format. If it goes away, we’ll
have to update WWW on over 200 R-cran ports.

At present, there are 497 R-cran ports setting WWW and all but 99 use either
the old or new standard URL.

If cran.mk offered a default WWW then we could eliminate the need to maintain
WWW at the individual port level.

All R-cran ports that set a WWW location that is not on cran directly would
continue to do-so while the ones that could stand to inherit a sensible default
could be nimble enough to not have to worry about their old deprecated URL
format one day not working.

Diff Detail

Repository
R11 FreeBSD ports repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

dteske created this revision.

Sounds like a good idea! Could you do a sed through the ports tree to edit all affected ports automatically?
Approved for commit.

This revision is now accepted and ready to land.Tue, Sep 15, 10:28 AM
In D59678#1369836, @fuz wrote:

Sounds like a good idea! Could you do a sed through the ports tree to edit all affected ports automatically?
Approved for commit.

Re: sed

Sure.

It will be a rather large review (less than ideal), but at least a very boring review (ideal for the conditions)

In D59678#1369836, @fuz wrote:

Sounds like a good idea! Could you do a sed through the ports tree to edit all affected ports automatically?
Approved for commit.

Re: sed

Sure.

It will be a rather large review (less than ideal), but at least a very boring review (ideal for the conditions)

Here's the magic in-action:

Step 1:

find /usr/ports -mindepth 2 -maxdepth 2 -type d -name 'R-cran-*' | tee ~/proj.r

Step 2:

for dir in $( cat ~/proj.r ); do Makefile="$dir/Makefile"; [ -e "$Makefile" ] || continue; proj="${dir##*/}"; proj="${proj#R-cran-}"; awk -v proj="$proj" -v Makefile="$Makefile" -v WWW="$( awk '$1=="WWW="{print $2}' $Makefile )" 'BEGIN { sub("/$", "", WWW); print Makefile, ((WWW == "https://cran.r-project.org/web/packages/" proj) ? "old" : (WWW == "https://cran.r-project.org/package=" proj ? "new" : WWW " " proj)) }'; done | tee ~/proj.r.www

Step 3:

awk '$2=="old"{print $1}' ~/proj.r.www | xargs sed -i '' -e 's#https://cran.r-project.org/web/packages/\([^/]*\)/*#https://cran.r-project.org/package=\1#'

Step 4:

(same command as step 2 but write to ~/proj.r.www2 instead of ~/proj.r.www

for dir in $( cat ~/proj.r ); do Makefile="$dir/Makefile"; [ -e "$Makefile" ] || continue; proj="${dir##*/}"; proj="${proj#R-cran-}"; awk -v proj="$proj" -v Makefile="$Makefile" -v WWW="$( awk '$1=="WWW="{print $2}' $Makefile )" 'BEGIN { sub("/$", "", WWW); print Makefile, ((WWW == "https://cran.r-project.org/web/packages/" proj) ? "old" : (WWW == "https://cran.r-project.org/package=" proj ? "new" : WWW " " proj)) }'; done | tee ~/proj.r.www2

Step 5:

awk '$2=="old"{print $1}' ~/proj.r.www2

(no output ... means we got them all)

plus:

dteske@FreeBSD ports $ awk '$2=="old"{print $1}' ~/proj.r.www | wc -l
     228
dteske@FreeBSD ports $ awk '$2=="new"{print $1}' ~/proj.r.www | wc -l
     147
dteske@FreeBSD ports $ awk '$2=="new"{print $1}' ~/proj.r.www2 | wc -l
     375
dteske@FreeBSD ports $ [ $(( 228 + 147 )) -eq 375 ] && echo golden
golden

What was old is now new.

Step 6:

git diff | vim +/'^\(Index\|diff\|--\|@@\|====\).*' +'set hls' +'set syntax=diff' -R -

Confirmed to look good, ... so commit on branch and raise review.

git status | awk '$1=="modified:"{print $2}' | xargs git add
git commit
git arc create -r fuz,jrm HEAD

Review coming.