mholt / archiver

DEPRECATED. Please use mholt/archives instead.
https://github.com/mholt/archives
MIT License
4.45k stars 392 forks source link

arc -mkdirs jj-v0.22.0-aarch64-apple-darwin.tar.gz format unrecognized by filename: #424

Closed gedw99 closed 1 month ago

gedw99 commented 1 month ago

sorry to post such a lame issue, but I guess the cli just does not yet support sniffing the archive type and then extracting it yet ?

full reproduction :)

Makefile


# https://github.com/martinvonz/jj

DEP_ROOT_NAME=.dep
DEP_ROOT=$(PWD)/.dep

PATH:=$(DEP_ROOT):$(PATH)

JJ_BIN=jj

jj-dep-dep:
    mkdir -p $(DEP_ROOT)
    go install github.com/bitrise-io/got/cmd/wgot@latest
    mv $(GOPATH)/bin/wgot $(DEP_ROOT)/wgot

    # https://github.com/mholt/archiver
    go install github.com/mholt/archiver/v3/cmd/arc@latest
    mv $(GOPATH)/bin/arc $(DEP_ROOT)/arc

jj-dep: jj-dep-dep

    cd $(DEP_ROOT) && wgot https://github.com/martinvonz/jj/releases/download/v0.22.0/jj-v0.22.0-aarch64-apple-darwin.tar.gz
    cd $(DEP_ROOT) && ls -al
    cd $(DEP_ROOT) && arc -h
    cd $(DEP_ROOT) && arc  -mkdirs jj-v0.22.0-aarch64-apple-darwin.tar.gz
    #cd $(DEP_ROOT) && rm -f jj-v0.22.0-aarch64-apple-darwin.tar.gz

Run it: here we go... juicy error bit is at the bottom !!

make jj-dep                                 
mkdir -p /Users/apple/workspace/go/src/junk/clock-data-star/.dep
go install github.com/bitrise-io/got/cmd/wgot@latest
mv /Users/apple/workspace/go/bin/wgot /Users/apple/workspace/go/src/junk/clock-data-star/.dep/wgot
# https://github.com/mholt/archiver
go install github.com/mholt/archiver/v3/cmd/arc@latest
mv /Users/apple/workspace/go/bin/arc /Users/apple/workspace/go/src/junk/clock-data-star/.dep/arc
cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && wgot https://github.com/martinvonz/jj/releases/download/v0.22.0/jj-v0.22.0-aarch64-apple-darwin.tar.gz
✔ https://github.com/martinvonz/jj/releases/download/v0.22.0/jj-v0.22.0-aarch64-apple-darwin.tar.gz
cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && ls -al
total 102928
drwxr-xr-x   6 apple  staff       192 20 Oct 14:44 .
drwxr-xr-x  16 apple  staff       512 20 Oct 14:43 ..
-rwxr-xr-x   1 apple  staff   8486034 20 Oct 14:44 arc
-rwxr-xr-x   1 apple  staff  24229842 20 Oct 14:33 git-town
-rw-r--r--   1 apple  staff   9068411 20 Oct 14:44 jj-v0.22.0-aarch64-apple-darwin.tar.gz
-rwxr-xr-x   1 apple  staff  10911074 20 Oct 14:44 wgot
cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && arc -h
Usage: arc {archive|unarchive|extract|ls|compress|decompress|help} [arguments...]
  archive
    Create a new archive file. List the files/folders
    to include in the archive; at least one required.
  unarchive
    Extract an archive file. Provide the archive to
    open and the destination folder to extract into.
  extract
    Extract a single file or folder (recursively) from
    an archive. First argument is the source archive,
    second is the file to extract (exact path within the
    archive is required), and third is destination.
  ls
    List the contents of the archive.
  compress
    Compresses a file, destination optional.
  decompress
    Decompresses a file, destination optional.
  help
    Display this help text. Also -h or --help.

  SPECIFYING THE ARCHIVE FORMAT
    The format of the archive is determined by its
    file extension*. Supported extensions:
      .zip
      .tar
      .tar.br
      .tbr
      .tar.gz
      .tgz
      .tar.bz2
      .tbz2
      .tar.xz
      .txz
      .tar.lz4
      .tlz4
      .tar.sz
      .tsz
      .zst
      .tar.zst
      .rar (open only)
      .bz2
      .gz
      .lz4
      .sz
      .xz

    *use flag --ext to manually set filetype. example: --ext=tar.gz

  (DE)COMPRESSING SINGLE FILES
    Some formats are compression-only, and can be used
    with the compress and decompress commands on a
    single file; they do not bundle multiple files.

    To replace a file when compressing, specify the
    source file name for the first argument, and the
    compression format (without leading dot) for the
    second argument. To replace a file when decompressing,
    specify only the source file and no destination.

  PASSWORD-PROTECTED RAR FILES
    Export the ARCHIVE_PASSWORD environment variable
    to be able to open password-protected rar archives.

  GLOBAL FLAG REFERENCE
    The following global flags may be used before the
    sub-command (some flags are format-specific):

  -allow-errors
        Log errors and continue processing (default true)
  -ext string
        specify file type
  -folder-safe
        If an archive does not have a single top-level folder, create one implicitly (default true)
  -level int
        Compression level (default -1)
  -mkdirs
        Make all necessary directories
  -overwrite
        Overwrite existing files
  -smart
        Only compress files which are not already compressed (zip only) (default true)
  -strip-components int
        Strip number of leading paths

cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && arc  -mkdirs jj-v0.22.0-aarch64-apple-darwin.tar.gz
format unrecognized by filename: 
gedw99 commented 1 month ago

got it all working.

for future lazy devs like me :)


# https://github.com/martinvonz/jj

WGOT_BIN=wgot
WGOT_BIN_WHICH=$(shell which $(WGOT_BIN))
ARC_BIN=arc
ARC_BIN_WHICH=$(shell which $(ARC_BIN))

JJ_BIN=jj
JJ_BIN_WHICH=$(shell which $(JJ_BIN))

jj-print:
    @echo ""

jj-dep-clean:
    rm -f $(WGOT_BIN_WHICH)
    rm -f $(ARC_BIN_WHICH)
    rm -f $(JJ_BIN_WHICH)

jj-dep-dep:
    mkdir -p $(DEP_ROOT)

ifeq ($(WGOT_BIN_WHICH), )
    # https://github.com/bitrise-io/got
    go install github.com/bitrise-io/got/cmd/wgot@latest
    mv $(GOPATH)/bin/wgot $(DEP_ROOT)/wgot
endif

ifeq ($(ARC_BIN_WHICH), )
    # https://github.com/mholt/archiver
    go install github.com/mholt/archiver/v3/cmd/arc@latest
    mv $(GOPATH)/bin/arc $(DEP_ROOT)/arc
endif

jj-dep: jj-dep-dep

ifeq ($(JJ_BIN_WHICH), )
    cd $(DEP_ROOT) && wgot https://github.com/martinvonz/jj/releases/download/v0.22.0/jj-v0.22.0-aarch64-apple-darwin.tar.gz
    #cd $(DEP_ROOT) && ls -al
    #cd $(DEP_ROOT) && arc --help
    #cd $(DEP_ROOT) && arc ls jj-v0.22.0-aarch64-apple-darwin.tar.gz

    # nope
    #cd $(DEP_ROOT) && arc unarchive --ext=tar.gz -mkdirs -overwrite jj-v0.22.0-aarch64-apple-darwin.tar.gz

    # yes
    cd $(DEP_ROOT) && arc unarchive jj-v0.22.0-aarch64-apple-darwin.tar.gz
    cp $(DEP_ROOT)/jj-v0/jj $(DEP_ROOT)/jj

    # clean up
    rm -rf $(DEP_ROOT)/jj-v0
    rm -f $(DEP_ROOT)/jj-v0.22.0-aarch64-apple-darwin.tar.gz
endif

jj-h: jj-dep
    $(JJ_BIN) --help

here we go:


make jj-dep-clean
rm -f /Users/apple/workspace/go/src/junk/clock-data-star/.dep/wgot
rm -f /Users/apple/workspace/go/src/junk/clock-data-star/.dep/arc
rm -f /Users/apple/workspace/go/src/junk/clock-data-star/.dep/jj

make jj-h        
mkdir -p /Users/apple/workspace/go/src/junk/clock-data-star/.dep
# https://github.com/bitrise-io/got
go install github.com/bitrise-io/got/cmd/wgot@latest
mv /Users/apple/workspace/go/bin/wgot /Users/apple/workspace/go/src/junk/clock-data-star/.dep/wgot
# https://github.com/mholt/archiver
go install github.com/mholt/archiver/v3/cmd/arc@latest
mv /Users/apple/workspace/go/bin/arc /Users/apple/workspace/go/src/junk/clock-data-star/.dep/arc
cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && wgot https://github.com/martinvonz/jj/releases/download/v0.22.0/jj-v0.22.0-aarch64-apple-darwin.tar.gz
✔ https://github.com/martinvonz/jj/releases/download/v0.22.0/jj-v0.22.0-aarch64-apple-darwin.tar.gz
#cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && ls -al
#cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && arc --help
#cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && arc ls jj-v0.22.0-aarch64-apple-darwin.tar.gz
# nope
#cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && arc unarchive --ext=tar.gz -mkdirs -overwrite jj-v0.22.0-aarch64-apple-darwin.tar.gz
# yes
cd /Users/apple/workspace/go/src/junk/clock-data-star/.dep && arc unarchive jj-v0.22.0-aarch64-apple-darwin.tar.gz
cp /Users/apple/workspace/go/src/junk/clock-data-star/.dep/jj-v0/jj /Users/apple/workspace/go/src/junk/clock-data-star/.dep/jj
# clean up
rm -rf /Users/apple/workspace/go/src/junk/clock-data-star/.dep/jj-v0
rm -f /Users/apple/workspace/go/src/junk/clock-data-star/.dep/jj-v0.22.0-aarch64-apple-darwin.tar.gz
jj --help
Jujutsu (An experimental VCS)

To get started, see the tutorial at https://martinvonz.github.io/jj/latest/tutorial/.
gedw99 commented 1 month ago

sorry about the noise... closing...