[PATCH libnbd] golang: make-dist.sh: Use strict ISO 8601 format
Go fail to parse the short date format (2021-11-30) from the @latest and .info file. Replace with %cI - strict ISO 8601 format. Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- golang/make-dist.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/golang/make-dist.sh b/golang/make-dist.sh index 86785e5d..c658f928 100755 --- a/golang/make-dist.sh +++ b/golang/make-dist.sh @@ -94,38 +94,40 @@ rm -rf libguestfs.org # └── v1.11.4.zip # # We create @latest and @v/*{.info,mod,zip} here. # # The "@v/list" file must be created on the web server after uploading # a new release: # # $ cd libguestfs.org/libnbd/@v # $ ls -1 v*.info | awk -F.info '{print $1}' > list # $ cat list # v1.11.3 # v1.11.4 # # See https://golang.org/ref/mod#serving-from-proxy module_dir=libguestfs.org/libnbd v_dir=$module_dir/@v mkdir -p $v_dir +# Go wants a string in RFC 3339, git strict ISO 8601 format is +# compatible. info="{ \"Version\": \"$version\", - \"Time\": \"$(git show -s --format=%cs)\" + \"Time\": \"$(git show -s --format=%cI)\" }" echo "$info" > $module_dir/@latest echo "$info" > $v_dir/$version.info cp go.mod $v_dir/$version.mod mv $version.zip $v_dir # Create tarball to upload and extract on the webserver. It should be # extracted in the directory pointed by the "go-import" meta tag. output=$PWD/libnbd-golang-$version.tar.gz tar czf $output libguestfs.org rm -rf libguestfs.org echo output written to $output -- 2.33.1
On Fri, Dec 3, 2021 at 12:18 AM Nir Soffer <nsoffer@redhat.com> wrote:
Go fail to parse the short date format (2021-11-30) from the @latest and .info file. Replace with %cI - strict ISO 8601 format.
Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- golang/make-dist.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/golang/make-dist.sh b/golang/make-dist.sh index 86785e5d..c658f928 100755 --- a/golang/make-dist.sh +++ b/golang/make-dist.sh @@ -94,38 +94,40 @@ rm -rf libguestfs.org # └── v1.11.4.zip # # We create @latest and @v/*{.info,mod,zip} here. # # The "@v/list" file must be created on the web server after uploading # a new release: # # $ cd libguestfs.org/libnbd/@v # $ ls -1 v*.info | awk -F.info '{print $1}' > list # $ cat list # v1.11.3 # v1.11.4 # # See https://golang.org/ref/mod#serving-from-proxy
module_dir=libguestfs.org/libnbd v_dir=$module_dir/@v
mkdir -p $v_dir
+# Go wants a string in RFC 3339, git strict ISO 8601 format is +# compatible. info="{ \"Version\": \"$version\", - \"Time\": \"$(git show -s --format=%cs)\" + \"Time\": \"$(git show -s --format=%cI)\" }" echo "$info" > $module_dir/@latest echo "$info" > $v_dir/$version.info
cp go.mod $v_dir/$version.mod mv $version.zip $v_dir
# Create tarball to upload and extract on the webserver. It should be # extracted in the directory pointed by the "go-import" meta tag. output=$PWD/libnbd-golang-$version.tar.gz tar czf $output libguestfs.org
rm -rf libguestfs.org
echo output written to $output -- 2.33.1
Tested using: $ ./make-dist.sh output written to /home/nsoffer/src/libnbd/golang/libnbd-golang-v1.11.5-1-g1b235f3e.tar.gz $ tar xvf libnbd-golang-v1.11.5-1-g1b235f3e.tar.gz libguestfs.org/ libguestfs.org/libnbd/ libguestfs.org/libnbd/@v/ libguestfs.org/libnbd/@v/v1.11.5-1-g1b235f3e.info libguestfs.org/libnbd/@v/v1.11.5-1-g1b235f3e.mod libguestfs.org/libnbd/@v/v1.11.5-1-g1b235f3e.zip libguestfs.org/libnbd/@latest Create list file: $ echo v1.11.5-1-g1b235f3e > libguestfs.org/libnbd/@v/list
From another shell in a project using libnbd:
$ go mod graph ovirt.org/ovirt-img libguestfs.org/libnbd@v1.11.3-4-g3226ff802 ovirt.org/ovirt-img ovirt.org/imageio@v0.0.0-00010101000000-000000000000 $ GOPROXY=file:///home/nsoffer/src/libnbd/golang go get -u go get: upgraded libguestfs.org/libnbd v1.11.3-4-g3226ff802 => v1.11.5-1-g1b235f3e $ git diff diff --git a/ovirt-img/go.mod b/ovirt-img/go.mod index 513947d..1ec6a67 100644 --- a/ovirt-img/go.mod +++ b/ovirt-img/go.mod @@ -1,11 +1,11 @@ module ovirt.org/ovirt-img // imageio-go is part of this repository. replace ovirt.org/imageio => ../go go 1.16 require ( - libguestfs.org/libnbd v1.11.3-4-g3226ff802 + libguestfs.org/libnbd v1.11.5-1-g1b235f3e ovirt.org/imageio v0.0.0-00010101000000-000000000000 ) diff --git a/ovirt-img/go.sum b/ovirt-img/go.sum index 5399478..798171f 100644 --- a/ovirt-img/go.sum +++ b/ovirt-img/go.sum @@ -1,2 +1,4 @@ libguestfs.org/libnbd v1.11.3-4-g3226ff802 h1:7ZNhVreHSeHS+aK1PXPZvcHY43ikvAnoFDE9blNSQ3E= libguestfs.org/libnbd v1.11.3-4-g3226ff802/go.mod h1:Qd8vaULc6nlNgj9+6qDNm1vSD/J7/wgoIlwmCh8uxAc= +libguestfs.org/libnbd v1.11.5-1-g1b235f3e h1:/fS9ohEtaL0nDBDl54NWqoNBD9NwEweB/TNnmmUaDUc= +libguestfs.org/libnbd v1.11.5-1-g1b235f3e/go.mod h1:Qd8vaULc6nlNgj9+6qDNm1vSD/J7/wgoIlwmCh8uxAc=
On Fri, Dec 03, 2021 at 12:18:27AM +0200, Nir Soffer wrote:
Go fail to parse the short date format (2021-11-30) from the @latest and .info file. Replace with %cI - strict ISO 8601 format.
Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- golang/make-dist.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/golang/make-dist.sh b/golang/make-dist.sh index 86785e5d..c658f928 100755 --- a/golang/make-dist.sh +++ b/golang/make-dist.sh @@ -94,38 +94,40 @@ rm -rf libguestfs.org # └── v1.11.4.zip # # We create @latest and @v/*{.info,mod,zip} here. # # The "@v/list" file must be created on the web server after uploading # a new release: # # $ cd libguestfs.org/libnbd/@v # $ ls -1 v*.info | awk -F.info '{print $1}' > list # $ cat list # v1.11.3 # v1.11.4 # # See https://golang.org/ref/mod#serving-from-proxy
module_dir=libguestfs.org/libnbd v_dir=$module_dir/@v
mkdir -p $v_dir
+# Go wants a string in RFC 3339, git strict ISO 8601 format is +# compatible. info="{ \"Version\": \"$version\", - \"Time\": \"$(git show -s --format=%cs)\" + \"Time\": \"$(git show -s --format=%cI)\" }" echo "$info" > $module_dir/@latest echo "$info" > $v_dir/$version.info
cp go.mod $v_dir/$version.mod mv $version.zip $v_dir
# Create tarball to upload and extract on the webserver. It should be # extracted in the directory pointed by the "go-import" meta tag. output=$PWD/libnbd-golang-$version.tar.gz tar czf $output libguestfs.org
rm -rf libguestfs.org
echo output written to $output
This looks OK, ACK. The other problem was the list file not containing all versions. Rich. -- Richard Jones, Virtualization Group, Red Hat http://people.redhat.com/~rjones Read my programming and virtualization blog: http://rwmj.wordpress.com virt-p2v converts physical machines to virtual machines. Boot with a live CD or over the network (PXE) and turn machines into KVM guests. http://libguestfs.org/virt-v2v
On Fri, Dec 3, 2021 at 10:38 AM Richard W.M. Jones <rjones@redhat.com> wrote:
On Fri, Dec 03, 2021 at 12:18:27AM +0200, Nir Soffer wrote:
Go fail to parse the short date format (2021-11-30) from the @latest and .info file. Replace with %cI - strict ISO 8601 format.
Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- golang/make-dist.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
diff --git a/golang/make-dist.sh b/golang/make-dist.sh index 86785e5d..c658f928 100755 --- a/golang/make-dist.sh +++ b/golang/make-dist.sh @@ -94,38 +94,40 @@ rm -rf libguestfs.org # └── v1.11.4.zip # # We create @latest and @v/*{.info,mod,zip} here. # # The "@v/list" file must be created on the web server after uploading # a new release: # # $ cd libguestfs.org/libnbd/@v # $ ls -1 v*.info | awk -F.info '{print $1}' > list # $ cat list # v1.11.3 # v1.11.4 # # See https://golang.org/ref/mod#serving-from-proxy
module_dir=libguestfs.org/libnbd v_dir=$module_dir/@v
mkdir -p $v_dir
+# Go wants a string in RFC 3339, git strict ISO 8601 format is +# compatible. info="{ \"Version\": \"$version\", - \"Time\": \"$(git show -s --format=%cs)\" + \"Time\": \"$(git show -s --format=%cI)\" }" echo "$info" > $module_dir/@latest echo "$info" > $v_dir/$version.info
cp go.mod $v_dir/$version.mod mv $version.zip $v_dir
# Create tarball to upload and extract on the webserver. It should be # extracted in the directory pointed by the "go-import" meta tag. output=$PWD/libnbd-golang-$version.tar.gz tar czf $output libguestfs.org
rm -rf libguestfs.org
echo output written to $output
This looks OK, ACK.
The other problem was the list file not containing all versions.
We discussed this in @guestfs. I think this is the simplest and most robust way: curl https://download.libguestfs.org/libnbd/golang/libguestfs.org/libnbd/@v/list
list echo current_version >> list
And include the list file in the distribution tar, so unpacking the tar will update the server completely, without any manual steps. The disadvantage is that a broken list file on the server will be propagated to the next build. But we should never have broken list file on the server since this breaks the Go tools. What do you think?
On Fri, Dec 03, 2021 at 12:18:27AM +0200, Nir Soffer wrote:
Go fail to parse the short date format (2021-11-30) from the @latest and
s/fail/fails/
.info file. Replace with %cI - strict ISO 8601 format.
Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- golang/make-dist.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
+# Go wants a string in RFC 3339, git strict ISO 8601 format is +# compatible. info="{ \"Version\": \"$version\", - \"Time\": \"$(git show -s --format=%cs)\" + \"Time\": \"$(git show -s --format=%cI)\"
Interesting that this preserves the timezone information of the committer. -- Eric Blake, Principal Software Engineer Red Hat, Inc. +1-919-301-3266 Virtualization: qemu.org | libvirt.org
On Fri, Dec 3, 2021 at 4:18 PM Eric Blake <eblake@redhat.com> wrote:
On Fri, Dec 03, 2021 at 12:18:27AM +0200, Nir Soffer wrote:
Go fail to parse the short date format (2021-11-30) from the @latest and
s/fail/fails/
Thanks, I will amend before pushing.
.info file. Replace with %cI - strict ISO 8601 format.
Signed-off-by: Nir Soffer <nsoffer@redhat.com> --- golang/make-dist.sh | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-)
+# Go wants a string in RFC 3339, git strict ISO 8601 format is +# compatible. info="{ \"Version\": \"$version\", - \"Time\": \"$(git show -s --format=%cs)\" + \"Time\": \"$(git show -s --format=%cI)\"
Interesting that this preserves the timezone information of the committer.
It makes sense, and with timezone it is easy to compare just like UTC timestamp. Nir
On Fri, Dec 3, 2021 at 5:50 PM Nir Soffer <nsoffer@redhat.com> wrote:
On Fri, Dec 3, 2021 at 4:18 PM Eric Blake <eblake@redhat.com> wrote:
On Fri, Dec 03, 2021 at 12:18:27AM +0200, Nir Soffer wrote:
Go fail to parse the short date format (2021-11-30) from the @latest and
s/fail/fails/
Thanks, I will amend before pushing.
Pushed as 0c838f5ef6470487cb938262660e455825186c35.
participants (3)
-
Eric Blake -
Nir Soffer -
Richard W.M. Jones