Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
F
forge001
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Gerhard Gonter
forge001
Commits
42f66861
Commit
42f66861
authored
9 years ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
added cd mode and event_die()
parent
fa5e3c8f
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
textarchive/vlib001.pl
+25
-1
25 additions, 1 deletion
textarchive/vlib001.pl
with
25 additions
and
1 deletion
textarchive/vlib001.pl
+
25
−
1
View file @
42f66861
...
...
@@ -20,6 +20,7 @@
* --limit <n> ... check up <n> files
* --noinode ... ignore the inode
* --edit ... edit configuration
* --cd ... change directory to store's base
* -D ... increase debug level
* -X ... stop after setup (useful as option -DX)
...
...
@@ -66,6 +67,7 @@ my $limit= undef;
my
$cat_file
=
'
_catalog
';
my
$ino_file
=
'
_catalog.inodes
';
my
$check_inode
=
1
;
my
$cd_mode
=
0
;
my
$EDITOR
=
$ENV
{'
EDITOR
'}
||
'
/bin/vi
';
my
@hdr
=
qw(md5 path mtime fs_size ino)
;
...
...
@@ -89,6 +91,7 @@ while (my $arg= shift (@ARGV))
elsif
(
$arg
eq
'
--fileinfo
')
{
$refresh_fileinfo
=
1
;
}
elsif
(
$arg
eq
'
--noinode
')
{
$check_inode
=
0
;
}
elsif
(
$arg
eq
'
--subdir
')
{
push
(
@subdirs
,
shift
(
@ARGV
));
}
elsif
(
$arg
eq
'
--cd
')
{
$cd_mode
=
1
;
}
elsif
(
$arg
=~
/^--(refresh|verify|lookup|edit|maint|next-seq|get-cat)$/
)
{
$op_mode
=
$
1
;
}
else
{
&usage
("
unknown option '
$arg
'
");
}
}
...
...
@@ -146,7 +149,21 @@ if ($op_mode eq 'refresh')
exit
(
-
2
);
}
# ZZZ
$DEBUG
=
1
;
print
"
store_cfg:
",
Dumper
(
$store_cfg
)
if
(
$DEBUG
);
if
(
$cd_mode
==
1
)
{
my
$path
=
$store_cfg
->
{'
path
'}
or
event_die
("
no path defined
");
print
"
path=[
$path
]
\n
";
my
$res
=
chdir
(
$path
)
or
event_die
("
can not change to
$path
");;
print
"
res=[
$res
]
\n
";
my
$pwd
=
`
pwd
`;
chop
(
$pwd
);
print
"
pwd=[
$pwd
]
\n
";
event_die
("
chdir failed strangely path=[
$path
] pwd=[
$pwd
]
")
unless
(
$pwd
eq
$path
);
}
if
(
exists
(
$store_cfg
->
{'
inodes
'}))
{
my
$i
=
$store_cfg
->
{'
inodes
'};
...
...
@@ -219,6 +236,13 @@ sub usage
exit
-
1
;
}
sub
event_die
{
my
$msg
=
shift
;
# TODO: write to MongoDB if an event collection is known
die
$msg
;
}
sub
refresh_md5cat
{
my
$objreg
=
shift
;
...
...
@@ -230,7 +254,7 @@ sub refresh_md5cat
# my $hasher= $objreg->{'hasher'};
open
(
CAT
,
'
<:utf8
',
'
_catalog
')
or
die
"
cant read catalog
";
open
(
CAT
,
'
<:utf8
',
'
_catalog
')
or
event_
die
"
cant read catalog
";
my
$cnt_processed
=
0
;
my
$cnt_updated
=
0
;
CAT:
while
(
<
CAT
>
)
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment