[fossil-users] autosetup: hidden autoconf/automake compatibility

2016-10-14 Thread Osamu Aoki
Hi,

Here is FYI suggestion to make compatibility of autosetup to support the
system expecting typical autoconf/automake options while not killing
nice option checking feature of autosetup via --disable-option-checking.

As I see output of "./configure --help" on autoconf/automake based code,
I see the following:

  --enable-silent-rules   less verbose build output (undo: "make V=1")
  --disable-silent-rules  verbose build output (undo: "make V=0")

Also I see in autosetup/system.tcl already supports many *hidden*
options for autoconf/automake compatibility.  Why not add one more
hidden option support for "silent-rules"?

Regards,

Osamu

FYI: back ground info

Here is the analysis of Debian packaging.

Since autosetup behaves very much like autoconf/automake, the current
Debian package maintainer sets standard autoconf/automake build options
using Debian default build infrastructure to build binary package.
Unless --disable-option-checking is used to invoke ./configure, binary
package build fails as:

| ...
| Checking for stdlib.h...ok
| Error: Unknown option --silent-rules
| Try: 'configure --help' for options
| "tail -v -n +0 config.log"
| ==> config.log <==
| Invoked as: ./configure --build=x86_64-linux-gnu --prefix=/usr
| --includedir=${prefix}/include --mandir=${prefix}/share/man
| --infodir=${prefix}/share/info --sysconfdir=/etc --localstatedir=/var
| --disable-silent-rules --libdir=${prefix}/lib/x86_64-linux-gnu
| --libexecdir=${prefix}/lib/x86_64-linux-gnu --disable-maintainer-mode
| --disable-dependency-tracking --disable-internal-sqlite --json
| --with-th1-docs --with-th1-hooks --with-tcl=/usr/lib/x86_64-linux-gnu
| --with-tcl-stubs

The Debian package maintainer currently disables option-checking via
alternative way without using --disable-option-checking.  That's anther
story.

Osamu
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Solved: Build ...

2016-10-14 Thread Osamu Aoki
Hi,

On Sat, Oct 15, 2016 at 10:27:44AM +1000, Steve Bennett wrote:
> autosetup already supports --disable-option-checking (like autoconf)
> Why wouldn't that be good enough?

Thanks.  This makes sense.

I will ask Debian package to use it.   This is cleaner approach.

Also, I will double check what option is set on Debian when building.

Osamu
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Build should be continued for unknown options

2016-10-14 Thread Steve Bennett

> On 15 Oct 2016, at 6:59 AM, Osamu Aoki  wrote:
> 
> Hi,
> 
> Here is a trivial patch to build the source tree even with unknown options
> for autosetup/autosetup but make sure to warn user.
> 
> The idea is from Barak A. Pearlmutter.
> 
> Regards,
> 
> Osamu

autosetup already supports --disable-option-checking (like autoconf)
Why wouldn't that be good enough?

Cheers,
Steve
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Build should be continued for unknown options

2016-10-14 Thread Barry Arthur
On 15 October 2016 at 05:26, Steven Gawroriski 
wrote:

> On Sat, 15 Oct 2016 05:59:23 +0900
> Osamu Aoki  wrote:
>
> > Hi,
> >
> > Here is a trivial patch to build the source tree even with unknown
> > options for autosetup/autosetup but make sure to warn user.
> >
> > The idea is from Barak A. Pearlmutter.
> >
> > Regards,
> >
> > Osamu
> >
> > PS: re-send from subscribed addess
>
> Hello,
>
> Not a developer of Fossil, but this could have potential compatibility
> issues in the future with unknown options being passed. Say someone
> builds with `--with-butter=salted`. Then later on Fossil adds a switch
> that has the same name `--with-butter=`, but it takes a different kind
> of argument that is completely incompatible. If the behavior is relied
> upon it cannot really be taken back once it is out in the open.
>
> ___
> fossil-users mailing list
> fossil-users@lists.fossil-scm.org
> http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users
>


This won't be a problem - Fossil is a fat-free scm.   :-p

I guess I better leave a serious response here too... I don't know how
other projects handle non-standard build features (apart from rejecting
them outright), but a possible solution is for Fossil to agree to never
use the --with-my- namespace, or something similar if they
don't like -my-.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] mark offeset: fossil export and import and re-export

2016-10-14 Thread Joerg Sonnenberger
On Sat, Oct 15, 2016 at 05:59:50AM +0900, Osamu Aoki wrote:
> These 2 files should be the same ... I hoped but reality is a bit
> complicated.  They are very similar but the mark field is strange.

No, the marks are derived from the rid and those again depend on the
order in which blobs are added. I'm not at all surprised if the
export/import cycle does change the order. If you want to compare two
fossil repositories for being equivalent, the easiest approach would be
to take all non-cluster entries in the blob table, print the uuid and
sort the result.

