Stata The Stata listserver
[Date Prev][Date Next][Thread Prev][Thread Next][Date index][Thread index]

RE: ADO request: -ssc update-


From   "Nick Cox" <n.j.cox@durham.ac.uk>
To   <statalist@hsphsun2.harvard.edu>
Subject   RE: ADO request: -ssc update-
Date   Fri, 19 Nov 2004 11:52:06 -0000

I just think one risk should be flagged. 

This arises from Joseph's code which 
automatically -replace-s previously 
installed packages. Naturally, this is 
the main point of his program, 

BUT 

installing everything willy-nilly could, 
in extremis, overwrite your own programs,
or any other user-written programs, of 
the same name as those on SSC. 

If you follow StataCorp 
advice and place them in PERSONAL not 
PLUS (see results of -adopath-), this won't 
happen, but it's not guaranteed otherwise. 

Note also that a package with a given name 
can include several programs with quite 
different names. 

Naturally, this is also true of -ssc- used
by itself, as you can 

. ssc inst foo, replace 

and then find that your own -foo- (or -bar-) has 
been zapped if you put it in the wrong place. 
But it's the difference between 
a shotgun and a revolver fired randomly. 

Nick 
n.j.cox@durham.ac.uk 

Joseph Coveney
 
> Fredrik Wallenberg wrote:
> 
> Would it be possible to write a package that could check for updates
> of my installed ado files (the ones installed from ssc). I'm sure I'm
> not the only one that simply types -update all- every now and then and
> would love to do the same from user created packages.
> 
> --------------------------------------------------------------
> --------------
> 
> I've got the following do-file for this in my Stata 
> directory, and a pointer
> to it tied to a function button in my profile.ado file.  I'm 
> not sure why I
> didn't make it an ado-file and place it in my personal ado 
> directory.  In
> too much of a hurry, I guess.
> 
> I believe that, even if a lot of people run it often, it 
> wouldn't put an
> undue load on the SSC server . . .
> 
> Joseph Coveney
> 
> ---------updater.do---------
> clear
> set more off
> quietly ssc whatsnew
> insheet using ssc_results.smcl
> drop if substr(v1, 1, 1) == "{"
> split v1, generate(stub) parse(":")
> drop if substr(stub3, -1, 1) != "}"
> replace stub3 = lower(subinstr(stub3, "}", "", .))
> levels stub3
> foreach package in `r(levels)' {
>     capture noisily ssc install `package'.pkg
>     if _rc == 602 {
>         capture noisily ssc install `package'.pkg, replace
>     }
> }
> clear
> erase ssc_results.smcl
> exit
> -------------------------
> 
> profile.ado has the following lines in it:
> 
> global F4 "update query;"
> global F5 "ssc whatsnew;"
> global F6 "myfindit "
> global F7 "do C:\Progra~1\Stata\updater;"
> 
> In case you're curious, myfindit.ado is in the personal 
> directory.  It's
> just a wrapper to perform -findit- like I want it done:
> 
> ------------myfindit.ado----------------
> program define myfindit
>     version 8.1
>     syntax anything
>     set more off
>     findit_7 "`anything'", noview
>     set more on
> end
> ----------------------------------------
> 
> 
> 
> 
> 
> *
> *   For searches and help try:
> *   http://www.stata.com/support/faqs/res/findit.html
> *   http://www.stata.com/support/statalist/faq
> *   http://www.ats.ucla.edu/stat/stata/
> 

*
*   For searches and help try:
*   http://www.stata.com/support/faqs/res/findit.html
*   http://www.stata.com/support/statalist/faq
*   http://www.ats.ucla.edu/stat/stata/



© Copyright 1996–2014 StataCorp LP   |   Terms of use   |   Privacy   |   Contact us   |   What's new   |   Site index