- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Perl or shell script
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2011 10:51 AM - edited 07-08-2011 10:52 AM
07-08-2011 10:51 AM - edited 07-08-2011 10:52 AM
Perl or shell script
Hi!
Time and again I have to tag my app configs. I want a script which can automate this process.
1)First I do a svn info to get a list of configs which are pointing to BRANCHES/TAGS
svn info * |grep URL
URL: http://svn.com/qbo/library/General/GeneralConfiguration/BRANCHES/2011-05
URL: http://svn.com/qbo/library/Core/CoreConfiguration/BRANCHES/2011-05
URL: http://svn.com/qbo/library/signup/signupProcessorConfiguration/BRANCHES/2011-05
URL: http://svn.com/qbo/library/signup/signupStatusConfiguration/BRANCHES/2011-05
URL: http://svn.com/qbo/library/signup/signupingConfiguration/BRANCHES/2011-05
URL: http://svn.com/qbo/library/web/WebConfiguration/TAGS/2011-05-1
2)Now I basically find out if there are existing TAGS for the these configs with the same TAG as that I am hoping to create .
3) Thirdly I create them -
svn cp http://svn.com/qbo/library/Core/CoreConfiguration/BRANCHES/2011-05 http://svn.com/qbo/library/Core/CoreConfiguration/TAGS/2011-05-1
....
IF TAGS/2011-05-1 exists then I create a TAGS/2011-05-2 tag.
I want to automate this in a way so that the script can check the existence of a tag and if it does not exists then create one or increment to the next number if there is already one created.
Thanks,
Allan.
- Tags:
- Subversion
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2011 12:13 PM
07-08-2011 12:13 PM
Re: Perl or shell script
Hi:
See if this fits your needs:
#!/usr/bin/perl use strict; use warnings; my $tag = shift or die "tag to match expected\n"; while (<>) { print; next unless m{$tag}; chomp; if ( m{^.+\d\d\d\d\-\d\d$} ) { print $_ . "-1\n"; } elsif ( m{(^.+\d\d\d\d\-\d\d\-)(\d+)$} ) { print $1 . ($2+1) . "\n"; } } 1;
...run as:
# ./fixup 2011-05 file
...or :
# svn info * | ./fixup 2011-05
That is, the script expects a tag to match (e.g. 2011-05) and a file or STDIN stream. Use your data to verify that you get what you want.
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2011 03:04 PM
07-08-2011 03:04 PM
Re: Perl or shell script
Hi JRF,
Would this suffice to create a new TAG out of svn info if the output has a TAG listed out instead of BRANCHES -
URL: http://svn.com/qbo/library/web/WebConfiguration/TAGS/2011-05-1 svn cp http://svn.com/qbo/library/web/WebConfiguration/BRANCHES/2011-05 http://svn.com/qbo/library/web/WebConfiguration/TAGS/2011-05-2
Thanks,
Allan.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-08-2011 03:21 PM
07-08-2011 03:21 PM
Re: Perl or shell script
HI (again) Allan:
@allanm77 wrote:
Would this suffice to create a new TAG out of svn info if the output has a TAG listed out instead of BRANCHES -
...
It isn't clear to me exactly what you want to match and what you want to manufacture. The suggestion I made thus far allows you to match by passing an argument like "2011-05" or "TAGS/2011-05" or "BRANCHES/2011-05" and incrementing any suffix found.
The scriptlet I offered prints out the old and newly manufactured information. Do you want it to issue the actual 'svn cp'?
Please provide a sample input and expected output (given that the output may be one or more commands). Specify, too what *you* mean by "match".
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-09-2011 05:26 AM
07-09-2011 05:26 AM
Re: Perl or shell script
Hi (again) Allan:
By the way, if you are/were known as simply "Allanm" in the old ITRC, you have several un-evaluated (scored/kudoed) threads from just before the migration:
http://h30499.www3.hp.com/t5/user/viewprofilepage/user-id/1082079
Please consider revisiting them as anyone can now assign kudos.
Regards!
...JRF...