Joerg
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] mark offeset: fossil export and import and re-export

2016-10-14 Thread Osamu Aoki
Hi,

As a part of sanity check, I made an export of fossil archive to a file
and back into another fossil archive ... and re-export to a file.

These 2 files should be the same ... I hoped but reality is a bit
complicated.  They are very similar but the mark field is strange.

The initial export start with:
| blob
| mark :4
| data 3238
...

But re-export starts with:
| blob
| mark :2
| data 3238
...

This "mark" entry seems to get 2 offset for all the data entry.

So the fossil archive generated by "fossil import" has 2 less number for
all the marks.  

This is strange...

Osamu
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Build should be continued for unknown options

2016-10-14 Thread Osamu Aoki
Hi,

Here is a trivial patch to build the source tree even with unknown options
for autosetup/autosetup but make sure to warn user.

The idea is from Barak A. Pearlmutter.

Regards,

Osamu

PS: re-send from subscribed addess
From: "Barak A. Pearlmutter" 
Date: Sun, 9 Oct 2016 08:05:52 +0900
Subject: Build to be continued for unknown options

This patch is based on the patch by Barak A. Pearlmutter used to build
Debian package.  Osamu Aoki used his idea to update autosetup/autosetup
by copy-and-paste existing code in the file with trivial changes.

This patch does not contain diff for auto-generated files.

This patch can be applied by the upstream to the trunk.
---
 autosetup/autosetup | 14 +-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/autosetup/autosetup b/autosetup/autosetup
