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
3ed023fc
Commit
3ed023fc
authored
7 months ago
by
Gerhard Gonter
Browse files
Options
Downloads
Patches
Plain Diff
add catalog export for use with show_dups.pl
parent
c0f2e0fa
Branches
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
+31
-20
31 additions, 20 deletions
textarchive/vlib001.pl
with
31 additions
and
20 deletions
textarchive/vlib001.pl
+
31
−
20
View file @
3ed023fc
...
@@ -6,8 +6,8 @@
...
@@ -6,8 +6,8 @@
=head1 VERSION
=head1 VERSION
Version: 0.
5
0
Version: 0.
6
0
Date:
Fri Oct 16 13:09:17
CEST 20
15
Date:
Wed Sep 11 07:21:21 PM
CEST 20
24
=head1 USAGE
=head1 USAGE
...
@@ -74,7 +74,7 @@ my $op_mode= 'refresh';
...
@@ -74,7 +74,7 @@ my $op_mode= 'refresh';
my
$limit
=
undef
;
my
$limit
=
undef
;
my
$show_every
=
1000
;
my
$show_every
=
1000
;
my
$cat_file
=
'
_catalog
';
my
$cat_file
=
'
_catalog
';
my
$ino_file
=
'
_catalog.inodes
';
#
my $ino_file= '_catalog.inodes';
my
$check_inode
=
1
;
my
$check_inode
=
1
;
my
$cd_mode
=
0
;
my
$cd_mode
=
0
;
my
$EDITOR
=
$ENV
{'
EDITOR
'}
||
'
/bin/vi
';
my
$EDITOR
=
$ENV
{'
EDITOR
'}
||
'
/bin/vi
';
...
@@ -105,15 +105,16 @@ while (my $arg= shift (@ARGV))
...
@@ -105,15 +105,16 @@ while (my $arg= shift (@ARGV))
{
{
my
(
$opt
,
$val
)
=
split
('
=
',
$
1
,
2
);
my
(
$opt
,
$val
)
=
split
('
=
',
$
1
,
2
);
if
(
$opt
eq
'
project
')
{
$project
=
$val
||
shift
(
@ARGV
)
;
}
if
(
$opt
eq
'
project
')
{
$project
=
$val
||
shift
(
@ARGV
)
}
elsif
(
$opt
eq
'
store
')
{
$store
=
$val
||
shift
(
@ARGV
)
;
}
elsif
(
$opt
eq
'
store
')
{
$store
=
$val
||
shift
(
@ARGV
)
}
elsif
(
$opt
eq
'
limit
')
{
$limit
=
$val
||
shift
(
@ARGV
)
;
}
elsif
(
$opt
eq
'
limit
')
{
$limit
=
$val
||
shift
(
@ARGV
)
}
elsif
(
$opt
eq
'
fileinfo
')
{
$refresh_fileinfo
=
1
;
}
elsif
(
$opt
eq
'
fileinfo
')
{
$refresh_fileinfo
=
1
;
}
elsif
(
$opt
eq
'
noinode
')
{
$check_inode
=
0
;
}
elsif
(
$opt
eq
'
noinode
')
{
$check_inode
=
0
;
}
elsif
(
$opt
eq
'
subdir
')
{
$par_mode
=
'
subdir
';
}
elsif
(
$opt
eq
'
subdir
')
{
$par_mode
=
'
subdir
';
}
elsif
(
$opt
eq
'
file
')
{
$par_mode
=
'
file
';
}
elsif
(
$opt
eq
'
file
')
{
$par_mode
=
'
file
';
}
elsif
(
$opt
eq
'
cd
')
{
$cd_mode
=
1
;
}
elsif
(
$opt
eq
'
cd
')
{
$cd_mode
=
1
;
}
elsif
(
$arg
=~
/^--(refresh|verify|lookup|edit|maint|next-seq|get-cat|policy)$/
)
{
$op_mode
=
$
1
;
}
elsif
(
$opt
eq
'
cat
')
{
$cat_file
=
$val
||
shift
(
@ARGV
)
}
elsif
(
$arg
=~
/^--(refresh|verify|lookup|edit|maint|next-seq|get-cat|policy|crf)$/
)
{
$op_mode
=
$
1
;
}
else
{
&usage
("
unknown option '
$arg
'
");
}
else
{
&usage
("
unknown option '
$arg
'
");
}
}
}
elsif
(
$arg
=~
/^-/
)
elsif
(
$arg
=~
/^-/
)
...
@@ -170,7 +171,7 @@ if ($op_mode eq 'edit')
...
@@ -170,7 +171,7 @@ if ($op_mode eq 'edit')
my
$objreg
=
new
TA::
ObjReg
('
project
'
=>
$project
,
'
store
'
=>
$store
,
'
key
'
=>
'
md5
');
my
$objreg
=
new
TA::
ObjReg
('
project
'
=>
$project
,
'
store
'
=>
$store
,
'
key
'
=>
'
md5
');
# print "objreg: ", Dumper ($objreg); exit;
# print "objreg: ", Dumper ($objreg); exit;
&
usage
('
no config found
')
unless
(
defined
(
$objreg
));
usage
('
no config found
')
unless
(
defined
(
$objreg
));
print
"
objreg:
",
Dumper
(
$objreg
)
if
(
$DEBUG
||
$STOP
);
print
"
objreg:
",
Dumper
(
$objreg
)
if
(
$DEBUG
||
$STOP
);
if
(
!
defined
(
&
MongoDB::Collection::
remove
)
&&
defined
(
&
MongoDB::Collection::
delete_one
))
if
(
!
defined
(
&
MongoDB::Collection::
remove
)
&&
defined
(
&
MongoDB::Collection::
delete_one
))
...
@@ -260,7 +261,7 @@ TODO: For MongoDB backend: synchronize information about stores with maint colle
...
@@ -260,7 +261,7 @@ TODO: For MongoDB backend: synchronize information about stores with maint colle
elsif
(
$op_mode
eq
'
get-cat
')
elsif
(
$op_mode
eq
'
get-cat
')
{
{
my
$catalog
=
$objreg
->
{'
cfg
'}
->
{'
catalog
'};
my
$catalog
=
$objreg
->
{'
cfg
'}
->
{'
catalog
'};
&
usage
('
no catalog found in config
')
unless
(
defined
(
$catalog
));
usage
('
no catalog found in config
')
unless
(
defined
(
$catalog
));
my
$stores_p
=
$objreg
->
{'
cfg
'}
->
{'
stores
'};
my
$stores_p
=
$objreg
->
{'
cfg
'}
->
{'
stores
'};
my
$store_cfg
=
$stores_p
->
{
$store
};
my
$store_cfg
=
$stores_p
->
{
$store
};
...
@@ -324,6 +325,11 @@ elsif ($op_mode eq 'policy')
...
@@ -324,6 +325,11 @@ elsif ($op_mode eq 'policy')
}
}
}
}
}
}
else
{
print
"
unknown op_mode=[
$op_mode
]
\n
";
exit
(
2
);
}
# print "objreg: (after refresh)", Dumper ($objreg);
# print "objreg: (after refresh)", Dumper ($objreg);
...
@@ -440,7 +446,7 @@ sub refresh_internal
...
@@ -440,7 +446,7 @@ sub refresh_internal
# print "toc: ", Dumper ($toc);
# print "toc: ", Dumper ($toc);
my
@check_list
=
qw(mtime size)
;
my
@check_list
=
qw(mtime size)
;
push
(
@check_list
,
'
ino
')
if
(
$check_inode
);
push
(
@check_list
,
'
ino
')
if
(
$check_inode
);
# TODO: if the store is configured as { "inodes": "ignore" }, then there is no need to collect inode data here
# compare TOC and reference filelist
# compare TOC and reference filelist
my
%key
=
();
my
%key
=
();
...
@@ -673,25 +679,30 @@ sub get_cat_internal
...
@@ -673,25 +679,30 @@ sub get_cat_internal
my
(
$md5
,
$fs_size
,
$path
,
$ino
)
=
map
{
$t
->
{
$_
}
}
qw(md5 fs_size path ino)
;
my
(
$md5
,
$fs_size
,
$path
,
$ino
)
=
map
{
$t
->
{
$_
}
}
qw(md5 fs_size path ino)
;
printf
CAT
("
%s file %9ld %s
\n
",
$md5
,
$fs_size
,
$path
);
printf
CAT
("
%s file %9ld %s
\n
",
$md5
,
$fs_size
,
$path
);
# print "t: ", Dumper ($t);
# print "t: ", Dumper ($t);
push
(
@
{
$inodes
{
$ino
}},
$path
)
if
(
$check_inode
);
push
(
@
{
$inodes
{
$ino
}},
$path
)
if
(
defined
(
$ino
)
&&
$check_inode
);
$count
++
;
$count
++
;
}
}
close
(
CAT
);
close
(
CAT
);
if
(
$check_inode
)
if
(
$check_inode
)
{
{
if
(
open
(
INO
,
'
>:utf8
',
$ino_file
))
my
@inodes_sorted
=
sort
{
$a
<=>
$b
}
keys
%inodes
;
if
(
@inodes_sorted
)
{
{
print
"
writing new catalog
'
$
ino
_file
'
\n
"
;
my
$ino_file
=
$cat_file
.
'
.
ino
des
'
;
foreach
my
$ino
(
sort
{
$a
<=>
$b
}
keys
%inodes
)
if
(
open
(
INO
,
'
>:utf8
',
$ino_file
)
)
{
{
print
INO
join
('
|
',
$ino
,
@
{
$inodes
{
$ino
}}),
"
\n
";
print
"
writing new catalog '
$ino_file
'
\n
";
foreach
my
$ino
(
@inodes_sorted
)
{
print
INO
join
('
|
',
$ino
,
@
{
$inodes
{
$ino
}}),
"
\n
";
}
close
(
INO
);
}
else
{
print
"
can not write to '
$ino_file
'
\n
";
}
}
close
(
INO
);
}
else
{
print
"
can not write to '
$ino_file
'
\n
";
}
}
}
}
...
...
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