podfile gives an error on install - cocoapods

I cloned a repo from git. Then removed the .git and .gitignore. The podFile looks like
platform :ios, '6.1'
pod 'AFNetworking', '~>1.3.3'
pod 'AFOAuth1Client'
After "pod install" I get the following errors:
$ pod install
Analyzing dependencies
[!] Pod::Executable pull
A ALPValidator/0.0.1/ALPValidator.podspec
A APAsyncDictionary/0.0.3/APAsyncDictionary.podspec
A ASCScreenBrightnessDetector/0.1.0/ASCScreenBrightnessDetector.podspec
A AdBrixSDK/3.0.8/AdBrixSDK.podspec
A AlertShortkut/1.0/AlertShortkut.podspec
A AppStoreOpener/0.0.1/AppStoreOpener.podspec
A Appboy-iOS-SDK/2.3.1/Appboy-iOS-SDK.podspec
A Apptimize/1.5.8/Apptimize.podspec
A AtkDragAndDrop/0.1.0/AtkDragAndDrop.podspec
A AuthorizeNet/0.1.0/AuthorizeNet.podspec
A BloodMagic/0.5.2/BloodMagic.podspec
A CKStringUtils/1.1.1/CKStringUtils.podspec
A CMHTMLView/0.2.0/CMHTMLView.podspec
A CTAssetsPickerController/1.5.0/CTAssetsPickerController.podspec
A CTFeedback/1.0.8/CTFeedback.podspec
U CardIO/3.2.0/CardIO.podspec
U CardIO/3.2.2/CardIO.podspec
U CardIO/3.3.0/CardIO.podspec
U CardIO/3.4.1/CardIO.podspec
U CardIO/3.4.3/CardIO.podspec
U CardIO/3.4.4/CardIO.podspec
A CargoBay/2.0.2/CargoBay.podspec
U CocoaSPDY/1.0.0/CocoaSPDY.podspec
A Colours/4.1/Colours.podspec
M CorePlot/1.0/CorePlot.podspec
M CorePlot/1.1/CorePlot.podspec
M CorePlot/1.2/CorePlot.podspec
M CorePlot/1.3/CorePlot.podspec
M CorePlot/1.4/CorePlot.podspec
M DB5/0.0.1/DB5.podspec
A DCTextEngine/0.1.0/DCTextEngine.podspec
A DUIToolbox/0.1.1/DUIToolbox.podspec
M FMDB/2.0/FMDB.podspec
A FXBlurView/1.5.2/FXBlurView.podspec
A FXBlurView/1.5.3/FXBlurView.podspec
A FXKeychain/1.5/FXKeychain.podspec
M Facebook-iOS-SDK/3.9.0/Facebook-iOS-SDK.podspec
A FlatUI/0.1.0/FlatUI.podspec
A FlatUIKit/1.3/FlatUIKit.podspec
A FreeStreamer/1.5.3/FreeStreamer.podspec
A Functional.m/1.0.0/Functional.m.podspec
A GCDWebServer/1.2.1/GCDWebServer.podspec
A GCDWebServer/1.2.2/GCDWebServer.podspec
A GHUnit/0.5.9/GHUnit.podspec
A GlitchKit/0.0.3/GlitchKit.podspec
A GoldenFleece/1.1/GoldenFleece.podspec
A Google-Mobile-Ads-SDK/6.8.0/Google-Mobile-Ads-SDK.podspec
A Heyzap/6.2.2/Heyzap.podspec
A Heyzap/6.2.4/Heyzap.podspec
U IGIdenticon/0.1/IGIdenticon.podspec
A IOSLinkedInAPI/2.0.0/IOSLinkedInAPI.podspec
A JDStatusBarNotification/1.4.7/JDStatusBarNotification.podspec
A JFOpenWeatherMapManager/1.0.0/JFOpenWeatherMapManager.podspec
A JSONJoy/0.1.0/JSONJoy.podspec
A KTBTaskQueue/1.0.0/KTBTaskQueue.podspec
A LINEActivity/0.2.0/LINEActivity.podspec
U LetsMove/1.9/LetsMove.podspec
A LumberjackPrettyClassInformation/1.0.0/LumberjackPrettyClassInformation.podspec
A M13CSVParser/1.0.0/M13CSVParser.podspec
A M13Checkbox/1.0.0/M13Checkbox.podspec
A M13InfiniteTabBar/2.0.1/M13InfiniteTabBar.podspec
A MSCachedAsyncViewDrawing/1.0.1/MSCachedAsyncViewDrawing.podspec
A MSSlidingPanelController/1.1.1/MSSlidingPanelController.podspec
A MUKAdMobViewController/1.2.1/MUKAdMobViewController.podspec
A MUKAdMobViewController/1.2.2/MUKAdMobViewController.podspec
A MUKAdMobViewController/1.2/MUKAdMobViewController.podspec
A MUKToolkit/1.1.1/MUKToolkit.podspec
U MapBox/1.1.0/MapBox.podspec
A NCICharts/1.0.0/NCICharts.podspec
A NSObjectProperties/0.0.3/NSObjectProperties.podspec
A NSOrderedDictionary/1.0.0/NSOrderedDictionary.podspec
A NSOrderedDictionary/1.0.1/NSOrderedDictionary.podspec
A NXOAuth2Client/1.2.5/NXOAuth2Client.podspec
A OCBorghettiView/0.0.5/OCBorghettiView.podspec
A OpenSSL-Universal/1.0.1.f/OpenSSL-Universal.podspec
A PMAudioRecorderViewController/0.5/PMAudioRecorderViewController.podspec
A PXSourceList/2.0.1/PXSourceList.podspec
A PayPal-iOS-SDK/1.4.6/PayPal-iOS-SDK.podspec
A PopulateKit/0.0.1/PopulateKit.podspec
A PopulateKit/0.0.2/PopulateKit.podspec
A PopulateKit/0.0.3/PopulateKit.podspec
A PopulateKit/0.0.4/PopulateKit.podspec
A PubNub/3.5.5/PubNub.podspec
A RMPickerViewController/1.0.0/RMPickerViewController.podspec
A RZSquaresLoading/1.0/RZSquaresLoading.podspec
A RestReaper/0.1.0/RestReaper.podspec
A RestReaper/0.1.1/RestReaper.podspec
A SVBlurView/0.0.1/SVBlurView.podspec
A SatelliteStore/1.0.0/SatelliteStore.podspec
A TPMapsApp/1.0.0/TPMapsApp.podspec
A Taplytics/1.1.0/Taplytics.podspec
A Typhoon/1.7.3/Typhoon.podspec
A Typhoon/1.7.4/Typhoon.podspec
A UICustomizeKit/0.1.0/UICustomizeKit.podspec
A UIImage+Dummy/0.0.2/UIImage+Dummy.podspec
A WJHXCTest/0.0.2/WJHXCTest.podspec
A WYPopoverController/0.1.8/WYPopoverController.podspec
A YISplashScreen/1.2.1/YISplashScreen.podspec
A YandexMobileMetrica/1.2.0/YandexMobileMetrica.podspec
A ZumeroSync/1.1.0.1729/ZumeroSync.podspec
A wpxmlrpc/0.4/wpxmlrpc.podspec
Pull is not possible because you have unmerged files.
Please, fix them up in the work tree, and then use 'git add/rm <file>'
as appropriate to mark resolution, or use 'git commit -a'.

A bug was found in libgit2 and they had to execute a force push on the specs repo. This is what broke everyone's CocoaPods setup.
You can find the official post about this issue on the CocoaPods blog :
http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
The recommended way to fix your setup is to execute the following commands :
$ pod repo remove master
$ pod setup
If that doesn't work, you can also delete manually all your cached specs :
$ rm -rf ~/.cocoapods/
$ pod setup

Take a look up the quick fix here !
https://github.com/CocoaPods/Specs/issues/1268
rm -rf ~/.cocoapods/

As Kirualex worte,you'll find the correct solution on http://blog.cocoapods.org/Repairing-Our-Broken-Specs-Repository/
Short, do the following:
$ pod repo remove master
$ pod setup
You could of course also remove the master as described by the others.

Related

Xcode Cloud: unable to open configuration settings file

I'm working with a React Native project, setting up Xcode Cloud builds.
I keep getting this error:
unable to open configuration settings file
Pods-XXX.debug.xcconfig:1
The files in my workspace look like the following:
|-- XXX
|-- Pods
|. -- Podfile
|. -- Targets Support Files
|. -- Pods-XXX
|. -- Pods-XXX.debug
Guess what? XCode is garbage but doc can help us here.
This what I'm using to smoothly build my workflow. I'l share exact bash scripts here.
Why it's failing?
First open logs on your workflow window side bar.
Check if you're installing necessary dependencies before running archive process. You're using virtual machine so any dependencies like cocoapods or yarn aren't installed by default there.
If you haven't read and skipped to the SOLUTION:
Here is the steps:
Create ci_scripts folder inside ios folder.
Create 3 files inside ci_scripts folder:
ci_post_clone.sh
ci_post_xcodebuild.sh
ci_pre_xcodebuild.sh
Inside your ci_post_clone.sh file add this:
#!/bin/zsh
# fail if any command fails
echo "🧩 Stage: Post-clone is activated .... "
set -e
# debug log
set -x
# Install dependencies using Homebrew. This is MUST! Do not delete.
brew install node yarn cocoapods fastlane
# Install yarn and pods dependencies.
# If you're using Flutter or Swift
# just install pods by "pod install" command
ls && cd .. && yarn && pod install
echo "🎯 Stage: Post-clone is done .... "
exit 0
Inside your ci_pre_xcodebuild.sh file add this:
#!/bin/zsh
echo "🧩 Stage: PRE-Xcode Build is activated .... "
# You can add additional scripts here...
echo "🎯 Stage: PRE-Xcode Build is DONE .... "
exit 0
Inside your ci_post_xcodebuild.sh file add this:
#!/bin/zsh
echo "🧩 Stage: POST-Xcode Build is activated .... "
# You can add additional scripts here...
echo "🎯 Stage: POST-Xcode Build is DONE .... "
exit 0
I've had this same issue recently, there is now a default workflow for xcode cloud that performs the post clone step that was provided by #BEK ROZ
I also had the same issue locally when building a VueJS app with Ionic/Capacitor
Before now my knowledge of iOS builds is precisely zero, so excuse innocence, but I found the issues were relating to the *xcconfig files. Every capacitor module that you install with npm will have it's own xcconfig file for debug and release - Stored in:
ios/App/Pods/Target Support Files/{{ Module Name }}/{{ Module Name }}.debug.xcconfig
ios/App/Pods/Target Support Files/{{ Module Name }}/{{ Module Name }}.release.xcconfig
I've only installed two plugins, so I uninstalled one of them, which was cordova-plugin-screen-orientation, synced and then archived (steps below) and this time it passed.
# Remove a capacitor module with npm e.g. cordova-plugin-screen-orientation
npm uninstall cordova-plugin-screen-orientation
# Sync the iOS plugins to remove the plugin from your Podfile (ios/App/Podfile)
npx cap sync ios
So I'd recommend going through all of the plugins you've installed and see if any of them are playing up. Then go back to xcode, run "Product -> Archive" from the menus to start a new build or push your changes and let xcode cloud do the heavy lifting for you.
Good luck

Using a private go module on Gitlab as import : "Unknown revision"

I cannot get this to work, even after checking other topics on stackoverflow. My project on gitlab.com/my_company/backend needs a module, found at gitlab.com/my_company/pkg/auth.
Locally, I've setup GOPRIVATE / git's configuration to make it work (and it works), though in Gitlab's CI Pipelines on a merge request, this fails.
Pipeline log / go.mod
I've added some debugging logs just to make sure everything was setup like I thought. Here's a failing pipeline's log :
$ git config --global url."ssh://git#gitlab.com/my_company/".insteadOf "https://gitlab.com/my_company/"
$ git config --global url."git#gitlab.com:".insteadOf "https://gitlab.com/"
$ git config -l | grep instead
url.ssh://git#gitlab.com/my_company/.insteadof=https://gitlab.com/my_company/
url.git#gitlab.com:.insteadof=https://gitlab.com/
$ env | grep GOPRIVATE
GOPRIVATE=gitlab.com/my_company
$ go mod download
go: gitlab.com/my_company/pkg/auth#v1.1.0: reading gitlab.com/my_company/pkg/auth/auth/go.mod at revision auth/v1.1.0: unknown revision auth/v1.1.0
One weird part of this log I've found is :
reading gitlab.com/my_company/pkg/auth/auth/go.mod - why is it repeating auth/auth? It actually happened once before locally, but it was because I wrote "github" instead of "gitlab" :)
The relevant go.mod line just in case :
require (
gitlab.com/my_company/pkg/auth v1.1.0 // indirect
)
Repository tags
Here are the tags setup on the repository gitlab.com/my_company/pkg :
$ git tag -l
auth/v1.0.0
auth/v1.1.0
cache/v1.0.0
cache/v1.0.1
$ git ls-remote --tags
From git#gitlab.my_company/pkg.git
9efcb02d5489adaac9d525dcb496d868d65e856a refs/tags/auth/v1.0.0
13730d4f61df978c6d690fd2678e2ed924808e0c refs/tags/auth/v1.1.0
2b8dff0ec1b737d975290720933180a9b591a1db refs/tags/cache/v1.0.0
9a3e598bbf83bea57b29d8a908b514861ae37b12 refs/tags/cache/v1.0.1
I'm not that familiar with Gitlab CI so I'm out of things to try. Any ideas?
Thank you!
Update: I finally got gitlab-runner installed so I could try running the yml directly, no luck. It still works locally (not a big surprise).
In you project should be file .gitlab-ci.yml and you can add GOPRIVATE variable to your CI and runner will use it for you project.
More details how to add env vars:
https://docs.gitlab.com/ee/ci/variables/#create-a-custom-cicd-variable-in-the-gitlab-ciyml-file