index df3317c..d2888cc 100755
--- a/autosetup/autosetup
+++ b/autosetup/autosetup
@@ -422,7 +422,7 @@ proc options {optlist} {
 	if {[opt-bool option-checking]} {
 		foreach o [array names ::useropts] {
 			if {$o ni $::autosetup(options)} {
-user-error "Unknown option --$o"
+user-warning "Unknown option --$o"
 			}
 		}
 	}
@@ -759,6 +759,18 @@ proc user-error {msg} {
 	exit 1
 }
 
+# @user-warning msg
+#
+# Indicate incorrect usage to the user, including if required components
+# or features are not found.
+# autosetup doesn't exit.
+#
+proc user-warning {msg} {
+	show-notices
+	puts stderr "Error: $msg"
+	puts stderr "Try: '[file tail $::autosetup(exe)] --help' for options"
+}
+
 # @user-notice msg
 #
 # Output the given message to stderr.
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


Re: [fossil-users] Patch to fix "fossil export" and "fossil import"

2016-10-14 Thread Osamu Aoki
Hi,

> Please note these are clean reverse engineered dedes independent of the
> code in the git using the code analysis result included.

Of course, I meant s/dedes/codes/

> The default of the quoting flag is FALSE.  The meaning of the conversion rule
> indicators are the following:

Hmmm... patch header seems to have some limitation or I removed it
accidentally.  I see "the following" portion.  Here is the following:

Here each character is represented as HEX number adding row and column
index.

The default of the quoting flag is FALSE.  The meaning of the conversion
rule
indicators are the following:

  "A" indicates output as is without setting the quoting flag.
  "O" indicates output as the octal escape while setting the quoting
flag.
  "Q" indicates output as is while setting the quoting flag.
  "E" indicates output as the single character escape using the
original
  character in the filename while setting the quoting flag.
  others  indicates output as the single character escape using the
character
  in this conversion table while setting the quoting flag.

If quoting flag is set, the filename is enclosed in the double quotation
marks.

___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users


[fossil-users] Patch to fix "fossil export" and "fossil import"

2016-10-14 Thread Osamu Aoki
Hi,

I have a set of working patches for "fossil export" and "fossil import"
as attached.

Please note these are clean reverse engineered dedes independent of the
code in the git using the code analysis result included.

These codes are BSD-2-Clause licensed and I agree to copyright
assignment to Hipp, Wyrick & Company, Inc. to any patches submitted to
this ML.

Please review and consider.

Osamu

PS:  The previous "fossil import" code could not handle some
non-standard filenames.
From: Osamu Aoki 
Date: Tue, 11 Oct 2016 23:45:30 +0900
Subject: Fix export

Newline and UTF-8 characters in filename is now allowed

The git-fast-export code was analyzed as below.  This analysis was used to
create an independent code as this patch.

== Git fast-export filename encoding spec ==

Filenames exported by "git fast-export" are encoded and quoted if they contain
some non-plain ASCII alphanumeric characters.

Filenames imported by "git fast-import" are unencoded if it is recorded within
double quotes.

This memo documents the details of encoding and quotation to enable creating a
clean reverse engineered GPL unencumbered code in BSD-2-Clause license.

In Git 2.9.3, the focal point defining this feature:

* quote.c quote_c_style
Escape odd characters and quote the escaped string
Return TRUE if used

* builtin/fast-export.c   print_path_1
Use quote_c_style if if finds needs to quote and escape
Otherwise, quote entire string if ' ' is found in it
If neither, use the original filename to export

* quote.c unquote_c_style
Unescape escaped characters

The following table summarizes the end result for each character found in the
filename for the combined effects of the above 2 functions:

 01234567 89abcdef
0x00 OOOa btnvfrOO
0x10  
0x20 QAEA   (quote space and escape double quote)
0x30  
0x40  
0x50  EAAA  (escape backslash)
0x60  
0x70  AAAO  (DEL is octal!)
0x80  
0x90  
0xa0  
0xb0  
0xc0  
0xd0  
0xe0  
0xf0  

Here each character is represented as HEX number adding row and column index.

The default of the quoting flag is FALSE.  The meaning of the conversion rule
indicators are the following:
---
 src/export.c | 60 
 1 file changed, 56 insertions(+), 4 deletions(-)

diff --git a/src/export.c b/src/export.c
index f524cdc..e677351 100644
--- a/src/export.c
+++ b/src/export.c
@@ -305,6 +305,49 @@ void export_marks(FILE* f, Bag *blobs, Bag *vers){
 }
 
 /*
+** Quote and escape a filename to be exported if it contains some special
+** characters.  This implements not only the minimum requirements
+** '\\', '"' and '\n' but also 3 digits octal escapes for all high bits
+** characters and other standard single character escapes such as
+** '\a'..'\r' on par with what the git-fast-export does.
+*/
+static void quote_git_filename(const char *zName, char *name){
+  int i, j;
+  int needQuote;
+  static char escs[] = "abtnvfr";
+  needQuote = 0;
+  for(i=0; zName[i]!=0; i++){
+if( zName[i]<=' ' || zName[i]>'~' || zName[i]=='\\' || zName[i]=='"' ){
+  needQuote = 1;
+}
+  }
+  j = 0;
+  if( needQuote==1 ){
+name[j++] = '"';
+  }
+  for(i=0; zName[i]!=0; i++){
+if( zName[i]=='\\' || zName[i]=='"' ){
+  name[j++] = '\\';
+  name[j++] = zName[i];
+}else if ( zName[i]>=' ' && zName[i]<='~' ){
+  name[j++] = zName[i];
+}else if( zName[i]>='\a' && zName[i]<='\r' ){
+  name[j++] = '\\';
+  name[j++] = escs[( zName[i] - '\a')];
+}else{
+  name[j++] = '\\';
+  name[j++] = ((zName[i] >> 6) & '\03') + '0';
+  name[j++] = ((zName[i] >> 3) & '\07') + '0';
+  name[j++] = ((zName[i] >> 0) & '\07') + '0';
+}
+  }
+  if( needQuote==1 ){
+name[j++] = '"';
+  }
+  name[j] = '\0';
+}
+
+/*
 ** COMMAND: export
 **
 ** Usage: %fossil export --git ?OPTIONS? ?REPOSITORY?
@@ -516,19 +559,28 @@ void export_cmd(void){
 );
 while( db_step()==SQLITE_ROW ){
   const char *zName = db_column_text(,0);
+  char *name;
   int zNew = db_column_int(,1);
   int mPerm = db_column_int(,2);
-  if( zNew==0)
-printf("D %s\n", zName);
-  else if( bag_find(, zNew) ) {
+  if( zName==0 || zName=="" ){
+name = fossil_malloc( 1 );
+name[0] = '\0';
+  }else{
+name = fossil_malloc( 4*strlen(zName) + 2 + 1 );
+  }
+  quote_git_filename(zName, name);
+  if( zNew==0 ){
+printf("D %s\n", name);
+  }else if( bag_find(, zNew) ){
 const char *zPerm;
 switch( mPerm ){

Re: [fossil-users] How to make post-commit hook?

2016-10-14 Thread Svyatoslav Mishyn
(Thu, 13 Oct 08:25) Nickolas Lloyd:
> At a cursory glance, it looks like the `fsl' tool would allow you to do
> something similar: just define a new `fsl' command that will do the
> commit, export, and push all in one step.

So, now I just use a function that imitates a post-commit hook.
Not perfect, but it works.

https://f.juef.space/dotfiles/artifact/c164208b86419f679ac644ab8536eb66d96300dd?txt=1=86,115


-- 
I am not a native English speaker,
so feel free to correct any spelling or grammatical errors!


signature.asc
Description: PGP signature
___
fossil-users mailing list
fossil-users@lists.fossil-scm.org
http://lists.fossil-scm.org:8080/cgi-bin/mailman/listinfo/fossil-users