Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
bugzilla
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
etersoft
bugzilla
Commits
f39fc76d
Commit
f39fc76d
authored
Jan 18, 2008
by
mkanat%bugzilla.org
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Bug 147776: Make checksetup.pl re-write localconfig with the most modern comments.
Patch By Max Kanat-Alexander <mkanat@bugzilla.org> (module owner) a=mkanat
parent
b45d242b
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
51 additions
and
30 deletions
+51
-30
Filesystem.pm
Bugzilla/Install/Filesystem.pm
+3
-0
Localconfig.pm
Bugzilla/Install/Localconfig.pm
+48
-30
No files found.
Bugzilla/Install/Filesystem.pm
View file @
f39fc76d
...
...
@@ -64,6 +64,7 @@ sub FILESYSTEM {
my
$libdir
=
bz_locations
()
->
{
'libpath'
};
my
$extlib
=
bz_locations
()
->
{
'ext_libpath'
};
my
$skinsdir
=
bz_locations
()
->
{
'skinsdir'
};
my
$localconfig
=
bz_locations
()
->
{
'localconfig'
};
my
$ws_group
=
Bugzilla
->
localconfig
->
{
'webservergroup'
};
...
...
@@ -116,6 +117,8 @@ sub FILESYSTEM {
'sanitycheck.pl'
=>
{
perms
=>
$ws_executable
},
'install-module.pl'
=>
{
perms
=>
$owner_executable
},
"$localconfig.old"
=>
{
perms
=>
$owner_readable
},
'docs/makedocs.pl'
=>
{
perms
=>
$owner_executable
},
'docs/rel_notes.txt'
=>
{
perms
=>
$ws_readable
},
'docs/README.docs'
=>
{
perms
=>
$owner_readable
},
...
...
Bugzilla/Install/Localconfig.pm
View file @
f39fc76d
...
...
@@ -187,12 +187,10 @@ EOT
},
);
use
constant
OLD_LOCALCONFIG_VARS
=>
qw(
mysqlpath
contenttypes
pages
severities platforms opsys priorities
)
;
# When you read the symbol table of a package in Perl (like we do to
# get the localconfig variables), there are some symbols that are always
# there and should be ignored.
use
constant
IGNORE_SYMBOLS
=>
qw(_ INC __ANON__)
;
sub
read_localconfig
{
my
(
$include_deprecated
)
=
@_
;
...
...
@@ -221,10 +219,24 @@ Please fix the error in your 'localconfig' file. Alternately, rename your
EOT
}
my
@vars
=
map
(
$_
->
{
name
},
LOCALCONFIG_VARS
);
push
(
@vars
,
OLD_LOCALCONFIG_VARS
)
if
$include_deprecated
;
foreach
my
$var
(
@vars
)
{
my
$glob
=
$s
->
varglob
(
$var
);
# First we have to get the whole symbol table
my
$safe_root
=
$s
->
root
;
my
%
safe_package
;
{
no
strict
'refs'
;
%
safe_package
=
%
{
$safe_root
.
"::"
};
}
# And now we read the contents of every var in the symbol table
# except those from IGNORE_SYMBOLS. If $include_deprecated is false,
# we also skip any vars that aren't specifically listed in
# LOCALCONFIG_VARS.
my
@standard_vars
=
map
(
$_
->
{
name
},
LOCALCONFIG_VARS
);
foreach
my
$symbol
(
keys
%
safe_package
)
{
if
(
!
$include_deprecated
)
{
next
if
!
grep
(
$_
eq
$symbol
,
@standard_vars
);
}
next
if
grep
(
$_
eq
$symbol
,
IGNORE_SYMBOLS
);
# Perl 5.10 imports a lot of symbols that we want to ignore that
# all contain "::".
next
if
$symbol
=~
/::/
;
my
$glob
=
$s
->
varglob
(
$symbol
);
# We can't get the type of a variable out of a Safe automatically.
# We can only get the glob itself. So we figure out its type this
# way, by trying first a scalar, then an array, then a hash.
...
...
@@ -234,13 +246,13 @@ EOT
# fine since as I write this all modern localconfig vars are
# actually scalars.
if
(
defined
$$glob
)
{
$localconfig
{
$
var
}
=
$$glob
;
$localconfig
{
$
symbol
}
=
$$glob
;
}
elsif
(
defined
@$glob
)
{
$localconfig
{
$
var
}
=
\
@$glob
;
$localconfig
{
$
symbol
}
=
\
@$glob
;
}
elsif
(
defined
%
$glob
)
{
$localconfig
{
$
var
}
=
\%
$glob
;
$localconfig
{
$
symbol
}
=
\%
$glob
;
}
}
}
...
...
@@ -290,11 +302,6 @@ sub update_localconfig {
}
}
my
@old_vars
;
foreach
my
$name
(
OLD_LOCALCONFIG_VARS
)
{
push
(
@old_vars
,
$name
)
if
defined
$localconfig
->
{
$name
};
}
if
(
!
$localconfig
->
{
'interdiffbin'
}
&&
$output
)
{
print
<<EOT
...
...
@@ -307,30 +314,41 @@ as well), you should install patchutils from:
EOT
}
my
@old_vars
;
foreach
my
$var
(
keys
%
$localconfig
)
{
push
(
@old_vars
,
$var
)
if
!
grep
(
$_
->
{
name
}
eq
$var
,
LOCALCONFIG_VARS
);
}
my
$filename
=
bz_locations
->
{
'localconfig'
};
# Move any custom or old variables into a separate file.
if
(
scalar
@old_vars
)
{
my
$filename_old
=
"$filename.old"
;
open
(
my
$old_file
,
">>$filename_old"
)
||
die
"$filename_old: $!"
;
local
$
Data::Dumper::
Purity
=
1
;
foreach
my
$var
(
@old_vars
)
{
print
$old_file
Data::
Dumper
->
Dump
([
$localconfig
->
{
$var
}],
[
"*$var"
])
.
"\n\n"
;
}
close
$old_file
;
my
$oldstuff
=
join
(
', '
,
@old_vars
);
print
<<EOT
The following variables are no longer used in $filename, and
should be remove
d: $oldstuff
have been moved to $filename_ol
d: $oldstuff
EOT
}
if
(
scalar
@new_vars
)
{
my
$filename
=
bz_locations
->
{
'localconfig'
};
my
$fh
=
new
IO::
File
(
$filename
,
'>>'
)
||
die
"$filename: $!"
;
$fh
->
seek
(
0
,
SEEK_END
);
foreach
my
$var
(
LOCALCONFIG_VARS
)
{
if
(
grep
(
$_
eq
$var
->
{
name
},
@new_vars
))
{
print
$fh
"\n"
,
$var
->
{
desc
},
Data::
Dumper
->
Dump
([
$localconfig
->
{
$var
->
{
name
}}],
[
"*$var->{name}"
]);
}
}
# Re-write localconfig
open
(
my
$fh
,
">$filename"
)
||
die
"$filename: $!"
;
foreach
my
$var
(
LOCALCONFIG_VARS
)
{
print
$fh
"\n"
,
$var
->
{
desc
},
Data::
Dumper
->
Dump
([
$localconfig
->
{
$var
->
{
name
}}],
[
"*$var->{name}"
]);
}
if
(
@new_vars
)
{
my
$newstuff
=
join
(
', '
,
@new_vars
);
print
<<EOT;
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment