create a new page, using OOobbs3/78 as a template.
Front page
Search
掲示板
Reload
Help
Browse Log
掲示板の使い方
OOo 掲示板3
OOo 掲示板2
OOo 掲示板
掲示板
雑談掲示板
New
List of pages
Recent changes
Backup
簡単ヘルプ
整形ルール
Start:
** [[OOobbs3/78]] [#k03c530e]
-''サマリ'': AOO 3.4 uno_packages.db -> uno_packages.pmap
-''環境'': Other
-''状態'': 投稿
-''投稿者'': [[はにゃ?]]
-''投稿日'': 2012-01-07 (土) 23:48:26
*** 質問 [#wae59b86]
[ &multilang(link,en=English+text); | &multilang(link,ja=...
#multilang(ja_JP){{
不要になりました。
Apache OpenOffice 3.4 では Berkeley Database がライセンス...
ライブラリが削除されるので該当するファイルの移行は期待で...
拡張機能をインストールしなおせばよいのですが、多数の拡張...
以下のスクリプトは Python の bsddb モジュールを利用して変...
使い方
python migrate_db.py
設定がデフォルト以外の場所や失敗した場合には -u オプショ...
}}
#multilang(en_US){{
This is not required anymore.
The coming Apache OpenOffice 3.4 does not have Berkeley D...
The library of Berkeley Database is completely removed an...
You can install extensions on new environment but it is t...
The following python script convert old db to new format,...
How to use:
python migrate_db.py
If you do not have the settings of the office in the defa...
Never tested on Windows Vista and Windows 7.
}}
#code(python){{
#! /bin/env python
import bsddb
from optparse import OptionParser
import os
import os.path
import re
import platform
__doc__ = """There is no file spacification for uno_packa...
and uno_packages.pmap but you can find its implementation...
main/desktop/source/deployment/dp_persmap.cxx of the sou...
def get_items(packages):
""" Open Berkeley database file and read its content.
# Format of uno_packages.db
# Berkeley detabase
# Ignore white spaces in key and value
# key: 0xFF EXTENSION_ID
# value: TEMP_NAME 0xFF PACKAGE_NAME 0xFF PACKAGE_MIME_T...
# The last value is always zero in value because of it i...
"""
items = {}
d = bsddb.hashopen(packages + ".db", "r")
for k, v in d.iteritems():
items[k] = v
d.close()
return items
def write_pmap(packages, items):
""" Write to pmap file.
# Format of uno_packages.pmap
# file header: Pmp1
# Ignore white space in the body.
# body: key \n value \n
# file footer: \n
# The 00 ... 0F are replaced with %0 ... %F and
# % is replaced with %% in key and value.
"""
magic = "Pmp1"
regexp = re.compile("(\x00|\x01|\x02|\x03|\x04|\x05|\x06...
def encode(m):
# 00 ... 0F -> %0 ... %F, % -> %%
c = m.group(0)
if c == "%":
return "%%"
else:
n = ord(c)
if n < 0x09:
return "%%%s" % chr(0x30 + n)
else:
return "%%%s" % chr(0x37 + n)
lines = []
for k, v in items.iteritems():
lines.append(regexp.sub(encode, k))
lines.append(regexp.sub(encode, v))
lines.append("\n")
f = open(packages + ".pmap", "w")
f.write(magic)
f.write("\n".join(lines))
f.flush()
f.close()
def main():
""" Tries to convert uno_packages.db to pmap. """
USER_KEY = "user"
if os.sep == "/":
data_dir = os.path.join("~", ".openoffice.org")
elif platform.system() == "Windows":
release = platform.release()
if release == "XP" or release == "2000":
data_dir = os.path.join("~", "Application Data", "Open...
else:
data_dir = os.path.join("~", "AppData", "OpenOffice.or...
parser = OptionParser()
parser.add_option("-u", dest=USER_KEY,
help="Data directory of the office. Default: %s" % data...
parser.set_default(USER_KEY, data_dir)
options, args = parser.parse_args()
packages_dir = os.path.join(
os.path.expanduser(getattr(options, USER_KEY)),
"3", "user",
"uno_packages", "cache")
# check user directory is exist
if not os.path.exists(packages_dir):
print("Error: %s is not found." % packages_dir)
return
packages_path = os.path.join(packages_dir, "uno_packages")
items = get_items(packages_path)
write_pmap(packages_path, items)
if __name__ == "__main__":
main()
}}
*** 回答 [#t0deaf58]
#comment
*** 感想,コメント,メモ [#k5dbd2f1]
#comment
End:
** [[OOobbs3/78]] [#k03c530e]
-''サマリ'': AOO 3.4 uno_packages.db -> uno_packages.pmap
-''環境'': Other
-''状態'': 投稿
-''投稿者'': [[はにゃ?]]
-''投稿日'': 2012-01-07 (土) 23:48:26
*** 質問 [#wae59b86]
[ &multilang(link,en=English+text); | &multilang(link,ja=...
#multilang(ja_JP){{
不要になりました。
Apache OpenOffice 3.4 では Berkeley Database がライセンス...
ライブラリが削除されるので該当するファイルの移行は期待で...
拡張機能をインストールしなおせばよいのですが、多数の拡張...
以下のスクリプトは Python の bsddb モジュールを利用して変...
使い方
python migrate_db.py
設定がデフォルト以外の場所や失敗した場合には -u オプショ...
}}
#multilang(en_US){{
This is not required anymore.
The coming Apache OpenOffice 3.4 does not have Berkeley D...
The library of Berkeley Database is completely removed an...
You can install extensions on new environment but it is t...
The following python script convert old db to new format,...
How to use:
python migrate_db.py
If you do not have the settings of the office in the defa...
Never tested on Windows Vista and Windows 7.
}}
#code(python){{
#! /bin/env python
import bsddb
from optparse import OptionParser
import os
import os.path
import re
import platform
__doc__ = """There is no file spacification for uno_packa...
and uno_packages.pmap but you can find its implementation...
main/desktop/source/deployment/dp_persmap.cxx of the sou...
def get_items(packages):
""" Open Berkeley database file and read its content.
# Format of uno_packages.db
# Berkeley detabase
# Ignore white spaces in key and value
# key: 0xFF EXTENSION_ID
# value: TEMP_NAME 0xFF PACKAGE_NAME 0xFF PACKAGE_MIME_T...
# The last value is always zero in value because of it i...
"""
items = {}
d = bsddb.hashopen(packages + ".db", "r")
for k, v in d.iteritems():
items[k] = v
d.close()
return items
def write_pmap(packages, items):
""" Write to pmap file.
# Format of uno_packages.pmap
# file header: Pmp1
# Ignore white space in the body.
# body: key \n value \n
# file footer: \n
# The 00 ... 0F are replaced with %0 ... %F and
# % is replaced with %% in key and value.
"""
magic = "Pmp1"
regexp = re.compile("(\x00|\x01|\x02|\x03|\x04|\x05|\x06...
def encode(m):
# 00 ... 0F -> %0 ... %F, % -> %%
c = m.group(0)
if c == "%":
return "%%"
else:
n = ord(c)
if n < 0x09:
return "%%%s" % chr(0x30 + n)
else:
return "%%%s" % chr(0x37 + n)
lines = []
for k, v in items.iteritems():
lines.append(regexp.sub(encode, k))
lines.append(regexp.sub(encode, v))
lines.append("\n")
f = open(packages + ".pmap", "w")
f.write(magic)
f.write("\n".join(lines))
f.flush()
f.close()
def main():
""" Tries to convert uno_packages.db to pmap. """
USER_KEY = "user"
if os.sep == "/":
data_dir = os.path.join("~", ".openoffice.org")
elif platform.system() == "Windows":
release = platform.release()
if release == "XP" or release == "2000":
data_dir = os.path.join("~", "Application Data", "Open...
else:
data_dir = os.path.join("~", "AppData", "OpenOffice.or...
parser = OptionParser()
parser.add_option("-u", dest=USER_KEY,
help="Data directory of the office. Default: %s" % data...
parser.set_default(USER_KEY, data_dir)
options, args = parser.parse_args()
packages_dir = os.path.join(
os.path.expanduser(getattr(options, USER_KEY)),
"3", "user",
"uno_packages", "cache")
# check user directory is exist
if not os.path.exists(packages_dir):
print("Error: %s is not found." % packages_dir)
return
packages_path = os.path.join(packages_dir, "uno_packages")
items = get_items(packages_path)
write_pmap(packages_path, items)
if __name__ == "__main__":
main()
}}
*** 回答 [#t0deaf58]
#comment
*** 感想,コメント,メモ [#k5dbd2f1]
#comment
Page: