Pulp 3 files plugin - pulp

I am reading pulp files REST API documentation
https://docs.pulpproject.org/pulp_file/restapi.html#operation/content_file_files_list
and I see that I can upload file content and then publish it so that it become available for download. But is it possible to delete old file content after it was uploaded?

Related

What is the best way to retrieve a single folder from a github repository in a python script?

I need to download a single folder from a github repository in a Python 3 script.
Listing all raw file URLs to download is tedious and eventual new files would need to be added manually
Downloading the whole repository as zip takes rather long; there are lots of unneeded files. [This how I do at the moment]
I have read about web services that do what I would need, such as downgit.github.io, but the problem is that generating the relevant URL and fetching it via urllib.request.urlretrive() downloads the website rather than the actual file.
What can I do? Is there a web service that provides raw file links that I can download as described above?
I just found a solution: The ffspec library may be used to download a single folder from a GitHub repository using Python. See https://sebastianwallkoetter.wordpress.com/2022/01/30/copy-github-folders-using-python/

Transfering files through github API

I am trying to transfer files using the GitHub API by curl. The files may have any extension (eg: .java, .jar, .jpg, etc). I have found no solutions in the net. Is there a way I can do this? Or is it even possible?
What do you mean by transfer file?
there is an option of uploading a blob files through the github api /repos/git/blobs.
you should add a parameter of the content of the file in base64 format.
if you want to use them later on you can create new tree with the returned SHA.
base64 online converter: https://www.base64decode.org/

What is the best way to extract .zip file/folder structure then commit to Github using Github API?

I'm trying to place some config files under version control using Github. The ONLY way to get these particular config files is via a GET request to the hosting server. Server responds with a .zip file.
.zip file structure looks similar to:
|-Folder1
--|-File1.json
--|-File2.json
--|-Pic1.jpg
|-Folder2
--|-File3.json
--|Folder3
----|Pic2.jpg
|-File4.json
|-File5.json
As you can see, its a mix of text and binary files. Also has a nested folder structure.
I need to:
Commit this .zip file to Github using the Github REST API (no problem there)
But BEFORE committing, how can I programmatically extract the folders and files (LEAVING THE FOLDER STRUCTURE IN PLACE)
Commit the results to Github
I've checked the question/solutions mentioned here, but they don't quite match/are a few years old.
Anyone have a workflow for doing this? I have to imagine SOMEONE has come across similar requirements.
I ended up using Power Automate to handle this.
Basically,
GET .zip file
Add it to OneDrive for Business
Extract it there (folder structure is "flattened", but luckily OneDrive "keeps" it by renaming each file)
Example: Folder1/File1.json in the .zip becomes Folder1_File1.json once extracted
When committing to Github via api, I just did a replace for the filename; INCLUDING the / as part of the path.
Example URL: https://api.github.com/repos/SeaDude/replace(items('FOR_EACH_app')?['properties']?['DisplayName'], ' ', '-')/contents/replace(items('FOR_EACH_source_file_2')?['Name'],'_','/')
Apparently, you can specify an empty (or non-empty) path as part of an API commit. If the directory is empty, Github will create it!

Automatically upload ProGuard mapping files to play console

Is pretty annoying to upload the ProGuard mapping files to google play console everytime i need to build a new version of my apk (my gradle build generate 4 different apks for every release so i do need to upload 4 different mapping files)
I was wondering if is possible to make this process automatically then i found this article
https://developers.google.com/android-publisher/api-ref/edits/deobfuscationfiles/upload
So google does have an api to upload the mapping files, is there any gradle plugin to work with? is there any easy way to integrate?
Suggestion: If you publish an Android App Bundle instead of APKs, the deobfuscation mapping file will be uploaded automatically with your artifact so you don't have to do it separately.
For the curious, the mapping file is located at BUNDLE-METADATA/com.android.tools.build.obfuscation/proguard.map in AAB (which is, like the APK format, just a ZIP file).
you can write a gradle build script to run tasks after build complees
and then you can use something like this file upload plugin to upload the file to the url
when you have Crashlytics set up, this is being explained here. there's also a Play Publisher Plugin for Gradle, while it does no seem to upload the mapping.txt. if you want to use that API, it should be easy to extend eg. the Google Cloud PHP Client with another API endpoint.

Transfer zip file to web server

I would like to develop an app that targets everything from Gingerbread(version 2.3 API 9) to JellyBean(version 4.3 API 18).
The problem:
I need to transfer large images(40 to 50 at a time) either independently or in a zip file without the user having to click on each file being transferred. As far as I can tell I need to use the HttpClient(org.apache) that was deprecated after JellyBean.
Right now the application takes the images and zips them to a zip file prior to uploading. I can create additional zip files, for example if I have 50MB to transfer I can make each zip file about 10MB and have 5 files to be transferred if I have to. I need to transfer these files to a web server. I cant seem to find anything about transferring files after Jellybean. All the searching I've done uses the deprecated commands and the posts are 2-5 years old. I have installed andftp and transferred a 16MB zip file last night that was created by my app, but I really don't want to use that as it will require additional steps from the user. I will try andftp today and setup an intent to transfer the files to see how that works out. Supposedly andftp works until Lollipop(5.0). If there is an easier way please let me know, hopefully I've missed something about transferring files. Is there another way to do this after JellyBean?

Resources