Is there a script to remove old packages from local disk

2009-06-16 Thread Keith Christian
Has anyone written a script that will remove older .bz2 files in the
release/ directory on local drives, e.g.

release/bash/bash-3.2.25-17.tar.bz2
release/bash/bash-3.2.33-18.tar.bz2
release/bash/bash-3.2.39-19.tar.bz2
release/bash/bash-3.2.39-20.tar.bz2
release/bash/bash-3.2.48-21.tar.bz2

Perhaps delete:

bash-3.2.25-17
bash-3.2.33-18
bash-3.2.39-19

and keeping the two most recent updates.

Thanks in advance.

===Keith

--
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: Is there a script to remove old packages from local disk

2009-06-16 Thread Christopher Faylor
On Tue, Jun 16, 2009 at 12:59:19PM -0600, Keith Christian wrote:
>Has anyone written a script that will remove older .bz2 files in the
>release/ directory on local drives, e.g.
>
>   release/bash/bash-3.2.25-17.tar.bz2
>   release/bash/bash-3.2.33-18.tar.bz2
>   release/bash/bash-3.2.39-19.tar.bz2
>   release/bash/bash-3.2.39-20.tar.bz2
>   release/bash/bash-3.2.48-21.tar.bz2
>
>Perhaps delete:
>
>   bash-3.2.25-17
>   bash-3.2.33-18
>   bash-3.2.39-19
>
>and keeping the two most recent updates.

You can just rm -r all of the directories that setup creates when
installing packages.  There is no reason to keep any of them around.

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/



Re: Is there a script to remove old packages from local disk

2009-06-16 Thread Ralph Hempel

Christopher Faylor wrote:


You can just rm -r all of the directories that setup creates when
installing packages.  There is no reason to keep any of them around.


I think he's talking about the old versions of the .bz2 files that live
in the local download folders.

I may have a similar usage pattern in that I have a folder on my USB
key that has all the packages, and when I get to a client machine that
has no Cygwin and they let me install it, I just install from my local
copy - no Internet, no problem.

But those folders do fill up with old cruft after a while.



Wouldn't it be nice if setup knew enough to remove the bz2 files for
packages that were no longer current?



Ralph



--
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: Is there a script to remove old packages from local disk

2009-06-16 Thread Charles Wilson
There used to be a script by Michael Chase called "clean_setup.pl" but
it has disappeared from the web. I have discovered a truly marvelous
copy of it, which the margin of this email is too narrow to contain.

Just kidding -- it's attached. I haven't used it in several years, so
YMMV.

--
Chuck


clean_setup.tar.bz2
Description: Binary data
--
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: Is there a script to remove old packages from local disk

2009-06-16 Thread Christopher Faylor
On Tue, Jun 16, 2009 at 06:16:17PM -0400, Ralph Hempel wrote:
>Christopher Faylor wrote:
>>You can just rm -r all of the directories that setup creates when
>>installing packages.  There is no reason to keep any of them around.
>
>I think he's talking about the old versions of the .bz2 files that live
>in the local download folders.

So am I.

>I may have a similar usage pattern in that I have a folder on my USB
>key that has all the packages, and when I get to a client machine that
>has no Cygwin and they let me install it, I just install from my local
>copy - no Internet, no problem.
>
>But those folders do fill up with old cruft after a while.

But you wouldn't want to keep different versions of bz2 files around in
that case.

>
>
>Wouldn't it be nice if setup knew enough to remove the bz2 files for
>packages that were no longer current?
>
>

No need to duck.  I think setup really should just delete the files
when it is done with them if you choose "install from internet".

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/



Re: Is there a script to remove old packages from local disk

2009-06-16 Thread Ralph Hempel

Christopher Faylor wrote:


But those folders do fill up with old cruft after a while.


But you wouldn't want to keep different versions of bz2 files around in
that case.


Right. But I do want to keep only the most current versions.

Not to belabour the point, but if you do a "Download to local directory"
and then do "Install from local directory" like I do, after a few
months your local directory has _many_ incremental versions of the
download files.




Wouldn't it be nice if setup knew enough to remove the bz2 files for
packages that were no longer current?




No need to duck.  I think setup really should just delete the files
when it is done with them if you choose "install from internet".


Should it keep only the current .bz2 files if you _download_ from
the Internet?

That way we can always carry around a minimal sized USB stick from
which we can do an "Install from local directory" for those times
when you don't have access to the Internet but you have to install
Cygwin on a client or friends machine...

Ralph


--
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: Is there a script to remove old packages from local disk

2009-06-16 Thread Christopher Faylor
On Tue, Jun 16, 2009 at 11:01:15PM -0400, Ralph Hempel wrote:
>Christopher Faylor wrote:
>>>But those folders do fill up with old cruft after a while.
>>But you wouldn't want to keep different versions of bz2 files around in
>>that case.
>
>Right.  But I do want to keep only the most current versions.

You may, but the OP said:

"Perhaps delete:

bash-3.2.25-17
bash-3.2.33-18
bash-3.2.39-19

and keeping the two most recent updates."

>Not to belabour the point, but if you do a "Download to local
>directory" and then do "Install from local directory" like I do, after
>a few months your local directory has _many_ incremental versions of
>the download files.

Then you get what you paid for.

>>> 
>>>
>>> Wouldn't it be nice if setup knew enough to remove the bz2 files for
>>> packages that were no longer current?
>>>
>>> 
>> 
>> No need to duck.  I think setup really should just delete the files
>> when it is done with them if you choose "install from internet".
>
>Should it keep only the current .bz2 files if you _download_ from
>the Internet?

That's what I meant, yes.  I think many people don't understand that
those files don't need to be there and since we advocate using
just the straight install from internet, we probably should be nice
and delete the files.

It is also a lot easier to delete files than it is to have setup.exe
iterate over an old directory structure looking for files that could
be arbitrarily called out-of-date.

I really think that if you want to cleanup your download directory
other than that you should use a tool to do it.

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/



Re: Is there a script to remove old packages from local disk

2009-06-16 Thread David Arnstein
On Wed, Jun 17, 2009 at 12:50:34AM -0400, Christopher Faylor wrote:
> That's what I meant, yes.  I think many people don't understand that
> those files don't need to be there and since we advocate using
> just the straight install from internet, we probably should be nice
> and delete the files.

I hope that you make this proposed behavior optional.

The way I use the setup program is to "install from the internet" onto
peecee A. Then I "install from local directory" on peecee B. In the
second step, I use the download area of peecee A as the "local directory."

I find this method to be attractive. My access to the mirrors is often
slow. On bad days, the mirror I use will time out, which is inconvenient.
For these reasons, I appreciate that it is currently only necessary to
putz with the mirrors once, and still update two (or more) peecees.

--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Fergus

