Repository: conan-io/conan-center-index

Issue:
argparse  argparse/2.1: descrepency between downloaded package files vs actual index file and github version
using https://github.com/p-ranav/argparse
conan-center has v2.1

My remote:
```
conan remote list
conan-center: https://center.conan.io [Verify SSL: True]
```

It was 
```
conan remote list
conan-center: https://conan.bintray.com [Verify SSL: True]
```

and I updated it to point to the new center.conan.io.
```
conan remote update conan-center https://center.conan.io
```

```
conan --version
Conan version 1.40.0
x86_64 machine. Ubuntu 18.04.
Python 3.7.10, using conan in a venv
```
Only using default profile:
```
[settings]
os=Linux
os_build=Linux
arch=x86_64
arch_build=x86_64
compiler=gcc
compiler.version=9
compiler.libcxx=libstdc++11
build_type=Release
[options]
[build_requires]
[env]
```


Per my understanding, this is what I should see:
https://github.com/conan-io/conan-center-index/blob/0be2132ba0d229068bf78770319c51cadfa622c4/recipes/argparse/all/conandata.yml#L3

and indeed when wget this: https://github.com/p-ranav/argparse/archive/v2.1.tar.gz I'm getting the right files (it's a single header C++ library btw)

I tried
```
conan install --build=missing --update ..
```
and even 
```
conan remove argparse
```
and re-installing it. Same header (old, not the v2.1) is downloaded.

my conandata.yml
```
cat ~/.conan/data/argparse/2.1/_/_/export/conandata.yml
sources:
  '2.1':
    sha256: 0a82f464b568b8ee6650fc837f371eb9c81417e2ef9fb3b51f65ad50fa3b8662
    url: https://github.com/p-ranav/argparse/archive/v2.1.tar.gz
```

and here is the diff:
```
wget https://github.com/p-ranav/argparse/archive/v2.1.tar.gz
tar zxvf ./v2.1.tar.gz
md5sum argparse-2.1/include/argparse/argparse.hpp
f60449c9860d46cf3e5926017ccf079e  argparse-2.1/include/argparse/argparse.hpp
 md5sum ~/.conan/data/argparse/2.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/argparse/argparse.hpp
ae35c7d5423ccfd149b7f0fd060c2f87  ~/.conan/data/argparse/2.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/argparse/argparse.hpp

wc -l argparse-2.1/include/argparse/argparse.hpp
1107 argparse-2.1/include/argparse/argparse.hpp

wc -l /usr2/kobic/.conan/data/argparse/2.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/argparse/argparse.hpp
621 ~/.conan/data/argparse/2.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/argparse/argparse.hpp
```

So clearly what conan has in cache and what is in the v2.1 tag are 2 different things.

Question is, why the indexing is saying v2.1, the tgz is OK, but something else resides in the conan center backend.



Discussion:
I can reproduce.
```
conan remove -f argparse
conan install argparse/2.1@

cd /tmp
rm -rf v2.1.tar.gz argparse-2.1
wget https://github.com/p-ranav/argparse/archive/v2.1.tar.gz
tar xf v2.1.tar.gz

md5sum ~/.conan/data/argparse/2.1/_/_/package/5ab84d6acfe1f23c4fae0ab88f26e3a396351ac9/include/argparse/argparse.hpp
md5sum /tmp/argparse-2.1/include/argparse/argparse.hpp
```

The one in the conan cache has `Copyright (c) 2019`.
The one in the 2.1 tarball has `Copyright (c) 2019-2021`

I'm also curious how and what old version of argparse went into conan center.

OTOH, when running `conan create . argparse/2.1@` in the conan repo, I get a signature error.
I believe the p-ranav/argparse repo changed the v2.1 tag.

I see you have already opened an issue at https://github.com/p-ranav/argparse/issues/126.
It should mention that they changed the `v2.1` tag.


Look at https://github.com/p-ranav/argparse/releases/tag/v2.1
It says: *released this 4 days ago* -> 2021-09-08
Whereas I added a recipe for argparse/2.1 on 2020-02-08.
Can verify, the 2.1 contains the (c) 2019, and trying to create the package produces:

```bash
ConanException: sha256 signature failed for 'v2.1.tar.gz' file.
 Provided signature: 0a82f464b568b8ee6650fc837f371eb9c81417e2ef9fb3b51f65ad50fa3b8662
 Computed signature: 44f40a5b9908e722a419973f676bfad4f34d904bf23f89351c477988bc5c4044
```

Changing the signature, produces an incorrect package, (fails at test_package), because of the include location changed: \argparse\argparse, but at least the file is showing the (c)2019-2021
I have opened https://github.com/conan-io/conan-center-index/pull/7269, but lets see what they say regarding the tag v2.1 changes.
question is how conan folks can avoid such accident in the future? is there such a mechanism?
> 
> 
> question is how conan folks can avoid such accident in the future? is there such a mechanism?

This is not a Conan issue. Git tags / Releases shouldn't be re-released with changes. 

Resolving patch:
diff --git a/recipes/argparse/all/conanfile.py b/recipes/argparse/all/conanfile.py
--- a/recipes/argparse/all/conanfile.py
+++ b/recipes/argparse/all/conanfile.py
@@ -2,29 +2,33 @@
 from conans.errors import ConanInvalidConfiguration
 import os
 
+required_conan_version = ">=1.33.0"
+
 
 class ArgparseConan(ConanFile):
     name = "argparse"
     url = "https://github.com/conan-io/conan-center-index"
     homepage = "https://github.com/p-ranav/argparse"
-    topics = ("conan", "argparse", "argument", "parsing")
+    topics = ("argparse", "argument", "parsing")
     license = "MIT"
     description = "Argument Parser for Modern C++"
     settings = "compiler"
     no_copy_source = True
 
-    _compiler_required_cpp17 = {
-        "gcc": "7",
-        "clang": "5",
-        "Visual Studio": "15",
-        "apple-clang": "10",
-    }
+    @property
+    def _compiler_required_cpp17(self):
+        return {
+            "gcc": "7" if tools.Version(self.version) <= "2.1" else "8",
+            "clang": "5" if tools.Version(self.version) <= "2.1" else "7",
+            "Visual Studio": "15",
+            "apple-clang": "10",
+        }
 
     @property
     def _source_subfolder(self):
         return os.path.join(self.source_folder, "source_subfolder")
 
-    def configure(self):
+    def validate(self):
         if self.settings.get_safe("compiler.cppstd"):
             tools.check_min_cppstd(self, "17")
         try:
@@ -34,16 +38,25 @@ def configure(self):
         except KeyError:
             self.output.warn("This recipe has no support for the current compiler. Please consider adding it.")
 
+        if tools.Version(self.version) > "2.1" and self.settings.compiler == "clang" and self.settings.compiler.libcxx == "libstdc++":
+            raise ConanInvalidConfiguration("This recipe does not permit >2.1 with clang and stdlibc++. There may be an infrastructure issue in CCI.")
+
     def source(self):
-        tools.get(**self.conan_data["sources"][self.version])
-        os.rename("argparse-{}".format(self.version), self._source_subfolder)
+        tools.get(**self.conan_data["sources"][self.version], strip_root=True, destination=self._source_subfolder)
 
     def package(self):
         self.copy("LICENSE", src=self._source_subfolder, dst="licenses")
-        self.copy("*.hpp", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include", "argparse"))
+        if tools.Version(self.version) <= "2.1":
+            self.copy("*.hpp", src=os.path.join(self._source_subfolder, "include"), dst=os.path.join("include", "argparse"))
+        else:
+            self.copy("*.hpp", src=os.path.join(self._source_subfolder, "include"), dst="include")
 
     def package_id(self):
         self.info.header_only()
 
     def package_info(self):
-        self.cpp_info.includedirs.append(os.path.join("include", "argparse"))
+        self.cpp_info.names["cmake_find_package"] = "argparse"
+        self.cpp_info.names["cmake_find_package_multi"] = "argparse"
+        self.cpp_info.names["pkg_config"] = "argparse"
+        if tools.Version(self.version) <= "2.1":
+            self.cpp_info.includedirs.append(os.path.join("include", "argparse"))


Test patch:
diff --git a/recipes/argparse/all/test_package/test_package.cpp b/recipes/argparse/all/test_package/test_package.cpp
--- a/recipes/argparse/all/test_package/test_package.cpp
+++ b/recipes/argparse/all/test_package/test_package.cpp
@@ -1,4 +1,4 @@
-#include <argparse.hpp>
+#include <argparse/argparse.hpp>
 
 #include <iostream>
 
@@ -23,4 +23,3 @@ int main(int argc, char *argv[]) {
 
   return 0;
 }
-