downloadertools: remove apply_patch and build_patch

These seem to be unused.  Let me know if this is not the case.
This commit is contained in:
rdb 2019-09-06 11:19:21 +02:00
parent 55d5fe30e6
commit aef81aceab
4 changed files with 0 additions and 183 deletions

View File

@ -4605,16 +4605,6 @@ if PkgSkip("OPENAL") == 0 and not RUNTIME:
if (PkgSkip("OPENSSL")==0 and not RTDIST and not RUNTIME and PkgSkip("DEPLOYTOOLS")==0):
OPTS=['DIR:panda/src/downloadertools', 'OPENSSL', 'ZLIB', 'ADVAPI', 'WINSOCK2', 'WINSHELL', 'WINGDI', 'WINUSER']
TargetAdd('apply_patch_apply_patch.obj', opts=OPTS, input='apply_patch.cxx')
TargetAdd('apply_patch.exe', input=['apply_patch_apply_patch.obj'])
TargetAdd('apply_patch.exe', input=COMMON_PANDA_LIBS)
TargetAdd('apply_patch.exe', opts=OPTS)
TargetAdd('build_patch_build_patch.obj', opts=OPTS, input='build_patch.cxx')
TargetAdd('build_patch.exe', input=['build_patch_build_patch.obj'])
TargetAdd('build_patch.exe', input=COMMON_PANDA_LIBS)
TargetAdd('build_patch.exe', opts=OPTS)
if not PkgSkip("ZLIB"):
TargetAdd('check_adler_check_adler.obj', opts=OPTS, input='check_adler.cxx')
TargetAdd('check_adler.exe', input=['check_adler_check_adler.obj'])

View File

@ -2087,8 +2087,6 @@
<File RelativePath="..\panda\src\downloadertools\multify.cxx"></File>
<File RelativePath="..\panda\src\downloadertools\check_md5.cxx"></File>
<File RelativePath="..\panda\src\downloadertools\check_crc.cxx"></File>
<File RelativePath="..\panda\src\downloadertools\apply_patch.cxx"></File>
<File RelativePath="..\panda\src\downloadertools\build_patch.cxx"></File>
<File RelativePath="..\panda\src\downloadertools\punzip.cxx"></File>
</Filter>
<Filter Name="gles2gsg">

View File

@ -1,46 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file apply_patch.cxx
*/
#include "pandabase.h"
#include "panda_getopt.h"
#include "preprocess_argv.h"
#include "patchfile.h"
#include "filename.h"
using std::cerr;
using std::endl;
int
main(int argc, char **argv) {
preprocess_argv(argc, argv);
if (argc < 3) {
cerr << "Usage: apply_patch <patch_file> <old_file>" << endl;
cerr << "Will overwrite old_file" << endl;
return 1;
}
Filename patch = argv[1];
patch.set_binary();
Filename file = argv[2];
file.set_binary();
Patchfile pfile;
cerr << "Applying patch file " << patch << " to " << file << endl;
if (pfile.apply(patch, file) == false) {
cerr << "apply patch failed" << endl;
return 1;
}
return 0;
}

View File

@ -1,125 +0,0 @@
/**
* PANDA 3D SOFTWARE
* Copyright (c) Carnegie Mellon University. All rights reserved.
*
* All use of this software is subject to the terms of the revised BSD
* license. You should have received a copy of this license along
* with this source code in a file named "LICENSE."
*
* @file build_patch.cxx
*/
#include "pandabase.h"
#include "panda_getopt.h"
#include "preprocess_argv.h"
#include "patchfile.h"
#include "filename.h"
using std::cerr;
using std::endl;
void
usage() {
cerr << "Usage: build_patch [opts] <old_file> <new_file>" << endl;
}
void
help() {
usage();
cerr << "\n"
"This program generates a patch file that describes the differences\n"
"between any two source files. The patch file can later be used to\n"
"construct <new_file>, given <old_file>. Arbitrary file types, including\n"
"binary files, are supported.\n\n"
"The patching algorithm can get very slow for very large files. As an\n"
"optimization, if the input files are both Panda Multifiles, the patcher\n"
"will by default patch them on a per-subfile basis, which has the potential\n"
"to be much faster. The -c option will forbid this and force the patcher\n"
"to work on the full file.\n\n"
"Options:\n\n"
" -o output_name\n"
" Specify the filename of the patch file to generate.\n\n"
" -c\n"
" Always generate patches against the complete file, even if the\n"
" input files appear to be multifiles.\n\n"
" -f footprint_length\n"
" Specify the footprint length for the patching algorithm.\n\n";
}
int
main(int argc, char **argv) {
Filename patch_file;
bool complete_file = false;
int footprint_length = 0;
// extern char *optarg;
extern int optind;
static const char *optflags = "o:cf:h";
preprocess_argv(argc, argv);
int flag = getopt(argc, argv, optflags);
Filename rel_path;
while (flag != EOF) {
switch (flag) {
case 'o':
patch_file = optarg;
break;
case 'c':
complete_file = true;
break;
case 'f':
footprint_length = atoi(optarg);
break;
case 'h':
help();
return 1;
case '?':
usage();
return 1;
default:
cerr << "Unhandled switch: " << flag << endl;
break;
}
flag = getopt(argc, argv, optflags);
}
argc -= (optind - 1);
argv += (optind - 1);
if (argc < 3) {
usage();
return 1;
}
Filename src_file = Filename::from_os_specific(argv[1]);
src_file.set_binary();
Filename dest_file = Filename::from_os_specific(argv[2]);
dest_file.set_binary();
if (patch_file.empty()) {
patch_file = dest_file.get_fullpath() + ".pch";
}
Patchfile pfile;
pfile.set_allow_multifile(!complete_file);
if (footprint_length != 0) {
cerr << "Footprint length is " << footprint_length << "\n";
pfile.set_footprint_length(footprint_length);
}
cerr << "Building patch file to convert " << src_file << " to "
<< dest_file << endl;
if (pfile.build(src_file, dest_file, patch_file) == false) {
cerr << "build patch failed" << endl;
return 1;
}
return 0;
}