[Pypt-offline-general] SF.net SVN: pypt-offline: [191] trunk
Status: Beta
Brought to you by:
riteshsarraf
|
From: <rit...@us...> - 2007-08-21 20:29:10
|
Revision: 191
http://pypt-offline.svn.sourceforge.net/pypt-offline/?rev=191&view=rev
Author: riteshsarraf
Date: 2007-08-21 13:28:35 -0700 (Tue, 21 Aug 2007)
Log Message:
-----------
changeset: 175:9b45cef98006
branch: trunk
tag: tip
user: Ritesh Raj Sarraf <rr...@re...>
date: Wed Aug 22 01:48:50 2007 +0530
files: pypt-offline.1 pypt_core.py
description:
* Added a socket timeout option which sets the socket timeout to a user
* supplied value
changeset: 174:5754621a926e
branch: trunk
user: Ritesh Raj Sarraf <rr...@re...>
date: Wed Aug 22 01:02:27 2007 +0530
files: pypt-offline.1
description:
* Updated the pypt-offline.1 manpage
changeset: 173:6b84e630839d
branch: trunk
user: Ritesh Raj Sarraf <rr...@re...>
date: Wed Aug 22 00:22:16 2007 +0530
files: pypt-offline.1 pypt_core.py
description:
* Remove the -u/--uris option. It is not used anymore
* Order the parser options properly.
changeset: 172:abd2471381ce
branch: trunk
user: Ritesh Raj Sarraf <rr...@re...>
date: Tue Aug 21 23:58:37 2007 +0530
files: pypt_core.py
description:
* Simplified error and verbose display
changeset: 171:a823825c4f59
branch: trunk
user: Ritesh Raj Sarraf <rr...@re...>
date: Tue Aug 21 23:53:53 2007 +0530
files: pypt_core.py
description:
* Added option to choose a release when requesting for a package install
Modified Paths:
--------------
trunk/pypt-offline.1
trunk/pypt_core.py
Modified: trunk/pypt-offline.1
===================================================================
--- trunk/pypt-offline.1 2007-08-20 13:54:32 UTC (rev 190)
+++ trunk/pypt-offline.1 2007-08-21 20:28:35 UTC (rev 191)
@@ -1,30 +1,149 @@
-.TH pypt-offline 1 "December 10, 2006" "version 0.6.2" "USER COMMANDS"
+.TH pypt-offline 1 "August 20, 2007" "version 0.7.0" "USER COMMANDS"
.SH NAME
pypt-offline \- Offline Package manager
.SH SYNOPSIS
.B pypt-offline
[OPTIONS] [ARGUMENTS]
.SH DESCRIPTION
-pypt-offline is an Offline Package Manager for Debian based systems. It bring offline package management functionality. It can download the required packages for a disconnected machine from a connected machine running Windows or Linux or Mac OS X.
+pypt-offline is an Offline Package Manager for Debian based systems. It bring offline package management functionality.
+It can download the required packages for a disconnected machine from a different connected machine running Windows or Linux or Mac OS X.
.PP
+It can also fetch bug reports for packages which are downloaded.
+.PP
Currently it supports only apt based systems but plans are there to support RPM based distros also.
.SH OPTIONS
.TP
+\-\-set\-update filename
+Specify the file to which the details about the update files with be written to
+.TP
+\-\-set\-upgrade filename
+Specify the file to which the details about the package files will be written to
+.TP
+\-\-upgrade\-type upgrade-type
+Specify the type of upgrade you want to do. Possible values are upgrade/dist-upgrade
+.TP
+\-\-set\-install filename
+Specify the file to which the details about the packages to be installed will be written to
+.TP
+\-\-set\-install\-packages [package names]
+Specify the name of packages which you want to install
+.TP
+\-\-set\-install\-release [release name]
+Specify the name of the release from which you want to download the packages. Eg. testing/unstable/experimental
+.TP
\-\-fetch\-update filename
Specify the data file which contains the details about update files to be downloaded
.TP
+\-\-fetch\-upgrade filename
+Specify the data file which contains the details about the package files to be downloaded
+.TP
+\-\-fetch\-bug\-reports
+Fetch bug reports for the packages which are to be downloaded. Currently works only with Debian BTS
+.TP
+\-\-install\-update filename
+Specify the archive file or folder path which contains the update data you downloaded
+.TP
+\-\-install\-upgrade filename
+Specify the archive file or folder path which contains the package data you downloaded
+.TP
+\-z/\-\-zip
+Zip the downloaded files to a single zip archive file
+.TP
+\-\-zip\-update\-file filename
+Specify a zip file name for the downloaded files to be archived to. Default: pypt-offline-update.zip
+.TP
+\-\-zip\-upgrade\-file filename
+Specify a zip file name for the downloaded files to be archived to. Default: pypt-offline-upgrade.zip
+.TP
\-\-threads N
Specifiy the number of threads to be spawned (Default: 1)
.TP
+\-\-disable\-md5check
+Disable MD5 Checksum. Default: False
+.TP
+\-d/\-\-download\-dir path
+Path where the downloaded files will be saved to. Eg: C:\\debs or /var/tmp/debs
+.TP
+\-s/\-\-cache\-dir path
+Path to search for files before downloading from the web. Eg: C:\\debs or /var/tmp/debs
+.TP
+\-\-socket\-timeout N
+Set socket timeout value. Default: 30
+.TP
+\-\-verbose
+Enable verbose messages
+.TP
+\-\-test\-windows
+This switch is used while doing testing on Microsoft Windows
+.TP
\-\-help
display a short help text
.TP
\-\-version
display the version of the progream
+
.SH EXAMPLES
.TP
-.B pypt-offline \-\-fetch\-update uris\-file
+.B To keep your disconnected machine up-to-date, here are the examples
+.TP
+.B pypt-offline \-\-set\-update update_uris
+This command will extract the details about the files that need to be fetched to update the package management database on the machine without internet connection.
+.TP
+.B pypt-offline \-\-fetch\-update update_uris
+This command will fetch the required data as defined in the update_uris file and create a zip archive if the \-z option is used
+.TP
+.B pypt-offline \-\-install\-update pypt-offline-update.zip
+This command will update your disconnected machine's package management database by extracting the data from the file pypt-offline-update.zip
+
+.TP
+.B To upgrade/install packages on your disconnected machine, here are the examples
+.TP
+.B pypt-offline \-\-set\-upgrade upgrade_uris
+This command will extract the details about the packages that need to be fetched to upgrade the softwares install on your machine without an internet connection.
+.TP
+.B pypt-offline \-\-fetch\-upgrade upgrade_uris
+This command will fetch the required data as defined in the upgrade_uris file and create a zip archive if the \-z option is used. Else it will download it into the folder you specify.
+.TP
+.B pypt-offline \-\-install\-upgrade pypt-offline-upgrade.zip
+This command will install packages to your disconnected machine's package management database by extracting the data from the file pypt-offlien-upgrade.zip. If you didn't use the \-z option, you will have to specify the directory path
+Once the packages are synced, you can do the installation as you usually do by using "apt-get install package_name" or "apt-get upgrade". apt will not ask you to download any additional byte.
+
+.TP
+.B Other important options to use with the above
+
+.TP
+.B -z / --zip
+This option, when used along with \-\-fetch\-up[date/grade], creates a archive file for the files which are downloaded. It becomes convenient to use a single zip archive file.
+This option is highly recommended to be used but is not enable by default.
+
+.TP
+.B --threads N
+This option allows multiple downloads to be enabled. It spawns multiple threads when downloading. Use this when you have a high speed internet connection.
+On a high speed internet connection, 5 is a good value to use.
+
+.TP
+.B --disable-md5check
+This option, if enabled, disables MD5 Checksum for the data which is downloaded. It is HIGHLY DISCOURAGED to use this option
+
+.TP
+.B --fetch-bug-reports
+This option, if enabled, fetched bug reports for packages which are being downloaded. Currently only Debian BTS is supported.
+Disabled by default but highly recommened to use it.
+
.SH AUTHOR
-Ritesh Raj Sarraf (rr...@re...)
+.B Ritesh Raj Sarraf (rr...@re...)
+
+.SH BUGS
+Currently there is no way to break out from the application which it is fetching the required packages.
+This is because when multiple threads are spawned, the signal needs to be handled accordingly. This is in the TODO list.
+
+
+If you wish to report a bug in pypt-offline, please see
+.B http://sf.net/projects/pypt-offline
+or send an email to me at
+.B rr...@re...
+
.SH SEE ALSO
-.SM apt(1)
+.SM apt-get(8)
+.SM apt-cache(8)
+.SM dpkg(8)
\ No newline at end of file
Modified: trunk/pypt_core.py
===================================================================
--- trunk/pypt_core.py 2007-08-20 13:54:32 UTC (rev 190)
+++ trunk/pypt_core.py 2007-08-21 20:28:35 UTC (rev 191)
@@ -286,7 +286,7 @@
self.DispLock.acquire(True)
self.set_color('Red')
- sys.stderr.write(msg)
+ sys.stderr.write("ERROR: " + msg)
sys.stderr.flush()
self.set_color('SwitchOffAttributes')
@@ -318,7 +318,7 @@
if self.VERBOSE is True:
self.set_color('Cyan')
- sys.stdout.write(msg)
+ sys.stdout.write("VERBOSE: " + msg)
sys.stdout.flush()
self.set_color('SwitchOffAttributes')
@@ -710,7 +710,7 @@
sys.exit(errno)
else:
- log.err("Error: I don't understand this errorcode\n" % (errno))
+ log.err("I don't understand this errorcode\n" % (errno))
sys.exit(errno)
def get_pager_cmd(pager_cmd = None):
@@ -799,7 +799,7 @@
os.mkdir("pypt-downloads")
download_path = os.path.abspath("pypt-downloads")
except:
- log.err("Error: I couldn't create a directory")
+ log.err("I couldn't create a directory")
errfunc(1, '')
else:
download_path = os.path.abspath(ArgumentOptions.download_dir)
@@ -1270,12 +1270,12 @@
shutil.copy(archive_file, target_path + filename)
retval = True
else:
- log.err("ERROR: Cannot write to target path %s\n" % (target_path) )
+ log.err("Cannot write to target path %s\n" % (target_path) )
sys.exit(1)
elif filename.endswith(pypt_bug_file_format):
retval = False # We intentionally put the bug report files as not printed.
else:
- log.err("ERROR: I couldn't understand file type %s.\n" % (filename) )
+ log.err("I couldn't understand file type %s.\n" % (filename) )
if retval is True:
log.msg("%s file synced.\n" % (filename))
@@ -1383,7 +1383,7 @@
magic_check_and_uncompress(archive_file, target_path, filename)
data.file.close()
else:
- log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n")
+ log.err("Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n")
sys.exit(1)
elif path_type == 2:
@@ -1464,7 +1464,7 @@
magic_check_and_uncompress(archive_file, target_path, filename)
else:
- log.err("ERROR: Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n")
+ log.err("Inappropriate argument sent to syncer during data fetch. Do you need to fetch bugs or not?\n")
sys.exit(1)
def main():
@@ -1483,12 +1483,13 @@
help="Root directory path where the pre-downloaded files will be searched.Make sure you give the full path of the cache directory. If not, give a period '.'",
action="store", type="string", metavar=".")
parser.add_option("--verbose", dest="verbose", help="Enable verbose messages", action="store_true")
- parser.add_option("-u","--uris", dest="uris_file",
- help="Full path of the uris file which contains the main database of files to be downloaded",action="store", type="string")
parser.add_option("","--disable-md5check", dest="disable_md5check",
help="Disable md5checksum validation on downloaded files",action="store_false", default=False)
parser.add_option("", "--threads", dest="num_of_threads", help="Number of threads to spawn",
action="store", type="int", metavar="1", default=1)
+ parser.add_option("", "--test-windows", dest="test_windows", help="This switch is used while doing testing on windows.", action="store_true")
+ parser.add_option("", "--socket-timeout", dest="socket_timeout", help="Set the socket timeout value. Default is 30s.",
+ action="store", type="int", metavar="30", default=30)
#INFO: Option zip is not enabled by default but is highly encouraged.
parser.add_option("-z","--zip", dest="zip_it", help="Zip the downloaded files to a single zip file", action="store_true")
@@ -1506,29 +1507,32 @@
action="store", metavar="pypt-offline-install.dat")
parser.add_option("", "--set-install-packages", dest="set_install_packages", help="Name of the packages which need to be fetched",
action="store_true", metavar="package_names")
+ parser.add_option("", "--set-install-release", dest="set_install_release", help="Name of the release from which packages need to be fetched",
+ action="store", metavar="release_name")
parser.add_option("", "--set-update", dest="set_update", help="Extract the list of uris which need to be fetched for updation",
action="store", type="string", metavar="pypt-offline-update.dat")
- parser.add_option("", "--fetch-update", dest="fetch_update",
- help="Fetch the list of uris which are needed for apt's databases _updation_. This command must be executed on the WITHNET machine",
- action="store", type="string", metavar="pypt-offline-update.dat")
- parser.add_option("", "--install-update", dest="install_update",
- help="Install the fetched database files to the NONET machine and _update_ the apt database on the NONET machine. This command must be executed on the NONET machine",
- action="store", type="string", metavar="pypt-offline-update.zip")
parser.add_option("", "--set-upgrade", dest="set_upgrade", help="Extract the list of uris which need to be fetched for _upgradation_",
action="store", type="string", metavar="pypt-offline-upgrade.dat")
parser.add_option("", "--upgrade-type", dest="upgrade_type",
help="Type of upgrade to do. Use one of upgrade, dist-upgrade, dselect-ugprade",
action="store", type="string", metavar="upgrade")
+
+ parser.add_option("", "--fetch-update", dest="fetch_update",
+ help="Fetch the list of uris which are needed for apt's databases _updation_. This command must be executed on the WITHNET machine",
+ action="store", type="string", metavar="pypt-offline-update.dat")
parser.add_option("", "--fetch-upgrade", dest="fetch_upgrade",
help="Fetch the list of uris which are needed for apt's databases _upgradation_. This command must be executed on the WITHNET machine",
action="store", type="string", metavar="pypt-offline-upgrade.dat")
+ parser.add_option("", "--fetch-bug-reports", dest="deb_bugs",
+ help="Fetch bug reports from the BTS", action="store_true")
+
+ parser.add_option("", "--install-update", dest="install_update",
+ help="Install the fetched database files to the NONET machine and _update_ the apt database on the NONET machine. This command must be executed on the NONET machine",
+ action="store", type="string", metavar="pypt-offline-update.zip")
parser.add_option("", "--install-upgrade", dest="install_upgrade",
help="Install the fetched packages to the NONET machine and _upgrade_ the packages on the NONET machine. This command must be executed on the NONET machine",
action="store", type="string", metavar="pypt-offline-upgrade.zip")
- parser.add_option("", "--fetch-bug-reports", dest="deb_bugs",
- help="Fetch bug reports from the BTS", action="store_true")
- parser.add_option("", "--test-windows", dest="test_windows", help="This switch is used while doing testing on windows.", action="store_true")
#global options, args
(options, args) = parser.parse_args()
@@ -1542,6 +1546,15 @@
log.msg("Copyright %s\n" % (copyright))
log.msg(terminal_license)
+ if options.socket_timeout:
+ try:
+ options.socket_timeout.__int__()
+ socket.setdefaulttimeout(options.socket_timeout)
+ log.verbose("Default timeout now is: %d.\n" % (socket.getdefaulttimeout() ) )
+ except AttributeError:
+ log.err("Incorrect value set for socket timeout.\n")
+ sys.exit(1)
+
if options.test_windows:
global apt_package_target_path
global apt_update_target_path
@@ -1624,9 +1637,14 @@
for x in args:
os.environ['__pypt_set_install_packages'] += x + ' '
- #FIXME: Find a more Pythonic implementation
- if os.system('/usr/bin/apt-get -qq --print-uris install $__pypt_set_install_packages > $__pypt_set_install') != 0:
- log.err("FATAL: Something is wrong with the apt system.\n")
+ if options.set_install_release:
+ os.environ['__pypt_set_install_release'] = options.set_install_release
+ if os.system('/usr/bin/apt-get -qq --print-uris -t $__pypt_set_install_release install $__pypt_set_install_packages > $__pypt_set_install') != 0:
+ log.err("FATAL: Something is wrong with the apt system.\n")
+ else:
+ #FIXME: Find a more Pythonic implementation
+ if os.system('/usr/bin/apt-get -qq --print-uris install $__pypt_set_install_packages > $__pypt_set_install') != 0:
+ log.err("FATAL: Something is wrong with the apt system.\n")
else:
parser.error("This argument is supported only on Unix like systems with apt installed\n")
sys.exit(1)
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|