Login
Username:

Password:

Remember me



Lost Password?

Register now!

Sections

Who's Online
154 user(s) are online (142 user(s) are browsing Forums)

Members: 2
Guests: 152

Amigafreak02, Mr_byte, more...

Support us!

Headlines

 
  Register To Post  

Is AmigaDOS scripting able to read into files?
Home away from home
Home away from home


See User information
Here is what i try to do:

I have a program that checks for updates.
It's a port so it doesn't set any amiga variables like WARN or ERROR.

Though it will print something like "0 updates found" or "X updates found"

I wrote a little amiga dos script which automates updates for all the programs i take care of

Only problem is i cannot check while in the script if there were updates or not and as such cannot automate it further to immediately start the compiling.

Now my question:

If i redirect this "X updates found" to a text file in ram: will i be able with the amiga dos scripting language to access the file and check if the number is "0" or "X" or do i have to rewrite my script in AREXX?

Final information:

The port in question is the hggit extension for Mercurial from Andy Broad, so it's pearl
Maybe some pearl gurus or even Andy have an idea on how i could achieve that?

and here is the script as it looks now - the compiling i need to do by hand after me looking which programs got updates
Quote:

cd program-to-update/ ; Must be inside the directory, otherwise hg will throw a syntax error
hg pull ; "hg pull" to get the latest changes
hg update ; "hg update" to merge them into the local copy
cd / ; cd back to root


Thanks for every hint

Go to top
Re: Is AmigaDOS scripting able to read into files?
Home away from home
Home away from home


See User information
hg and hggit are written in python, never heard of 'pearl' although 'perl' is quite popular.

There a vareiety of solutions IMHO.

1.

If the projects are built by make.
Then just add 'make' and make will check if anything has changed, and only build if something has (usually).

If yoo must avoid that way because make does too much other stuff or the project is large and takes a long time for make to decide not to do anything then:

2.

perhaps do

set updates `hg update` ; note backticks
if NOT EQ $updates "0 updates found"
make project
endif


3. or write a master makefile that perfoms the action of your script and only calls the project makefile if there are changes

4. or write a python script. using the hg modules directly.

I personally would never write a amigados script for anything, unless I had no choice.


Go to top
Re: Is AmigaDOS scripting able to read into files?
Home away from home
Home away from home


See User information
Quote:

broadblues wrote:
hg and hggit are written in python, never heard of 'pearl' although 'perl' is quite popular.


Arrgh, yes, of course...sorry

Quote:

There a vareiety of solutions IMHO.

1.

If the projects are built by make.
Then just add 'make' and make will check if anything has changed, and only build if something has (usually).

If yoo must avoid that way because make does too much other stuff or the project is large and takes a long time for make to decide not to do anything then:


Never thought of that, yes that would be the easiest solution, thank you

Quote:

2.

perhaps do

set updates `hg update` ; note backticks
if NOT EQ $updates "0 updates found"
make project
endif


I will keep this one in mind, slick way to what i wanted to, thank you

Quote:

3. or write a master makefile that perfoms the action of your script and only calls the project makefile if there are changes

4. or write a python script. using the hg modules directly.


I'm no master when it comes to makefiles or python, i can do some alterations to make it build on AmigaOS, but thats about it
Remember, i wasn't even able to recompile your hggit version, let alone update it to the latest root

Quote:

I personally would never write a amigados script for anything, unless I had no choice.


I do normally keep off my hands of it either, i do AREXX and for now it does anything i want, but i thought why don't give it a shot?

Thank you for all the hints Andy

PS: You think you got some time on your hands in the near future for updates to mercurial and hggit?

Go to top
Re: Is AmigaDOS scripting able to read into files?
Home away from home
Home away from home


See User information
Quote:
set updates `hg update` ; note backticks
if NOT EQ $updates "0 updates found"

I would strongly suggest adding some quote marks to that code, e.g.:
Quote:
set updates "`hg update`" ; note backticks
if NOT EQ "$updates" "0 updates found"

Also, personally I would find the last line easier to read if it is written like this:
Quote:
if "$updates" NOT EQ "0 updates found"

Author of the PortablE programming language.
Go to top
Re: Is AmigaDOS scripting able to read into files?
Home away from home
Home away from home


See User information
@ChrisH

Thanks for the additions, will put them in my tricks file

I used the simple make command after the checks as it does exactly what i need.

The script part with starting the command "hg pull" dosn't work like it should, because it actually prints out two lines of information. (hg update merges found updates in)

1) pulling from http://site/where/program/lives
2) no updates found

On checking the file only "pulling" is available, but that might be fixed with your quotes?

Go to top
Re: Is AmigaDOS scripting able to read into files?
Just can't stay away
Just can't stay away


See User information
Don't forget to 'UnSet updates' before moving on to the next program, you never know when you might get an error and updates gets used with the wrong result.

Amiga user since 1985
AOS4, A-EON, IBrowse & Alinea Betatester

Ps. I hate the new amigans website. <shudder>
Go to top

  Register To Post

 




Currently Active Users Viewing This Thread: 1 ( 0 members and 1 Anonymous Users )




Powered by XOOPS 2.0 © 2001-2024 The XOOPS Project