← Back to team overview

launchpad-reviewers team mailing list archive

Re: [Merge] ~ruinedyourlife/launchpad:native-tools-publishing into launchpad:master

 

Agree with Enrique's comment, and left one more small one. Will approve after those are addressed, thanks!

Diff comments:

> diff --git a/lib/lp/archiveuploader/craftrecipeupload.py b/lib/lp/archiveuploader/craftrecipeupload.py
> index 7d62488..0596477 100644
> --- a/lib/lp/archiveuploader/craftrecipeupload.py
> +++ b/lib/lp/archiveuploader/craftrecipeupload.py
> @@ -123,10 +134,61 @@ class CraftRecipeUpload:
>                              restricted=build.is_private,
>                          )
>                      build.addFile(libraryfile)
> +                elif jar_files and pom_files:

This also relies on `metadata_path.exists()` right?

> +                    try:
> +                        metadata = yaml.safe_load(metadata_path.read_text())
> +                        jar_name = metadata.get("name")
> +                        jar_version = metadata.get("version")
> +                        self.logger.debug(
> +                            "Found jar %s version %s",
> +                            jar_name,
> +                            jar_version,
> +                        )
> +                    except Exception as e:
> +                        self.logger.warning(
> +                            "Failed to parse metadata.yaml: %s", e
> +                        )
> +
> +                    # Upload the JAR file
> +                    jar_path = jar_files[0]
> +                    with open(jar_path, "rb") as file:
> +                        libraryfile = self.librarian.create(
> +                            os.path.basename(str(jar_path)),
> +                            os.stat(jar_path).st_size,
> +                            file,
> +                            filenameToContentType(str(jar_path)),
> +                            restricted=build.is_private,
> +                        )
> +                    build.addFile(libraryfile)
> +
> +                    # Upload the POM file
> +                    pom_path = pom_files[0]
> +                    with open(pom_path, "rb") as file:
> +                        libraryfile = self.librarian.create(
> +                            "pom.xml",
> +                            os.stat(pom_path).st_size,
> +                            file,
> +                            filenameToContentType(str(pom_path)),
> +                            restricted=build.is_private,
> +                        )
> +                    build.addFile(libraryfile)
> +
> +                    # Upload metadata.yaml
> +                    with open(metadata_path, "rb") as file:
> +                        libraryfile = self.librarian.create(
> +                            "metadata.yaml",
> +                            os.stat(metadata_path).st_size,
> +                            file,
> +                            filenameToContentType(str(metadata_path)),
> +                            restricted=build.is_private,
> +                        )
> +                    build.addFile(libraryfile)
>                  else:
> -                    # If no crate file found, upload the original archive
> +                    # If no crate or jar+pom files found
> +                    # upload the original archive
>                      self.logger.debug(
> -                        "No crate files found in archive, " "uploading tar.xz"
> +                        "No crate or jar+pom found in archive, "
> +                        "uploading tar.xz"
>                      )
>                      with open(craft_path, "rb") as file:
>                          libraryfile = self.librarian.create(


-- 
https://code.launchpad.net/~ruinedyourlife/launchpad/+git/launchpad/+merge/483691
Your team Launchpad code reviewers is requested to review the proposed merge of ~ruinedyourlife/launchpad:native-tools-publishing into launchpad:master.



References