Re: Couple of scripts to remove duplicate packages

2005-01-22 Thread Michael A Chase
On Thu, 20 Jan 2005 13:56:10 -0500, Christopher Faylor wrote:

 On Thu, Jan 20, 2005 at 08:48:11AM -0500, Jonathan Arnold wrote:
 Igor Pechtchanski wrote:

 That's a nice attempt.  However, I can see that you're not aware of
 Michael Chase's clean_setup.pl (which does that and much, much more).
 Google for it.

 It is here if you are interested:

 http://home.ix.netcom.com/~mchase/zip/
 
 Should this be a cygwin (or maybe a cygutuils) package?

I originally wrote it as a stop-gap until setup.exe provided a way to
remove obsolete packages.  The other options came from user suggestions.

You should have a release on file for me.  Anyone who wants to add the
script to a package is welcome to. The only dependency would be the main
Perl package.

-- 
Mac :})
** I usually forward private questions to the appropriate mail list. **
Ask Smarter: http://www.catb.org/~esr/faqs/smart-questions.html
Give a hobbit a fish and he eats fish for a day.
Give a hobbit a ring and he eats fish for an age.



--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Re: Couple of scripts to remove duplicate packages

2005-01-20 Thread Jonathan Arnold
Igor Pechtchanski wrote:
On Wed, 19 Jan 2005, Alex wrote:
Hi,
I have a habit of keeping cygwin packages on my computer and updating
them from time to time using setup.exe. This saves me time when I need
to install on another computer.
This creates a problem of old versions of packages accumulating in my
download directory. I used to remove them by hand but that is a time
consuming process. Finally I wrote an awk script to help me deal with
the problem. And just for kicks I added a shell wrapper :).
Attached are the scripts. I hope they could be useful to someone else.
I am sure they can be improved but they have been useful to me as is.
That's a nice attempt.  However, I can see that you're not aware of
Michael Chase's clean_setup.pl (which does that and much, much more).
Google for it.
It is here if you are interested:
http://home.ix.netcom.com/~mchase/zip/
--
Jonathan Arnold (mailto:[EMAIL PROTECTED])
Amazing Developments   http://www.buddydog.org
I feel like a fugitive from the law of averages. -
 William H. Mauldin
--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/


Re: Couple of scripts to remove duplicate packages

2005-01-20 Thread Christopher Faylor
On Thu, Jan 20, 2005 at 08:48:11AM -0500, Jonathan Arnold wrote:
Igor Pechtchanski wrote:
On Wed, 19 Jan 2005, Alex wrote:

Hi,
I have a habit of keeping cygwin packages on my computer and updating
them from time to time using setup.exe. This saves me time when I need
to install on another computer.
This creates a problem of old versions of packages accumulating in my
download directory. I used to remove them by hand but that is a time
consuming process. Finally I wrote an awk script to help me deal with
the problem. And just for kicks I added a shell wrapper :).

Attached are the scripts. I hope they could be useful to someone else.
I am sure they can be improved but they have been useful to me as is.

That's a nice attempt.  However, I can see that you're not aware of
Michael Chase's clean_setup.pl (which does that and much, much more).
Google for it.

It is here if you are interested:

http://home.ix.netcom.com/~mchase/zip/

Should this be a cygwin (or maybe a cygutuils) package?

cgf

--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/



Couple of scripts to remove duplicate packages

2005-01-19 Thread Alex
Hi,
I have a habit of keeping cygwin packages on my computer and updating 
them from time to time using setup.exe. This saves me time when I need 
to install on another computer.
This creates a problem of old versions of packages accumulating in my 
download directory. I used to remove them by hand but that is a time 
consuming process. Finally I wrote an awk script to help me deal with 
the problem. And just for kicks I added a shell wrapper :).

Attached are the scripts. I hope they could be useful to someone else.
I am sure they can be improved but they have been useful to me as is.
Thanks,
Alex
#! /bin/awk
BEGIN { \
  last_pkg = ;
  last_date = 0;
  last_dir = ;
  last_pkg_name = ;
  cmd = find release -type f -printf '%h %f %TY%Tm%Td\n';
  while(( cmd | getline )  0)
{ 
  dir = $1;
  pkg = $2;
  date = $3;
  count = split(dir, part, /);
  if( last_pkg_name == part[count] ){
if( date  last_date ){
  print dir / pkg;
  continue;
}else{
  print last_dir / last_pkg;
}
  }
  last_pkg = pkg;
  last_date = date;
  last_dir = dir;
  last_pkg_name = part[count];
}
  close(cmd);
}
#! /bin/bash
# Version of cyg-remove-dups in bash, just for kicks. Still uses awk and find
# awk is used in a normal way. Trick is to pass program to it with the data
# on stdin.
find release -type f -printf %h %f %TY%Tm%Td\n  | \
awk -- '
BEGIN { \
  last_pkg = ;
  last_date = 0; 
  last_dir = ;
  last_pkg_name = ; 
}
{
  dir = $1;
  pkg = $2;
  date = $3;
  count = split(dir, part, /);
  if( last_pkg_name == part[count] ){
if( date  last_date ){
   print dir / pkg;
   next;
}else{
print last_dir / last_pkg;
}
  }
  last_pkg = pkg;
  last_date = date;
  last_dir = dir;
  last_pkg_name = part[count];
}
'
--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/

Re: Couple of scripts to remove duplicate packages

2005-01-19 Thread Igor Pechtchanski
On Wed, 19 Jan 2005, Alex wrote:
Hi,
I have a habit of keeping cygwin packages on my computer and updating
them from time to time using setup.exe. This saves me time when I need
to install on another computer.
This creates a problem of old versions of packages accumulating in my
download directory. I used to remove them by hand but that is a time
consuming process. Finally I wrote an awk script to help me deal with
the problem. And just for kicks I added a shell wrapper :).
Attached are the scripts. I hope they could be useful to someone else.
I am sure they can be improved but they have been useful to me as is.
That's a nice attempt.  However, I can see that you're not aware of
Michael Chase's clean_setup.pl (which does that and much, much more).
Google for it.
HTH,
Igor
--
http://cs.nyu.edu/~pechtcha/
 |\  _,,,---,,_ [EMAIL PROTECTED]
ZZZzz /,`.-'`'-.  ;-;;,_[EMAIL PROTECTED]
|,4-  ) )-,_. ,\ (  `'-'Igor Pechtchanski, Ph.D.
   '---''(_/--'  `-'\_) fL  a.k.a JaguaR-R-R-r-r-r-.-.-.  Meow!
The Sun will pass between the Earth and the Moon tonight for a total
Lunar eclipse... -- WCBS Radio Newsbrief, Oct 27 2004, 12:01 pm EDT
--
Unsubscribe info:  http://cygwin.com/ml/#unsubscribe-simple
Problem reports:   http://cygwin.com/problems.html
Documentation: http://cygwin.com/docs.html
FAQ:   http://cygwin.com/faq/