Use documentation to extract 2 more .h lists

- Change default_cvsignore char[] into a define.
- Make the DEFAULT_DONT_COMPRESS and DEFAULT_CVSIGNORE defines get set
  based on their info in rsync.1.md.
- Add a few more don't-compress suffixes from Simon Matter.
This commit is contained in:
Wayne Davison committed 2020-06-18 11:20:57 -07:00
1 parent 88c18ef648
commit b5e539fc5a
7 files changed
+88 -21

No files matched your search

+2
View File
@@ -19,6 +19,8 @@ aclocal.m4
/rsync*.5
/rsync*.html
/help-rsync*.h
/default-cvsignore.h
/default-dont-compress.h
/.md2man-works
/autom4te*.cache
/confdefs.h
+6 -1
View File
@@ -100,11 +100,16 @@ rsync$(EXEEXT): $(OBJS)
$(OBJS): $(HEADERS)
$(CHECK_OBJS): $(HEADERS)
options.o: latest-year.h help-rsync.h help-rsyncd.h
exclude.o: default-cvsignore.h
loadparm.o: default-dont-compress.h
flist.o: rounding.h
default-cvsignore.h default-dont-compress.h: rsync.1.md define-from-md.awk
awk -f $(srcdir)/define-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
help-rsync.h help-rsyncd.h: rsync.1.md help-from-md.awk
awk -f $(srcdir)/help-from-md.awk -v helpfile=$@ $(srcdir)/rsync.1.md
awk -f $(srcdir)/help-from-md.awk -v hfile=$@ $(srcdir)/rsync.1.md
rounding.h: rounding.c rsync.h proto.h
@for r in 0 1 3; do \
+41
View File
@@ -0,0 +1,41 @@
#!/usr/bin/awk -f
# The caller must pass args: -v hfile=NAME rsync.1.md
BEGIN {
heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from a list of values in " ARGV[1] "! */"
if (hfile ~ /compress/) {
define = "#define DEFAULT_DONT_COMPRESS"
prefix = "*."
} else {
define = "#define DEFAULT_CVSIGNORE"
prefix = ""
}
value_list = ""
}
/^ > [^ ]+$/ {
gsub(/`/, "")
if (value_list != "") value_list = value_list " "
value_list = value_list prefix $2
next
}
value_list ~ /\.gz / && hfile ~ /compress/ {
exit
}
value_list ~ /SCCS / && hfile ~ /cvsignore/ {
exit
}
value_list = ""
END {
if (value_list != "")
print heading "\n\n" define " \"" value_list "\"" > hfile
else {
print "Failed to find a value list in " ARGV[1] " for " hfile
exit 1
}
}
+2 -11
View File
@@ -21,6 +21,7 @@
*/
#include "rsync.h"
#include "default-cvsignore.h"
extern int am_server;
extern int am_sender;
@@ -1051,16 +1052,6 @@ static filter_rule *parse_rule_tok(const char **rulestr_ptr,
return rule;
}
static char default_cvsignore[] =
/* These default ignored items come from the CVS manual. */
"RCS SCCS CVS CVS.adm RCSLOG cvslog.* tags TAGS"
" .make.state .nse_depinfo *~ #* .#* ,* _$* *$"
" *.old *.bak *.BAK *.orig *.rej .del-*"
" *.a *.olb *.o *.obj *.so *.exe"
" *.Z *.elc *.ln core"
/* The rest we added to suit ourself. */
" .svn/ .git/ .hg/ .bzr/";
static void get_cvs_excludes(uint32 rflags)
{
static int initialized = 0;
@@ -1070,7 +1061,7 @@ static void get_cvs_excludes(uint32 rflags)
return;
initialized = 1;
parse_filter_str(&cvs_filter_list, default_cvsignore,
parse_filter_str(&cvs_filter_list, DEFAULT_CVSIGNORE,
rule_template(rflags | (protocol_version >= 30 ? FILTRULE_PERISHABLE : 0)),
0);
+4 -4
View File
@@ -1,10 +1,10 @@
#!/usr/bin/awk -f
# The caller must set -v helpfile=help-NAME.h and pass arg NAME.NUM.md
# The caller must pass args: -v hfile=help-NAME.h NAME.NUM.md
BEGIN {
heading = "/* DO NOT EDIT THIS FILE! It is auto-generated from the option list in " ARGV[1] "! */"
findcomment = helpfile
findcomment = hfile
sub("\\.", "\\.", findcomment)
findcomment = "\\[comment\\].*" findcomment
backtick_cnt = 0
@@ -32,9 +32,9 @@ $0 ~ findcomment {
END {
if (foundcomment && backtick_cnt > 1)
print heading "\n" prints > helpfile
print heading "\n" prints > hfile
else {
print "Failed to find " helpfile " section in " ARGV[1]
print "Failed to find " hfile " section in " ARGV[1]
exit 1
}
}
+1 -5
View File
@@ -42,6 +42,7 @@
#include "rsync.h"
#include "itypes.h"
#include "default-dont-compress.h"
extern item_list dparam_list;
@@ -52,11 +53,6 @@ extern item_list dparam_list;
#define LOG_DAEMON 0
#endif
#define DEFAULT_DONT_COMPRESS "*.gz *.zip *.z *.rpm *.deb *.iso *.bz2" \
" *.t[gb]z *.7z *.mp[34] *.mov *.avi *.ogg *.jpg *.jpeg *.png" \
" *.lzo *.rzip *.lzma *.rar *.ace *.gpg *.xz *.txz *.lz *.tlz" \
" *.ogv *.web[mp] *.squashfs"
/* the following are used by loadparm for option lists */
typedef enum {
P_BOOL, P_BOOLREV, P_CHAR, P_INTEGER,
+32
View File
@@ -1852,6 +1852,8 @@ your home directory (remove the '=' for that).
The exclude list is initialized to exclude the following items (these
initial items are marked as perishable -- see the FILTER RULES section):
[comment]: # (This list gets used for the default-cvsignore.h file.)
> `RCS`
> `SCCS`
> `CVS`
@@ -2335,38 +2337,68 @@ your home directory (remove the '=' for that).
The default file suffixes in the skip-compress list in this version of
rsync are:
[comment]: # (This list gets used for the default-dont-compress.h file.)
> 7z
> ace
> apk
> avi
> bz2
> deb
> flac
> gpg
> gz
> iso
> jar
> jpeg
> jpg
> lz
> lz4
> lzma
> lzo
> mkv
> mov
> mp3
> mp4
> odb
> odf
> odg
> odi
> odm
> odp
> ods
> odt
> ogg
> ogv
> opus
> otg
> oth
> otp
> ots
> ott
> oxt
> png
> rar
> rpm
> rz
> rzip
> squashfs
> sxc
> sxd
> sxg
> sxm
> sxw
> tbz
> tgz
> tlz
> txz
> tzo
> webm
> webp
> xz
> z
> zip
> zst
This list will be replaced by your `--skip-compress` list in all but one
situation: a copy from a daemon rsync will add your skipped suffixes to its