How to specify a username for a private pod

I am setting up a private pod that will be used across our team. In my podfile I have something like:
pod 'MySDK', :git => 'https://myusername#bitbucket/...git'
Is there a way to replace myusername with the username that downloaded the current project.
I can get the current username by parsing the url from
git config --get remote.origin.url
Plan B is to make a script that modifies the podfile before running pod install. I am curious if I can make it without this extra step?
This is what I came up, below is part of my podfile
#try to keep the current git user in the pod url
remoteUrl = %x|git config --get remote.origin.url|
username = remoteUrl.scan(/[A-Z0-9._%+-]+#[A-Z0-9.-]+\.[A-Z]{2,4}/i).first
podUrl = "https://#{username}/mycompany/myrepo.git"
puts podUrl
pod 'MySDK', :git => podUrl, :commit => 'commitid'
Works great for me! Respect to all cocopods devs that made it so customizable!

Not getting success after publish cocoaPod libray push

pod repo push iOS_FS iOS_FS.podspec
Validating spec
-> iOS_FS (0.1.0)
- NOTE | xcodebuild: note: Using new build system
- NOTE | [iOS] xcodebuild: note: Planning build
- NOTE | [iOS] xcodebuild: note: Constructing build description
And trying to add in my project pod 'iOS_FS'. it's not working saying not available. How get know whether my library has been publish successfully or not.
I am able to create own iOS cocoa pod. follow below steps.
How to create your own pod file and shared it with other developers.
Create and public own pod.
Step 1:-
Create pod file in a local directory by running the below command.
pod spec create podspecificationfileName
Example:
pod spec create iOSUtilis
After creating file do configuration of target version, tag, code sync, dependency of other framework.
Step 2: once you make sure your code is compiling and well working
Create tag of your branch like below
git tag 0.0.1
git push origin 0.0.1
And update tag number in iOSUtilis.podspec file
Step 3: run command:
pod spec lint iOSUtilis.podspec
Result will be:
iOSUtilis.podspec passed validation
Step 4: publish you pod to online
Run command.
pod trunk push iOSUtilis.podspec
Result will be:
🎉 Congrats
🚀 iOSLoader (0.0.1) successfully published
📅 September 28th, 20:27
🌎 https://cocoapods.org/pods/iOSLoader
👍 Tell your friends!
MacBook-Pro:iOSUtilis chandrakant$
How to create another version of pod.
Step 1: Just make changes in your code and validate the working.
Step 2. Create another version of tag
git tag 0.0.2
git push origin tag 0.0.2
Step 3. Update new tag version in iOSUtils.podspec
Run command
pod spec lint iOSUtils.podspec
Still getting error fix
Delete tag
git tag -d tagName
git push origin tagName
Clear cache
pod cache clean --all
Fix error in origin branch and again create tag and do the remaining process when get success “iOSUtilis.podspec passed validation”
Step 4. Final step
Run command
pod trunk push iOSUtils.podspec

Using forked package import in Go

Suppose you have a repository at github.com/someone/repo and you fork it to github.com/you/repo. You want to use your fork instead of the main repo, so you do a
go get github.com/you/repo
Now all the import paths in this repo will be "broken", meaning, if there are multiple packages in the repository that reference each other via absolute URLs, they will reference the source, not the fork.
Is there a better way as cloning it manually into the right path?
git clone git#github.com:you/repo.git $GOPATH/src/github.com/someone/repo
If you are using go modules. You could use replace directive
The replace directive allows you to supply another import path that might
be another module located in VCS (GitHub or elsewhere), or on your
local filesystem with a relative or absolute file path. The new import
path from the replace directive is used without needing to update the
import paths in the actual source code.
So you could do below in your go.mod file
module some-project
go 1.12
require (
github.com/someone/repo v1.20.0
)
replace github.com/someone/repo => github.com/you/repo v3.2.1
where v3.2.1 is tag on your repo. Also can be done through CLI
go mod edit -replace="github.com/someone/repo#v0.0.0=github.com/you/repo#v1.1.1"
To handle pull requests
fork a repository github.com/someone/repo to github.com/you/repo
download original code: go get github.com/someone/repo
be there: cd "$(go env GOPATH)/src"/github.com/someone/repo
enable uploading to your fork: git remote add myfork https://github.com/you/repo.git
upload your changes to your repo: git push myfork
http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html
To use a package in your project
https://github.com/golang/go/wiki/PackageManagementTools
One way to solve it is that suggested by Ivan Rave and http://blog.campoy.cat/2014/03/github-and-go-forking-pull-requests-and.html -- the way of forking.
Another one is to workaround the golang behavior. When you go get, golang lays out your directories under same name as in the repository URI, and this is where the trouble begins.
If, instead, you issue your own git clone, you can clone your repository onto your filesystem on a path named after the original repository.
Assuming original repository is in github.com/awsome-org/tool and you fork it onto github.com/awesome-you/tool, you can:
cd $GOPATH
mkdir -p {src,bin,pkg}
mkdir -p src/github.com/awesome-org/
cd src/github.com/awesome-org/
git clone git#github.com:awesome-you/tool.git # OR: git clone https://github.com/awesome-you/tool.git
cd tool/
go get ./...
golang is perfectly happy to continue with this repository and doesn't actually care some upper directory has the name awesome-org while the git remote is awesome-you. All import for awesome-org are resovled via the directory you have just created, which is your local working set.
In more length, please see my blog post: Forking Golang repositories on GitHub and managing the import path
edit: fixed directory path
If your fork is only temporary (ie you intend that it be merged) then just do your development in situ, eg in $GOPATH/src/launchpad.net/goamz.
You then use the features of the version control system (eg git remote) to make the upstream repository your repository rather than the original one.
It makes it harder for other people to use your repository with go get but much easier for it to be integrated upstream.
In fact I have a repository for goamz at lp:~nick-craig-wood/goamz/goamz which I develop for in exactly that way. Maybe the author will merge it one day!
Here's a way to that works for everyone:
Use github to fork to "my/repo" (just an example):
go get github.com/my/repo
cd ~/go/src/github.com/my/repo
git branch enhancement
rm -rf .
go get github.com/golang/tools/cmd/gomvpkg/…
gomvpkg <<oldrepo>> ~/go/src/github.com/my/repo
git commit
Repeat each time when you make the code better:
git commit
git checkout enhancement
git cherry-pick <<commit_id>>
git checkout master
Why? This lets you have your repo that any go get works with. It also lets you maintain & enhance a branch that's good for a pull request. It doesn't bloat git with "vendor", it preserves history, and build tools can make sense of it.
Instead of cloning to a specific location, you can clone wherever you want.
Then, you can run a command like this, to have Go refer to the local version:
go mod edit -replace github.com/owner/repo=../repo
https://golang.org/cmd/go#hdr-Module_maintenance
The answer to this is that if you fork a repo with multiple packages you will need to rename all the relevant import paths. This is largely a good thing since you've forked all of those packages and the import paths should reflect this.
Use vendoring and submodules together
Fork the lib on github (go-mssqldb in this case)
Add a submodule which clones your fork into your vendor folder but has the path of the upstream repo
Update your import statements in your source code to point to the vendor folder, (not including the vendor/ prefix). E.g. vendor/bob/lib => import "bob/lib"
E.g.
cd ~/go/src/github.com/myproj
mygithubuser=timabell
upstreamgithubuser=denisenkom
librepo=go-mssqldb
git submodule add "git#github.com:$mygithubuser/$librepo" "vendor/$upstreamgithubuser/$librepo"
Why
This solves all the problems I've heard about and come across while trying to figure this out myself.
Internal package refs in the lib now work because the path is unchanged from upstream
A fresh checkout of your project works because the submodule system gets it from your fork at the right commit but in the upstream folder path
You don't have to know to manually hack the paths or mess with the go tooling.
More info
https://git-scm.com/book/en/v2/Git-Tools-Submodules
How do I fix the error message "use of an internal package not allowed" when go getting a golang package?
https://github.com/denisenkom/go-mssqldb/issues/406
https://github.com/golang/go/wiki/PackageManagementTools#go15vendorexperiment
The modern answer (go 1.15 and higher, at least).
go mod init github.com/theirs/repo
Make an explicit init arg that is the ORIGINAL package names. If you don't include the repo name, it will assume the one in gopath. But when you use go modules, they no longer care where they are on disk, or where git actually pulls dependencies from.
To automate this process, I wrote a small script. You can find more details on my blog to add a command like "gofork" to your bash.
function gofork() {
if [ $# -ne 2 ] || [ -z "$1" ] || [ -z "$2" ]; then
echo 'Usage: gofork yourFork originalModule'
echo 'Example: gofork github.com/YourName/go-contrib github.com/heirko/go-contrib'
return
fi
echo "Go get fork $1 and replace $2 in GOPATH: $GOPATH"
go get $1
go get $2
currentDir=$PWD
cd $GOPATH/src/$1
remote1=$(git config --get remote.origin.url)
cd $GOPATH/src/$2
remote2=$(git config --get remote.origin.url)
cd $currentDir
rm -rf $GOPATH/src/$2
mv $GOPATH/src/$1 $GOPATH/src/$2
cd $GOPATH/src/$2
git remote add their $remote2
echo Now in $GOPATH/src/$2 origin remote is $remote1
echo And in $GOPATH/src/$2 their remote is $remote2
cd $currentDir
}
export -f gofork
You can use command go get -f to get you a forked repo
in your Gopkg.toml file add these block below
[[constraint]]
name = "github.com/globalsign/mgo"
branch = "master"
source = "github.com/myfork/project2"
So it will use the forked project2 in place of github.com/globalsign/mgo

Resources