Assume your local Cygwin repository is under some /pathname/ for example:
/g/users/yourname/cygfiles/setup.ini AND 
/g/users/yourname/cygfiles/release/*

or you can have spaces if you like:
/h/my name/cygnus solutions/setup.ini AND /h/my name/cygnus 
solutions/release/*


As setup.ini advances with time and you augment the subdirectory 
release/, it becomes bloated with more and more redundant files. It can 
be cleaned out using the following script with the syntax


clean /pathname/

for example

clean /g/users/yourname/cygfiles/ # note leading and trailing /s
or
clean /h/my\ name/cygnus\ solutions/  # note handling of spaces achieved 
eg by Tab-completion


(By the way: the reason the script looks so horrible is entirely because 
it is constructed to cope with the possibility of spaces in the 
repository pathname. If there were guaranteed no spaces, the 
line-by-line syntax would be much easier. But the job the script does is 
very simple.)


This is the script:

#! /bin/sh
#  clean
cat "$1setup.ini" | sed -n '/release\//p' | sed 's/^.*release\///g' |\
sed 's/\( [a-f0-9]*\)*$//g' | sort | uniq> setup.1
find "$1release/" -type f | sed -e 's/^.*release\///g' | sort> setup.2
diff setup.1 setup.2 | grep ">"  > setup.3
cat setup.3 | sed -e 's:> :rm -vfr "'"$1"'release\/:g ; s/$/"/g' | bash

If you are nervous about what you might delete you can replace the last 
line with


cat setup.3 | sed -e 's:> :rm -vfr "'"$1"'release\/:g ; s/$/"/g' > setup.4

and then

bash setup.4

when you are happy with what the script does.

Key:
setup.1 lists all the release files referred to in setup.ini, including 
[prev] and *src*

setup.2 lists all the release files in your repository /pathname/
setup.3 identifies those files in your repository not referred to in 
setup.ini

setup.4 is the script that deletes all these unnecessary files

Fergus


--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Ralph Hempel

Christopher Faylor wrote:


That's what I meant, yes.  I think many people don't understand that
those files don't need to be there and since we advocate using
just the straight install from internet, we probably should be nice
and delete the files.


Whenever the next round of changes to setup happens, and the talk gets
around to "Removing the Download to Local Directory" or "Should we
Delete the Downloaded Files", please consider saying "No" to both
proposals. :-)


I really think that if you want to cleanup your download directory
other than that you should use a tool to do it.


Agreed. Nuff said.

Ralph

--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Dave Korn
Christopher Faylor wrote:
> On Tue, Jun 16, 2009 at 06:16:17PM -0400, Ralph Hempel wrote:
>> Christopher Faylor wrote:

>> 
>>
>> Wouldn't it be nice if setup knew enough to remove the bz2 files for
>> packages that were no longer current?
>>
>> 
> 
> No need to duck.  I think setup really should just delete the files
> when it is done with them if you choose "install from internet".

  Keeping the accumulated older versions cached in the local package dir has
saved my skin and/or been a handy source of historical reference material on
numerous occasions.  So if we're going to add a "tidy up local package dir"
behaviour, I reckon it should be governed by another check-box on the final
page, alongside the "create menu item" and "create shortcut" boxes.

cheers,
  DaveK


--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Christopher Faylor
On Wed, Jun 17, 2009 at 08:39:05AM -0400, Ralph Hempel wrote:
>Christopher Faylor wrote:
>>That's what I meant, yes.  I think many people don't understand that
>>those files don't need to be there and since we advocate using just the
>>straight install from internet, we probably should be nice and delete
>>the files.
>
>Whenever the next round of changes to setup happens, and the talk gets
>around to "Removing the Download to Local Directory" or "Should we
>Delete the Downloaded Files", please consider saying "No" to both
>proposals.  :-)

Why do you expand this to mean something that I never implied?  I never
said that we should remove "Download to Local Directory".

But regardless, maybe a tool is all that is really needed here.

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/



Re: Is there a script to remove old packages from local disk

2009-06-17 Thread Christopher Faylor
On Wed, Jun 17, 2009 at 01:54:07PM +0100, Dave Korn wrote:
>Christopher Faylor wrote:
>>On Tue, Jun 16, 2009 at 06:16:17PM -0400, Ralph Hempel wrote:
>>>Christopher Faylor wrote:
>
>>>
>>>
>>>Wouldn't it be nice if setup knew enough to remove the bz2 files for
>>>packages that were no longer current?
>>>
>>>
>>
>>No need to duck.  I think setup really should just delete the files
>>when it is done with them if you choose "install from internet".
>
>Keeping the accumulated older versions cached in the local package dir
>has saved my skin and/or been a handy source of historical reference
>material on numerous occasions.  So if we're going to add a "tidy up
>local package dir" behaviour, I reckon it should be governed by another
>check-box on the final page, alongside the "create menu item" and
>"create shortcut" boxes.

Yes.  You're a "power user" unlike 99.9% of the people here who think
that the files in the download directory are crucial to the continued
operation of their cygwin installation.  For them, we're using up their
disk space for no reason.

But, I should just shut up now since I have no intention of implementing
this feature in setup anyway.  It was just an idle thought.

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/



Re: Is there a script to remove old packages from local disk

2009-06-17 Thread Christopher Faylor
On Wed, Jun 17, 2009 at 11:34:24AM +0100, Fergus wrote:
>Assume your local Cygwin repository is under some /pathname/ for example:
>/g/users/yourname/cygfiles/setup.ini AND 
>/g/users/yourname/cygfiles/release/*
>or you can have spaces if you like:
>/h/my name/cygnus solutions/setup.ini AND /h/my name/cygnus 
>solutions/release/*
>
>As setup.ini advances with time and you augment the subdirectory 
>release/, it becomes bloated with more and more redundant files. It can 
>be cleaned out using the following script with the syntax

Are you paying attention?  It can be cleaned up by:

rm -rf "/h/my name/cygnus solutions/*"

Yes, yes.  I know.  Your internet connection is only 1 byte per second
so you desperately need to keep useless files around on disk for when
you accidentally type rm -rf /bin.  Or, you have all of cygwin carefully
installed on multiple floppies and don't want to delete anything.

However, for most people here, removing the directories is the right
thing to do.

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/



Re: Is there a script to remove old packages from local disk

2009-06-17 Thread Ralph Hempel

Christopher Faylor wrote:

On Wed, Jun 17, 2009 at 08:39:05AM -0400, Ralph Hempel wrote:



Whenever the next round of changes to setup happens, and the talk gets
around to "Removing the Download to Local Directory" or "Should we
Delete the Downloaded Files", please consider saying "No" to both
proposals.  :-)


Why do you expand this to mean something that I never implied?  I never
said that we should remove "Download to Local Directory".


Because there's no point to having a separate download to local
directory if you're going to erase the files later. The dangers
of leaping to conclusions based on what I think you are thinking
is becoming apparent.


But regardless, maybe a tool is all that is really needed here.


Yes, and that saves everyone from thinking about how to change
setup again - which is good.

Ralph

--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Fergus

Are you paying attention?  It can be cleaned up by:
rm -rf "/h/my name/cygnus solutions/*"
Yes, yes.  I know. Your internet connection is only 1 byte per second
so you desperately need to keep useless files around on disk for when
you accidentally type rm -rf /bin.


For Goodness sake. There really is nothing you enjoy more than admonishing 
people is there,
in that famously sarcastic and superior manner. My interpretation of the 
original post was that
the user was interested in maintaining a complete but minimal resource under 
/release/ ...


 ... "and keeping the two most recent updates" ...


... that would thus enable a fresh installation, internet-independent, on a 
virgin machine. The
script provided enables precisely that level of maintenance.

Any user of this list is of course free to ignore answers to questions they 
didn't put.

Love from,

Fergus






--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Christopher Faylor
On Wed, Jun 17, 2009 at 11:30:38AM -0400, Ralph Hempel wrote:
>Christopher Faylor wrote:
>> On Wed, Jun 17, 2009 at 08:39:05AM -0400, Ralph Hempel wrote:
>>>Whenever the next round of changes to setup happens, and the talk gets
>>>around to "Removing the Download to Local Directory" or "Should we
>>>Delete the Downloaded Files", please consider saying "No" to both
>>>proposals.  :-)
>>
>>Why do you expand this to mean something that I never implied?  I never
>>said that we should remove "Download to Local Directory".
>
>Because there's no point to having a separate download to local
>directory if you're going to erase the files later.  The dangers of
>leaping to conclusions based on what I think you are thinking is
>becoming apparent.

>Christopher Faylor wrote:
>>I think setup really should just delete the files when it is done with
>>them if you choose "install from internet"

"install from internet" != "install from local directory"

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/



Re: Is there a script to remove old packages from local disk

2009-06-17 Thread Ralph Hempel

Christopher Faylor wrote:

I think setup really should just delete the files when it is done with
them if you choose "install from internet"


"install from internet" != "install from local directory"


Ah, now I understand why I was jumping to conclusions. Thanks for
clearing that up.

And contrary to some readers, I don't mind the tone of the responses
as long as they are making a point. And it's pretty clear it took
me a while to understand the point you were making.

You should write more of your responses in pseudo-code. :-)

Ralph

--
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: Is there a script to remove old packages from local disk

2009-06-17 Thread Christopher Faylor
On Wed, Jun 17, 2009 at 03:59:09PM -0400, Ralph Hempel wrote:
>>>Christopher Faylor wrote:
I think setup really should just delete the files when it is done with
them if you choose "install from internet"
>>
>>"install from internet" != "install from local directory"
>
>Ah, now I understand why I was jumping to conclusions.  Thanks for
>clearing that up.
>
>And contrary to some readers, I don't mind the tone of the responses as
>long as they are making a point.  And it's pretty clear it took me a
>while to understand the point you were making.

Well, given past communications, I was pretty sure you were clueful so I
thought there was something being missed there.

>You should write more of your responses in pseudo-code.  :-)

I try to do that sometimes but the sarcasm and superiority just don't
come across as well.

It was a silly discussion to be arguing about something that no one was
going to do, nonetheless.  I just didn't want the archives to end on an
unclear point.  I am always thinking about the children after all.

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/



Re: Is there a script to remove old packages from local disk

2009-06-17 Thread Keith Christian
On Wed, Jun 17, 2009 at 4:34 AM, Fergus wrote:
> #! /bin/sh
> #  clean
> cat "$1setup.ini" | sed -n '/release\//p' | sed 's/^.*release\///g' |\

I used Fergus' script referenced above, with the "safety feature" of
executing "setup.4" independently, as the search and destroy
mechanism.  I like this approach, try before you, er, um, "buy."

I saved the script in the "release/" directory and invoked thusly:

bash ./clean_cygwin.sh

Worked like a champ.  Anyone fearing that changes to setup.exe might
be asked for, forget it.  (-:  (-:

My "release/" directory was trimmed by 301mb, from 1000mb to 699mb!
That's well worth it.

Thanks, Fergus.


===Keith

--
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/